Blog.

ROS Installation & Setup Guide

Cover Image for ROS Installation & Setup Guide
AURA Digital Labs
AURA Digital Labs

ROS Installation & Setup Guide: A Robot's Best Friend

So, you're ready to dive into the world of robotics? Congratulations! You've chosen an exciting and challenging path. But before you can start building your own robot army (or just a really cool robot arm), you need to get familiar with ROS – the Robot Operating System. This comprehensive guide will walk you through the installation and setup of ROS, making the process as smooth as possible.

What is ROS?

ROS isn't an operating system in the traditional sense (like Windows or Linux). Instead, it's a flexible framework for writing robot software. Think of it as a sophisticated toolbox packed with pre-built components and tools that simplify the complex task of robot programming. It allows you to easily manage different parts of your robot's functionality, like sensors, actuators, and control algorithms, all while communicating efficiently. ROS supports multiple programming languages (like Python and C++) and runs on various operating systems.

Choosing Your Distribution: ROS Noetic vs. ROS Humble

The first decision you'll need to make is which ROS distribution to use. At the time of writing, the most recent long-term support (LTS) releases are ROS Noetic Ninjemys (for Ubuntu 20.04) and ROS Humble Hawksbill (for Ubuntu 22.04). Both are excellent choices, but choosing the right one depends on your operating system and preference.

  • ROS Noetic (Ubuntu 20.04): Mature, well-tested, and widely used. A safer bet if you're new to ROS.
  • ROS Humble (Ubuntu 22.04): Newer, with potential improvements and newer features. Might be slightly more prone to bugs in its early stages, but offers long-term support.

For this guide, we'll focus on installing ROS Humble on Ubuntu 22.04, but the steps are largely similar for other distributions.

Step-by-Step Installation Guide (ROS Humble on Ubuntu 22.04)

  1. Install Ubuntu 22.04: If you don't already have Ubuntu 22.04 installed, download the ISO from the official Ubuntu website and create a bootable USB drive. Install Ubuntu 22.04 following the on-screen instructions.

  2. Update your system: Once Ubuntu is installed, open a terminal and update your package lists:

    sudo apt update && sudo apt upgrade
    
  3. Set up your sources list: This crucial step adds the ROS repositories to your system, allowing you to install ROS packages.

    sudo apt install curl
    curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key -o /usr/share/keyrings/ros-archive-keyring.gpg
    echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] http://packages.ros.org/ros2/ubuntu jammy main" | sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
    
  4. Install ROS: Now, you're ready to install ROS Humble. You can install the basic desktop version using this command:

    sudo apt update
    sudo apt install ros-humble-desktop
    

    This installs a comprehensive set of packages, including essential tools and libraries.

  5. Initialize ROS: After installation, you need to initialize ROS environment variables. This makes ROS commands easily accessible from the terminal.

    source /opt/ros/humble/setup.bash
    

    You'll likely want to add this line to your .bashrc file so that it's automatically sourced every time you open a new terminal:

    echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
    
  6. Verify Installation: Test your installation by checking the ROS version:

    ros2 --version
    
  7. Install additional tools (optional): You might want to install additional tools based on your needs. Some popular choices include:

    • rviz2: A 3D visualization tool.
    • rosbag2: For recording and playing back ROS data.
    • rqt_graph: For visualizing the ROS graph (connections between nodes).

    You can install these using:

    sudo apt install ros-humble-rviz2 ros-humble-rosbag2-py ros-humble-rqt-graph
    

Beyond Installation: Getting Started with ROS

Once ROS is installed, you're ready to begin your robotics journey! You can explore numerous tutorials and examples available online, focusing on topics like creating nodes, publishing and subscribing to topics, and using services. The ROS website is an excellent resource for beginners and experienced users alike.

Remember, installing ROS is just the first step. The real challenge lies in understanding the concepts and developing your robot applications. Don't be afraid to experiment, ask questions, and engage with the vibrant ROS community. The world of robotics awaits!