The Robot Operating System (ROS) is a set of software libraries and tools for building robot applications.
OS Requirement
- OS: Linux
- Distro: Ubuntu/RHEL
- Shell: Bash
Installation Procedure:
My OS Specification
- OS: Linux
- Distro: Fedora 38
- Shell: Bash
Used Tools
Packages used to run ROS2 on distributions other than the supported ones.
Distrobox
Podman
Ubuntu 22.04 Container
Installation Procedure
- Install
docker,podman, and distrobox. - Run the following command to make a distro container for Ubuntu 22.04:
distrobox-create --name ros --image ubuntu:22.04- Log inside the created container:
distrobox enter ros- Install the ROS2 distribution following the instruction for ubuntu 22.04 inside the container.
Example Usage
- Log inside the ubuntu container we just created by:
distrobox enter ros- In one ros container terminal, source the setup file and then run a C++
talker:
source /opt/ros/humble/setup.bash
ros2 run demo_nodes_cpp talker- In another ros container terminal, source the setup file and then run a Python
listener:
source /opt/ros/humble/setup.bash
ros2 run demo_nodes_py listenerYou should see the talker saying that it’s Publishing messages and the listener saying I heard those messages. This verifies both the C++ and Python APIs are working properly. yayyyy!
Additional Setup
- ROS requires the
setup.bashfile to be sourced every time before running it. This can be automated by adding the following line in your.bashrc.
source /opt/ros/humble/setup.bash- This might cause error on the host terminal because the
/opt/ros/humble/setup.bashis only on the container.
# Error: bash: /opt/ros/humble/setup.bash: No such file or directory- To fix that add the following snippet at the end of your
.bashrcfile instead of the above mentioned line.
# ROS
if [ "$(grep Ubuntu /etc/issue | awk '{print $1}')" == "Ubuntu" ]; then
source /opt/ros/humble/setup.bash
fi- The
clearcommand might not work inside the container, to fix that run the following command on your terminal. (It addsexport TERM=linuxin your.bash_profile)
echo 'export TERM=linux' >> ~/.bash_profile- We need to log into the container every time we launch a new terminal so it’s better to make a shortcut to log straight to the container terminal.
# For most terminals the shortcut can be set as:
<terminal-name> -e distrobox enter ros