Skip to content
RoboLearn
Not completed

Introduction to ROS 2

AdvancedAdvanced45 minBefore this: Functions, Raspberry Pi and Pico

What you’ll learn

  • What ROS 2 is (and isn’t)
  • Nodes, topics, services and actions
  • What a tiny ROS 2 program looks like, and how to start

What is ROS 2?

ROS 2 (Robot Operating System 2) isn’t an operating system: it’s a free, open-source framework of tools and libraries that runs on Linux (and others), used by universities and companies to build complex robots. Its big idea is splitting a robot’s software into many small programs that talk to each other.

The building blocks

Concept What it is Example
Node One small program with one job camera_node, motor_driver, planner
Topic A named channel; nodes publish messages to it and others subscribe /scan (laser data), /cmd_vel (speed commands)
Message A typed data structure Twist = linear and angular speed
Service A request with a reply “Reset the map” → “done”
Action A long task with progress updates “Drive to the kitchen” → “50%… arrived”
Launch file Starts many nodes together Start the whole robot with one command
[lidar node] --/scan--> [SLAM node] --/map--> [planner] --/cmd_vel--> [motor node]

Because every node uses the same message types, you can swap a real robot for a simulator, or one lidar for another, without rewriting everything.

Getting started

  • Install the current long-term support (LTS) release on Ubuntu Linux, following the official docs at docs.ros.org (a Raspberry Pi 4/5 can run it).
  • Try turtlesim (a 2D turtle robot) and the beginner tutorials.
  • Use the command-line tools: ros2 topic list, ros2 topic echo /topic, ros2 run.

Finished this lesson?