A Gentle Introduction to ROS

A Gentle Introduction to ROS


Overview

Motivation
  • Robots have many components:
    • sensors, actuators
    • perception, planning, action, control.
  • These components are built by different teams, update independently, and communicate at different rates.
  • ROS 2 solves the problem of coordinating them reliably.
ROS
  • Robot Operating System
    • Is a middleware running on top of Linux
    • Is a communication framework for robotics
    • Uses message passing, publish–subscribe, services, actions
  • Latest documentation
  • Not an operating system, despite the name
Why ROS Exists
  • The origin story
  • Original Authors: Keenan Wyrobek and Eric Berger, Ph.D. students at Standford in 2010.
Before ROS
  • Every robotics team wrote bespoke drivers
  • No shared message formats
  • No common build system
  • High integration cost
Vision
  • A Linux of Robotics
  • Initially considered a crazy idea!
ROS standardized
  • Node-based architecture
  • Message definitions
  • Communication semantics
  • Reusable libraries (TF, Nav2, MoveIt)
Quic summary: ROS 1 vs ROS 2
  • DDS-based (Data Distribution Service) communication layer
  • Real-time support
  • Multi-robot and multi-host support
  • Security (DDS-Security plugins)
  • Better Windows/Mac support
  • Modern C++ / Python APIs

Core ROS 2 Concept:

Nodes
  • A node is a single-purpose program.
  • Examples:
    • camera_node produces images
    • lidar_node publishes scans
    • planner_node computes trajectories
    • controller_node sends motor commands
  • Nodes can be written in C++ (rclcpp) or Python (rclpy).
Topics
  • Topics implement publish–subscribe messaging.
    • Asynchronous broadcast
  • Topics are abstractions for message channels.
  • Properties:
    • Asynchronous
    • Multi-producer, multi-consumer
    • Typed messages via .msg files
    • Transported through DDS
  • Example:
    • /camera/image_raw
    • /scan
    • /cmd_vel
Services
  • Services implement synchronous request–reply.
    • Synchronous request-responses (RPC)
  • Used when a node needs an answer now.
  • Example:
    • Resetting sensors
    • Requesting a map
    • Triggering calibration
Actions
  • Actions support long-running tasks.
    • Somewhat similar to async Future (Javascript)
  • Provides:
    • Goal
    • Feedback
    • Result
    • Cancellation
  • Examples:
    • Move robot arm to position
    • Navigate to point
    • Execute motion trajectories
ROS Graph
  • Is the runtime connectivity structure formed by:
    • Nodes, Topics, Services, Actions
    • Parameters, QoS relationships
  • Is not static
  • Is discovered dynamically through DDS:
    • All nodes announce themslves and their endpoints (topics/services) to DDS
      • Actions are invoked by Nodes
    • DDS automatically builds a discovery graph and informs all participants.
    • zero configuration.
  • ROS Graph: Organizational blueprint of a robot’s software mind.

Data Distribution Service

External vendors
  • FastDDS
  • CycloneDDS
What does it provide?
  • Discovery (no central master)
  • QoS policies
  • Transport reliability settings
  • Multi-host communication
DDS: Quality of Service
  • Critical in robotics.
  • Key policies:
    • Reliability: Reliable vs Best-effort
    • History: Keep last N messages
    • Durability: Transient-local for late subscribers
    • Deadline: Expected publication frequency
Parameters
  • Nodes have runtime parameters.
  • Example: camera resolution, update rate, PID gains.

What Robots Use ROS 2?

Key Takeaways
  • ROS 2 is middleware for modular robotics
  • Nodes communicate via DDS topics/services/actions
  • Tools and conventions streamline complex systems
  • Great platform for experimentation
  • Concepts generalize to distributed systems, realtime, and event-driven architectures