Skip to content

Commit ddac28e

Browse files
authored
Fix "Planning Scene ROS API" tutorial to spawn the object in the gripper (#544)
1 parent 7a547f8 commit ddac28e

1 file changed

Lines changed: 9 additions & 7 deletions

File tree

doc/planning_scene_ros_api/src/planning_scene_ros_api_tutorial.cpp

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,23 +91,24 @@ int main(int argc, char** argv)
9191
// subtract the object from the world
9292
// and to attach the object to the robot.
9393
moveit_msgs::AttachedCollisionObject attached_object;
94-
attached_object.link_name = "panda_leftfinger";
94+
attached_object.link_name = "panda_hand";
9595
/* The header must contain a valid TF frame*/
96-
attached_object.object.header.frame_id = "panda_leftfinger";
96+
attached_object.object.header.frame_id = "panda_hand";
9797
/* The id of the object */
9898
attached_object.object.id = "box";
9999

100100
/* A default pose */
101101
geometry_msgs::Pose pose;
102+
pose.position.z = 0.11;
102103
pose.orientation.w = 1.0;
103104

104105
/* Define a box to be attached */
105106
shape_msgs::SolidPrimitive primitive;
106107
primitive.type = primitive.BOX;
107108
primitive.dimensions.resize(3);
108-
primitive.dimensions[0] = 0.1;
109-
primitive.dimensions[1] = 0.1;
110-
primitive.dimensions[2] = 0.1;
109+
primitive.dimensions[0] = 0.075;
110+
primitive.dimensions[1] = 0.075;
111+
primitive.dimensions[2] = 0.075;
111112

112113
attached_object.object.primitives.push_back(primitive);
113114
attached_object.object.primitive_poses.push_back(pose);
@@ -170,7 +171,7 @@ int main(int argc, char** argv)
170171
/* First, define the REMOVE object message*/
171172
moveit_msgs::CollisionObject remove_object;
172173
remove_object.id = "box";
173-
remove_object.header.frame_id = "panda_link0";
174+
remove_object.header.frame_id = "panda_hand";
174175
remove_object.operation = remove_object.REMOVE;
175176

176177
// Note how we make sure that the diff message contains no other
@@ -181,6 +182,7 @@ int main(int argc, char** argv)
181182
planning_scene.world.collision_objects.clear();
182183
planning_scene.world.collision_objects.push_back(remove_object);
183184
planning_scene.robot_state.attached_collision_objects.push_back(attached_object);
185+
planning_scene.robot_state.is_diff = true;
184186
planning_scene_diff_publisher.publish(planning_scene);
185187

186188
visual_tools.prompt("Press 'next' in the RvizVisualToolsGui window to continue the demo");
@@ -194,7 +196,7 @@ int main(int argc, char** argv)
194196
/* First, define the DETACH object message*/
195197
moveit_msgs::AttachedCollisionObject detach_object;
196198
detach_object.object.id = "box";
197-
detach_object.link_name = "panda_link8";
199+
detach_object.link_name = "panda_hand";
198200
detach_object.object.operation = attached_object.object.REMOVE;
199201

200202
// Note how we make sure that the diff message contains no other

0 commit comments

Comments
 (0)