December 22, 2024

How To Move Robot Using MoveIt 2 in RViz and ROS2 and How to Perform Motion Planning

In this MoveIt 2 tutorial, we first explain how to load a graphical representation of a robot from a command line. For simplicity, we use a predefined robot launch file from official MoveIt2 tutorials. Then, we explain how to adjust the Rviz settings such that you can properly visualize and move the robot in the joint mode. We then explain how to perform motion planning and how to properly visualize and simulate robot intermediate states. In this tutorial, we explain how to manually or graphically move the robot, and in our future tutorials, we explain how to write C++ programs for moving the robot. We use a Panda robot model from the official MoveIt 2 tutorial package. The YouTube tutorial accompanying this webpage is given below.

To be able to reproduce everything explained in this tutorial, the following two conditions have to be satisfied:

1.) You need Ubuntu 22.04 and ROS2 Humble.

2.) You need to install MoveIt 2 for ROS2 by building the source code. This is explained in our previous tutorial. Note that in that tutorial, we have explained how to fix some errors that appear when trying to load the built-in tutorial files.

Once MoveIt2 is installed from the source. You need to source the setup file:

source ~/ws_moveit/install/setup.bash

Next, we can load the tutorial launch file

ros2 launch moveit2_tutorials demo.launch.py rviz_config:=panda_moveit_config_demo_empty.rviz

This will open the RViz with the motion planning scence. You need to watch the YouTube tutorial in order to learn how to move the robot.