@@ -71,15 +71,15 @@ int main(int argc, char** argv)
7171
7272 // The :planning_interface:`MoveGroupInterface` class can be easily
7373 // setup using just the name of the planning group you would like to control and plan for.
74- moveit::planning_interface::MoveGroupInterface move_group (PLANNING_GROUP);
74+ moveit::planning_interface::MoveGroupInterface move_group_interface (PLANNING_GROUP);
7575
7676 // We will use the :planning_interface:`PlanningSceneInterface`
7777 // class to add and remove collision objects in our "virtual world" scene
7878 moveit::planning_interface::PlanningSceneInterface planning_scene_interface;
7979
8080 // Raw pointers are frequently used to refer to the planning group for improved performance.
8181 const moveit::core::JointModelGroup* joint_model_group =
82- move_group .getCurrentState ()->getJointModelGroup (PLANNING_GROUP);
82+ move_group_interface .getCurrentState ()->getJointModelGroup (PLANNING_GROUP);
8383
8484 // Visualization
8585 // ^^^^^^^^^^^^^
@@ -106,15 +106,15 @@ int main(int argc, char** argv)
106106 // ^^^^^^^^^^^^^^^^^^^^^^^^^
107107 //
108108 // We can print the name of the reference frame for this robot.
109- ROS_INFO_NAMED (" tutorial" , " Planning frame: %s" , move_group .getPlanningFrame ().c_str ());
109+ ROS_INFO_NAMED (" tutorial" , " Planning frame: %s" , move_group_interface .getPlanningFrame ().c_str ());
110110
111111 // We can also print the name of the end-effector link for this group.
112- ROS_INFO_NAMED (" tutorial" , " End effector link: %s" , move_group .getEndEffectorLink ().c_str ());
112+ ROS_INFO_NAMED (" tutorial" , " End effector link: %s" , move_group_interface .getEndEffectorLink ().c_str ());
113113
114114 // We can get a list of all the groups in the robot:
115115 ROS_INFO_NAMED (" tutorial" , " Available Planning Groups:" );
116- std::copy (move_group .getJointModelGroupNames ().begin (), move_group. getJointModelGroupNames (). end (),
117- std::ostream_iterator<std::string>(std::cout, " , " ));
116+ std::copy (move_group_interface .getJointModelGroupNames ().begin (),
117+ move_group_interface. getJointModelGroupNames (). end (), std::ostream_iterator<std::string>(std::cout, " , " ));
118118
119119 // Start the demo
120120 // ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -131,14 +131,14 @@ int main(int argc, char** argv)
131131 target_pose1.position .x = 0.28 ;
132132 target_pose1.position .y = -0.2 ;
133133 target_pose1.position .z = 0.5 ;
134- move_group .setPoseTarget (target_pose1);
134+ move_group_interface .setPoseTarget (target_pose1);
135135
136136 // Now, we call the planner to compute the plan and visualize it.
137- // Note that we are just planning, not asking move_group
137+ // Note that we are just planning, not asking move_group_interface
138138 // to actually move the robot.
139139 moveit::planning_interface::MoveGroupInterface::Plan my_plan;
140140
141- bool success = (move_group .plan (my_plan) == moveit::planning_interface::MoveItErrorCode::SUCCESS);
141+ bool success = (move_group_interface .plan (my_plan) == moveit::planning_interface::MoveItErrorCode::SUCCESS);
142142
143143 ROS_INFO_NAMED (" tutorial" , " Visualizing plan 1 (pose goal) %s" , success ? " " : " FAILED" );
144144
@@ -154,7 +154,7 @@ int main(int argc, char** argv)
154154
155155 // Finally, to execute the trajectory stored in my_plan, you could use the following method call:
156156 // Note that this can lead to problems if the robot moved in the meanwhile.
157- // move_group .execute(my_plan);
157+ // move_group_interface .execute(my_plan);
158158
159159 // Moving to a pose goal
160160 // ^^^^^^^^^^^^^^^^^^^^^
@@ -164,7 +164,7 @@ int main(int argc, char** argv)
164164 // and should be preferred. Note that the pose goal we had set earlier is still active,
165165 // so the robot will try to move to that goal.
166166
167- // move_group .move();
167+ // move_group_interface .move();
168168
169169 // Planning to a joint-space goal
170170 // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -174,24 +174,24 @@ int main(int argc, char** argv)
174174 //
175175 // To start, we'll create an pointer that references the current robot's state.
176176 // RobotState is the object that contains all the current position/velocity/acceleration data.
177- moveit::core::RobotStatePtr current_state = move_group .getCurrentState ();
177+ moveit::core::RobotStatePtr current_state = move_group_interface .getCurrentState ();
178178 //
179179 // Next get the current set of joint values for the group.
180180 std::vector<double > joint_group_positions;
181181 current_state->copyJointGroupPositions (joint_model_group, joint_group_positions);
182182
183183 // Now, let's modify one of the joints, plan to the new joint space goal and visualize the plan.
184184 joint_group_positions[0 ] = -tau / 6 ; // -1/6 turn in radians
185- move_group .setJointValueTarget (joint_group_positions);
185+ move_group_interface .setJointValueTarget (joint_group_positions);
186186
187187 // We lower the allowed maximum velocity and acceleration to 5% of their maximum.
188188 // The default values are 10% (0.1).
189189 // Set your preferred defaults in the joint_limits.yaml file of your robot's moveit_config
190190 // or set explicit factors in your code if you need your robot to move faster.
191- move_group .setMaxVelocityScalingFactor (0.05 );
192- move_group .setMaxAccelerationScalingFactor (0.05 );
191+ move_group_interface .setMaxVelocityScalingFactor (0.05 );
192+ move_group_interface .setMaxAccelerationScalingFactor (0.05 );
193193
194- success = (move_group .plan (my_plan) == moveit::planning_interface::MoveItErrorCode::SUCCESS);
194+ success = (move_group_interface .plan (my_plan) == moveit::planning_interface::MoveItErrorCode::SUCCESS);
195195 ROS_INFO_NAMED (" tutorial" , " Visualizing plan 2 (joint space goal) %s" , success ? " " : " FAILED" );
196196
197197 // Visualize the plan in RViz
@@ -219,7 +219,7 @@ int main(int argc, char** argv)
219219 // Now, set it as the path constraint for the group.
220220 moveit_msgs::Constraints test_constraints;
221221 test_constraints.orientation_constraints .push_back (ocm);
222- move_group .setPathConstraints (test_constraints);
222+ move_group_interface .setPathConstraints (test_constraints);
223223
224224 // Enforce Planning in Joint Space
225225 // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -241,24 +241,24 @@ int main(int argc, char** argv)
241241 // Note that this will only work if the current state already
242242 // satisfies the path constraints. So we need to set the start
243243 // state to a new pose.
244- moveit::core::RobotState start_state (*move_group .getCurrentState ());
244+ moveit::core::RobotState start_state (*move_group_interface .getCurrentState ());
245245 geometry_msgs::Pose start_pose2;
246246 start_pose2.orientation .w = 1.0 ;
247247 start_pose2.position .x = 0.55 ;
248248 start_pose2.position .y = -0.05 ;
249249 start_pose2.position .z = 0.8 ;
250250 start_state.setFromIK (joint_model_group, start_pose2);
251- move_group .setStartState (start_state);
251+ move_group_interface .setStartState (start_state);
252252
253253 // Now we will plan to the earlier pose target from the new
254254 // start state that we have just created.
255- move_group .setPoseTarget (target_pose1);
255+ move_group_interface .setPoseTarget (target_pose1);
256256
257257 // Planning with constraints can be slow because every sample must call an inverse kinematics solver.
258258 // Lets increase the planning time from the default 5 seconds to be sure the planner has enough time to succeed.
259- move_group .setPlanningTime (10.0 );
259+ move_group_interface .setPlanningTime (10.0 );
260260
261- success = (move_group .plan (my_plan) == moveit::planning_interface::MoveItErrorCode::SUCCESS);
261+ success = (move_group_interface .plan (my_plan) == moveit::planning_interface::MoveItErrorCode::SUCCESS);
262262 ROS_INFO_NAMED (" tutorial" , " Visualizing plan 3 (constraints) %s" , success ? " " : " FAILED" );
263263
264264 // Visualize the plan in RViz
@@ -271,7 +271,7 @@ int main(int argc, char** argv)
271271 visual_tools.prompt (" next step" );
272272
273273 // When done with the path constraint be sure to clear it.
274- move_group .clearPathConstraints ();
274+ move_group_interface .clearPathConstraints ();
275275
276276 // Cartesian Paths
277277 // ^^^^^^^^^^^^^^^
@@ -303,7 +303,7 @@ int main(int argc, char** argv)
303303 moveit_msgs::RobotTrajectory trajectory;
304304 const double jump_threshold = 0.0 ;
305305 const double eef_step = 0.01 ;
306- double fraction = move_group .computeCartesianPath (waypoints, eef_step, jump_threshold, trajectory);
306+ double fraction = move_group_interface .computeCartesianPath (waypoints, eef_step, jump_threshold, trajectory);
307307 ROS_INFO_NAMED (" tutorial" , " Visualizing plan 4 (Cartesian path) (%.2f%% acheived)" , fraction * 100.0 );
308308
309309 // Visualize the plan in RViz
@@ -321,21 +321,21 @@ int main(int argc, char** argv)
321321 // Pull requests are welcome.
322322 //
323323 // You can execute a trajectory like this.
324- move_group .execute (trajectory);
324+ move_group_interface .execute (trajectory);
325325
326326 // Adding objects to the environment
327327 // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
328328 //
329329 // First let's plan to another simple goal with no objects in the way.
330- move_group .setStartState (*move_group .getCurrentState ());
330+ move_group_interface .setStartState (*move_group_interface .getCurrentState ());
331331 geometry_msgs::Pose another_pose;
332332 another_pose.orientation .x = 1.0 ;
333333 another_pose.position .x = 0.7 ;
334334 another_pose.position .y = 0.0 ;
335335 another_pose.position .z = 0.59 ;
336- move_group .setPoseTarget (another_pose);
336+ move_group_interface .setPoseTarget (another_pose);
337337
338- success = (move_group .plan (my_plan) == moveit::planning_interface::MoveItErrorCode::SUCCESS);
338+ success = (move_group_interface .plan (my_plan) == moveit::planning_interface::MoveItErrorCode::SUCCESS);
339339 ROS_INFO_NAMED (" tutorial" , " Visualizing plan 5 (with no obstacles) %s" , success ? " " : " FAILED" );
340340
341341 visual_tools.deleteAllMarkers ();
@@ -351,7 +351,7 @@ int main(int argc, char** argv)
351351 //
352352 // Now let's define a collision object ROS message for the robot to avoid.
353353 moveit_msgs::CollisionObject collision_object;
354- collision_object.header .frame_id = move_group .getPlanningFrame ();
354+ collision_object.header .frame_id = move_group_interface .getPlanningFrame ();
355355
356356 // The id of the object is used to identify it.
357357 collision_object.id = " box1" ;
@@ -389,7 +389,7 @@ int main(int argc, char** argv)
389389 visual_tools.prompt (" Press 'next' in the RvizVisualToolsGui window to once the collision object appears in RViz" );
390390
391391 // Now when we plan a trajectory it will avoid the obstacle
392- success = (move_group .plan (my_plan) == moveit::planning_interface::MoveItErrorCode::SUCCESS);
392+ success = (move_group_interface .plan (my_plan) == moveit::planning_interface::MoveItErrorCode::SUCCESS);
393393 ROS_INFO_NAMED (" tutorial" , " Visualizing plan 6 (pose goal move around cuboid) %s" , success ? " " : " FAILED" );
394394 visual_tools.publishText (text_pose, " Obstacle Goal" , rvt::WHITE, rvt::XLARGE);
395395 visual_tools.publishTrajectoryLine (my_plan.trajectory_ , joint_model_group);
@@ -417,7 +417,7 @@ int main(int argc, char** argv)
417417 cylinder_primitive.dimensions [primitive.CYLINDER_RADIUS ] = 0.04 ;
418418
419419 // We define the frame/pose for this cylinder so that it appears in the gripper
420- object_to_attach.header .frame_id = move_group .getEndEffectorLink ();
420+ object_to_attach.header .frame_id = move_group_interface .getEndEffectorLink ();
421421 geometry_msgs::Pose grab_pose;
422422 grab_pose.orientation .w = 1.0 ;
423423 grab_pose.position .z = 0.2 ;
@@ -431,7 +431,7 @@ int main(int argc, char** argv)
431431 // Then, we "attach" the object to the robot. It uses the frame_id to determine which robot link it is attached to.
432432 // You could also use applyAttachedCollisionObject to attach an object to the robot directly.
433433 ROS_INFO_NAMED (" tutorial" , " Attach the object to the robot" );
434- move_group .attachObject (object_to_attach.id , " panda_hand" );
434+ move_group_interface .attachObject (object_to_attach.id , " panda_hand" );
435435
436436 visual_tools.publishText (text_pose, " Object attached to robot" , rvt::WHITE, rvt::XLARGE);
437437 visual_tools.trigger ();
@@ -440,8 +440,8 @@ int main(int argc, char** argv)
440440 visual_tools.prompt (" Press 'next' in the RvizVisualToolsGui window once the new object is attached to the robot" );
441441
442442 // Replan, but now with the object in hand.
443- move_group .setStartStateToCurrentState ();
444- success = (move_group .plan (my_plan) == moveit::planning_interface::MoveItErrorCode::SUCCESS);
443+ move_group_interface .setStartStateToCurrentState ();
444+ success = (move_group_interface .plan (my_plan) == moveit::planning_interface::MoveItErrorCode::SUCCESS);
445445 ROS_INFO_NAMED (" tutorial" , " Visualizing plan 7 (move around cuboid with cylinder) %s" , success ? " " : " FAILED" );
446446 visual_tools.publishTrajectoryLine (my_plan.trajectory_ , joint_model_group);
447447 visual_tools.trigger ();
@@ -457,7 +457,7 @@ int main(int argc, char** argv)
457457 //
458458 // Now, let's detach the cylinder from the robot's gripper.
459459 ROS_INFO_NAMED (" tutorial" , " Detach the object from the robot" );
460- move_group .detachObject (object_to_attach.id );
460+ move_group_interface .detachObject (object_to_attach.id );
461461
462462 // Show text in RViz of status
463463 visual_tools.deleteAllMarkers ();
0 commit comments