Home        Store        Learn        Blog

Installing ROS on BlueROV companion

Hello everyone,

I recently faced the issue of getting ROS to run on our companion computer. We want to make use of some of the pins on the Pi for additional sensors and servos in one of our projects, and communicating with the laptop via the ROS framework seemed like the most straighforward way to do this without interfering with ArduSub or QGC. After lots of trying and googling and troubleshooting, I managed to figure it out. Here is a comprehensive guide for everyone who would like to install ROS on their companion computer :slight_smile:

Introduction

The BlueROV companion software runs on a Raspberry Pi computer with Raspbian Jessie. This means that the only ROS version that can be installed on the companion is ROS1 Kinetic Kame (see here).

A lot of the commands in this guide require root access (sudo). If you get asked about a password, the standard password is companion.

You will need internet access for this, so make sure that the companion is connected to WiFi on the network page.

All of the following instructions will have to be executed in a terminal window on the Raspberry Pi. To connect to the terminal on the Pi, you can either use the terminal that comes with the companion software, or open a new terminal on your computer and use the ssh command:

ssh pi@192.168.2.2

This will prompt you for the password, which is companion.

Step 1: Preparing Raspbian Jessie

Since Raspbian Jessie is quite old, you will have to make a few modifications to the Pi’s update routine. First, you will need to let the system know to use Jessie backports. Create and modify the following file using nano:

sudo nano ~/etc/apt/sources.list.d/jessie-backports.list

In this file, add the following line:

deb [check-valid-until=no] http://archive.debian.org/debian jessie-backports main

Close and save the file by pressing Ctrl+x, then y, then Enter.

Next, you need to bring all existing software on the Pi up to date. When I tried to update my Pi, it asked me for a key, so I did the following:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 8B48AD6246925553`
sudo apt-get -o Acquire::Check-Valid-Until=false update
sudo apt-get upgrade

This might end up installing quite a few new packages, so be prepared for this to take a while.

Step 2: Preparing ROS installation

As always with ROS, you will need to let your system know where to find the ROS packages. You will need to add the URL and a couple of keys, followed by another update command.

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) 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-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
sudo apt-get -o Acquire::Check-Valid-Until=false update

You should now see that the update command is fetching information from more locations than before.

Step 3: Installing/Building ROS

Since Raspbian Jessie is in end-of-life stage, you will have to build the required ROS packages from source on the Pi as described here. This is done with the help of rosdep and catkin_make. Execute the following lines in the terminal one after another:

sudo apt-get install python-rosdep python-rosinstall-generator python-wstool python-rosinstall build-essential
sudo rosdep init
rosdep update
mkdir ~/ros_catkin_ws
cd ~/ros_catkin_ws

Since I only needed the bare-bones installation for my setup, I specified “ros_comm” for the rosinstall_generator. If you need the desktop version of ROS, use “desktop” instead of “ros_comm” in the following commands:

rosinstall_generator ros_comm --rosdistro kinetic --deps --wet-only --tar > kinetic-ros_comm-wet.rosinstall
wstool init -j8 src kinetic-ros_comm-wet.rosinstall
rosdep install --from-paths src --ignore-src --rosdistro kinetic -y

And now to actually building ROS. For me, this contained 52 steps and took about an hour:

./src/catkin/bin/catkin_make_isolated --install -DCMAKE_BUILD_TYPE=Release

Make sure that the process is not interrupted by any means. My laptop went into standby mode halfway through, which messed up the building process. I had to delete the ~/ros_catkin_ws folder and start the build again to fix this. If it always gets stuck on the same package, delete the respective folders from ~/ros_catkin_ws/build_isolated/ and ~/ros_catkin_ws/devel_isolated/ using the rm -r command or the file manager that comes with the companion software, then start the build again. It will skip the packages that were built correctly and only re-attempt those that are not completed yet.

If you notice your Pi stopping during the build (a sign for this is the green LED being constantly on, another is that the terminal is not responding), there might be an issue with the number of CPUs that are being used by the build process. For me, it always got stuck when building the roscpp package. I fixed this by by first deleting the respective folders as described above, and then specifying the -j option to set the number of parallel jobs to 2. (It could work with 3 as well but I did not test that. The default was 4 and that was too much for my Pi. Be aware that using only two jobs will slow the whole process down quite a bit.)

./src/catkin/bin/catkin_make_isolated -j2 --install -DCMAKE_BUILD_TYPE=Release

After everything has built correctly, it is time to test our installation!

Step 4: Running ROS

You can now start ROS in the terminal as usual:

source ~/ros_catkin_ws/install_isolated/setup.bash
roscore

You should now see the familiar lines of a running roscore.

If you want this ROS to talk to another ROS, for example running on your laptop, have a look at ROS_MASTER_URI.

There might be the occasional update to your installed ROS packages. If you want to apply these updates on your companion as well, follow the instructions given here.

Conclusion

Installing ROS on the BlueROV companion is possible, albeit a bit time-consuming. So far, I have not found it to interfere with the normal functionality of the companion software. Good luck!

1 Like

Hi Anne,

This is really cool, thanks for putting the effort into writing these instructions! :smiley:

They’re well written and cover many of the potential pitfalls during the installation process, which will no doubt be useful to anyone trying to follow them :slight_smile:


Given many of the challenges you faced were with Jessie being old and no longer supported, I’m curious how much simpler the steps would be to run on Companion Beta. Perhaps an ROS service integration is a decent idea for one of our initial Extensions

1 Like