# Path constraint in euler coordinates? I want to create a motion plan with the gripper/end effector in a fixed orientation, e.g. pointing downwards. In euler coordinates this means the roll and pitch are fixed (roll = 0, pitch = pi/2) and the yaw may freely defined. However, the orientation constraints are defined using quaternions (x, y, z, w), and as far as I understand my constraint cannot be specified using quaternions. Or am I missing something?

How can I constrain the orientation of the end effector as described? Is this possible?

(Preferably Python solutions, but any help is appreciated.)

UPDATE: To give an example of what I mean, see the following possible orientations, each with the end effectuator pointed downwards, but rotated around the z-axis (in the cartesion frame), in steps of 45 degrees (=pi/4). In euler coordinates, it's clear that "roll" should be fixed to 0 and "pitch" to 1.571 (=pi/2), and that "yaw" defines the rotation about the z-axis. But how could I constrain this using quaternions? The x, y, z and w value all change when I only change the yaw in euler coordinates...

euler:                                   --> quaternion:
roll = 0.000, pitch = 1.571, yaw = 0.000 --> x =  0.0000, y =  0.7071, z =  0.0000, w =  0.7071
roll = 0.000, pitch = 1.571, yaw = 0.785 --> x = -0.2706, y =  0.6533, z =  0.2706, w =  0.6533
roll = 0.000, pitch = 1.571, yaw = 1.571 --> x = -0.5000, y =  0.5000, z =  0.5000, w =  0.5000
roll = 0.000, pitch = 1.571, yaw = 2.356 --> x = -0.6533, y =  0.2706, z =  0.6533, w =  0.2706
roll = 0.000, pitch = 1.571, yaw = 3.142 --> x = -0.7071, y =  0.0000, z =  0.7071, w =  0.0000
roll = 0.000, pitch = 1.571, yaw = 3.927 --> x = -0.6533, y = -0.2706, z =  0.6533, w = -0.2706
roll = 0.000, pitch = 1.571, yaw = 4.712 --> x = -0.5000, y = -0.5000, z =  0.5000, w = -0.5000
roll = 0.000, pitch = 1.571, yaw = 5.498 --> x = -0.2706, y = -0.6533, z =  0.2706, w = -0.6533
roll = 0.000, pitch = 1.571, yaw = 6.283 --> x =  0.0000, y =  0.7071, z =  0.0000, w =  0.7071

edit retag close merge delete

Sorry I did not mention this explicitly (although I tagged moveit :p). Yes, with MoveIt!, e.g. by using group.set_path_constraints().

Sort by » oldest newest most voted Taken from here

Will something like this work from their example?

moveit_msgs::OrientationConstraint ocm;
ocm.orientation.x = -0.5;
ocm.orientation.y = 0.5;
ocm.orientation.z = 0.5;
ocm.orientation.w = 0.5;
ocm.absolute_x_axis_tolerance = 0.01;
ocm.absolute_y_axis_tolerance = 0.01;
ocm.absolute_z_axis_tolerance = 2*pi;
ocm.weight = 1.0;


Essentially you're fully defining the orientation, but telling the solver the rotation around the Z axis (Yaw) can be any value.

more

Thanks for your answer. I've updated my question to make more clear what I mean. In euler coordinates I want to fix the roll & pitch and "don't care about" the yaw. However, in your example I have to specify quaternions, so what are the axes I don't care about?!

1

Yeah anytime quaternions are involved things get confusing, but with this specific message you specify the orientation with a quaternion, then specify the tolerances in terms of axis-angles.

From here: Roll is a rotation around X, Pitch is Y, and Yaw is Z, you want a loose tolerance on your Z axis. You can even make the Z tolerance 2*PI so it can be anything, and make the X and Y tolerance small (eg .01)

I think you're right! The x/y/z in the tolerances refer to the cartesian axes, not to the x/y/z values in the quaternion (or I don't quaternions correctly...). Unfortunately motion planning with path constraints doesn't work really well yet, but that's another problem :)

PS: If you update your answer to have the z-axis tolerance set to 2*PI (as mentioned in your comment), and the initial orientation to e.g. x=-0.5, y=0.5, z=0.5, w=0.5 (as mentioned in the question), I'll accept this as the correct answer.