From ROS to ROS 2: A Comprehensive Guide to the Next Generation Robotics

ScaleX Innovation
13 min readNov 16, 2023

--

Abstract

This comprehensive guide explores the significant transition from the Robot Operating System (ROS) to ROS 2, highlighting the evolution and advancements in robotic software frameworks. It details the shift from ROS’s focus on single-robot systems to ROS 2’s emphasis on swarm robotics, real-time capabilities, and enhanced communication with DDS middleware. The guide examines key aspects like programming languages, executor models, navigation stacks, and security enhancements. ROS 2’s advancements in scalability, reliability, and cross-platform support are emphasized, positioning it as a pivotal development in modern robotics, catering to diverse and complex applications in the field.

Evolution of Robotics

Learning Outcomes

Architectural Evolution: Understand the transition from ROS to ROS 2, focusing on the shift to a distributed architecture, DDS integration for communication, and enhanced real-time capabilities and QoS.

Programming Enhancements: Learn about ROS 2’s advancements in programming with modern C++ and Python 3, and explore its improved executor models for more efficient robotic programming.

Security and Navigation: Recognize improvements in ROS 2’s security framework and the development of the Navigation2 stack, enhancing safety and dynamism in robotic applications.

Introduction

The Dawn of a New Era in Robotics: From ROS to ROS 2

In Robotics, the evolution of software platforms plays a pivotal role in shaping the capabilities and scope of robotic systems. One such transformative journey is the transition from the Robot Operating System (ROS) to its successor, ROS 2. This transition marks not just a mere upgrade in software but a significant leap forward in addressing the growing complexities and demands of modern robotics.

Historical Evolution

The evolution from ROS (Robot Operating System) to ROS 2 marks a pivotal shift in the robotics landscape. Originating in 2009, ROS rapidly became the backbone for a wide array of robotics applications, from simple mobile robots to complex autonomous systems. Its integration of open-source libraries and high-level abstractions simplified robotics development, propelling it to the forefront of the field.

However, at the ROSCon 2014 conference, the community identified key limitations in ROS: its single point of failure due to reliance on the ROS Master Node, limited scalability, and a design primarily for single-robot systems. Additionally, ROS’s lack of real-time guarantees raised concerns for its application in more critical scenarios.

In response, the development of ROS 2 began, focusing on overcoming these challenges. Officially launched in December 2017 with the Ardent Apalone release, ROS 2 aimed to address the identified gaps, particularly in multi-robot systems and real-time operations. Despite its release, ROS remained predominant until 2022, largely due to the ongoing development of ROS 2. The introduction of the ROS Bridge package facilitated communication between the two systems during this transition period.

By late 2021, ROS 2 had matured significantly, incorporating essential functionalities like navigation and transformation, positioning it to potentially overtake ROS by 2023. This blog explores this critical transition, emphasizing the advancements ROS 2 brings to modern robotics and its expected impact on future developments in the field.

Implications of the Transition for Modern Robotics

The transition from ROS to ROS 2 is a significant milestone in the context of modern robotics for several reasons:

  1. Enhanced Robustness and Reliability: ROS 2 addresses the fundamental limitations of ROS, particularly its reliance on a single master node, which was a potential point of failure. By adopting a more distributed architecture, ROS 2 enhances system robustness and reliability, crucial for critical applications like autonomous driving and industrial automation.
  2. Real-Time Capabilities: With real-time support, ROS 2 opens doors to applications where timing and responsiveness are critical. This feature is vital for robotics tasks that require high levels of precision and safety, such as robotic surgery and manufacturing processes.
  3. Scalability and Multi-Robot Systems: The design of ROS 2 caters to the growing demand for multi-robot systems, such as drone swarms or collaborative industrial robots. This scalability is key to the future of robotics, where systems need to interact and work in unison efficiently.
  4. Improved Security: ROS 2 introduces built-in security features, an aspect that was largely supplementary in ROS. As robotics systems are increasingly networked and exposed to cyber threats, this focus on security is essential to protect sensitive data and ensure safe operations.
  5. Wider Application and Adoption: With enhancements in usability, security, and cross-platform support, ROS 2 is poised for broader adoption in both research and industry. This includes sectors that were previously hesitant to integrate ROS due to its limitations, potentially leading to more innovative and diverse robotic applications.
  6. Community and Ecosystem Growth: The transition to ROS 2 also signifies a vibrant and evolving community committed to addressing the contemporary challenges in robotics. This evolution fosters a more collaborative and dynamic ecosystem, driving further advancements in the field.

