Robotics · Step 7 of 8 · 6 min

ROS 2 basics

You know what ROS 2 is, its core ideas, and how to take your first steps.

01 · What ROS 2 is

ROS 2, the Robot Operating System, is not an operating system. It is a free, open-source framework and set of tools that lets the parts of a robot's software talk to each other. It is the common language of research labs and many robot companies.

It runs best on Ubuntu Linux. Use the current long-term support release: Jazzy Jalisco (2024) is supported until 2029, and a new LTS release arrives every two years in May.

02 · Nodes and topics

A node is one small program with one job: read the lidar, plan a path, drive the wheels. Nodes share data by publishing and subscribing to named topics, like /scan or /cmd_vel.

The lidar node publishes on /scan without knowing who listens. Any node that needs the scan subscribes. This loose coupling lets you swap parts without rewriting everything.

03 · Services, actions and tools

Services are quick request and reply calls. Actions are long tasks with progress updates and the option to cancel, such as navigating to a room. You write nodes in Python with rclpy or in C++ with rclcpp.

Tools do a lot of the work. RViz shows what the robot sees. ros2 topic echo prints live messages. Gazebo simulates the robot. Nav2 handles navigation, and MoveIt 2 plans arm motion.

04 · Be patient with setup

Installation and build tools trip up most beginners. Follow the official tutorials in order, starting with turtlesim. If you are not on Linux, a Docker container or a virtual machine running Ubuntu works.

05 · Try it

06 · Check yourself

In ROS 2, how does a lidar node usually share its readings with other nodes?