06-28-2021, 02:34 PM
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.
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
0610年tool_position = [0, 0, -20, 0]
tool_pose = xyzrpw_2_pose(tool_position)
robot.setPoseTool(tool_pose)
# Move to the home position and save the pose
robot.MoveJ([90,-45,-90,0,65,0])
Home_pose = robot.Pose()
# Adjust the angle
Home_position = pose_2_xyzrpw(Home_pose)
x,y,z,rx,ry,rz = Home_position
new_position = [x,y,z,rx,ry,rz+20] # Here I change the angle
# Move to new position
new_pose = xyzrpw_2_pose(new_position)
robot.MoveJ(new_pose)