In summary, the shift to ROS 2 is more than a technical upgrade; it represents an alignment with the evolving demands and complexities of modern robotics, ensuring that the framework remains at the forefront of innovation in this rapidly advancing field.

ROS Overview: The Defacto Standard

The Robot Operating System (ROS) has established itself as a foundational framework in the field of robotics, known for its innovation and adaptability. In this section, we delve into the technical intricacies of ROS, examining its core features, design goals, and architectural framework, while also highlighting the limitations that necessitated the evolution to ROS 2.

Core Features of ROS

Design Goals: Emphasis on Single-Robot Systems, Reusability, and Modularity At its core, ROS was designed with a clear focus on single-robot applications. The framework’s architecture was built around a standardized collection of tools, libraries, and conventions, which streamlined the development process of robotic systems. This standardization was pivotal in expediting the development of a wide spectrum of robotic applications, from basic prototypes to more complex, integrated systems.

The key design philosophy of ROS centered on reusability and modularity. This was achieved by enabling developers to create and share interchangeable software components. Such an ecosystem facilitated the construction of sophisticated and diverse robotic applications, effectively reducing development time and enhancing collaborative potential.

Modular Architecture and Communication Patterns
The architectural design of ROS is characterized by its modularity. It operates on a network of nodes — individual processes or executables that perform specific functions like sensing, actuation, computation, or decision-making. These nodes communicate with each other via a publish-subscribe mechanism for data sharing or a client-server model for service requests. Nodes are simply C++ programs or Python script using the underlying ROS libraries.

A distinctive aspect of ROS’s architecture is its reliance on a centralized node known as the ROS master node (ROSCORE). This node acts as a registry and facilitator for inter-node communication, maintaining a record of publishers, subscribers, and services. While this centralized design simplifies network management, it also introduces challenges in terms of scalability and fault tolerance — a single point of failure can disrupt the entire network.

Limitations of ROS

Despite ROS’s widespread adoption and success, its design and architectural choices led to certain limitations:

  1. Single-Robot Focus: The ROS infrastructure was primarily tailored for individual robot systems, lacking inherent support for coordinated multi-robot operations. This focus limited its applicability in scenarios requiring swarm robotics or collaborative robotic systems.
  2. Lack of Real-Time Guarantees: ROS did not natively support real-time processing, a critical requirement for applications demanding precise timing and synchronization, such as in industrial automation or autonomous vehicle navigation.
  3. Scalability and Reliability Concerns: The dependence on the centralized ROS master node raised scalability issues for larger, more complex systems. Moreover, this single point of failure could compromise the reliability of the entire system.

Recognizing these limitations, the robotics community, led by the Open Source Robotics Foundation (OSRF), initiated the development of ROS 2. This next-generation framework aims to address the challenges of real-time processing, scalability, multi-robot systems, and overall system reliability, marking a significant leap in the evolution of robotic software frameworks.

ROS 2 — The Next Generation

ROS 2 emerges as a beacon of this evolution, addressing the limitations of its predecessor, ROS, and introducing a suite of advanced features and architectural enhancements. Let’s explore the design goals and architectural advancements that make ROS 2 a pivotal development in robotics.

