How to Install ROS (2024)

Introduction: How to Install ROS

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

How to Install ROS (2024)

FAQs

How to install a ROS system? ›

  1. Step 1: Install VirtualBox. Go to www.virtualbox.org and download the newest version of VirtualBox for OS you're using. ...
  2. Step 2: Configurating the VirtualMachine. ...
  3. Step 3: Booting and Installing Ubuntu on VirtualBox. ...
  4. Step 4: Install ROS Kinetic Kame. ...
  5. Step 5: Install Arduino IDE. ...
  6. Step 6: Including ROS Library.

Can I install ROS in Windows? ›

To use ROS on Windows with VMs, you need to install a virtualization software, such as VirtualBox or VMware, and create a VM with a Linux distribution of your choice. Then, you can install ROS on the VM as you would on a native Linux system.

How to install a ROS package Linux? ›

Install ROS Packages and Dependencies for ROS
  1. Install python3 and python3-pip by executing the following command in the Linux terminal. ...
  2. Install conan using pip and setup a default profile. ...
  3. Create a new workspace with src folder. ...
  4. Download the ros_kortex ROS packages (version 2.2.

What are the requirements for ROS install? ›

You can use either a desktop or a laptop, as long as it has enough processing power, memory, and storage space. The minimum requirements vary depending on the ROS version and the packages you want to use, but a general guideline is to have at least a dual-core processor, 4 GB of RAM, and 10 GB of free disk space.

Is ROS2 better than ROS? ›

ROS 2 is the newer and more advanced version of ROS. It was released in 2016 and has been evolving rapidly since then. ROS 2 is designed to address some of the limitations and challenges of ROS 1, such as scalability, performance, security, and cross-platform compatibility.

How do I download ROS 2.0 on my PC? ›

Installing ROS 2 on Windows
  1. Install Chocolatey.
  2. Install Python.
  3. Install Visual C++ Redistributables.
  4. Install OpenSSL.
  5. Install Visual Studio.
  6. Install additional DDS implementations (optional)
  7. Install OpenCV.
  8. Install dependencies.

How do I know if ROS is installed on Windows? ›

You can do this by opening a terminal and typing the following command: rosversion -d . This will display the name of the ROS distribution that you are using, such as Kinetic, Melodic, or Noetic. You can also check the version of a specific ROS package by typing: rosversion <package_name> .

Does ROS only run on Linux? ›

rosjava has also enabled ROS to be integrated into an officially supported MATLAB toolbox which can be used on Linux, macOS, and Microsoft Windows.

Can we run ROS on Windows 11? ›

I just successfully installed ros 2 (galactic) on windows 11 (in so far as I am able to run the demo_nodes_cpp talker and listener ). It was surprisingly painless.

How to install ROS 2 on Linux? ›

Building ROS 2 on Linux
  1. System requirements.
  2. System setup. Set locale. Add the ROS 2 apt repository. ...
  3. Get ROS 2 code.
  4. Install dependencies using rosdep.
  5. Install additional DDS implementations (optional)
  6. Build the code in the workspace.
  7. Environment setup. Source the setup script. Install argcomplete (optional)
  8. Try some examples.

Where are ROS packages installed in Linux? ›

Software in ROS is organized into packages (and packages exist inside the catkin_ws folder, your catkin workspace). Each package might contain a mixture of code (e.g. ROS nodes), data, libraries, images, documentation, etc. Every program you write in ROS will need to be inside a package.

Can I install ROS on virtual machine? ›

There is no difference in an ROS installation on a virtual machine. Therefore, we can simply install ROS Kinetic following the same instructions described in the previous section. We can run most of the examples and stacks that we are going to work with.

How do I know if ROS is installed? ›

dpkg -s ros-noetic-<pkg> will give you info only if installed. Either using that or another dpkg tool, you could find if the base ROS binary is installed as a way to know if ROS is around, e.g. dpkg -s ros-<distro>-ros .

Which Linux OS is best for ROS? ›

While Ubuntu is the most popular and widely used distribution for ROS development, other distributions like Debian, Fedora, Arch Linux, and OpenSUSE are also compatible with ROS. Before choosing a distribution, consider the level of support, the stability of ROS packages, and the size of the user community.

Is Ubuntu needed for ROS? ›

Ubuntu has been the primary platform for ROS from the very beginning, thanks to its flexibility and user-friendliness.

Can I install ROS on Windows 11? ›

Windows Operating System

ROS for Windows requires 64-bit Windows 10 Desktop or Windows 10 IoT Enterprise. Please ensure that you have Powershell installed and in the system path.

How to install ROS in virtual environment? ›

Contents
  1. Step 1: Configure ROS Software Repository.
  2. Step 2: Install ROS Melodic.
  3. Step 3: Initialize rosdep.
  4. Step 4: Add Environment Variables and Install ROS Dependencies.
  5. Step 5: Verify the ROS Environment.
  6. Step 6: Set up Workspace.
  7. Download & Compile the Source Cofe of the Jetbot_pro Virtual Machine.

How do you connect to a ROS network? ›

To connect to a ROS network, you can create the ROS master in MATLAB or connect to an existing ROS master. In both cases, MATLAB will also create and register its own ROS node (called the MATLAB global node) with the master. The rosinit function manages this process. Exchange data.

Top Articles
Latest Posts
Article information

Author: Fr. Dewey Fisher

Last Updated:

Views: 5898

Rating: 4.1 / 5 (42 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Fr. Dewey Fisher

Birthday: 1993-03-26

Address: 917 Hyun Views, Rogahnmouth, KY 91013-8827

Phone: +5938540192553

Job: Administration Developer

Hobby: Embroidery, Horseback riding, Juggling, Urban exploration, Skiing, Cycling, Handball

Introduction: My name is Fr. Dewey Fisher, I am a powerful, open, faithful, combative, spotless, faithful, fair person who loves writing and wants to share my knowledge and understanding with you.