136 SCOPED_TRACE(
"PositionConstraint");
139 move_group_->setStartStateToCurrentState();
140 const geometry_msgs::msg::PoseStamped eef_pose = move_group_->getCurrentPose();
143 geometry_msgs::msg::PoseStamped pose_goal = eef_pose;
144 pose_goal.pose.position.y += 0.3;
145 pose_goal.pose.position.z -= 0.3;
148 moveit_msgs::msg::PositionConstraint position_constraint;
149 position_constraint.header.frame_id = ref_link_;
150 position_constraint.link_name = ee_link_;
151 position_constraint.weight = 1.0;
153 shape_msgs::msg::SolidPrimitive cbox;
154 cbox.type = shape_msgs::msg::SolidPrimitive::BOX;
155 cbox.dimensions = { 0.1, 0.4, 0.4 };
156 position_constraint.constraint_region.primitives.emplace_back(cbox);
158 geometry_msgs::msg::Pose cbox_pose;
159 cbox_pose.position.x = eef_pose.pose.position.x;
160 cbox_pose.position.y = 0.15;
161 cbox_pose.position.z = 0.45;
162 cbox_pose.orientation.w = 1.0;
163 position_constraint.constraint_region.primitive_poses.emplace_back(cbox_pose);
166 moveit_msgs::msg::Constraints path_constraint;
167 path_constraint.name =
"position constraint";
168 path_constraint.position_constraints.emplace_back(position_constraint);
170 planAndMove(pose_goal, path_constraint);