Design Goals of ROS 2

  1. Focus on Swarm Robotics: Unlike ROS, which was tailored for single-robot applications, ROS 2 shifts its focus to swarm robotics. This change is significant because swarm robotics involves complex, coordinated behavior among multiple robots, demanding a more flexible and distributed communication infrastructure. ROS 2’s design facilitates efficient coordination and collective behavior, which are vital in swarm robotic applications.
  2. Real-Time and QoS Guarantees: One of the critical limitations of ROS was its lack of support for real-time processing and Quality of Service (QoS) guarantees. ROS 2 places these features at the forefront. The ability to ensure real-time operation and prioritize message delivery based on their importance is crucial for applications like autonomous vehicles and industrial robotics, where timing and reliability are paramount.
  3. Fast Prototyping and Cross-Platform Compatibility: ROS 2 emphasizes ease of transition from prototyping to production, offering cross-platform compatibility. This aspect is crucial for the rapid development and deployment of applications across diverse platforms, making ROS 2 more versatile and user-friendly than ROS, especially in production environments.

Architectural Advancements in ROS 2

  1. Distributed by Design: ROS 2 introduces a fundamentally distributed architecture, a stark contrast to ROS’s centralized design. By eliminating the need for a central master node, ROS 2 overcomes the scalability and single-point-of-failure limitations of ROS. This decentralized approach aligns better with the demands of large-scale, distributed robotic applications, ensuring more robust and reliable communication.
  2. Enhanced Scalability and Modularity: Continuing the ROS tradition, ROS 2 maintains a modular architecture but extends it with the concept of ‘Managed Nodes.’ These nodes, governed by a lifecycle manager, provide greater control over the system’s state and behavior. The scalability is further enhanced due to the distributed nature of ROS 2, allowing more efficient management of a larger number of nodes.
  3. Extended Communication Patterns: ROS 2 retains the primary communication patterns of ROS but introduces significant improvements. It incorporates Quality of Service (QoS) policies for topics, enabling more precise control over message delivery. This addition, along with the retention of synchronous and asynchronous client/server models, makes communication in ROS 2 more flexible and reliable.
  4. Revolutionized Client Libraries and Middleware: With ROS 2, there’s a shift to more robust and feature-rich client libraries, namely rclcpp for C++ and rclpy for Python. The most notable advancement in ROS 2 is the adoption of the Data Distribution Service (DDS) as its communication middleware. DDS, known for its high-performance, real-time, scalable, and interoperable publish-subscribe communication, addresses the limitations of ROS’s custom protocols. This transition not only enhances real-time capabilities and security mechanisms but also ensures interoperability with a broader range of systems and technologies.

In summary, ROS 2 represents a significant leap forward in robotic software frameworks. Its emphasis on real-time processing, distributed architecture, and enhanced communication capabilities makes it a formidable successor to ROS, poised to redefine the landscape of robotics applications. The next section will delve into the non-architectural differences between ROS and ROS 2, further highlighting the advancements ROS 2 brings to the field.

DDS: Revolutionizing Middleware Communication in ROS 2

The adoption of the Data Distribution Service (DDS) as the communication middleware in ROS 2 marks a significant advancement in the way robotic systems communicate and interact. DDS is a middleware protocol and API standard for data-centric connectivity from the Object Management Group (OMG). It offers several key features that make it an ideal choice for the complex and diverse demands of modern robotics.

