ROS Kinetic on Raspberry Pi with Resin

Robot Operating System (ROS) is a great tool for robotics that meshes quite well with Resin, but the dependencies for ROS Kinetic (their current LTS distro) seem to be incompatible with Resin base images for on Raspberry Pi 3.

From ROS Kinetic Ubuntu ARM install instructions,

Ubuntu packages are built for the following distros and architectures.

Distro----amd64-----i386-----armhf 
Wily-------X---------X-----------
Xenial-----X---------X---------X-

And from ROS Kinetic Debian install instructions

Debian packages are built for the following distros and architectures.

Distro----amd64-----i386-----armhf-----arm64
Jessie-----X-----------------------------X--

So far, we’ve only been able to reliably install all our packages and dependencies on images running armv7/armhf-ubuntu:16.04 (Ubuntu Xenial), so we’ve stitched in elements from the Resin base images (systemd, udev etc.). We’d like to move over to a resin base image, but it looks like we’d need a Resin Xenial base or a Resin base layered with a source ROS base (the latter could be found from the Open Robotics dockerhub).

If we use FROM resin/aarch64-debian:jessie, we get the following error message:

[Error] Error: Image architecture does not match target application architecture.
[Error] Expected: armv7hf
[Error] Got: aarch64
[Error] Check that the docker base image you are using is compatible with the application.

So, when targeting the armhf architecture, it looks like we’re limited to Ubuntu Xenial, unless we want to maintain a source build. This is more of a problem with ROS’s binary support, but I’m wondering what we can do to resolve this.

Their website does have a set of installation instructions, listed as experimental, for Yocto http://wiki.ros.org/hydro/Installation/OpenEmbedded
I mention this because this seems like a reasonable jumping off point for creating something from.

Out of curiosity, have you tried using the Ubuntu ROS packages on a Debian base? I was able to do this with ROS Kinetic some time ago and put my project up on Github. The Dockerfile shows how I added the Ubuntu repos and pulled in the ROS packages from there.

I didn’t run into any compatibility issues with this so it might be worth a try. Otherwise, I think your only real option is going to be to perform a full ROS build from source, unfortunately. (Though at least there you could get away with doing that once and using cached layers from then on, so the build would only be slow the first time.)

We had tried that as well, but got into package dependency hell.

Here’s an example failing step:

