How to run ROS 2 on an Odroid-XU4
Getting the next generation Robot Operating System onto Hardkernel’s Octa-core SBC for your next robotics project
The second generation of the Robot Operating System (ROS) is steadily maturing. Although there are still plenty of features outstanding on the official roadmap, ROS 2 has by now had its first official Long Term Support (LTS) release, Dashing Diademata. This release, and even more so the currently latest release, Eloquent Elusor, is now at a stage where it can comfortably be used as the base of new robotics projects.
In my RoboCup team, the Bold Hearts, we are now using ROS 2 on our robots. They were originally based on ROBOTIS’s DARwIn-OP platform, but have undergone several upgrades over the years. One of these is that they currently use the Odroid-XU4 as their main computation device: an 8-core big.LITTLE 32 bit ARM single-board computer (SBC), not too dissimilar from a Raspberry Pi, with quite some performance. Getting started with ROS 2 on one of these is as simple as following the steps below.
Main Operating System
The Odroid-XU4 can run both Android or Ubuntu Linux; to use ROS 2 you have to use the second option. If you haven’t done so already, follow the official guide to flash your storage (eMMC or SD) with the specially made Ubuntu image. You can use the version with the Mate desktop included, though the ‘minimal’ version probably makes more sense for a robot without keyboard/mouse and monitor and will save some resources. Follow the links to the latest version — currently ubuntu-18.04.3–4.14-minimal-odroid-xu4–20190910.img.xz — or if you already have an older version installed you can upgrade with the instructions at the bottom of the download page.
Once flashed, stick your storage onto/into the board, power it on, wait for it to turn itself off again (on first boot it resizes the root filesystem and shuts down again), and connect it to your network and SSH in, all as described in the headless setup wiki documentation. Assuming you went for the ‘minimal’ image you can ignore the VNC and Mate related sections.
Installing ROS 2
Before the release of Dashing, ROS 2 had to be compiled from source for 32 bit ARM platforms, but luckily this is no longer the case. Since Dashing and Eloquent there are Debian packages available in the official ROS repositories. Although
arm32 is listed as a ‘Tier 2’ platform, which in theory means fewer guarantees on completeness and reliability, all you need is there. You can pretty much follow the instructions described on ROS Index for installing ROS 2 via Debian Packages, with some slight additions for the Odroid:
Ensure some requirements for adding the ROS 2 repository are installed:
$ sudo apt update && sudo apt install curl gnupg2 lsb-release
Add the ROS Apt authentication key:
$ curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
Add the ROS Apt repository source:
$ sudo sh -c 'echo "deb [arch=armhf] http://packages.ros.org/ros2/ubuntu `lsb_release -cs` main" > /etc/apt/sources.list.d/ros2-latest.list'
Install ROS 2 (use
dashing instead of
eloquent if you want to use the LTS release, though Eloquent contains a bunch of great improvements you would want; also you could choose to install
ros-eloquent-ros-desktop to get the kitchen sink, including graphical applications, but here we assume again your robot is monitor-less):
$ sudo apt update && sudo apt install ros-eloquent-ros-base
And there you go! ROS 2 is installed and ready to go. Let’s try some things out.
Running some nodes
The ROS 2 ecosystem is not as rich yet as that of ROS 1, but there are already a bunch of packages out there to use, with a good amount available through
apt search ros-eloquent to get the full list. Let’s try one of the very basic standard demos:
$ sudo apt install ros-eloquent-demo-nodes-cpp
$ source /opt/ros/eloquent/setup.bash
$ ros2 launch demo_nodes_cpp talker_listener.launch.py
[INFO] [launch]: All log files can be found below /home/sander/.ros/log/2020-04-12-18-33-03-704440-ade-3326
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [talker-1]: process started with pid 
[INFO] [listener-2]: process started with pid 
[talker-1] [INFO] [talker]: Publishing: 'Hello World: 1'
[listener-2] [INFO] [listener]: I heard: [Hello World: 1]
[talker-1] [INFO] [talker]: Publishing: 'Hello World: 2'
[listener-2] [INFO] [listener]: I heard: [Hello World: 2]
[talker-1] [INFO] [talker]: Publishing: 'Hello World: 3'
[listener-2] [INFO] [listener]: I heard: [Hello World: 3]
The output you see is coming from 2 separate nodes that are communicating with each other. Congratulations, you just ran your first complete ROS 2 application on your Odroid-XU4!
If you’re familiar with ROS then you know that you always have to run the
source command to (re)initialize the environment before being able to run anything, and after installing any new package. It is a good idea to have this done automatically every time you log in, by adding this command to the
$ echo "source /opt/ros/eloquent/setup.bash" >> ~/.bashrc
We will finish off with another demo that is a little bit more towards actually running a robot:
$ sudo apt install ros-eloquent-dummy-robot-bringup
$ source /opt/ros/eloquent/setup.bash
$ ros2 launch dummy_robot_bringup dummy_robot_bringup.launch.py
You will see several nodes being started, including a laser… If you have ROS 2 installed on your workstation with Rviz2, e.g. by installing
ros-eloquent-ros-desktop, you can run it, select the ‘world’ fixed frame, and add the TF and LaserScan displays to see the dummy robot in action:
See the Rviz usage guide for more on how to work with it; although it is for the ROS 1 version, most is still valid for Rviz2.
There you have it, ROS 2 Eloquent Elusor is running on your Odroid-XU4. The next LTS release, Foxy Fitzroy, is already planned for the 23rd of May. Once that happens you will be able to just install it next to Eloquent, and source its setup file instead to try it out:
$ sudo apt update && sudo apt install ros-foxy-ros-base
$ source /opt/ros/foxy/setup.bash