• 0 Vote(s) - 0 Average
• 1
• 2
• 3
• 4
• 5

# Rotate Tool Ref around Robot Flange Ref

I am using the C# API to import tool coordinate systems that were created in SolidWorks and attach them to a robot.  I am importing the 4x4 matrix data that solid works uses and converting it to the 4x4 matrix format that RoboDK uses, which is working fine.  The thing I can't figure out how to do is rotate these imported tool coordinate systems around the robot flange coordinate system, since they are importing in a different orientation from what I need.  If I just rotate the matrix by multiplying it by another matrix that represents the rotation I need, it rotates about the tools origin and not the robot flange origin, which is to be expected.  What I need to do is rotate around the flange origin as seen in the attached image.  I really can't figure out how to do this from the RoboDK user interface as well, changing parameters always operates around the tools origin.  With reference frames you can specify another reference frame so that relative rotations can be done, but this does not seem to be the case with   tool objects.  Ideally I just need the way to do this programatically using matrix math on the tool matrix prior to adding it to the robot, since this has to be an automated process involving several tools on a rotary tool head.

Yo should pre-multiply your TCP matrix by a constant rotation. Looking at the picture you attached it looks like a 90 deg rotation around the Z axis.

Example:
Code:
`pose_tcp = rotz(-90 * pi/180) * pose_solidworks`
Can you share some sample code?
That worked! Thanks so much, I spent all day Friday trying a million different things and never got anywhere. I tried all kinds of matrix multiplications that looked similar to this one, but they always rotated the tool coordinate system around its own axis instead of the TCP axis.

The C# version of this code looks like: tool_pose = Mat.rotz(90 * Math.PI / 180) * tool_pose;

Thanks for all your hard work answering people's questions here Albert, I see your detailed responses all throughout this forum.

For anyone who happens upon this thread and is trying to do the same thing, here are two great resources that explain the matrix format in both SolidWorks and RoboDK: