Incorrect rotation from python program- Printable Version +- RoboDK Forum (//www.sinclairbody.com/forum) +-- Forum: RoboDK (EN) (//www.sinclairbody.com/forum/Forum-RoboDK-EN) +--- Forum: RoboDK API (//www.sinclairbody.com/forum/Forum-RoboDK-API) +--- Thread: Incorrect rotation from python program (/Thread-Incorrect-rotation-from-python-program) |
Incorrect rotation from python program-william.stewart-06-28-2021 Hello, I have been working on a python program for a Staubli TX2-90 robot. I am attempting to adjust the angle of the tool. I first set the tool pose relative to the robot flange, then I move the robot to the home position using predefined joints. Then I retrieve the position of the tool, and adjust the relevant angle (saving it as a new position). I convert back to a pose, then use the MoveJ command to move the robot. The code seems to work fine, however, in the line where I adjust the angle, if I adjust rx or rz (+20 in my code) they produce rotation about the same axis. Regardless of whether I change the rx or rz angle, it changes the purple value (in attached screenshot). It seems like a gimbal lock problem, but in the roboDK GUI, I am able to use the dial to rotate about each axis correctly (light blue/purple/yellow angles in the figure below). Furthermore, I don't get any errors related to that. I have included the code below. Thanks in advance for any insights.
Code:
# Set the tool pose relative to the robot flange
RE: Incorrect rotation from python program-william.stewart-07-02-2021 I think I have narrowed down the culprit a bit. It seems to be a problem with xyzrpw_2_pose(). Regardless of whether I change the r or w input, it produces almost the same pose (one term is -0 in one pose and in the other pose it is 0).My question is why when given different inputs, does xyzrpw_2_pose() give the same output?
Code:
# get the current robot position
This produces the following output:
Code:
First position:
RE: Incorrect rotation from python program-Maarten-07-08-2021 Hi William, What the angular values of [90,20,90] in the "Pose(,,,,,)" line mean following both your angular inputs of [20,-90,90] and [0,-90,110] is unclear to me too. The 4x4 homogenous transformation matrix below it is however correct: a roll-pitch-yaw of [20,-90,90] yields the same orientation as [0,-90,110]. Why? Because the three different subsequent axial rotations in this case add up to the same orientation. The function xyzrpw_2_pose which outputs this 4x4 matrix thus seems correct to me. When calling "print(some_pose)" however, with "some_pose" being a 4x4 matrix output from xyzrpw_2_pose, not only this 4x4 matrix is printed. It seems some other function adds the misunderstood "Pose(,,,,,)" line before it, but I'm not savvy enough to see which. Maarten RE: Incorrect rotation from python program-william.stewart-07-09-2021 Hi Maarten! Thanks for your reply. Quote: The 4x4 homogenous transformation matrix below it is however correct: a roll-pitch-yaw of [20,-90,90] yields the same orientation as [0,-90,110]. Why? Because the three different subsequent axial rotations in this case add up to the same orientation. You might indeed be correct. In this case, any thoughts on how to differentiate the between the two? Quote: The function xyzrpw_2_pose which outputs this 4x4 matrix thus seems correct to me. When calling "print(some_pose)" however, with "some_pose" being a 4x4 matrix output from xyzrpw_2_pose, not only this 4x4 matrix is printed. It seems some other function adds the misunderstood "Pose(,,,,,)" line before it, but I'm not savvy enough to see which. I'm not very familiar with poses. I thought that maybe it was not just the 4x4 matrix, but included the position in it. |