Installing ROS Noetic on Ubuntu 22.04
ROS1 provides robotics tooling from sensor drivers to controls and perception algorithms. It is a key tool used in academia, research, and even the industry.
With the recent release of ROS2, support for ROS1 is slowly fading away even though many current robotics applications still depend on it. Notably the final version of ROS1: Noetic Ninjemys is not supported under Ubuntu 22.04.
This tutorial provides guidance to build ROS1: Noetic Ninjemys for Ubuntu 22.04 LTS (Jammy Jellyfish).
Content
Context
Let’s first try to understand why ROS Noetic is not supported under Ubuntu 22.04. The issues are:
- The main
ros-noetic-desktop-full
package is not distributed under 22.04. We will have to install from source. python3-rosdep
andpython3-vcstool
packages are not readily available under 22.04 (see error below). We will install them from the 20.04 package distribution.
apt-get install python3-rosdep python3-rosinstall-generator python3-vcstools python3-vcstool build-essential
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package python3-rosdep
E: Unable to locate package python3-vcstool
- The
hddtemp
utility needed by thediagnostic_common_diagnostics
ROS package is not readily available under Ubuntu 22.04 (see error below). We will install it manually from a.deb
package file.
# rosdep install --from-paths ./src --ignore-packages-from-source --rosdistro noetic -y
ERROR: the following packages/stacks could not have their rosdep keys resolved
to system dependencies:
diagnostic_common_diagnostics: [hddtemp] defined as "not available" for OS version [*]
rosconsole
withlog4cxx
backend does not compile because of the use ofstd::shared_ptr
in version 0.12 (see error below). We will use a patch from dreuter.
==> Processing catkin package: 'rosconsole'
...
==> make -j16 -l16 in '/root/ros_catkin_ws/build_isolated/rosconsole'
[ 16%] Building CXX object CMakeFiles/rosconsole_backend_interface.dir/src/rosconsole/rosconsole_backend.cpp.o
[ 33%] Linking CXX shared library /root/ros_catkin_ws/devel_isolated/rosconsole/lib/librosconsole_backend_interface.so
[ 33%] Built target rosconsole_backend_interface
[ 50%] Building CXX object CMakeFiles/rosconsole_log4cxx.dir/src/rosconsole/impl/rosconsole_log4cxx.cpp.o
/root/ros_catkin_ws/src/rosconsole/src/rosconsole/impl/rosconsole_log4cxx.cpp: In function ‘void ros::console::impl::initialize()’:
/root/ros_catkin_ws/src/rosconsole/src/rosconsole/impl/rosconsole_log4cxx.cpp:169:23: error: cannot convert ‘ros::console::impl::ROSConsoleStdioAppender*’ to ‘log4cxx::AppenderPtr’ {aka ‘std::shared_ptr<log4cxx::Appender>’}
- Everything downstream of
rosconsole
has to be built with C++17 enabled. This is usually fine except forurdf
which sets itsCMAKE_CXX_STANDARD
differently (see error below). We will use a patched version from dreuter.
==> Processing catkin package: 'urdf'
==> make -j16 -l16 in '/root/ros_catkin_ws/build_isolated/urdf'
[ 33%] Building CXX object CMakeFiles/urdf.dir/src/model.cpp.o
[ 66%] Building CXX object CMakeFiles/urdf.dir/src/rosconsole_bridge.cpp.o
In file included from /usr/include/log4cxx/log4cxx.h:45,
from /usr/include/log4cxx/logstring.h:28,
from /usr/include/log4cxx/level.h:22,
from /root/ros_catkin_ws/install_isolated/include/ros/console.h:46,
from /root/ros_catkin_ws/install_isolated/include/ros/ros.h:40,
from /root/ros_catkin_ws/src/urdf/urdf/include/urdf/model.h:50,
from /root/ros_catkin_ws/src/urdf/urdf/src/model.cpp:42:
/usr/include/log4cxx/boost-std-configuration.h:10:18: error: ‘shared_mutex’ in namespace ‘std’ does not name a type
10 | typedef std::shared_mutex shared_mutex;
For reference, these instructions were tested on the following configurations:
- Barebone: Linux my_hostname 5.15.0–53-generic #59-Ubuntu SMP Mon Oct 17 18:53:30 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
- ubuntu:22.04 Docker image:
The steps below mostly follow the Installing from source instructions, but have more prerequisites and dependencies tweaks.
Installation
For this tutorial, make sure you have the following packages:
sudo apt install git gnupg wget
Build tools
First add packages.ros.org as an accepted software provider, but for the previous Ubuntu 20.04 release, focal. This is step is mostly similar to the one listed under Configure your Ubuntu repositories.
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu focal main" > /etc/apt/sources.list.d/ros-latest.list'
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
sudo apt update
You should now be able to install the build dependencies:
sudo apt-get install python3-rosdep python3-rosinstall-generator python3-vcstools python3-vcstool build-essential
Next, we initialize rosdep
, the ROS dependencies manager:
sudo rosdep init
hddtemp
Before running rosdep update
, we need to install hddtemp
for Ubuntu 22.04:
cd ~/Downloads
wget http://archive.ubuntu.com/ubuntu/pool/universe/h/hddtemp/hddtemp_0.3-beta15-53_amd64.deb
sudo apt install ~/Downloads/hddtemp_0.3-beta15-53_amd64.deb
We then need to declare it as available to rosdep
. For this, create an modified sources list from the rosdep
repository:
cd ~/Downloads
wget https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
Open the downloaded base.yaml
file and modify the hddtemp
section to add a jammy: [hddtemp]
line. This tells rosdep
that hddtemp
is indeed present under Ubuntu 22.04 Jammy. After this change, the hddtemp
section should something like this (notice the last line):
hddtemp:
arch: [hddtemp]
debian: [hddtemp]
fedora: [hddtemp]
freebsd: [python27]
gentoo: [app-admin/hddtemp]
macports: [python27]
nixos: [hddtemp]
openembedded: [hddtemp@meta-oe]
opensuse: [hddtemp]
rhel: [hddtemp]
slackware: [hddtemp]
ubuntu:
'*': null
bionic: [hddtemp]
focal: [hddtemp]
impish: [hddtemp]
jammy: [hddtemp]
Now we just need to tell rosdep
to get its sources from our local base.yaml
file instead of the one on the online repository. Open /etc/ros/rosdep/sources.list.d/20-default.list
as sudo
, for example:
sudo gedit /etc/ros/rosdep/sources.list.d/20-default.list
Modify the base.yaml
line to get the file locally. The contents of 20-default.list
should look similar to this:
NOTE: you need to modify the your_username part below
# os-specific listings first
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/osx-homebrew.yaml osx
# generic
#yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/base.yaml
yaml file:///home/your_username/Downloads/base.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/python.yaml
yaml https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/ruby.yaml
gbpdistro https://raw.githubusercontent.com/ros/rosdistro/master/releases/fuerte.yaml fuerte
# newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead
Make rosdep
aware of the change with:
rosdep update
Downloading ROS packages dependencies
Create a catkin workspace:
mkdir ~/ros_catkin_ws
cd ~/ros_catkin_ws
Download the source code for the ROS packages. Here we assume that you want all the packages from the ros-noetic-desktop-full
install:
rosinstall_generator desktop --rosdistro noetic --deps --tar > noetic-desktop.rosinstall
mkdir ./src
vcs import --input noetic-desktop.rosinstall ./src
Install the dependencies for all those ROS packages:
rosdep install --from-paths ./src --ignore-packages-from-source --rosdistro noetic -y
This step will take a few minutes.
Patching
We are now almost ready to build ROS! We just need to patch 2 packages to make them compatible with Ubuntu 22.04:
rosconsole
: console logging utilities for ROSurdf
: parser for Unified Robot Description Format (URDF) files
With the magic of open source, and thanks to Daniel Reuter (dreuter) and their contributions, we do have fixes available!
See their repositories:
- GitHub — dreuter/rosconsole (up for review with PR#54)
- GitHub — dreuter/urdf
Backup the original copies of these packages and download the patched versions in the src
folder:
# Backup
cd ~/ros_catkin_ws/src
mkdir ~/Downloads/backup
mv rosconsole urdf ~/Downloads/backup/
# Download and use fix branch
git clone https://github.com/dreuter/rosconsole.git
cd rosconsole
git checkout noetic-jammy
cd ~/ros_catkin_ws/src
git clone https://github.com/dreuter/urdf.git
cd urdf
git checkout set-cxx-version
cd ~/ros_catkin_ws/src
Building
Finally, with the previous fixes out of the way, we can now continue with the instructions from Installing from source:
cd ~/ros_catkin_ws
./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release
This steps proceeds to build the ROS packages one by one. It can take some time.
If you want to install ROS in the same standard location as in Ubuntu 20.04, you can run with --install-space /opt/ros/noetic
.
Testing the installation
You can now try to start the roscore
to check if ROS1 was installed properly:
source ~/ros_catkin_ws/install_isolated/setup.bash
roscore
You should see:
$ roscore
... logging to /home/your_user/.ros/log/5b726cd6-6b53-11ed-a17b-730ee1817eab/roslaunch-3g96ln3-851647.log
Checking log directory for disk usage. This may take a while.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://your_host:46495/
ros_comm version 1.15.14
SUMMARY
========
PARAMETERS
* /rosdistro: noetic
* /rosversion: 1.15.14
NODES
auto-starting new master
process[master]: started with pid [851670]
ROS_MASTER_URI=http://your_host:11311/
setting /run_id to 5b726cd6-6b53-11ed-a17b-730ee1817eab
process[rosout-1]: started with pid [851694]
started core service [/rosout]
Congratulations, you are now running ROS1 under Ubuntu 22.04!
Troubleshooting
If you run into issues, I recommend checking out the References section below. I got a lot of help from those links.
References
- Installing ROS Noetic from source
- GitHub — dreuter/rosconsole
- GitHub — dreuter/urdf
- ros_from_src: Useful scripts and build instructions for Ubuntu 22.04
- ROS Answers: [hddtemp] defined as “not available” for OS version [*]
- ROS Answers: Will ROS Noeric support Ubuntu 22.04?
- Contributing rosdep rules
- Codesti: Error when compiling with log4cxx 0.12.0