Virtualizing ROS

UPDATE: ROS Fuerte was released on April 2012. You might want use a more recent version of ROS:


If you want to use the Robot Operating System (ROS), the first step is to install it on some PC. Ideally, it should be an Ubuntu box. In a previous post, we explained the installation procedure step by step in an attempt to make easy this tedious task. In this post, we provide you with an even simpler solution! Yes, we made all the setup for you, in a VirtualBox virtual machine that you can Download (~2.4GB), duplicate and use freely for your experiments. Please note that we provide this file with no warranty. We will though try our best to answer questions and fix reported issues.

We assume that you have VirtualBox installed on your laptop as well as the VirtualBox Extension Pack. The archive we provide is actually an OVA (Open Virtualization Archive) which is an open standard format for packaging virtual machines. We will show step by step how to use it with Mac OS X as a host operating system. The setup should be similar with other operating systems if you use the same version of VirtualBox as we do, which is 4.1.20.

Step 1: Launch the import process by selecting the “Import Appliance…” menu (see Picture 1). Note that this requires an extra 6.3 GB approximatively on you disk.

Picture 1: Launch the import process

Step 2: Adjust the settings of the new virtual machine (see Picture 2). The default name is ROS. Since we want to be able to  run our tutorial on networking with ROS, we will rename this virtual machine to C3PO. You may want to also adjust other properties such as the amount of memory allocated to the virtual machine or the number of CPU cores it will be using.

Picture 2: Adjust the virtual machine settings

 Step 3: You need to agree with the licenses (see Picture 3). Those are free sotware licenses of Ubuntu and ROS. Once you have pressed the Agree button, it takes a few minutes to get the virtual machine ready.

Picture 3: Accept the licence agreement

Step 4: Launch the virtual machine by pressing the Start button of the VirtualBox Manager as shown by Picture 4. The virtual machine automatically opens the default user account which login and password are both viki (a reference to the V.I.K.I character from the I, Robot movie).

Picture 4: Start the C3PO virtual machine

Step 5: Rename the host name from ROS to c3po by editing the /etc/hostname file. To do so, evaluate the following command line in a terminal.

sudo gedit /etc/hostname

You’ll get prompted to povide the password for the viki account which is also viki. Then, an editor will open. Change the content of the file to c3po before saving (see Picture 5).

Picture 5: Edit the /etc/hostname file

Step 6: Map the IP address to the c3po host name by editing the /etc/hosts file. This can be done by evaluating the following command line in a terminal.

sudo gedit /etc/hosts

It will open an editor on the /etc/hosts file. Replace ROS by c3po and save the file (see Picture 6). So far, we just set the loopback address (127.0.0.1) to map to c3po. You can map it to other IP addresses as explained in our ROS networking tutorial.

Picture 6: Edit the /etc/hosts file

Step 7: Reboot Ubuntu, et voilà! You are ready to use ROS or run some ROS tutorial.

Regarding networking, there is a caveat. We set the virtual machine with a network bridged adapter connected to the Ethernet interface. If your hosting machine is connected to the network through internet via Ethernet, that’s fine. If you are using Wifi, you need to change the network setting (after having switched-off the virtual machine). However, on Mac OS X, the bridged adapter does not work with Airport for VirtualBox 4.1.2. Different solutions are possible:

  • Keep the virtual machine original settings (use of bridged adapter connected to the ethernet interface), and share the internet connection through ethernet under Mac OS X.
  • Attach the virtual machine adapter to “Internal Network”. With this setting, the virtual machine won’t be visible outside your computer, but it can interact with other virtual machines running on the same host.

There is an nice post about virtual machine network setup with VirtualBox. It provides clear explanations and drawings. We recommand you to read it if you wish to learn more about VirtualBox network options.

