In this tutorial, I will show you how to install MoveIt 2 for ROS 2 Foxy Fitzroy. MoveIt 2 is a popular software platform for controlling robotic arms (industrial, humanoid, and collaborative).
The official tutorial is located in the MoveIt 2 documentation, but we’ll run through the entire process step-by-step below.
You Will Need
In order to complete this tutorial, you will need:
Update the Package List
The first thing you need to do is make sure you have the latest version of packages installed. Open a new terminal window, and type the following commands, one after the other.
sudo apt update
Upgrade any outdated packages
sudo apt dist-upgrade
Type Y, and then press Enter.
Update ROS dependencies.
rosdep update
Add Various ROS 2 Build Tools
Add some other build tools that Move It 2 needs. Copy and paste the full command below into your Linux terminal and then press Enter.
sudo apt install -y \
build-essential \
cmake \
git \
libbullet-dev \
python3-colcon-common-extensions \
python3-flake8 \
python3-pip \
python3-pytest-cov \
python3-rosdep \
python3-setuptools \
python3-vcstool \
wget \
clang-format-10 && \
# install some pip packages needed for testing
python3 -m pip install -U \
argcomplete \
flake8-blind-except \
flake8-builtins \
flake8-class-newline \
flake8-comprehensions \
flake8-deprecated \
flake8-docstrings \
flake8-import-order \
flake8-quotes \
pytest-repeat \
pytest-rerunfailures \
pytest
Create a Workspace
Let’s create a workspace for our MoveIt 2 work. Open a new terminal, and type the following commands:
export COLCON_WS=~/ws_moveit2/
mkdir -p $COLCON_WS/src
cd $COLCON_WS/src
Download MoveIt 2
Download the MoveIt 2 repository.
wget https://raw.githubusercontent.com/ros-planning/moveit2/main/moveit2.repos
Now run this command. Be patient as it will take a while for this command to complete. Feel free to go get something to eat or drink.
vcs import < moveit2.repos
![1-import-moveit2JPG](https://automaticaddison.com/wp-content/uploads/2021/03/1-import-moveit2JPG.jpg)
Make sure MoveIt 2 has all the dependencies it needs. This command below will also take several minutes to complete.
rosdep install -r --from-paths . --ignore-src --rosdistro foxy -y
![2-moveit2JPG](https://automaticaddison.com/wp-content/uploads/2021/03/2-moveit2JPG.jpg)
Build MoveIt 2
Move to the root of the workspace.
cd $COLCON_WS
Build MoveIt 2. This command below will take a while to complete. Mine took 26 minutes and 51 seconds.
colcon build --event-handlers desktop_notification- status- --cmake-args -DCMAKE_BUILD_TYPE=Release
Here is what my terminal looks like after the build.
![3-packages-finishedJPG](https://automaticaddison.com/wp-content/uploads/2021/03/3-packages-finishedJPG.jpg)
Source the Setup File for the Workspace
Open your .bashrc file, and add the following line to the very bottom of the file:
source ~/ws_moveit2/install/setup.bash
![3b-gedit-bash-rcJPG](https://automaticaddison.com/wp-content/uploads/2021/03/3b-gedit-bash-rcJPG.jpg)
Test Your Installation
Open a new terminal window, and type the following commands to launch the demo.
cd ~/ws_moveit2
ros2 launch run_move_group run_move_group.launch.py
![4-run-move-groupJPG](https://automaticaddison.com/wp-content/uploads/2021/03/4-run-move-groupJPG.jpg)
Here is another command you can run:
ros2 launch run_ompl_constrained_planning run_move_group.launch.py
Here is the output:
![6-other-commandJPG](https://automaticaddison.com/wp-content/uploads/2021/03/6-other-commandJPG.jpg)
When you are finished, press CTRL + C in all terminal windows to shut everything down.