Skip to main content

ROS2 Humble Config

· 2 min read
Wei Bingchuan
PhD Student

This Document aims to provide the steps to set up a PC for ROS2 developing, which can also be used to setup the relevant dependencies for ROS2 Humble on Ubuntu 22.04.

System Requirements

Ubuntu 22.04 Desktop

Basic Software Installation

Download .deb package of chrome, vs code from the official site

sudo dpkg -i <xxx>.deb

Basic Commands Installation

sudo apt update
sudo apt upgrade
sudo apt-get install git vim curl htop

Config git

git config --global user.name "YOUR_NAME"
git config --global user.email "YOUR_EMAIL"
# Generate ssh key
ssh-keygen -t ed25519 -C "your_email@example.com"

Then add the key to github, see ref

Config zsh (Optional)

Since many scripts are based on zsh, it is recommended to config zsh:

sudo apt-get install zsh
sudo vim /etc/passwd

Change then end of the line started with your username /bin/bash to /bin/zsh

Config oh-my-zsh and powerlevel10k

Use oh-my-zsh to customize zsh:oh-my-zsh

Use powerlevel10k: powerlevel10k

Attention: powerlevel works best using its fonts, so don't forget install the fonts and apply them in the profile of zsh Config auto_suggestion and syntax-highlighting

sudo git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions
sudo git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

Edit .zshrc, add:

plugins=(
...
zsh-autosuggestions
zsh-syntax-highlighting
)

Install ROS2-Humble

ROS2 humble can be installed following [official-docs], use

# Set up sources
sudo apt install software-properties-common
sudo add-apt-repository universe
# Add ROS2 GPG key
sudo apt update && sudo apt install curl -y
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.
sudo apt update
sudo apt upgrade
sudo apt install ros-humble-desktop

This makes gazebo11 installed as well. And don't forget

sudo apt install ros-dev-tools

Config zshrc (substitute all .zshrc to .bashrc if you use bash)

echo "source /opt/ros/humble/setup.zsh" >> .zshrc
echo "source /usr/share/colcon_cd/function/colcon_cd.sh" >> ~/.zshrc
echo "export _colcon_cd_root=/opt/ros/humble/" >> ~/.zshrc

Config rosdep

sudo rosdep init
sudo rosdep update

Some useful packages:

sudo apt-get install ros-humble-rqt-tf-tree
sudo apt install ros-humble-gazebo-ros-pkgs

Install ros2_control

ros2_control is used in many parts of ROS2 such as chassis or arm:

sudo apt-get install ros-humble-ros2-control
sudo apt-get install ros-humble-ros2-controllers
sudo apt-get install ros-humble-gazebo-ros2-control
sudo apt install ros-humble-joint-state-publisher

Install moveit2

sudo apt install ros-humble-moveit