Fusion of Engineering, Control, Coding, Machine Learning, and Science

How to Properly Install MoveIt2 in ROS2 Humble and Fix Tutorial Errors

In this ROS2 tutorial, we explain how to properly install MoveIt 2 in ROS2 Humble and how to start with robot visualization in RViz and motion planning. We also explain how to fix errors that occur when one is trying to load robot models from the official MoveIt tutorial package. The YouTube video accompanying this post is given below.

How to Correctly Install MoveIt2 in ROS2 Humble and How to Start with Motion Planning of Robots

Important Notes

Before starting with the installation process, you need to understand the following.

Installation

This installation is based on the official MoveIt 2 tutorial page. However, as mentioned previously, we will have to make several modification to fix the errors. First, check the Linux version. Open a terminal, and type

lsb_release -a

This should give Linux Ubuntu 22.04. Next, we need to verify that we have the correct ROS2 version. We do that by typing:

cd /opt/ros
ls -la

You should see “humble” folder. Then, let us double check by typing:

source /opt/ros/humble/setup.bash
printenv ROS_DISTRO

This should give “humble” as an output. Let us start with installation. Open a new terminal, and type

source /opt/ros/humble/setup.bash

Next, we need to execute the following set of commands to install rosdep and upgrade:

sudo apt install python3-rosdep
sudo rosdep init
rosdep update
sudo apt update
sudo apt dist-upgrade

Next, we need to install Colcon build system with mixin, and vcstool:

sudo apt install python3-colcon-common-extensions
sudo apt install python3-colcon-mixin
colcon mixin add default https://raw.githubusercontent.com/colcon/colcon-mixin-repository/master/index.yaml
colcon mixin update default
sudo apt install python3-vcstool

Next, we need to create the workspace and source folder, clone the tutorials for the Humble branch (this is the main difference with respect to the official installation page)

mkdir -p ~/ws_moveit/src
cd ~/ws_moveit/src
git clone --branch humble https://github.com/ros-planning/moveit2_tutorials
vcs import < moveit2_tutorials/moveit2_tutorials.repos

Here, the main difference with respect the official installation page is the option “–branch humble” when cloning the tutorials.

Next, we need to build everything. We do that by typing:

sudo apt update && rosdep install -r --from-paths . --ignore-src --rosdistro $ROS_DISTRO -y
cd ~/ws_moveit
colcon build --mixin release --executor sequential

Here, the main difference with respect to the official installation page is that we have added an option “–executor sequential” to the colcon build command. This will make sure that the installation does not use the complete computer CPU resources. Without this option, the installation will be stuck.

Also, the colcon build command will take around 20-30 minutes to complete. After completing this, you can source MoveIt 2 like this:

source ~/ws_moveit/install/setup.bash

Note that whenever you want to use Moveit 2, you need to execute this command.

Exit mobile version