Skip to main content

Introduction to ROS 2

Overview​

Robot Operating System 2 (ROS 2) is the next-generation robotics middleware designed to address the limitations of ROS 1 and meet the requirements of production robotics applications. Unlike ROS 1, which was primarily designed for research environments, ROS 2 was built with industrial deployment, security, and real-time capabilities in mind.

ROS 2 is not just an upgrade of ROS 1 but a complete redesign that maintains the core concepts that made ROS successful while incorporating modern technologies and architectural improvements.

What is ROS 2?​

ROS 2 is a collection of software libraries and tools that help developers create robot applications. It provides:

  • Hardware abstraction and device drivers
  • Libraries for implementing common robot functionality
  • Tools for visualization, simulation, and testing
  • Message-passing capabilities for distributed computation
  • Package management for sharing and distributing code

ROS 2 is built on top of DDS (Data Distribution Service), a communications middleware that provides a publish-subscribe pattern for distributed systems. This foundation enables ROS 2 to support real-time systems, embedded systems, and multi-vendor interoperability.

Role of ROS 2 in Robotics​

ROS 2 plays a crucial role in robotics development by:

  1. Standardizing Communication: Providing standardized interfaces for robot components
  2. Enabling Rapid Prototyping: Offering pre-built libraries and tools for common tasks
  3. Facilitating Collaboration: Allowing researchers and developers to share code and solutions
  4. Supporting Production Deployment: Providing security, real-time capabilities, and reliability features required for commercial applications

Key Components of ROS 2​

Nodes​

Nodes are the fundamental building blocks of a ROS 2 system. Each node is a process that performs computation. Nodes communicate with each other through topics, services, and actions.

Topics and Messages​

Topics provide a publish-subscribe communication pattern. Publishers send messages to topics, and subscribers receive messages from topics. This enables asynchronous, decoupled communication between nodes.

Services​

Services provide a request-response communication pattern. A client sends a request to a service and waits for a response. This is useful for synchronous operations that require a specific result.

Actions​

Actions are an extension of services that support long-running operations with feedback and goal preemption. They're ideal for tasks like navigation where you need to monitor progress and potentially cancel the operation.

ROS 2 Architecture​

The architecture of ROS 2 represents a fundamental shift from the centralized design of ROS 1 to a distributed, standards-based approach. This new architecture addresses critical limitations of ROS 1, particularly in areas of scalability, real-time performance, and security.

DDS-Based Communication Layer​

ROS 2's communication layer is built on Data Distribution Service (DDS), an industry-standard middleware for real-time systems. DDS provides:

  • Quality of Service (QoS) policies that allow fine-tuning of communication behavior
  • Language and platform independence for multi-vendor interoperability
  • Built-in discovery mechanisms for automatic node detection
  • Real-time capabilities with deterministic timing characteristics

Node-Based Execution Model​

In ROS 2, a node is the basic unit of computation. Each node:

  • Encapsulates the functionality of a specific component
  • Owns communication entities (publishers, subscribers, services, etc.)
  • Runs within a single process
  • Can be grouped with other nodes in the same process for efficiency

Evolution from ROS 1 to ROS 2​

ROS 2 was developed to address several key limitations of ROS 1:

  1. Distributed Architecture: ROS 2 uses a distributed architecture with no single point of failure, unlike ROS 1's centralized master architecture
  2. Real-time Support: Built-in real-time support suitable for production systems
  3. Security: Comprehensive security framework including authentication, access control, and encryption
  4. Cross-platform Support: Works across Linux, Windows, macOS, and real-time operating systems
  5. Quality of Service: Configurable communication behavior for different application needs

Learning Objectives​

By the end of this lesson, you should be able to:

  • Understand what ROS 2 is and its role in robotics
  • Identify the key components of ROS 2 (nodes, topics, services, actions)
  • Explain the architecture of ROS 2 and how it differs from ROS 1
  • Recognize the advantages of using ROS 2 for robotics applications
Physical AI assistant
Hello! I am your Physical AI assistant. Ask me anything about the course!