Robotics StackExchange | Archived questions

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

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;

Asked by Matúš on 2023-08-04 03:29:41 UTC

Comments

Answers

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

orientation_constraint.header.frame_id

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

Asked by Mike Scheutzow on 2023-08-05 08:18:14 UTC

Comments

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

Asked by Matúš on 2023-08-05 09:08:21 UTC

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.

Asked by Mike Scheutzow on 2023-08-05 10:09:10 UTC

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

Asked by Mike Scheutzow on 2023-08-05 10:20:04 UTC