185 SCOPED_TRACE(
"PathConstraintCollisionTest");
190 geometry_msgs::Pose start_pose;
191 start_pose.orientation.w = 1.0;
192 start_pose.position.x = 0.3;
193 start_pose.position.y = 0.0;
194 start_pose.position.z = 0.6;
195 planAndMoveToPose(start_pose);
199 geometry_msgs::Pose target_pose;
200 target_pose.orientation.w = 1.0;
201 target_pose.position.x = 0.3;
202 target_pose.position.y = -0.3;
203 target_pose.position.z = 0.6;
206 Eigen::Isometry3d eigen_target_pose;
207 tf2::fromMsg(target_pose, eigen_target_pose);
210 move_group_->setPoseTarget(eigen_target_pose);
211 geometry_msgs::PoseStamped set_target_pose = move_group_->getPoseTarget();
212 Eigen::Isometry3d eigen_set_target_pose;
213 tf2::fromMsg(set_target_pose.pose, eigen_set_target_pose);
216 testEigenPose(eigen_target_pose, eigen_set_target_pose);
220 moveit_msgs::OrientationConstraint ocm;
221 ocm.link_name = move_group_->getEndEffectorLink();
222 ocm.header.frame_id = move_group_->getPlanningFrame();
223 ocm.orientation.w = 1.0;
224 ocm.absolute_x_axis_tolerance = 0.1;
225 ocm.absolute_y_axis_tolerance = 0.1;
226 ocm.absolute_z_axis_tolerance = 0.1;
228 moveit_msgs::Constraints test_constraints;
229 test_constraints.orientation_constraints.push_back(ocm);
230 move_group_->setPathConstraints(test_constraints);
237 testPose(eigen_target_pose);
240 move_group_->clearPathConstraints();
243 move_group_->setNamedTarget(
"ready");
251 moveit_msgs::CollisionObject collision_object;
252 collision_object.header.frame_id = move_group_->getPlanningFrame();
255 collision_object.id =
"box1";
258 shape_msgs::SolidPrimitive primitive;
259 primitive.type = primitive.BOX;
260 primitive.dimensions.resize(3);
261 primitive.dimensions[0] = 0.1;
262 primitive.dimensions[1] = 1.0;
263 primitive.dimensions[2] = 1.0;
266 geometry_msgs::Pose box_pose;
267 box_pose.orientation.w = 1.0;
268 box_pose.position.x = 0.5;
269 box_pose.position.y = 0.0;
270 box_pose.position.z = 0.5;
272 collision_object.primitives.push_back(primitive);
273 collision_object.primitive_poses.push_back(box_pose);
274 collision_object.operation = collision_object.ADD;
276 std::vector<moveit_msgs::CollisionObject> collision_objects;
277 collision_objects.push_back(collision_object);
280 synchronizeGeometryUpdate([&]() { planning_scene_interface_.addCollisionObjects(collision_objects); });
283 synchronizeGeometryUpdate([&]() { EXPECT_TRUE(move_group_->attachObject(collision_object.id)); });
284 EXPECT_EQ(planning_scene_interface_.getAttachedObjects().size(), std::size_t(1));
285 synchronizeGeometryUpdate([&]() { EXPECT_TRUE(move_group_->detachObject(collision_object.id)); });
286 EXPECT_EQ(planning_scene_interface_.getAttachedObjects().size(), std::size_t(0));
289 const std::vector<std::string> object_ids = { collision_object.id };
290 EXPECT_EQ(planning_scene_interface_.getObjects().size(), std::size_t(1));
291 synchronizeGeometryUpdate([&]() { planning_scene_interface_.removeCollisionObjects(object_ids); });
292 EXPECT_EQ(planning_scene_interface_.getObjects().size(), std::size_t(0));
297 SCOPED_TRACE(
"CartPathTest");
300 const geometry_msgs::PoseStamped start_pose = move_group_->getCurrentPose();
302 std::vector<geometry_msgs::Pose> waypoints;
303 waypoints.push_back(start_pose.pose);
305 geometry_msgs::Pose target_waypoint = start_pose.pose;
306 target_waypoint.position.z -= 0.2;
307 waypoints.push_back(target_waypoint);
309 target_waypoint.position.y -= 0.2;
310 waypoints.push_back(target_waypoint);
312 target_waypoint.position.z += 0.2;
313 target_waypoint.position.y += 0.2;
314 target_waypoint.position.x -= 0.2;
315 waypoints.push_back(target_waypoint);
317 moveit_msgs::RobotTrajectory trajectory;
318 const auto eef_step = 0.01;
321 ASSERT_GE(
EPSILON + move_group_->computeCartesianPath(waypoints, eef_step, trajectory), 1.0);
324 EXPECT_EQ(move_group_->execute(trajectory), moveit::core::MoveItErrorCode::SUCCESS);
327 testPose(target_waypoint);
332 SCOPED_TRACE(
"JointSpaceGoalTest");
335 std::vector<double> plan_joint_positions;
336 move_group_->getCurrentState()->copyJointGroupPositions(
337 move_group_->getCurrentState()->getJointModelGroup(PLANNING_GROUP), plan_joint_positions);
340 ASSERT_EQ(plan_joint_positions.size(), std::size_t(7));
341 plan_joint_positions = { 1.2, -1.0, -0.1, -2.4, 0.0, 1.5, 0.6 };
342 move_group_->setJointValueTarget(plan_joint_positions);
348 testJointPositions(plan_joint_positions);