Key Features of DDS

  1. High-Performance Communication: DDS provides efficient, low-latency data transfer, crucial for real-time robotic applications where timely response and data processing are essential. This performance is achieved through optimized data paths and minimal overhead in message serialization and deserialization.
  2. Real-Time Capability: One of the primary reasons for selecting DDS in ROS 2 is its native support for real-time systems. DDS can handle time-critical data delivery, ensuring that messages are not only delivered quickly but also predictably, a requirement in scenarios like autonomous vehicle coordination or industrial automation.
  3. Scalability: DDS excels in scalable systems, capable of managing communications in both small-scale and large-scale distributed networks. This scalability is vital for ROS 2, as it aims to support everything from individual robotic units to complex, multi-robot systems.
  4. Quality of Service (QoS) Policies: A standout feature of DDS is its comprehensive set of QoS policies. These policies allow developers to fine-tune various aspects of data communication, such as reliability, durability, deadline, latency, and more. Such granular control over communication parameters allows for customized configurations tailored to the specific needs of each application.
  5. Interoperability: DDS standardizes the way data is exchanged, promoting interoperability among systems. This feature is particularly beneficial in heterogeneous environments where different systems and technologies need to communicate and work in unison.
  6. Robust Security Mechanisms: DDS includes built-in security features offering encryption, authentication, and access control. These features are integral to ensuring data integrity and privacy, especially in applications where sensitive data is communicated over potentially insecure networks.
  7. Data-Centric Publish-Subscribe (DCPS) Model: At its core, DDS operates on a data-centric publish-subscribe model. This model facilitates a decentralized and loosely coupled architecture, where data producers (publishers) and data consumers (subscribers) interact dynamically based on the data itself, rather than predefined message paths.
  8. Fault Tolerance: DDS supports fault-tolerant communication, enabling systems to maintain operational integrity even in the face of node failures or network disruptions. This resilience is essential in robotic systems, where uninterrupted operation is often critical.

Impact of DDS in ROS 2

The integration of DDS into ROS 2 drastically enhances the framework’s communication capabilities, making it more suited for a wider array of applications, from simple robotic tasks to complex, multi-robot operations in industrial, commercial, and research environments. By leveraging DDS, ROS 2 addresses many of the communication and operational challenges faced in ROS, setting a new standard for reliability, efficiency, and scalability in robotic middleware.

Detailed Comparison: ROS vs. ROS 2

In the realm of robotic development, understanding the nuances between ROS and ROS 2 is crucial for developers and researchers. While both frameworks share a common lineage, their non-architectural differences are pivotal in the evolution of robotic applications. This section explores these differences, focusing on programming languages, executor models, transformation libraries, navigation stacks, security enhancements, and platform support.

Non-Architectural Aspects

Programming Languages — C++ and Python Support:

  • C++ in ROS 2: ROS 2 embraces modern C++ features like move semantics and lambda functions, offering a significant boost in performance and readability. The adoption of C++14 in core libraries expands the scope for using advanced C++ features, thus empowering developers with cutting-edge tools for robotic programming.
  • Python in ROS 2: Moving from Python 2 in ROS to Python 3 in ROS 2, the framework aligns with contemporary Python practices. This shift enables developers to utilize recent enhancements in Python, including type hints and better asyncio support, thereby improving the efficiency of script development.

Executors:

ROS 2 introduces a sophisticated executor model, vastly different from the spinner mechanism in ROS. The new model includes SingleThreadedExecutor, MultiThreadedExecutor, and StaticSingleThreadedExecutor, each designed to optimize task execution based on the complexity and runtime requirements of the nodes. This enhanced executor model in ROS 2 ensures more efficient task management and optimal resource utilization.

Transformations — tf vs. tf2:

The transition from tf in ROS to tf2 in ROS 2 marks a significant improvement in managing coordinate frame transformations. Tf2 addresses the limitations of tf, offering a thread-safe environment, support for multiple coordinate representations, and additional features like support for non-rigid transforms and transform interpolation. These enhancements make tf2 a more robust and efficient tool in ROS 2 for handling complex transformation tasks.

ROS 2 Navigation Stack

The ROS 2 Navigation Stack, or Navigation2, represents a considerable advancement over the ROS 1 navigation stack. It introduces features such as behavior tree-based task orchestration, modularity, configurable asynchronous servers, and managed nodes, allowing for more dynamic and flexible navigation strategies. Moreover, Navigation2 takes full advantage of ROS 2’s real-time capabilities and multi-core processor support, making it more suitable for dynamic environments and a broader range of modern sensors.

