ROS: The Robot Operating System
ROS is to robotics what the internet is to communication — a shared infrastructure that makes it possible for different components built by different people to work together. It's not actually an operating system; it's a middleware framework that runs on top of Linux. But it's the single most important piece of software in modern robotics, and understanding it is non-negotiable for anyone serious about the field.
What is ROS and why does it exist?
Imagine you're building a robot. You need a LiDAR driver, a camera driver, a SLAM algorithm, a path planner, and a motor controller. Without ROS, you'd have to write custom code for each component to communicate with every other component — a nightmare of incompatible interfaces.
ROS solves this by providing a standard communication layer. Every component becomes a "node" that publishes and subscribes to "topics" using a defined message format. The LiDAR node publishes sensor data; the SLAM node subscribes to it. Neither needs to know about the other's implementation — just the agreed-upon message format.
ROS 1 vs. ROS 2
ROS 1 (released 2010) was research-focused and had significant reliability issues in production. ROS 2 (released 2017, now the standard) was rebuilt from the ground up with real-time support, security, and multi-robot coordination. If you're starting today, learn ROS 2. The current long-term support release is ROS 2 Humble (Ubuntu 22.04).
Nodes, Topics & Messages — The Core Concepts
Three concepts power everything in ROS. Once you understand these, the rest falls into place.
Nodes
A node is a single process that does one specific job. Examples: a camera node that reads frames from a webcam, a detection node that runs YOLO on those frames, a motor node that drives the wheels. Each node is a separate program — they can be written in Python or C++, they run simultaneously, and they communicate through topics.
Topics & the Publisher/Subscriber pattern
A topic is a named channel of communication — like a radio frequency. Any node can publish data to a topic; any node can subscribe to receive it. The camera node publishes images to /camera/image_raw. The detection node subscribes to that topic and publishes results to /detections. The motor node subscribes to /detections to decide where to drive. No node needs to know the others exist — they just publish and subscribe.
Messages
The data format agreed upon for a topic. ROS comes with hundreds of standard message types: sensor_msgs/Image for camera frames, geometry_msgs/Twist for velocity commands, sensor_msgs/LaserScan for LiDAR data. You can also define custom messages. The key is that any node publishing or subscribing to a topic must use the same message type.
Services & Actions — Request/Response Communication
Topics are great for streaming data (camera frames, sensor readings), but sometimes you need a request-response pattern — "do this task and tell me when you're done."
Services
A synchronous request/response. One node sends a request and waits for a response. Example: a service that resets the robot's odometry to zero, or one that asks a perception node "is there a person in the current frame?" Services block until they get a reply, so they're for quick operations only.
Actions
Like services, but for long-running tasks where you want feedback during execution and the ability to cancel. Example: "navigate to coordinate (5, 3)" — this takes several seconds, and you want updates on progress. ROS Actions send a goal, stream feedback while executing, and return a result when done. Navigation in ROS 2 (Nav2) uses actions extensively.
Essential ROS Tools
ros2 topic list / echo
List all active topics (ros2 topic list) or print data streaming on a topic (ros2 topic echo /camera/image_raw). Your first debugging tool — if data isn't flowing, you'll see it here.
RViz2
The ROS visualization tool. Displays robot position, sensor data, point clouds, camera feeds, and planned paths in 3D — all in real time. Indispensable for debugging perception and navigation. Think of it as the robot's dashboard.
rqt_graph
Shows a diagram of all running nodes and which topics connect them. Essential for understanding the data flow in a complex robot system and debugging "why isn't my data reaching node X?"
Launch files
A Python (or XML) file that starts multiple nodes simultaneously with configured parameters. Instead of manually starting 10 terminal windows, a single ros2 launch my_robot bringup.launch.py command starts everything. Every real robot system uses launch files.
Frequently Asked Questions
Do I need Linux to use ROS?
Yes — ROS 2 is officially supported on Ubuntu Linux (22.04 for Humble). You can run it in a Docker container on Mac or Windows, but native Ubuntu is strongly recommended for robotics development. If you're new to Linux, Ubuntu is beginner-friendly and well-documented.
Should I use Python or C++ with ROS?
Python is easier to learn and sufficient for most tasks — perception, planning, and behavior code. C++ is needed when you require maximum performance (high-frequency control loops, custom hardware drivers). Many production robots use Python for high-level logic and C++ for the inner control loops.
What's the Nav2 stack?
Navigation2 (Nav2) is the standard ROS 2 navigation framework. Give it a map, a starting pose, and a goal, and it handles everything: path planning (using A* or Dijkstra), obstacle avoidance, and velocity commands to the wheels. It's used in commercial delivery robots and is the first thing to learn after ROS basics.
Is ROS used in industry or just academia?
Both. ROS started in academia (Willow Garage, 2007) but is now used heavily in industry. Boston Dynamics, iRobot, DHL, Amazon, and hundreds of robotics startups build on ROS. The ROS 2 rewrite specifically targeted the reliability and security needs of production deployments.
Frequently Asked Questions
What will I learn here?
This page covers the core concepts and techniques you need to understand the topic and progress confidently to the next lesson.
How should I use this page?
Start with the overview, then follow the section links to deepen your understanding. Use the table of contents on the right to jump to specific sections.
What should I read next?
Use the navigation below to continue to the next lesson or explore related topics.