In this blog post, you will learn how to install ROS core on the BeagleBone Black/Green/Blue.
For demonstration purposes, I will use the Machinekit Debian Stretch image as a base. If you haven't read my blog post about why Machinekit and ROS would be a great combo, I encourage you to read it later.
Although the BeagleBone Blue is designed for robotics, I couldn't find any recent description on how to install ROS. Luckily, Michael Haberler created a Gist for installing ROS on the BeagleBone with Debian Jessie. I adapted this script for Debian Stretch and ROS kinetic.
Prepare a base image
First of all, start by downloading, flashing and installing the latest RCN Machinekit Debian Stretch image from here: BBB Machinekit Image with Debian Stretch
If you need some help flashing and installing the image on your BeagleBone please take a look at the first few steps of my blog post about Machinekit and Debian Stretch on the BeagleBone Black.
All the following commands will be executed on the BeagleBone itself.
Setup ROS repositories
Next, we need to add the ROS repositories.
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu stretch main" > /etc/apt/sources.list.d/ros-latest.list'
wget https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -O - | sudo apt-key add -
Then we need to update the package source and upgrade the installed packages.
sudo apt-get update
sudo apt-get upgrade
Install basic ROS dependencies
Once the ROS repository is ready, we can continue by installing the ROS dependencies.
sudo apt-get install python-pip python-setuptools python-yaml python-distribute python-docutils python-dateutil python-six
sudo pip install rosdep rosinstall_generator wstool rosinstall
The following packages need to be installed as well to circumvent missing dependencies during installation.
sudo apt-get install \
libconsole-bridge-dev liblz4-dev checkinstall cmake \
python-empy python-nose libbz2-dev \
libboost-test-dev libboost-dev libboost-program-options-dev \
libboost-regex-dev libboost-signals-dev \
libtinyxml-dev libboost-filesystem-dev libxml2-dev \
libgtest-dev
And finally, we setup rosdep.
sudo rosdep init
rosdep update
Preparing the ROS build
Next, we need to tell the ROS build tool which packages we want to build and install. In this tutorial, we only install the basic ROS core tools. Feel free to extend the package selection with any additional package you require.
mkdir ~/ros_catkin_ws
cd ~/ros_catkin_ws
rosinstall_generator ros_comm --rosdistro kinetic --deps --wet-only --exclude roslisp --tar > kinetic-ros_comm-wet.rosinstall
wstool init src kinetic-ros_comm-wet.rosinstall
Additionally, before we can start the build, we need to make sure there is enough swap space available on the BeagleBone. This is easiest ensured by mounting an external USB drive.
# roscpp fails with oom error
# I added 4GB USB flash as swap space
sudo blkid
sudo mkswap /dev/XXX
sudo swapon /dev/XXX
Make sure to replace XXX
with the device descriptor ID of your USB flash drive, e.g. sda1
.
Install ROS dependencies
The ROS build tool can automatically resolve all dependencies of a ROS workspace. This works especially well if the ROS distribution supports the target operating system.
rosdep install --from-paths src --ignore-src --rosdistro kinetic -y -r --os=debian:stretch
The command may take a while to execute.
Build ROS
Now, that we have everything installed, we can continue by building and installing ROS. Note that this step takes a couple of hours on the BeagleBone.
sudo ./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release --install-space /opt/ros/kinetic
Alternatively, we could run this compilations step from cross-compile toolchain on a desktop computer. I will extend this guide at a later time to cover this step.
Source the ROS installation and get started
Once everything is installed, you can source the ROS workspace using the following command:
source /opt/ros/kinetic/setup.sh
Now it's time to follow the ROS tutorials.
Conclusion
In this short guide, you learned how to compile and install ROS Kinetic on the BeagleBone.
If you are looking for a compiled down version of the installation steps, please take a look at my Gist.
I hope you found this information useful.
Happy ROS hacking!
Your
Machine Koder
Comments 3
This link is broken.
"BBB Machinekit Image with Debian Stretch" https://machinekoder.com/ros-with-debian-stretch-on-the-beaglebone-black-green-blue/machinekit-image
https://medium.com/@atulsingh15743 follow this link to install ros on BB Blue
Author
Thanks.