Skip to content

ROS on BeagleBuntu

March 18, 2013

This isn’t strictly a sysadmin post but I needed a place to put it until it could be thoroughly tested and posted on the ROS site. This post is about how to get ROS Groovy running on a BeagleBoard-xM. I am a member of a local robotics club and am attempting to use the BeagleBoard-xM as our sole piece of on-board computing power for a self-navigating robot we intend to enter into a competition. If you live in central Illinois and are interested in robotics, you might want to check out http://www.circpeoria.org/. Now, on to the instructions.

In order to carry out these instructions, you must have access to a PC with a Linux distribution installed on the hard drive (not using VirtualBox or any other virtualization software) or use a live CD of any distro. This PC must have either a built-in SD card reader or an attached USB SD card reader. Once logged into your linux partition, do the following (lines beginning with $ are commands for the terminal/command line):

EDIT 5/8/2013: User MisterWanderer on Reddit pointed out to me that binaries are now available for armhf for ROS on Ubuntu. This means that building ROS from source is not completely necessary anymore. The tutorial below should still work just fine but will take significantly longer than using pre-built binaries. The instructions for installing the pre-built binaries can be found at http://www.ros.org/wiki/groovy/Installation/UbuntuARM. The disadvantage is that the default “desktop” package group does not compile at this time (“robot” is unknown – “base” should work) which means you’ll have to add packages one-by-one. Also, these only work on 11.10 or 12.04 (not 12.10 used below) and the instructions are pretty incomplete. I make no guarantees to the accuracy of these instructions.

Download and Burn SD Card Image