[Build]    Step 10/26 : RUN echo "deb http://packages.ros.org/ros/ubuntu xenial main" > /etc/apt/sources.list.d/ros-latest.list &&     ( apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116       || apt-key adv --keyserver hkp://pgp.mit.edu:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116       || apt-key adv --key
server hkp://keyserver.ubuntu.com:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116 ) &&     apt-get update &&     apt-get -y install $(cat ros-packages.txt) &&     apt-get clean &&     rm -rf /var/lib/apt/lists/* &&     rosdep init &&     rosdep update
[Build]     ---> Running in e2f63cf2f671
[Build]    Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.zW3GlWTDtD --no-auto-check-trustdb --trust-model always --keyring /etc/apt/trusted.gpg --primary-keyring /etc/apt/trusted.gpg --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 421C365BD9FF1F717815A3895523BAEEB01FA116
[Build]    gpg: requesting key B01FA116 from hkp server ha.pool.sks-keyservers.net
[Build]    gpg: key B01FA116: public key "ROS Builder <rosbuild@ros.org>" imported
[Build]    gpg: Total number processed: 1
[Build]    gpg:               imported: 1
[Build]    Get:1 http://archive.raspbian.org jessie InRelease [14.9 kB]
[Build]    Get:2 http://archive.raspberrypi.org jessie InRelease [22.9 kB]
[Build]    Get:3 http://packages.ros.org xenial InRelease [4037 B]
[Build]    Get:4 http://archive.raspberrypi.org jessie/main armhf Packages [171 kB]
[Build]    Get:5 http://archive.raspbian.org jessie/main armhf Packages [13.3 MB]
[Build]    Get:6 http://packages.ros.org xenial/main armhf Packages [510 kB]
[Build]    Get:7 http://archive.raspbian.org jessie/contrib armhf Packages [49.5 kB]
[Build]    Get:8 http://archive.raspbian.org jessie/non-free armhf Packages [101 kB]
[Build]    Get:9 http://archive.raspbian.org jessie/rpi armhf Packages [1297 B]
[Build]    Get:10 http://archive.raspbian.org jessie/firmware armhf Packages [1202 B]
[Build]    Fetched 14.2 MB in 9s (1472 kB/s)
[Build]    Reading package lists...
[Build]    Reading package lists...
[Build]    Building dependency tree...
[Build]    Some packages could not be installed. This may mean that you have
[Build]    requested an impossible situation or if you are using the unstable
[Build]    distribution that some required packages have not yet been created
[Build]    or been moved out of Incoming.
[Build]    The following information may help to resolve the situation:
[Build]    The following packages have unmet dependencies:
[Build]     ros-kinetic-hector-trajectory-server : Depends: libboost-system1.58.0 but it is not installable
[Build]                                            Depends: libstdc++6 (>= 5.2) but 4.9.2-10+deb8u1 is to be installed
[Build]                                            Depends: ros-kinetic-hector-map-tools but it is not going to be installed
[Build]                                            Depends: ros-kinetic-hector-nav-msgs but it is not going to be installed
[Build]                                            Depends: ros-kinetic-nav-msgs but it is not going to be installed
[Build]                                            Depends: ros-kinetic-roscpp but it is not going to be installed
[Build]                                            Depends: ros-kinetic-tf but it is not going to be installed
[Build]     ros-kinetic-joy : Depends: libboost-system1.58.0 but it is not installable
[Build]                       Depends: libstdc++6 (>= 5.2) but 4.9.2-10+deb8u1 is to be installed
[Build]                       Depends: ros-kinetic-diagnostic-updater but it is not going to be installed
[Build]                       Depends: ros-kinetic-roscpp but it is not going to be installed
[Build]                       Depends: ros-kinetic-sensor-msgs but it is not going to be installed
[Build]     ros-kinetic-navigation : Depends: ros-kinetic-amcl but it is not going to be installed
[Build]                              Depends: ros-kinetic-base-local-planner but it is not going to be installed
[Build]                              Depends: ros-kinetic-carrot-planner but it is not going to be installed
[Build]                              Depends: ros-kinetic-clear-costmap-recovery but it is not going to be installed
[Build]                              Depends: ros-kinetic-costmap-2d but it is not going to be installed
[Build]                              Depends: ros-kinetic-dwa-local-planner but it is not going to be installed
[Build]                              Depends: ros-kinetic-fake-localization but it is not going to be installed
[Build]                              Depends: ros-kinetic-global-planner but it is not going to be installed
[Build]                              Depends: ros-kinetic-map-server but it is not going to be installed
[Build]                              Depends: ros-kinetic-move-base but it is not going to be installed
[Build]                              Depends: ros-kinetic-move-base-msgs but it is not going to be installed
[Build]                              Depends: ros-kinetic-move-slow-and-clear but it is not going to be installed
[Build]                              Depends: ros-kinetic-nav-core but it is not going to be installed
[Build]                              Depends: ros-kinetic-navfn but it is not going to be installed
[Build]                              Depends: ros-kinetic-robot-pose-ekf but it is not going to be installed
[Build]                              Depends: ros-kinetic-rotate-recovery but it is not going to be installed
[Build]                              Depends: ros-kinetic-voxel-grid but it is not going to be installed
[Build]     ros-kinetic-robot : Depends: ros-kinetic-control-msgs but it is not going to be installed
[Build]                         Depends: ros-kinetic-diagnostics but it is not going to be installed
[Build]                         Depends: ros-kinetic-executive-smach but it is not going to be installed
[Build]                         Depends: ros-kinetic-filters but it is not going to be installed
[Build]                         Depends: ros-kinetic-geometry but it is not going to be installed
[Build]                         Depends: ros-kinetic-robot-model but it is not going to be installed
[Build]                         Depends: ros-kinetic-robot-state-publisher but it is not going to be installed
[Build]                         Depends: ros-kinetic-ros-base but it is not going to be installed
[Build]                         Depends: ros-kinetic-xacro but it is not going to be installed
[Build]     ros-kinetic-robot-localization : Depends: libboost-system1.58.0 but it is not installable
[Build]                                      Depends: libstdc++6 (>= 5.2) but 4.9.2-10+deb8u1 is to be installed
[Build]                                      Depends: libyaml-cpp0.5v5 but it is not installable
[Build]                                      Depends: ros-kinetic-diagnostic-msgs but it is not going to be installed
[Build]                                      Depends: ros-kinetic-diagnostic-updater but it is not going to be installed
[Build]                                      Depends: ros-kinetic-eigen-conversions but it is not going to be installed
[Build]                                      Depends: ros-kinetic-geographic-msgs but it is not going to be installed
[Build]                                      Depends: ros-kinetic-geometry-msgs but it is not going to be installed
[Build]                                      Depends: ros-kinetic-message-filters but it is not going to be installed
[Build]                                      Depends: ros-kinetic-message-runtime but it is not going to be installed
[Build]                                      Depends: ros-kinetic-nav-msgs but it is not going to be installed
[Build]                                      Depends: ros-kinetic-roscpp but it is not going to be installed
[Build]                                      Depends: ros-kinetic-sensor-msgs but it is not going to be installed
[Build]                                      Depends: ros-kinetic-std-msgs but it is not going to be installed
[Build]                                      Depends: ros-kinetic-std-srvs but it is not going to be installed
[Build]                                      Depends: ros-kinetic-tf2 but it is not going to be installed
[Build]                                      Depends: ros-kinetic-tf2-geometry-msgs but it is not going to be installed
[Build]                                      Depends: ros-kinetic-tf2-ros but it is not going to be installed
[Build]                                      Depends: ros-kinetic-xmlrpcpp but it is not going to be installed
[Build]     ros-kinetic-sparse-bundle-adjustment : Depends: libcholmod3.0.6 but it is not installable
[Build]                                            Depends: libcxsparse3.1.4 but it is not installable
[Build]                                            Depends: libstdc++6 (>= 5.2) but 4.9.2-10+deb8u1 is to be installed
[Build]    E: Unable to correct problems, you have held broken packages.

Where our ros-packages.txt contains only the following:

ros-kinetic-hector-trajectory-server
ros-kinetic-joy
ros-kinetic-navigation
ros-kinetic-robot
ros-kinetic-robot-localization
ros-kinetic-roslint
ros-kinetic-sparse-bundle-adjustment

Ah, I think I see the difference – I ended up pulling in just the various rosinstall tools and doing the build from source from there using rosinstall_generator. So effectively, I’m grabbing just the bootstrapping packages and then doing a build from there. It took about 1 hour 10 minutes to build, but as I said from there subsequent builds are much faster due to caching.

I’d definitely give that a try – you can likely grab the beginning of my Dockerfile and use that verbatim as I’m also using Debian Jessie and ROS Kinetic.

That’s a good point - I was thinking it’d be a pain to maintain a source install of ROS, but I guess we’d only need a source install of any additional packages that aren’t already available by the OSRF build farm. We could also see if we could get these missing packages maintained on the build farm.

Thanks, @mccollam! :slightly_smiling_face:

Did this work? Did you have to tweak the dockerfile?

Nothing to report yet - still on our backlog, but we’ll provide an update once we have a confirmation!