Robotics guide

Getting Started With ROS 2: A Beginner's Guide

A first pass through what ROS 2 is, why it matters, and how to install and test a basic setup.

Robotics is evolving rapidly, and open-source tools like ROS make it easier to develop and control complex robots. ROS 2 is the next-generation version of ROS, designed for distributed systems, real-time applications, and secure communication.

What Is ROS 2?

ROS 2 is a set of software libraries and tools that help developers build robot applications. It includes message passing, package management, device drivers, visualizers, and abstractions that make robotic systems easier to organize.

Why Choose ROS 2?

  1. Real-time systems: Useful when robots need precise timing and control.
  2. Improved communication: DDS middleware supports more flexible distributed communication.
  3. Security: ROS 2 includes mechanisms for safer communication.
  4. Cross-platform support: It can run across Linux, Windows, and macOS environments.

Setting Up ROS 2 Humble

Ubuntu is the most common ROS 2 development environment. A typical Humble install starts with repository setup and package installation.

Add required packages

sudo apt update
sudo apt install software-properties-common
sudo add-apt-repository universe

Install ROS 2 Humble

sudo apt update
sudo apt install ros-humble-desktop

Source the environment

source /opt/ros/humble/setup.bash

Test Your Installation

Run a talker node in one terminal:

ros2 run demo_nodes_cpp talker

Then run a listener node in another terminal:

ros2 run demo_nodes_cpp listener

Conclusion

ROS 2 can feel large at first, but even a small talker/listener demo introduces the core idea: connected nodes communicating inside a robotic system.