(see http://elinux.org/BeagleBoardUbuntu for more details)

$ sudo apt-get install xz-utils

This is if you are using Ubuntu/Debian. If not, use your package manager to install xz-utils. The following line downloads the most recent Ubuntu 12.10 image for the BeagleBoard-xM at the time of writing this tutorial. Check the link above for a more up-to-date image (in the “Demo Image” section).

$ wget http://rcn-ee.net/deb/rootfs/quantal/ubuntu-12.10-console-armhf-2013-02-16.tar.xz
$ md5sum ubuntu-12.10-console-armhf-2013-02-16.tar.xz

This should be d452c17a9caff3db56d4d03083552f83.

$ tar xJf ubuntu-12.10-console-armhf-2013-02-16.tar.xz
$ cd ubuntu-12.10-console-armhf-2013-02-16
$ sudo ./setup_sdcard.sh --probe-mmc

Here you are looking for /dev/mmc(something). This will be your SD card. Replace the /mmc(something) in the line below with the device name of your SD card.

$ sudo ./setup_sdcard.sh --mmc /dev/mmc(something) --uboot beagle_xm

In a few minutes, this will have the Ubuntu image burned and set up on your SD card for booting in the BeagleBoard-xM. After it finishes, make sure it isn’t mounted ($ mount).

Booting, Logging In, and Installing the Basics

Log in with the username ubuntu and password temppwd. You will likely want to change this with the $ passwd command. After that:

$ sudo apt-get update
$ sudo apt-get dist-upgrade
$ sudo apt-get install vim

I hate using the crippled vi instead of vim and it has problems with the arrow keys on many keyboard layouts so we install vim as well as updating the system. This assumes that you have a wired Ethernet cable attached to your xM and that your network uses DHCP. If it does not, you can perform the following steps first. Either way, you should do the next steps to make sure you can reliably connect to your xM remotely.

Setting a Static IP Address

$ sudo cp /etc/network/interfaces /etc/network/interfaces.bak
$ sudo vim /etc/network/interfaces

For those of you who don’t know anything about vim (don’t worry, most non-Linux users don’t), here are the bare basics: i enters insert mode; Esc exits it; : (colon) lets you enter commands; :q quits without saving; :x saves and exits. There is a lot more to vim but this is all that is required for this tutorial.

Once in the interfaces file, find the line iface eth0 inet dhcp and put a # in front of it on the same line. Just below it, add the following:

iface eth0 inet static
address xxx.xxx.xxx.xxx
netmask xxx.xxx.xxx.xxx
network xxx.xxx.xxx.xxx
broadcast xxx.xxx.xxx.xxx
gateway xxx.xxx.xxx.xxx
dns-nameservers xxx.xxx.xxx.xxx

address is the static IP address of the xM. netmask is the bit-mask of your local network (in most cases, 255.255.255.0 for home networks). network is essentially the lowest possible address on your network (in most cases, your static IP but with a 0 as the last number). broadcast is essentially the highest possible address on your network (in most cases, your static IP but with a 255 as the last number). gateway is your router’s IP address. dns-nameservers is a space-separated list of your DNS servers. For home networks, this is usually also your router’s IP address but can also be the IP address(es) of a server(s) given to you by your ISP. Once you’ve added all of this, save and close the file (Esc then :x).

$ sudo service networking restart

This will restart your networking service and switch to the static IP. This may not work 100% of the time so you may have to $ sudo shutdown -r now (restart) for it to take effect. You can check your current IP configuration with $ ifconfig. You can optionally connect with SSH at this time (which I recommend doing – and with KiTTY).

Install Desktop Environment

Although this step is optional and will take a little while, I recommend doing it anyway. Since we are using LXDE in a minimal configuration, the overhead will also be fairly minimal. Also, the rest of the tutorial is untested without it.

$ /bin/bash /boot/uboot/tools/ubuntu/minimal_lxde_desktop.sh

This will take about 30 minutes to complete so go get some coffee. After it’s complete:

$ sudo shutdown -r now

(Optional) Set Up Your VIM Environment with Sachet

This section is completely optional and is just my preference to make vim a lot nicer to look at and easier to work with. This section assumes you are working from a remote computer with SSH but if you are not it won’t be hard to modify.

Go to http://yoursachet.com/. Select the options you want for your VIM environment. Download the file. Copy the file to your xM’s /home/ubuntu directory using something like FileZilla in SFTP mode. Once it’s been copied, switch back to your xM and do:

$ cd ~
$ unzip sachet.zip

*SEE NOTE AT BOTTOM IF UNZIP COMMAND CAUSES ERROR
$ rm sachet.zip INSTRUCTIONS.txt
$ mv vimrc .vimrc
$ mv vim .vim
$ logout

Log back in.

Install Pre-reqs for and Download ROS Catkin Packages

Now to the meat and potatoes.

$ sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu quantal main" > /etc/apt/sources.list.d/ros-latest.list'
$ wget http://packages.ros.org/ros.key -O - | sudo apt-key add -
$ sudo apt-get update
$ sudo apt-get install python-rosdep python-wstool build-essential cmake
$ sudo rosdep init
$ rosdep update
$ mkdir ~/ros_catkin_ws
$ cd ~/ros_catkin_ws
$ wstool init src -j1 http://packages.ros.org/web/rosinstall/generate/raw/groovy/robot

Unfortunately, the “desktop” distribution cannot be installed at this time due to some missing dependencies on ARM. However, the “robot” distribution contains nearly everything you should need on a device like this. If you need packages that aren’t included in “robot”, you may want to try to install them separately but this will be covered in another tutorial.

Fix Missing Dependencies For Collada Packages

At the time of writing this tutorial, the collada- packages included in the Groovy distribution are missing some required files. To fix this, we need to download and build some of the Collada packages from source.

$ sudo apt-get install libxml2-dev checkinstall libpthread-stubs0-dev libgl1-mesa-dev libx11-dev libxrandr-dev libfreetype6-dev libglew1.5-dev libjpeg8-dev libsndfile1-dev libopenal-dev
$ mkdir ~/src
$ cd ~/src
$ wget http://sourceforge.net/projects/collada-dom/files/latest/download
$ tar xvf download
$ rm download
$ cd collada*
$ mkdir build
$ cd build
$ cmake ..
$ make -j1
$ sudo checkinstall --pkgname=collada-dom-dev --provides=collada-dom-dev --pkgversion=2.4.0

The checkinstall application will ask if you want to exclude the files generated by the installer from the package. Choose yes. Otherwise, leave everything at their default settings.

The commands below will download and build the latest version of the assimp project as of the time of writing. Check their SorceForge project page to verify that it is the latest version. If not, go into the folder of the latest version, grab the URL to the “source-only” zip file and replace it in the wget command below.

$ cd ~/src
$ wget http://sourceforge.net/projects/assimp/files/assimp-3.0/assimp--3.0.1270-source-only.zip/download
$ unzip download

*SEE NOTE AT BOTTOM IF UNZIP COMMAND CAUSES ERROR
$ rm download
$ cd assimp*
$ mkdir build
$ cd build
$ cmake ..
$ make -j1
$ sudo make install

It is also necessary to edit a file to fix a build dependency in one of the packages. to do this:

$ cd ~/ros_catkin_ws/src/collada_urdf
$ vim CMakeLists.txt

Find the line with the text set(IS_ASSIMP3 0) (on line 36 at time of writing) and replace it with set(IS_ASSIMP3 1). Add a new line directly below this line and insert add_definitions(-DIS_ASSIMP3).

Install Remaining ROS Catkin Dependencies

The second command below will take a very long time (at least an hour) on the xM. Unfortunately, you can’t leave it unattended because it performs several commands using the sudo command which will ask for your password periodically. Make sure to check on it from time to time.

$ cd ~/ros_catkin_ws
$ rosdep install --from-paths src --ignore-src --rosdistro groovy -y

Build ROS Catkin Packages

The following command will also take an incredibly long time. Exactly how long I’m unsure because I left it unattended but I know it was several hours. You may want to do this directly on the BeagleBoard-xM as opposed to through SSH in case your PC goes to sleep. Also, make sure to disable the screensaver in LXDE as it takes additional resources. Assuming you are still in ~/ros_catkin_ws:

$ ./src/catkin/bin/catkin_make_isolated --install

Setup ROS Catkin Environment

$ source ~/ros_catkin_ws/install_isolated/setup.bash

Create Rosbuild Workspace; Download and Build Rosbuild Stacks

As of the ROS Groovy distribution, the package build system has been partially converted from rosbuild to catkin. Because this partial conversion, we still have to download and build the packages which have not yet been converted as well.

$ mkdir ~/ros_ws
$ cd ~/ros_ws
$ rosws init . ~/ros_catkin_ws/install_isolated
$ rosws merge http://packages.ros.org/web/rosinstall/generate/dry/raw/groovy/robot
$ rosws update -j8
$ source ~/ros_ws/setup.bash
$ rosmake -a

Setup ROS Rosbuild Environment

$ vim ~/ros_ws/my_ros_init.sh

To this new file, add: export ROS_PACKAGE_PATH=~/ros_ws:$ROS_PACKAGE_PATH. Save and exit.

$ vim ~/.bashrc

At the bottom of this file, add:

$ source ~/ros_ws/setup.bash
$ source ~/ros_ws/my_ros_init.sh

Save and exit. To apply these new settings, log out ($ logout) and log back in.

If everything worked, you should now have a working installation of ROS. You can test this by running $ roscore. If it starts up, congratulations! If not, hit the Google or leave a comment below. Also, if you run into a problem and find a solution, leave it in the comments below as well so I can make revisions. THANKS!

Edit 5/8/2012: Modified call to wstool to use -j1 instead of -j8 (only run 1 job concurrently since the BeagleBoard-xM only has 1 core). Thanks to crunchytheory on Reddit for the suggestion!

Note about unzip: User Timothy Jump reported that unzip was not installed by default on his system causing the error “command not found” when trying to run any command starting with unzip. If you encounter this error, make sure you’ve run $ sudo apt-get update at some point on your BeagleBoard-xM and then run:

$ sudo apt-get install unzip

If this returns an error stating that the unzip package cannot be found, you may need to add the universe and multiverse repositories. To do this:

$ sudo vim /etc/apt/sources.list

Hit “i” to enter insert mode. Remove the “#” in front of all of the lines ending in “universe” and “multiverse”. Hit Esc to exit insert mode. Hit :x (enter) to save and exit. Try the update and install commands again.

Advertisements

From → Uncategorized

28 Comments
  1. I’m up to the assimp download, but when I do unzip download I get: -bash: unzip: command not found. What do I need to do?

    • That just means that unzip is not installed on your system. To install it, do:

      $ sudo apt-get install unzip

  2. I see $ sudo apt-get install xz-utils, but this seems to be for the Ubuntu PC and not the Beagle. After install of Ubuntu on the Beagle I’ve been moving the SD to the Beagle and booting from the Beagle (per Robert Nelson’s site) and this leaves the Beagle with no unzip util. Should a line be added to the script above to include installing unzip on the Beagle?

    FYI, I think this will make a great ROS wiki entry as it is difficult to find a good install instuction for ROS on the Beagle!!

    • Timothy – You may just need to $ sudo apt-get update before attempting to install if you haven’t already done so. This is required before installing any packages to update your local cache of all available packages. If this doesn’t solve the problem, make sure you have the Universe and Multiverse repositories enabled (uncommented) in your /etc/apt/sources.list file. If they aren’t, uncomment them and then:

      $ sudo apt-get update
      $ sudo apt-get install unzip

      Also, when you apt-get install anything on the Ubuntu version that is on your SD card (provided you downloaded the one in the instructions above), it is a version that has been compiled specifically for the type of processor that’s in the BeagleBoard.

  3. Hi Maximus – No problem with updating, et. al. I’ve had great success with the Ubuntu build on the SD card and updating/installing on the SD Card once it is on the Beagle. The only issue I had was not having an unzip utility. I’;m guessing that for the Ubuntu/Beagle release the update requests do not automatically add this, thus the reason I had to add it manually. I’ll run through another fresh install and see if the unzip does come over with update and report back. If it does not come over with the update then the instruction to sudo apt-get install unzip may be a good add to the instructions above. Cheers.

  4. Hi Maximus – to clarify, are you doing most of the install to the SD card on your Ubuntu PC through SSH? After installing Ubuntu I moved the SD card over to the Beagle so starting with the section, “Booting, Logging In, and Installing the Basics” I’m doing everything on the Beagle. This may explain why unzip did not work (and why installing unzip is not specified in the instructions).

    • I did everything exactly as you are. I moved the SD card from PC to BeagleBoard before the “Booting, Loggin in, and Installing the Basics” step. Just before the “Install Desktop Environment” step, I switched to using SSH. I may have simply installed unzip out of instinct using $ sudo apt-get install unzip without thinking about it (and, consequently, didn’t put it in the instructions) but I know that package is available for armhf. Again, check your repositories.

  5. Thanks for the clarification. As an FYI, I think this post is a critical tool for those wanting to get ROS on their Beagle, and many of us are not natural Linux/ROS users so we don’t have the built in instincts. This is why I’m going word by word exact on your instructions so if something leaves the “lost like me” with something that does not work I’m trying to flag it in case an edit is warranted. I hope this is a valuable service to you and the Beagle/ROS community. -Cheers

    • Certainly. I appreciate your help in clarifying items that may be missing. I intended this to be as detailed as possible for those who don’t have that background Linux knowledge but wanted to dive in. I’ll go ahead and throw in the missing commands to install unzip. Thanks for the feedback!

  6. Hi Maximus – About the -j1 vs. -j8: on some of the references on other pages about getting ROS on the Beagle they suggest adding SWAP space to the SD card so -j8 will function. I added 512MB to my SD card and all processed fine with -j8. Did adding the SWAP space actually allow for -j8 to work or is this just coincidental?

  7. So adding SWAP space may not be of any value?

    • It is for memory-intensive processes. I probably should have before building the ROS core which is one reason why it took mine so long. Good thing to have. FYI – you can email me at maximus5684@gmail.com if you have further questions that might require discussion to keep the comments on this thread on-topic.

  8. Okay, I will keep adding SWAP space. To do this (I got this from Robert Neslon/(http://elinux.org/BeagleBoardUbuntu)

    $ sudo ./setup_sdcard.sh –mmc /dev/mmc(something) –uboot (your Beagle type) –swap_file 512

    On the (your Beagle type) since I’m using a bone I use –uboot bone. For the BeagleBoard xM you use –uboot beagle_xm. The black BeagleBone is –uboot bone_dtb.

  9. Hi Maximus – a couple of updates. From the elinux site there is a newer version of the Quantal download:

    Get prebuilt image:

    wget http://rcn-ee.net/deb/rootfs/quantal/ubuntu-12.10-console-armhf-2013-04-26.tar.xz

    Verify image with:

    md5sum ubuntu-12.10-console-armhf-2013-04-26.tar.xz
    b7cd2f94c0dbc75f8d6897e559d52c0a ubuntu-12.10-console-armhf-2013-04-26.tar.xz

    Unpack image:

    tar xJf ubuntu-12.10-console-armhf-2013-04-26.tar.xz
    cd ubuntu-12.10-console-armhf-2013-04-26

    And the ROS install works with the new image.

  10. Hi Maximus – A few questions for my own understanding:

    1) If I’m only expecting to use a terminal (Gnome) with the Beagle do I need to set up the Desktop and VIM environments?

    2) I have not tried this yet and it may influence question 1, but if I need to connect to the Beagle wirelessly or over the Ethernet can I still do so with a Gnome terminal or will I need the Destop environment?

    Thanks, Tim

    • Just to clarify the questions above: I realize these are both optional, but do either effect a terminal display?

  11. Excellent and very complete tutorial! I’ve just installed ROS in my Beaglebone Black! Thanks!

    • Awesome! I’m glad to hear that it works on the Black as well! I’ll be working on one using the binaries (which are just experimental at this point) which should take significantly less time.

  12. hi. during this process, in the collada build sequence. i get a cmake error, no boost libraries found. how can i move forward?

    • I won’t be in front of a PC until Monday but you should be able to sudo apt-get install libboost-all-dev to install the missing libraries.

  13. ur a genius. i got thru that step. but during the checkinstall command, the installation fails. this is after the build completes.
    the instalation fails, and the overwritten files are restored from backup.
    is it absolutely neccesary to get the collada package from check install?

    • FYI, i think i got two errors at the end of make.

      external-libs/pcre-8.02/libpcre_local.a: could not read symbols: Bad value
      collect2: error: ld returned 1 exit status
      make[2]: *** [dom/libcollada-dom2.4-dp.so.2.4.0] Error 1
      make[1]: *** [dom/CMakeFiles/collada-dom.dir/all] Error 2
      make: *** [all] Error 2

      and i believe this is the same thing that pops up during the checkinstall function

  14. my progress has now halted completely on ‘BUILD THE ROS CATKIN PACKAGES’.

    after starting the build, about 20 mins into the process,

    CMake Error at CMakeLists.txt:12 (message):
    Couldn’t find log4cxx library

    — Configuring incomplete, errors occurred!
    cd /home/ubuntu/ros_catkin_ws/build_isolated && /home/ubuntu/ros_catkin_ws/install_isolated/env.sh cmake /home/ubuntu/ros_catkin_ws/src/rosconsole -DCATKIN_DEVEL_PREFIX=/home/ubuntu/ros_catkin_ws/devel_isolated/rosconsole -DCMAKE_INSTALL_PREFIX=/home/ubuntu/ros_catkin_ws/install_isolated

    Command failed, exiting.

    i am a total newbie to beagleboard. with little experience in ROS on ubuntu PC. Can u please help me out.

  15. petermilani permalink

    Hi Maximus

    The collada-dom-dev still cannot be located or the rosdep still tries to install using apt-get. I’ve followed through your list and successfully built and installed collada-dom-dev from source. Why would it still not recognise the installed version?

    Heres the error:

    executing command [sudo apt-get install -y collada-dom-dev]
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    E: Unable to locate package collada-dom-dev
    ERROR: the following rosdeps failed to install
    apt: command [sudo apt-get install -y collada-dom-dev] failed

    • Double-check that, when building collada-dom-dev, you correctly spelled the flags “–pkgname=collada-dom-dev –provides=collada-dom-dev” on checkinstall. These are what define the package contents and what dependencies the package provides when the package is installed to the system. Running the provided checkinstall command (without any errors) should fulfill the required dependency. Let me know once you’ve double-checked (or re-run) this command in the directory where you built the package and re-tried rosdep.

Trackbacks & Pingbacks

  1. Queensland Field Robotics » Installing ROS Hydro on Beagle Bone from source
  2. Installing ROS Hydro on Beagle Bone from source | Queensland Field Robotics

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: