Skip to content

Change the planning scene in MoveIt 2

This is a step-by-step tutorial on how to modify the planning scene in MoveIt. This allows the user to plan and execute collision-free joint trajectories that take into account objects that are not part of the robot description.

This tutorial shows how to do it with the RViZ GUI. This can also be done using the C++ and Python API of MoveIt.

In this tutorial we add a box in front of the robot and show how planning a motion from above to below this box results in the robot planning a motion that avoids the box.

Step 1: Add a collision mesh

You can add a collision mesh in the Scene objects tab of the MotionPlanning display of the MoveIt GUI. The box is one of the predefined objects that can be added. See Figure 1.

Moveit 2 GUI Scene Tab
Figure 1: Moveit 2 GUI Scene Tab.

Choose a position of the object in front of the robot by modifying the parameters also in the GUI, see Figure 1.

Step 2: Move the end-effector

Once the box is in front of the robot, use choose the arm_torso group and move the end-effector on the other side of the box. While moving it, the yellow highlighted parts of the robots will become red if there is a collision. An example of start and goal pose can be seen in Figure 2.

Moveit 2 Motion Planning with obstacles
Figure 2: Motion Planning with obstacles. Left: Start Pose. Right: Goal Pose.

Step 3: Plan and execute the motion

Going to the Planning tab in the MotionPlanning display allows to plan and execute. The planning might fail. If it does, you can re-plan as many times as needed to find a trajectory solution.

An example of such solution is shown in Figure 3.

Moveit 2 Joint trajectory avoiding an obstacle
Figure 3: Moveit 2 Joint trajectory avoiding an obstacle.