Security Enhancements in ROS 2

ROS 2 was designed with security as a core component, a significant departure from ROS, where security was more of an afterthought. The introduction of the built-in security framework in ROS 2, along with the SROS2 extension, provides comprehensive security features like authentication, encryption, and access control. These features are crucial for ensuring the integrity and confidentiality of data in robotic applications, especially in scenarios involving networked or collaborative robots.

Platform Support

One of the noteworthy advancements in ROS 2 is its enhanced compatibility with various operating systems. While ROS had limited and experimental support for Windows, ROS 2 offers full-fledged support for Windows 10, alongside comprehensive support for macOS and Linux. This cross-platform compatibility, bolstered by the use of the Data Distribution Service (DDS), makes ROS 2 a more versatile and accessible framework for developers working across different platforms.

In summary, the differences between ROS and ROS 2 are not just iterative improvements but represent a paradigm shift in robotic software development. From enhanced language support and execution models to advanced navigation capabilities and robust security features, ROS 2 stands as a testament to the evolving landscape of robotics, offering a more powerful, flexible, and secure framework for the developers and innovators of tomorrow.

Conclusion

ROS 2 represents a transformative leap in robotic frameworks, going beyond mere upgrades to revolutionize the field with its significant advancements over ROS. Key among these is integrating the Data Distribution Service (DDS) for communication, introducing high-performance, real-time capabilities and robust Quality of Service (QoS) policies. This integration ensures reliable data exchange in complex, multi-robot systems.

ROS 2 also advances in programming language support, embracing modern C++ and Python 3, aligning with contemporary software practices, and expanding its integration capabilities. The framework’s new executor models significantly enhance computational resource management, providing tailored task execution approaches. This is complemented by the transition from tf to tf2 for coordinate transformations, enhancing robustness and functionality.

Navigation2, ROS 2’s updated navigation stack, features behavior trees and enhanced modularity, enabling more dynamic navigation. Additionally, ROS 2’s focus on security through its built-in framework and SROS2 extension, alongside cross-platform compatibility, makes it an appealing choice across various sectors. These advancements position ROS 2 as a catalyst for future robotic innovations and applications.

References

Here are a few more references to learn more about ROS and ROS2.

  1. Macenski, Steven; Foote, Tully; Gerkey, Brian; Lalancette, Chris; and Woodall, William. “Robot Operating System 2: Design, Architecture, and Uses in the Wild.” Science Robotics. Available at: Science.org — Robot Operating System 2., 2023
  2. Macenski, Steve (ROS 2 Project Lead, Samsung Research), Moore, Tom (Robot Localization Maintainer, Locus Robotics), Lu, David V. (ROS 1 Co-Maintainer, Metro Robots), Merzlyakov, Alexey (ROS 2 Developer, Samsung Research), and Ferguson, Michael. “From the Desks of ROS Maintainers: A Survey of Modern & Capable Mobile Robotics Algorithms in the Robot Operating System 2.”, 2023
  3. Koubaa, Anis. “ROS for Beginners I: Basics, Motion and OpenCV.” Udemy Course. Available at: Udemy — ROS for Beginners.
  4. Koubaa, Anis. “ROS2 (Foxy-Humble) For Beginners I: Basics, Motion & Lasers.” Udemy Course. Available at: Udemy — ROS2 For Beginners.
  5. Koubaa, Anis. “Robot Operating System (ROS): The Complete Reference (Volume 7), 2023.” Springer. Available at: Springer — Robot Operating System (ROS): The Complete Reference.

--

--

ScaleX Innovation
ScaleX Innovation

Written by ScaleX Innovation

ScaleX Innovation excels in Generative AI & Large Language Models, driving business innovation with ethical AI solutions across diverse industries. [scalexi.ai]

Responses (1)