Good morning,
I am developing an add-in in RobotStudio that needs to extract the position and orientation of Link4, Link5 and Link6 of the robot. Yesterday I tried the following code, but I got some values that were not correct, or at least not where I expected them to be.
This is my code:
foreach (GraphicComponent gc in robot.GraphicComponents)
By using Mechanism.GetJointTransform(int index) and passing it the index of the joint you want to find, you will get a matrix with the position and orientation of the joint (its Euler XYZ and Euler ZYX)
Hello @DenisFR,
thanks for your time and for your response,
I see that you extracted the robot joints via
Mechanism.GetJointValues()
So I think that this is the correct way to go, to use the values inside Mechanism and not GraphicComponents, so:
*To get joint values of the robot you use Mechanism.GetJointValues(), that returns an array of double as result;
*To get the position and the orientation of the link of the joints you use Mechanism.GetJointTransform(), which gives you a Matrix4 result. Inside of it you can look for Transform and EulerXYZ/EulerZYX rotation values.