ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

How to constraint end-effector's orientation in base frame coordinates

asked 2023-08-04 03:29:41 -0500

Matúš gravatar image

Hi, using Ros2 humble, moveit2 and I need to constraint end-effector's orientation in base frame coordinates. For example effector should be horizontal or vertical to ground, but in both cases i want to set Z absolute tolerance to 6.28 and XY to 0.17, so that effector stays in it's orientation and arm can rotate around base.

How can I do that, because in current state depending on effector orientation I need to change tolerances depending on effector oreintation. I tried transforming tolerances from base frame to effector frame, but the numbers didn't make sense.

      moveit_msgs::msg::OrientationConstraint orientation_constraint;
      orientation_constraint.header.frame_id = rpi->move_group_->getPoseReferenceFrame();
      orientation_constraint.link_name = rpi->move_group_->getEndEffectorLink();
      orientation_constraint.orientation = start_orientation_constraint;
      orientation_constraint.absolute_x_axis_tolerance = deg_to_rad*tcp_pose_cmd->get_roll_tolerance();
      orientation_constraint.absolute_y_axis_tolerance = deg_to_rad*tcp_pose_cmd->get_pitch_tolerance();
      orientation_constraint.absolute_z_axis_tolerance = deg_to_rad*tcp_pose_cmd->get_yaw_tolerance();
      /*orientation_constraint.absolute_x_axis_tolerance = deg_to_rad*10;
      orientation_constraint.absolute_y_axis_tolerance = deg_to_rad*10;
      orientation_constraint.absolute_z_axis_tolerance = deg_to_rad*360;*/
      orientation_constraint.weight = 1.0;
edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2023-08-05 08:18:14 -0500

Mike Scheutzow gravatar image

updated 2023-08-05 08:20:03 -0500

This is very simple: you specify which frame the constraints apply to in the constraint message:


You even assigned this field in the sample code you showed us.

edit flag offensive delete link more


Well, now it is set that effector is constraint in base frame. Problem is when I am jogging with base joint around Z axis only yaw angle changes no matter of effector orientation, but when I constraint XY to 10 deg and Z to 360 deg I get error that tolerances were violated and X axis is out of bounds, even though only Z should change

Matúš gravatar image Matúš  ( 2023-08-05 09:08:21 -0500 )edit

The question you asked was answered. If you think the answer is correct, please click the checkmark in the gray circle (it will turn green.) If you have a new problem, please open a new question for it. In your new description, I suggest providing actual numbers/strings for message fields, not formulas.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2023-08-05 10:09:10 -0500 )edit

P.S. There are a bunch of existing questions on this site about the use of orientation constraints. Use a search engine and append to the search string.

Mike Scheutzow gravatar image Mike Scheutzow  ( 2023-08-05 10:20:04 -0500 )edit

Question Tools

1 follower


Asked: 2023-08-04 03:29:41 -0500

Seen: 112 times

Last updated: Aug 05 '23