Mastering ROS 2 for Robotics Programming (eBook)
576 Seiten
Packt Publishing (Verlag)
978-1-83620-900-3 (ISBN)
The rising demand for advanced robotics software has made proficiency in frameworks like ROS 2 essential for engineers and enthusiasts alike.
Lentin Joseph, co-founder of RUNTIME Robotics, and Jonathan Cacace, PhD in robotics, help you grasp the foundational concepts and practical applications in this comprehensive fourth edition updated to cover the latest LTS release from 2024-ROS 2 Jazzy. Starting with a solid introduction to ROS 2, including core components and tools, the chapters get you ready to start programming and using its key features confidently. Building on this, the book focuses on 3D robot modeling and simulation with the new Gazebo Sim, supported by ROS 2 controllers. You'll explore high-level features such as Nav2 for navigation and MoveIt 2 for manipulation, which are crucial for developing advanced systems. You'll also dive into aerial robotics with ROS 2 and learn how to build real-world robots using Micro-ROS. The concluding chapters cover advanced topics like CI/CD workflows, interfacing ROS 2 with large language model (LLM) agents for intelligent planning, and applying deep reinforcement learning for autonomy.
By the end of this book, you'll have a strong foundation in ROS 2, along with the skills needed to build sophisticated, real-world robotic applications.
In this fourth edition, master ROS 2 by creating robotics software applications that integrate the latest technologies, like Generative AI and reinforcement learning, to build your custom robotAll formats include a free PDF and an invitation to the Embedded System Professionals communityKey FeaturesGet a solid understanding of ROS 2 core concepts and features from scratchDesign, simulate, and prototype robotic applications using ROS 2, C++, Python, and GazeboGain hands-on experience with the latest technologies like GenAI and reinforcement learning, integrated with ROS 2 JazzyPurchase of the print or Kindle book includes a free PDF eBookBook DescriptionThe rising demand for advanced robotics software has made proficiency in frameworks like ROS 2 essential for engineers and enthusiasts alike. Lentin Joseph, co-founder of RUNTIME Robotics, and Jonathan Cacace, PhD in robotics, help you grasp the foundational concepts and practical applications in this comprehensive fourth edition updated to cover the latest LTS release from 2024 ROS 2 Jazzy. Starting with a solid introduction to ROS 2, including core components and tools, the chapters get you ready to start programming and using its key features confidently. Building on this, the book focuses on 3D robot modeling and simulation with the new Gazebo Sim, supported by ROS 2 controllers. You ll explore high-level features such as Nav2 for navigation and MoveIt 2 for manipulation, which are crucial for developing advanced systems. You'll also dive into aerial robotics with ROS 2 and learn how to build real-world robots using Micro-ROS. The concluding chapters cover advanced topics like CI/CD workflows, interfacing ROS 2 with large language model (LLM) agents for intelligent planning, and applying deep reinforcement learning for autonomy. By the end of this book, you'll have a strong foundation in ROS 2, along with the skills needed to build sophisticated, real-world robotic applications.What you will learnExplore ROS 2 architecture, DDS, and communication interfaces in depthSimulate various robots using Gazebo and ROS 2Master Nav2 and MoveIt 2 in ROS 2Explore ros2_control and PerceptionBuild and program a real mobile robot from scratch using Raspberry Pi board and ROS 2Build LLM-based AI agents in ROS 2Implement reinforcement learning applications in ROS 2, NVIDIA Isaac Lab, and Isaac SimWho this book is forIf you are a robotics enthusiast, researcher, or software professional looking to advance your skills in ROS 2, this book is for you. ROS developers who wish to explore the advanced features of ROS 2 will also find this book helpful. Basic knowledge of ROS, GNU/Linux, and C++, as well as Python programming concepts is necessary to get started with this book.]]>
Preface
ROS 2, the Robot Operating System 2, is a major milestone in robotics software development. More than just a tool, it is a modular, open-source ecosystem designed to support the creation of scalable, distributed, and intelligent robotic systems. Its adoption has grown rapidly across sectors—from startups developing autonomous robots, to aerospace and manufacturing companies, to leading research institutions—thanks to its strong community, robust architecture, and a rich set of tools that streamline the development of complex robotics applications. Mastering ROS 2 for Robotics Programming is a comprehensive guide designed for developers and roboticists who want to go beyond the basics and learn how to leverage the full capabilities of ROS 2. Whether you’re building mobile robots, manipulators, drones, or hybrid systems, this book will provide you with the knowledge and practical skills needed to develop and integrate advanced robotic behaviors using ROS 2.
We will begin by introducing the ROS 2 architecture and programming model, guiding you through setting up your development environment and creating your first nodes using C++. From there, we will cover key ROS 2 concepts—topics, services, actions, parameters, and launch systems—providing real-world examples along the way. As we move forward, you’ll learn how to:
- Build 3D models of robots and use them with simulators like Gazebo to test behavior in realistic environments
- Implement robot control systems with the
ros2_controlframework - Develop behavior trees for task planning using the
BehaviorTree.CPPlibrary - Use ROS 2 Navigation Stack (Nav2) to enable autonomous movement
- Apply robot manipulation with MoveIt 2 for grasping and motion planning
- Incorporate sensor data and vision systems into perception pipelines
- Work with aerial robots using ROS 2 interfaces and control systems
Advanced chapters will introduce you to modern practices, such as writing tests, setting up continuous integration and deployment pipelines for ROS 2 packages, and using cloud-native tools to build robust robotics software. You’ll also explore how to interface ROS 2 with artificial intelligence, including:
- Task planning using large language models
- Training reinforcement learning agents with ROS 2 environments
- Creating custom visualization and simulation plugins for more interactive development
Additionally, you will learn how to connect motors with ROS 2 nodes using Raspberry Pi boards.
This book is filled with practical examples helping you improve programming ROS 2 applications. The code examples in the book are based on ROS 2’s jazzy, the latest long-term-support distributions and compatible with widely used robot platforms. We hope this book becomes a valuable companion in your own robotics journey and helps you to truly master ROS 2.
Let’s get started!
Who this book is for
This book is intended for robotic software developers and IT professionals who have a foundational understanding of robotics and ROS programming. Readers should be familiar with Ubuntu Linux and command-line tools, have basic experience with C++, and have the foundational knowledge of robotics concepts to fully benefit from the content.
What this book covers
Chapter 1, Introduction to ROS 2, introduces the Robot Operating System 2 (ROS 2), its architecture, communication mechanisms, and its advantages over ROS 1. It sets the foundation for developing modern, distributed robotic systems.
Chapter 2, Getting Started with ROS 2 Programming, walks you through setting up a ROS 2 development environment on Ubuntu, creating and building packages, and writing basic publisher and subscriber nodes in C++.
Chapter 3, Implementing ROS 2 Concepts, dives into core ROS 2 functionalities, such as services, actions, parameters, and lifecycle nodes, demonstrating how to build modular and maintainable robotic software.
Chapter 4, Working with Robot 3D Modeling in ROS 2, explains how to create 3D robot models using URDF and Xacro, including sensor and actuator integration, and how to visualize the models using RViz.
Chapter 5, Simulating Robots in a Realistic Environment, shows how to set up robot simulations using Gazebo, Webots, and Nvidia Omniverse, integrating ROS 2 interfaces for testing robot behavior in virtual environments.
Chapter 6, Controlling Robots Using the ros2_control Package, explores how to configure and use the ros2_control framework to manage hardware interfaces and controllers for differential, wheeled, and articulated robots.
Chapter 7, Implementing ROS 2 Applications Using BehaviorTree.CPP, introduces the BehaviorTree.CPP library and explains how to create flexible and reactive decision-making logic for robotic tasks.
Chapter 8, ROS 2 Navigation Stack: Nav2, covers the setup and configuration of the ROS 2 Navigation Stack (Nav2), including map building, localization, path planning, and obstacle avoidance for mobile robots.
Chapter 9, Robot Manipulation Using MoveIt 2, provides a practical guide to using MoveIt 2 for robot arm planning, motion execution, collision checking, and integration with perception systems.
Chapter 10, Working with ROS 2 and Perception Stack, introduces tools and libraries for integrating cameras and depth sensors with ROS 2, processing sensor data, and using it for object detection and scene understanding.
Chapter 11, Aerial Robotics and ROS 2, explores the integration of ROS 2 with aerial robot platforms such as drones, including flight control, localization, and sensor integration.
Chapter 12, Designing and Programming a DIY Mobile Robot from Scratch, explains how to build and interface with ROS 2 and Nav 2, a cheap Do It Yourself robot, using a Raspberry pi board and eclectic motors and micro controllers.
Chapter 13, Testing, Continuous Integration, and Continuous Deployment with ROS 2, presents best practices for testing ROS 2 packages, setting up CI pipelines, and deploying software updates reliably in robotic systems.
Chapter 14, Interfacing Large Language Models with ROS 2, explores how to integrate LLMs with ROS 2 for high-level task planning, command interpretation, and natural language interfaces.
Chapter 15, ROS 2 and Deep Reinforcement Learning, introduces deep reinforcement learning concepts and demonstrates how to train and evaluate policies for robot control using ROS 2 environments.
Chapter 16, Implementing ROS 2 Visualization and Simulation Plugins, covers how to extend RViz and simulation tools with custom plugins to support visualization and interaction with specialized robot components and data.
To get the most out of this book
Before diving into the content, it’s important to clarify the foundational knowledge and tools that will help you make the most of this book. This book assumes that you have a basic understanding of C++ and are comfortable working in a Linux environment, particularly Ubuntu, as many of the examples and tools are designed and tested on this platform. You do not need to be an expert, but familiarity with command-line usage and package management.
As for hardware requirements, a standard computer is enough for most chapters, though in a few cases, having a GPU-enabled system with an NVIDIA card is suggested but not required. Finally, standard webcams and depth sensors are used in the computer vision chapter.
Download the example code files
The code bundle for the book is hosted on GitHub at https://github.com/PacktPublishing/Mastering-ROS-2-for-Robotics-Programming. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing. Check them out!
Download the color images
We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://packt.link/gbp/9781836209010.
This book contains some wide screenshots. These have been captured to provide readers with an overview of the entire console. As a result, the text on these images may appear small at 100% zoom. Kindly refer to color images in the graphics bundle above for better comprehension.
Conventions used
There are a number of text conventions used throughout this book.
CodeInText: Indicates code words in text, folder names, filenames, file extensions, pathnames, dummy URLs or user command input. Here is an example: “After enabling the universe repository, let’s add the ROS 2 GPG key and apt sources list “
A block of code is set as follows:
<inertia ixx="${mass / 12.0 * (width*width + height1*height1)}" ixy="0.0" ixz="0.0" ...| Erscheint lt. Verlag | 28.7.2025 |
|---|---|
| Sprache | englisch |
| Themenwelt | Mathematik / Informatik ► Informatik ► Programmiersprachen / -werkzeuge |
| Informatik ► Software Entwicklung ► User Interfaces (HCI) | |
| Informatik ► Weitere Themen ► Hardware | |
| ISBN-10 | 1-83620-900-2 / 1836209002 |
| ISBN-13 | 978-1-83620-900-3 / 9781836209003 |
| Informationen gemäß Produktsicherheitsverordnung (GPSR) | |
| Haben Sie eine Frage zum Produkt? |
Digital Rights Management: ohne DRM
Dieses eBook enthält kein DRM oder Kopierschutz. Eine Weitergabe an Dritte ist jedoch rechtlich nicht zulässig, weil Sie beim Kauf nur die Rechte an der persönlichen Nutzung erwerben.
Dateiformat: EPUB (Electronic Publication)
EPUB ist ein offener Standard für eBooks und eignet sich besonders zur Darstellung von Belletristik und Sachbüchern. Der Fließtext wird dynamisch an die Display- und Schriftgröße angepasst. Auch für mobile Lesegeräte ist EPUB daher gut geeignet.
Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen dafür die kostenlose Software Adobe Digital Editions.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen dafür eine kostenlose App.
Geräteliste und zusätzliche Hinweise
Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.
aus dem Bereich