How to constrain movement on z.axis in Moveit!

asked 2018-07-07 15:24:15 -0500

Gundam gravatar image

I want my end effector to stay above the table and not higher than 50cm.
How can I do this? I tried this, but it's not working:

moveit_msgs::Constraints constraints;
moveit_msgs::PositionConstraint pcm;
pcm.link_name = move_group_interface_.getEndEffectorLink();
pcm.header.frame_id = TABLE_FRAME_STRING;
pcm.target_point_offset.z = 0.5;
pcm.weight = 1.0;

constraints.position_constraints.push_back(pcm);

move_group_interface_.setPathConstraints(constraints);

I already read through all documentation but I really don't get it.
I just need a real code example.

edit retag flag offensive close merge delete