How to Install ROS

Introduction: How to Install ROS

About: I'm interested in making robots, I'm actively reading and learning about robotics and would like to share my knowledge. If you are interested in electronics or robotics, subscribe on my youtube channel and fol…

In this tutorial you'll learn how to install ROS.

Robot Operating System (ROS) is open-source robotics middleware and you'll be using it to control your Arduino. If you are interested in learning more visit: http://wiki.ros.org/ROS/Introduction

Supplies

  1. Linux based OS - Ubuntu 16.04 (Xenial) installed as main OS or on VirtualBox
  2. VirtualBox (any version)
  3. ROS Kinetic Kame
  4. Arduino IDE

Step 1: Install VirtualBox

1. Go to www.virtualbox.org and download the newest version of VirtualBox for OS you're using

2. Install VirtualBox

3. Download Ubuntu 16.04 (Xenial) as ISO file - https://releases.ubuntu.com/16.04/

Recommended PC Requirement:

  • 2GHz dual core processor or better
  • 2GB system memory
  • 25GB of free hard drive space

4. Run VirtualBox and create a new VM (Virtual Machine)

5. Name the Guest OS - Ubuntu (version) > click Next [Image 1]

6. Allocate RAM for Guest OS - preferable half the size of RAM you have on your PC (e.g. for 16GB of RAM you will set 8,192 MB) > click Next [Image 2]

7. Create a Virtual Hard Disk [Image 3]

8. Select VDI > click Next [Image 4]

9. Configurating the Type of VD (Virtual Disk) > Select a Fixed size storage > click Next [Image 5]

10. As said it is recommended minimum 25GB of free space (I recommend at least 30GB just to be sure that you'll have enough space for all the programs you'll be using) > click Next [Image 6]

11. Create the Virtual Machine

Step 2: Configurating the VirtualMachine

1. Go to Settings [Image 1]

2. Navigate to the Storage options on the left

3. Select Controller:IDE and insert downloaded Ubuntu image (ISO) > click OK [Image 2]

4. Configure the video configuration > navigate to the Display option on the left

5. Set Video Memory in screen tab on maximum > click OK [Image 3]

6. Configure the System settings > navigate to the System option on the left

7. Set Processor(s) in Processor tab to half of the existing ones > click OK [Image 4]

OPTIONAL: Configure the Shared Folder > navigate to the Shared Folder option on the left > click Add Folder on the right side of the window > select Folder you want to use > click OK [Image 5]

8. You're now ready to launch your VirtualMachine!

Step 3: Booting and Installing Ubuntu on VirtualBox

1. When the VirtualMachine boots up, you'll get a window which asks you to Try Ubuntu or Install Ubuntu

2. Select Install Ubuntu

3. After selecting Install Ubuntu you'll get the next window which asks you to Download updates while installing Ubuntu or to Install third-party software. Considering you're using VirtualBox, you can ignore that or select first option > click Continue

4. Selecting the installation type > The first option, Erase disk and install Ubuntu, is ok because you installed Ubuntu on VirtualBox > click Continue

5. Set the time zone

6. Set the keyboard layout

7. Set the login information (Your name, Username, Password etc.)

8. Ubuntu will now install

9. After rebooting, you'll be ready to use it!

GOOD TO KNOW:
Sometimes there is a common problem with Ubuntu and VirtualBox resolution. Here is instruction how to fix that:

  • Open Terminal > Type:
sudo apt-get install virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11 
  • If that doesn't fix the problem try this:

VirtualBox tab bar > Devices > Insert Guest Additions CD image... [Image 1]

Inside the window holding your virtual machine you can go to one of the menu options and select to install guest additions. It will mount a CD in the virtual machine where you will be able to run the installation scripts from. Once the installation is done and Ubuntu is restarted, Ubuntu will be able to detect your host OS' screen resolution and adjust automatically.

Step 4: Install ROS Kinetic Kame

As discussed, ROS is not an operating system, but it needs a host operating system to work. Ubuntu Linux is the most preferred OS for installing ROS.

1. Go to http://wiki.ros.org/ROS/Installation

2. Select the ROS Kinetic Kame

3. Select your Platform (Ubuntu)

4. You'll be transferred to http://wiki.ros.org/kinetic/Installation/Ubuntu

5. All you need to do is to open a Terminal and follow installation steps on the site

OR YOU CAN FOLLOW INSTRUCTION FROM HERE:

1. Open Terminal

2. Setup your computer to accept software from packages.ros.org:

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

3. Set up your keys:

sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654

4. Make sure your Debian package index is up-to-date:

sudo apt-get update

5. Desktop-Full Install:

sudo apt-get install ros-kinetic-desktop-full

6. Environment setup:

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

7. To install tools and other dependencies for building ROS packages, run:

sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential

8. Before you can use many ROS tools, you will need to initialize rosdep:

sudo apt install python-rosdep
sudo rosdep init 
rosdep update

Step 5: Install Arduino IDE

1. Download the latest Arduino software on your Ubuntu > https://www.arduino.cc/en/Main/Software

2. I would recommend downloading Linux 32bits because 64bits can sometimes cause trouble installing on VirtualBox Ubuntu

3. The file is compressed and you have to extract it in a suitable folder, remembering that it will be executed from there. (Preferable extract it in your Download folder)

4. Open the arduino-1.x.x folder just created by the extraction process and spot the install.sh file > right click on it and choose Run in Terminal from the contextual menu.

5. The installation process will quickly end and you should find a new icon on your desktop

6. If you don’t find the option to run the script from the contextual menu, you have to open a Terminal window and move into the arduino-1.x.x folder

ls
cd Downloads
cd arduino-1.x.x          // x.x. is your version of Arduino

7. Type the command

 ./install.sh

8. Wait for the process to finish.

9. You should find a new icon on your desktop

Step 6: Including ROS Library

1. You must first create a ROS workspace folder (Normally, this is in the Ubuntu home folder)

mkdir -p ~/catkin_ws/src

2. Now switch to /src folder

cd catkin_ws/src

3. Initialize a new ROS workspace

catkin_init_workspace

4. After initializing catkin workspace, you can build the workspace, switch from /src folder to catkin_ws folder

~/catkin_ws/src cd ..

5. Build the space

~/catkin_ws catkin_make

6. Now you can see a few folders in addition to the src files in your catkin_ws folder (src folder is where our packages are kept)

7. At a Terminal, switch to the home folder and select .bashrc file

cd ~
gedit .bashrc

8. Add the folowing line at the end of .bashrc file (after the last line "source /opt/ros/kinetic/setup.bash")

<strong>source ~/catkin_ws/devel/setup.bash</strong>

9. We source this file in Terminal (copy this same line and paste it in a Terminal)

10. Now when we use any terminal, we can access the package inside this workspace

11. After building the target executable locally, run the following command to install the executable:

catkin_make install

12. You can install rosserial for Arduino by running:

sudo apt-get install ros-kinetic-rosserial-arduino
sudo apt-get install ros-kinetic-rosserial<br>

13. In the steps below, is the directory where the Linux Arduino environment saves your sketches. Typically this is a directory called sketchbook or Arduino in your home directory. e.g cd ~/Arduino/libraries

cd /libraries
rm -rf ros_lib 
rosrun rosserial_arduino make_libraries.py .

14. After restarting your IDE, you should see ros_lib listed under examples

Be the First to Share

    Recommendations

    • Robots Contest

      Robots Contest
    • Reclaimed Materials Contest

      Reclaimed Materials Contest
    • 3D Printed Student Design Challenge

      3D Printed Student Design Challenge

    Comments