Problem importing targets via Python API, wrong configuration

Kind of new to Visual Components API but fairly easy to get started in my opinion.

My problem:
I read a list of joint values from file
Create PTP statement stat of type VC_STATEMENT_PTPMOTION

    positions = stat.Positions
    pos_frame = positions[0]
    pos_frame.Name = name
    target = robot_controller.createTarget()
    target.JointValues = [j1, j2, j3, j4, j5, j6]
    pos_frame.PositionInReference = target.Target

The targets is created as they should with the cartesian data relative to robot base. Approx 90% is correct but the rest is specified with the wrong configuration. I could move to the target and change the configuration manually and see on jog page that the correct joint values is there but with another active configuration.

Is it a known problem with mismatch in robot configuration data in target creation from joint values?

The robot is a KUKA KR16_2


Only to give some example data to the problem

If I set joint values
90.511059629 1.29792129331 -90.3435267697 11.3192969048 -65.3287623922 203.085921807
The configuration obtained is “110”, should be “100”

129.695414055 0.789822320585 -96.390637931 149.241296278 106.826949578 133.735740539
The configuration obtained “110”, should be “000”

69.7136083983 -4.02651820105 -84.324318653 -161.417909931 113.770625097 130.973682896
The configuration obtained “110” should be “000”

16.1044685224 -149.921626364 -42.2394799809 -240.952244121 -123.869521898 -284.650474649
The configuration obtained “110”, should be “101”

Often is it not enough to change configuration, but also change turn on j4 and j6 to find the correct state of joints as specified when the targets was created.

Try adding this line at the end:

pos_frame.Configuration = pos_frame.getProperty('Configuration').StepValues[target.RobotConfig]

Setting joint values on motion target will also affect configuration which you need to read into the position frame. Unlike you could easily think setJoints() on position frame does not automatically change the configuration.


Thank you keke!
This was the trick.
Working brilliantly

1 Like