MoveIt 2 Source Build - Linux

Installing MoveIt 2 from source is the first step in contributing new features, optimizations, and bug fixes back to the open source project. Thanks for getting involved!

MoveIt is mainly supported on Linux, and the following build instructions support in particular:

  • Ubuntu 22.04 / ROS 2 Humble Hawksbill (Recommended LTS)
  • Ubuntu 22.04 / ROS 2 Iron Irwini (Recommended Stable)
  • Ubuntu 22.04 / ROS 2 Rolling Ridley (Continuously Updated. Use this to access latest features.)

In the future, we would like to expand our source build instructions to more OS’s, please contribute instruction write-ups to this repo.

These instructions assume you are running on Ubuntu 22.04 (Humble, Iron, Rolling)

Prerequisites

Install

Install ROS 2 Humble, Iron, or Rolling following the installation instructions.

We recommend Humble for stable latest LTS distribution needs, Iron for latest stable release, and Rolling for contributing to MoveIt 2. Currently the main branch supports Rolling, Iron, and Humble. However, since it’s used for latest development, the main branch is unstable. For stable versions, please use the distro branches humble, or iron.

MoveIt2 source installation requires various other tools apart from what is already mentioned in the ROS2 install docs.

sudo apt install -y \
  build-essential \
  cmake \
  git \
  python3-colcon-common-extensions \
  python3-flake8 \
  python3-rosdep \
  python3-setuptools \
  python3-vcstool \
  wget

Make sure you have the latest versions of packages installed:

sudo apt update
sudo apt dist-upgrade
rosdep update

Finally, don’t forget to source the setup script.

source /opt/ros/$ROS_DISTRO/setup.bash

Uninstall Any Pre-existing MoveIt Debians

In ROS2, debians conflict with packages built from source. So, remove any existing MoveIt debians:

sudo apt remove ros-$ROS_DISTRO-moveit*

Create Workspace and Source

Create a colcon workspace:

export COLCON_WS=~/ws_moveit2/
mkdir -p $COLCON_WS/src
cd $COLCON_WS/src

Download Source Code

Download the repository and install any dependencies. Issue the relevant commands for your ROS distribution.

Humble, Iron -stable

git clone https://github.com/ros-planning/moveit2.git -b $ROS_DISTRO
for repo in moveit2/moveit2.repos $(f="moveit2/moveit2_$ROS_DISTRO.repos"; test -r $f && echo $f); do vcs import < "$repo"; done
rosdep install -r --from-paths . --ignore-src --rosdistro $ROS_DISTRO -y

Rolling, Iron, Humble -unstable

git clone https://github.com/ros-planning/moveit2.git -b main
for repo in moveit2/moveit2.repos $(f="moveit2/moveit2_$ROS_DISTRO.repos"; test -r $f && echo $f); do vcs import < "$repo"; done
rosdep install -r --from-paths . --ignore-src --rosdistro $ROS_DISTRO -y

Middleware

We recommend CycloneDDS as a middleware. Note: this makes all nodes started using this RMW incompatible with any other nodes not using Cyclone DDS.

sudo apt install ros-$ROS_DISTRO-rmw-cyclonedds-cpp
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp

You may want to add export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp to your ~/.bashrc to source it automatically.

Build MoveIt

The rest of the commands are same for every distribution.

Configure and build the workspace:

cd $COLCON_WS
colcon build --event-handlers desktop_notification- status- --cmake-args -DCMAKE_BUILD_TYPE=Release

Source the Colcon Workspace

Setup your environment - you can do this every time you work with this particular source install of the code, or you can add this to your .bashrc (recommended):

source $COLCON_WS/install/setup.bash

Quick Start

Check out the MoveIt 2 Tutorials on how to get started with simple demo packages.

MoveIt 2 Tutorials