35 Comments

  • Hi there,

    Could you please tell me what is the password for root authority of the virtual machine.

    Many thanks,
    Ricky

    Reply
  • I could not run Kinect with Primisense Openni from the virtual box and ubuntu with ros. I installed virtual box and ROS.ova. And it run good. Later, I updated and upgrade ubuntu system and I downloaded the openni driver and I installed openni-camera and openni-launch in the fuerte version but the device from usb is not detected.

    Reply
  • Hello!
    Could you tell me how to start the ROS, or any GUI?
    I need to configure it to use here in the institution where I work.

    Thankful.

    Reply
  • sudo passwd root
    type viki for the first password
    then type in whatever you want for the root password the next 2 time

    Reply
  • Hi, thank you very much for your image!
    Just wanted to say that it runs fine in Parallels too.
    Just use ovftool (availiable to download from vmware, needs registration but it’s free) to convert .ova to .vmx, then import from Parallels and you’re done!

    Reply
  • Hi,
    Just to say that I imported the image in VMWare Fusion 5.0.2 and it works fine.

    Reply
  • Dear,

    I just installed this VirtualBox ROS and the firefox runs fine. Now I would like to install turtlebot simulator but I got stuck at the first step. I cannot see any Software Center or Software Sources that allows me to set “universe”, “multiverse” etc. Also, it seems turtlebot is for electric version only, or not? Thank you very much for your help.

    David

    Reply
    • The turtlebot simulator is supposed to work for ROS Fuerte. Try evaluating in a terminal:
      sudo apt-get update

      and then
      sudo apt-get install ros-fuerte-turtlebot-robot

      You should not have any trouble with repositories. But, to answer your question there are different kinds of Ubunutu repositories (main, restricted, universe, and multiverse) depending on the licence (free software or not) and whether it is officially supported by Ubuntu or not. You’ll find out more inthe Ubuntu help .

      Reply
      • Dear NooTriX,

        Thank you very much indeed for your help. I have successfully installed turtlebot simulator. The command should read

        sudo apt-get install ros-fuerte-turtlebot-simulator

        that is, without ssh and replace robot by simulator. Thank you very much again.

        David

        Reply
  • Are there plans to update the ROS version in the downloadable virtual machine from the April 2012 “Fuerte” version, to the new Dec 2012 “Groovy Galapagos” version?

    Reply
  • Hi, NooTriX:

    I downloaded the virtual box 4.2.6 and the corresponding expansion pack and your ROS.ova file. I did all the things according to your instructions but I got stuck at the 2nd step.

    I got an error when importing the appliance, the error information is:

    Failed to import appliance /Users/Ian/Downloads/ROS.ova.

    Could not create the clone medium ‘/Users/Ian/VirtualBox VMs/C3RO/C3RO-disk1.vmdk’ (VERR_VD_VMDK_INVALID_FORMAT).

    Result Code: VBOX_E_FILE_ERROR (0x80BB0004)
    Component: Appliance
    Interface: IAppliance {3059cf9e-25c7-4f0b-9fa5-3c42e441670b}

    I am using a Mac OS X 10.8.2. Could you give me a hand on this?

    I really appreciate your help.

    Ian

    Reply
  • I installed the VM as directed, and then ran system updates. Now when I try `source /opt/ros/groovy/setup.bash’ I get the following error:

    File “”, line 1
    import os; print(os.pathsep.join([x for x in “/opt/ros/groovy/bin:# reset environment variables by unrolling modifications based on all workspaces in CMAKE_PREFIX_PATH
    ^
    SyntaxError: EOL while scanning string literal
    bash: cat: No such file or directory
    bash: python: No such file or directory

    Anyone else run into this?

    Reply
    • With ROS Galapagos the update breaks something with catkin that eventually empties the PATH environment variable. This can be easily fixed.
      First, comment the line which sources the catkins workspace setup.bash line. Then regenerate the setup.*sh files of ROS.
      Here is the sequence of operations step by step:
      1-Open a new terminal or in an existing one go to your home directory by evaluating:
      cd
      2-Open the .bashrc file using a text editor by evaluating:
      /usr/bin/gedit .bashrc
      3-In the text editor insert a # in the line that causes the bug. It is located at the end of the .bashrc file. The commmented line will become:
      #source ~/catkin_ws/devel/setup.bash
      4-save the .bashrc file
      5-regenerate the ROS setup files by evaluating in the terminal:
      source /opt/ros/groovy/setup.bash
      6-In the editor uncomment the line commented in step 3, by removing the #. It will become:
      source ~/catkin_ws/devel/setup.bash
      7-save the .bashrc file
      8-Open a new terminal or source the .bashrc file in the one already open. ROS should work again.

      Reply
      • Thanks for the reply, unfortunately, the steps you listed don’t seem to work. If I leave out step 6, everything works fine (except for catkin, of course). But as soon as I source the catkin setup.bash file, ROS breaks with the same error.

        It appears that something that the catkin setup.sh file is doing is setting environment variables incorrectly. Before step 6 my PATH variable looks like this:

        viki@c3po:~$ echo $PATH
        /opt/ros/groovy/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

        immediately after step 6 it looks like this:

        viki@c3po:~$ echo $PATH
        # reset environment variables by unrolling modifications based on all workspaces in CMAKE_PREFIX_PATH export CMAKE_PREFIX_PATH=”” export PATH=”/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games” export PKG_CONFIG_PATH=”” export PYTHONPATH=”” # prepend folders of workspaces to environment variables export CMAKE_PREFIX_PATH=”/opt/ros/groovy” export CPATH=”/opt/ros/groovy/include:$CPATH” export LD_LIBRARY_PATH=”/opt/ros/groovy/lib:$LD_LIBRARY_PATH” export PATH=”/opt/ros/groovy/bin:$PATH” export PKG_CONFIG_PATH=”/opt/ros/groovy/lib/pkgconfig” export PYTHONPATH=”/opt/ros/groovy/lib/python2.7/dist-packages”/opt/ros/groovy/bin:/usr/lib/lightdm/lightdm:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

        It’s like some script isn’t properly terminating a string, and it’s dumping the script into the environment variables. Several other environment variables are also affected, like PYTHONPATH and PKG_CONFIG_PATH.

        This seems only to affect Nootrix VM installs… there’s a post on ROS Answers to the same effect: http://answers.ros.org/question/53844/after-update-ubuntu-1204-and-groovy-ros-doesnt-work-more/

        Any ideas? I tried debugging, but my shell scripting skills aren’t up to par for the task :-)

        Reply
  • Turns out there was a very simple fix for the garbage in environment variables issue: I just had to re-initialized the catkin_workspace and did a catkin_make. Everything now works as expected. Thanks!

    Reply
      • To re-initialize catkin_workspace, you need to evaluate the following command lines in a terminal. Beware that this will delete packages you might have built, so make a backup before
        rm -rf ~/catkin_ws
        mkdir -p ~/catkin_ws/src
        cd ~/catkin_ws/src
        catkin_init_workspace
        cd ~/catkin_ws/
        catkin_make

        If you are doing this reinitialization to recover from an update bug, you should do the full sequence of fix steps as described in my other comment on this topic.

        Reply
  • Recently I’ve downloaded Nootrix pre-installed ROS-groovy virtual machine. BTW great job on that.
    The problem is that the password isn’t viki.
    I have a 5 character password, where as viki has only 4.
    I’ve tried doubling all of the letters without any luck. What to do?
    Please help me.
    Thank you in advanced.

    Reply
    • Just checked again and did a fresh rebuild of the virtual machine from .OVA file. The password is four letters: viki
      Try installing rebuilding the virtual machine.

      Reply
  • Is there a 64bit version of the image files? I Installed fuerte but it was 32 bit …

    Thank you in advance,
    Laszlo

    Reply
  • I am getting an error message “failed to open a session for the virtual machine c3po. nonexistent host networking interface, name “name of interface” (VERR_INTERNAL_ERROR)

    Reply
    • Which virtual machine are you using? The one with ROS Fuerte or with ROS Groovy? Which software are you using? VirtualBox?

      Reply
      • I got the same error for virtual box with ROS fuerte on virtual box 4.1.16
        I appreciate your help

        Reply
        • Hi Cati, We’d just tried with a more recent VirtualBox (4.3.10) and indeed Ubuntu fails to establish a network connection. But, this was easily fixed by switching the Network Adapter in VirtualBox settings to attach it to NAT.

          Reply
  • Hi
    I tried to download fuerte from your website, but it stops at 1 GB for two times.
    Is it problem on my side or your side?

    Thank you.

    Reply
  • I found an old package built in Fuerte that I want to run. Do you still have a VM with Fuerte loaded that I can get a copy of?

    Reply

Leave a Reply to roid Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top