Send pose to Universal Robots in MoveIt
I am working with a real UR5e robot and I can send a pose x,y,z,w to the robot. However, I need to send a pose x,y,z,rotx,roty,rotz as shown in the teach pendant. For example, for the robot shown pose values: 33.33,-704,219,-2.85,0.619,-2.917. xyz are in mm and rotations seems in radiants. However pose.position. seems to be working in meters. But, what about the rotations?
I tried to set the rotation values directly to pose.rotation.x/y/z in radiants, and also a quaternion as follows (this method throws a warning because is deprecated). But it doesn't seems to be the same pose.
What is the proper way to send this pose using the moveit group interface? Thank you.
tf::Quaternion q;
q.setEulerZYX(rotz,roty,rotx);
target_pose1.position.x = x;
target_pose1.position.y = y;
target_pose1.position.z = z;
target_pose1.orientation.x = q.x();
target_pose1.orientation.y = q.y();
target_pose1.orientation.z = q.z();
target_pose1.orientation.w = q.w();
move_group.setPoseTarget(target_pose1);
UPDATE:
I am using the RPY to Quaternion conversion as,
tf2::Quaternion q;
q.setRPY(roll, pitch, yaw);
Compared with the current pose of the robot (getCurrentPose()), I have that position have the same values. However, for the current given RPY to convert, values are different for the orientation.
Quaternion pose orientation requested to ROS: -0.41x, 0.75y, -0.04z, 0.51w. Quaternion pose orientation obtained from current robot RPY from teach pendant (setRPY(2.57,-0.51,2.29)): 0.44x, 0.81y, -0.34z, 0.11w.
So, It doesn't fit at all. Any relationship with the real and the calculated quaternions that could help to find the error?
Could you please add the relevant tags to your question next time? Your question is very specific to UR, but you had no
universal_robot
tag. I've added it.I intend to do the same, could you share the final solution for the conversion?