Skip to content

Moveit movegroup demo

Planning with MoveIt 2 Using the MoveGroup C++ API

If you want to integrate MoveIt 2 into your planning pipeline and want greater control over its various functionalities, using the MoveGroup API is the way to go. For this tutorial, we are going to use the RViz Visual Tools plugin to execute the C++ source code part by part to explore more sophisticated functionalities.

Execute the launch file again to begin the tutorial. You can follow along in the C++ code to inspect finer details. (Press Ctrl+C in the terminal to terminate) (Ensure you have enough room around the robot before running the script)

ros2 launch stretch_moveit2 movegroup_moveit2.launch.py

To execute the script and interact with the robot, all you need to do is press the Next button in the RViz Visual Tools window at the bottom left. Follow the prompts on the terminal to run through the tutorial. While executing the script, it's also a good idea to study and understand the script that is being executed. Find it here.

RVizVisualTools

  1. Let's begin by jogging the camera pan and tilt joints. For having a complete 3D representation of its environment, Stretch needs to point its head in all directions, up, down, left, right, you name it! Luckily, we have a planning group that allows you to do just that - the stretch_head planning group. Go ahead and press the Next button to jog the camera.

Head_Group

  1. What good is a robot that can't hold your hand on your worst days. We gave Stretch a gripper to do just that and more! Let's exercise it using the stretch_gripper planning group. All you have to do is press Next.

Gripper_Group

  1. What about the good days you ask? Stretch always wants to reach out to you, no matter what. Speaking of reaching out, let's make Stretch exercise its arm for the next time you need it. Press Next.

Arm_Group

  1. Stretch doesn't like sitting in a corner fretting about the future. It is the future. Stretch wants to explore and in style. What better way to do it than by rolling around? Press Next and you'll see. That's the mobile_base planning group.

Base_Group

  1. All that exploring does get tiring and sometimes Stretch just wants to relax and dream about its next adventure. Stretch prefers to relax with its arm down, lest someone trips over it and disturb Stretch's peaceful slumber. Press Next to see the mobile_base_arm planning group.

Base_Arm_Group

  1. Did someone say adventure? How about dodging some pesky obstacles? They're everywhere, but they don't bother Stretch a lot. It can go around them. Nothing stops Stretch! You know what to do.

Add_Object

  1. Stretch is smart, you don't need to tell it which joint goes where. Just say what you want done and it does it. How about planning a pose goal to see it in action? Press Next.

Pose_Goal

Press Ctrl+C to end this demo.

  1. To wrap it up, the final act! This one is a surprise that's only a click away. Go on and execute the following command:
    ros2 launch stretch_moveit2 moveit_draw.launch.py
    

draw