Installing VirtualBox, Ubuntu and ROS

Under Construction

Published At 2015-09-18 18:55:55



A Step-by-Step guide on getting started with ROS


By Somesh Daga



Overview

ROS (Robot Operating System) is an open-source software framework which provides an extensive set of tools and utilities to develop and manage complex robotics projects.

This tutorial aims to guide new users in installing ROS on their personal computers.

Step 1: Installing VirtualBox

Currently, ROS installations are fully verified only on the Ubuntu Operating System. This means that Mac and Windows users will have to install the Ubuntu OS alongside their host operating system. This can be done in one of 2 ways:
  • The first and the more popular way is to install Ubuntu through Virtualization software such as VirtualBox or VMWare. These programs allow for the creation of virtual machines running the desired Operation Systems on your computer. During the use of these virtual machines, you will still be able to access your host system through minimizing (just like any other program) these machines.
  • The second way is to do a dual-boot. This means that you can install another operating system alongside the host OS, and you will be prompted to select the one to use upon starting up your computer. This generally tends to offer better performance.

Performance is not an issue with running ROS on virtual machines, so we will cover installing Ubuntu in VirtualBox which is usually the preferred method.

Note: The following steps are performed using a Mac OS. All instructions apply for a Windows host as well, however subtle differences may be encountered.

  1. Go to the VirtualBox Downloads page

    Click here to go to the VirtualBox Downloads page

  2. Choose the download for your platform
  3. Install the program

    Once the download finishes, run the downloaded file (with extension .dmg for mac or .exe for windows) and follow the install prompts to complete installation of Virtualbox

  4. Verify that VirtualBox has been installed

    On a Mac. you can search for the installed application using Finder as shown below (or through the search bar on Windows)

    Start the application

    The left pane of the VirtualBox window shows the virtual machines installed (this will be empty for new installations)

Step 2: Install Ubuntu on a Virtual Machine

Now, we will proceed to add a virtual machine through VirtualBox (as seen in the above figure)

  1. Download an Ubuntu 14.04 disk image

    Click here to go to the Downloads page

    Click 'Download' and follow the prompts to start the download

  2. Create a new virtual machine in VirtualBox

    • Start VirtualBox
    • To create a new Virtual machine, click the 'New' button in the top-left corner
    • Choose a name for your virtual machine. This can be anything you want, but try to keep it easily distinguishable from other machines you might create. Choose 'Linux' for the Type field and 'Ubuntu (64bit)' for the Version.
    • Click Continue
    • For the Memory Size, I generally recommend allocating at least 2GB.

      Note that the allocated memory is only utilized when the Virtual Machine is active, which is otherwise free to be used completely by the host system. So, there is no harm in allocating even a bit more (as long as you don't plan to run performance intensive applications on your host or other virtual machines while simultaneously running this virtual machine).

    Choose the default option for the Hard Disk and click Create. Choose VDI for the Hard Disk File Type and continue.

    On the following page, choose 'Fixed Size' for the Hard Disk file as this generally results in faster operation.

    For the file size, I would recommend allocating around 30GB. Note that this number depends on how much you plan to store on this virtual drive, however, there is a minimum of 6.5GB for Ubuntu to be able to install successfully.

    Click 'Create'. You will now be able to see your new virtual machine in the left pane of the VirtualBox window.

    Select the virtual machine by clicking on it and then click on 'Settings'. Click on the 'Storage' tab in the new window.

    Click on the 'Empty' item under the storage tree and on the disc icon beside the drop-down menu. You will probably not have the ubuntu .iso file option as shown in the following image, so click 'Choose Optical Disk File...' and locate the Ubuntu 14.04 image downloaded in Step 1.

  3. Install Ubuntu on your new Virtual Machine

    Click on your Virtual machine in the left pane and click 'Start'.

    Click on 'Install Ubuntu' when the following screen shows up

    Choose the 'Download updates while installing' option and continue

    Be sure to keep the default option 'Erase disk and install Ubuntu' and click 'Install now'. Click 'Continue' in the pop-up window.

    Set your location

    Make sure that English(US) is selecting in both scroll down menus and click Continue

    Enter the required credentials to setup your account

    The installation process will then commence and click 'Restart Now' in the popup window after the install finishes.

  4. Enable Full Screen mode

    Start your Ubuntu Virtual machine and log in.

    You will notice that your machine does not occupy the full window when it is maximized. To enable full screen mode, we need to do the following: At the top of your screen, go to Devices > Install Guess Additions CD image...

    Click 'Run' in the pop-up window that appears

    Enter your password when prompted and continue. You will then notice the following screen. Press Enter when you see the line 'Press Return to continue'

    You need to restart the virtual machine for full-screen mode to take effect.

    After you restart and log in, you will find that Ubuntu will occupy the whole window. You can also go into full-screen mode by pressing the combination of host key and F. Note that the host key for a mac is usually the left 'command' key. This is usually indicated at the bottom right of your screen.

    The last thing to do is to right-click on the 'Disc' in the right hand side menu bar and eject the Guest Addition virtual disc as shown below.

    Congratulations. Ubuntu is now installed!!!

Installing ROS on Ubuntu

The final step to get started making awesome robots is to install ROS.
  1. The first thing we have to do is to open up a Terminal. A Terminal provides us with a command-line interface with a host of built-in as well as downloadable tools and utilities. This facility is also available on a Mac (try typing 'Terminal' in the finder) and Windows has a shabbier version of it known as the Command Prompt. Most of us are accustomed to using a Graphical User Interface, where you mostly perform operations by clicking away on your computer. A command line interface involves typing out commands into a window (the Terminal) to execute instructions such as downloading programs, performing operations on files (editing, copying, deleting, searches etc.) and so much more (basically everything you could do without your mouse and more). In fact, you will later find that a lot of the ROS commands are based upon the commands used in the Terminal. So it might be a good idea to acquaint yourself with the Ubuntu Terminal through online resources before proceeding any further. This article is a good one to get your started. Once you've had enough, open up a Terminal (shortcut ctrl + alt + T).

    The rest of the instructions have been taken from the official ROS documentation

    Note that the version of ROS being installed is Indigo which is a older build (newest version is Jade). We are using this because a lot of our code base was developed using this version, and we want to ensure that there are there are no compatibility issues.

  2. Setup your Sources.list

    Now run (i.e. paste and press Enter) the following in the terminal:

    sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

  3. Setup your keys

    Now run:

    sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net --recv-key 0xB01FA116

  4. Run Full Desktop Install for ROS Indigo

    Run the following instructions sequentially:

    sudo apt-get update
    sudo apt-get install ros-indigo-desktop-full
  5. Initialize Rosdep

    Run:

    sudo rosdep init
    rosdep update
  6. Setup the Environment

    echo "source /opt/ros/indigo/setup.bash" >> ~/.bashrc
    source ~/.bashrc

  7. Get RosInstall

    sudo apt-get install python-rosinstall

Next Steps

You are now ready to develop software through ROS. Go to the ROS Tutorials page to get started.