Difference between Motion Target configuration and Jog Panel configuration

Hello everyone, the following code retrieves all configurations of a motion target and stores the joint values in a list of double. When I then compare the configurations from the motion target with the same configurations from the jog panel, the 6-axis is always “wrong”. In every configuration, the axis value of the 6 axis is exactly 180° incorrect. All other axis values are identical.

Example:
If the value in the configuration that I receive via the motion target is -17, then the value in the configuration that I select via the jog panel is 163.

If the value that I receive via the motion target is 163, then it is -17 in the jog panel for the same configuration.

All tips welcome.

motionTarget = robot.RobotController.CreateTarget();
currentJointStatement = statement as IJointMotionStatement;

motionTarget.MotionType = MotionType.Joint;
motionTarget.TargetMode = TargetMode.World;
motionTarget.BaseMatrix = currentJointStatement.Base.TransformationInWorld;
motionTarget.ToolMatrix = currentJointStatement.Tool.TransformationInReference;
motionTarget.SetExternalJointValues(currentJointStatement.ExternalJointValues);
motionTarget.TargetMatrix = currentJointStatement.Target;

List<List> configs = new List<List>();

for (int i = 0; i < motionTarget.ConfigurationCount; i++)
{
motionTarget.CurrentConfiguration = i;
configs.Add(motionTarget.GetAllJointValues().ToList());
}

Update: It seems to have something to do with the tool. If no tool is attached to the robot, the configurations match.
Is it possible that the line motionTarget.ToolMatrix = currentJointStatement.Tool.TransformationInReference; is incorrect and a conversion is required instead?

I suggest to try using BaseName and ToolName instead of BaseMatrix and ToolMatrix. There’s an example snippet on this thread to read motion statement into motion target which you could try:

Thing with the matrices is that it probably doesn’t consider the fact that frame parent node might be different than the default (flange node for tool frame for example). Setting base/tool by its name should set both the parent node and position matrix correctly.

-k

1 Like

Thank you keke for your quick feedback. You have solved my problem, thank you :wink:

1 Like