Getting Started with ROS2: An Introduction

Part 1 of our “Getting Started with ROS2" Series

Sagar Kumar
Spinor
4 min readMay 8, 2024

--

Welcome to our series on ROS2. If you have never used the Robot Operating System(ROS) before, even ROS1, or if you want a practical and quick refreshment of the basics then this series is for you. This introductory article will explore Robot Operating System 2 (ROS2) and its evolution from ROS1. Feel free to explore the links provided to understand better the concepts discussed.

As we progress through the series, you can look forward to a range of topics that will deepen your understanding of ROS2. We’ll cover everything from installation and setup to advanced concepts like real-time performance and scalability. You’ll learn how to build and deploy ROS2 applications, leveraging its powerful features to create cutting-edge robotic systems. So let’s get started!

ROS2 101

Robot Operating System (ROS) is a flexible framework for writing robot software. It provides libraries and tools to help developers create complex robot applications. ROS2 is the latest version of ROS, designed to improve upon ROS1’s limitations and address new requirements in robotics and automation. Let’s explore the evolution of ROS from its inception to the current ROS2 version.

ROS1: The Beginning

ROS1 was introduced in 2007 by the Stanford Artificial Intelligence Laboratory in collaboration with Willow Garage. It quickly gained popularity in the robotics community due to its open-source nature and rich set of tools. ROS1 was primarily designed for research and prototyping, focusing on simplicity and flexibility.

However, as robotic applications became more complex and diverse, ROS1 started showing limitations in terms of real-time performance, scalability, and compatibility with modern software development practices. These limitations led to the development of ROS2.

ROS2: Addressing Limitations

  • ROS2 development began in 2014 as a joint effort by the Open Source Robotics Foundation (OSRF) and Willow Garage. The primary goal of ROS2 was to address the shortcomings of ROS1 while maintaining compatibility with existing ROS1 codebases.
  • One of the key improvements in ROS2 is better real-time performance and determinism. ROS2 introduces a more modular architecture that allows for better control over real-time requirements, making it suitable for a wider range of robotic applications, including industrial automation and autonomous vehicles.
  • ROS2 also improves on ROS1’s communication infrastructure, introducing a new middleware called Data Distribution Service (DDS). DDS provides more efficient and reliable communication between nodes, especially in large-scale robotic systems.
  • Another important aspect of ROS2 is its improved support for different operating systems and platforms. While ROS1 was primarily designed for Linux, ROS2 has better support for Windows and macOS, making it more accessible to a broader audience of developers.

Some basic concepts of ROS2

  • Workspaces: Workspaces in ROS2 are directories where you store your ROS2 packages. They help organize your development environment and manage dependencies between packages.
  • Packages: Packages are the basic unit of software in ROS2. They contain libraries, executables, scripts, and other files needed for your ROS2 nodes. Each package can be independently built, tested, and distributed.
  • Launch Files: Launch files are XML files used to launch ROS2 nodes and set their parameters. They provide a convenient way to start multiple nodes with the correct configuration for your robot.
  • Nodes: Nodes are executable files that perform computation in ROS2. They communicate with each other using topics, services, and parameters to achieve the desired behavior of your robot.
  • Client Libraries: ROS2 provides client libraries in different programming languages (e.g., C++, Python) to help you write ROS2 nodes. These libraries provide APIs for interacting with ROS2 concepts like topics, services, and parameters.
  • ros2 bag: Record data published on a topic so you can replay and examine it at any time.
  • Interfaces: ROS applications typically communicate through interfaces of one of three types: topics, services, or actions.

Next….

In the upcoming articles,

  • We’ll discuss the key differences between ROS1 and ROS2, highlighting the advancements that make ROS2 a compelling choice for roboticists.
  • We’ll explore the process of installing and setting up ROS2, guiding you through each step to ensure your development environment is ready for your projects. We’ll also take a detailed look at how nodes operate within the ROS2 framework, understanding their crucial role in enabling communication and functionality in robotic systems.
  • Moreover, we’ll examine how the Publisher and Subscriber model facilitates seamless data exchange between nodes via “Topics”. We’ll also simplify the concept of “Services”, the Client and Server interaction that allows nodes to request and provide specific functionalities.
  • We’ll also shed light on the concept of “Actions”, by comprehensively understanding how they enable complex, asynchronous behavior in ROS2.
  • Furthermore, we’ll discuss the importance of “logging” in ROS2, highlighting how it aids in debugging and monitoring the performance of our robotic applications.
  • We’ll also explore the capabilities of RVIZ, a powerful visualization tool in ROS2 that allows you to visualize sensor data, robot models, and more, providing valuable insights into the behavior of your robotic systems.
  • Lastly, We’ll walk you through the process of building ROS2 packages, showing you how to structure your code and manage dependencies effectively. You’ll learn how to create your first ROS2 application, gaining hands-on experience in developing robotic systems using ROS2.

So stay tuned for our next article, where we’ll continue our exploration of ROS2. Thank you for joining us on this journey of exploration and learning!

Additional Reading

  1. ROS 2 Documentation
  2. Robot Operating System 2: Design, Architecture, and Uses In The Wild

--

--

Sagar Kumar
Spinor
Editor for

Sagar is a computer vision and robotics expert with a focus on Perception & Localization | Twitter: twitter.com/sagarcadet | Linkedin: linkedin.com/in/sagark30