Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
ROS 2 from Scratch
ROS 2 from Scratch

ROS 2 from Scratch: Get started with ROS 2 and create robotics applications with Python and C++

Arrow left icon
Profile Icon Edouard Renard
Arrow right icon
€8.99 €23.99
eBook Nov 2024 380 pages 1st Edition
eBook
€8.99 €23.99
Paperback
€29.99
Subscription
Free Trial
Renews at €18.99p/m
Arrow left icon
Profile Icon Edouard Renard
Arrow right icon
€8.99 €23.99
eBook Nov 2024 380 pages 1st Edition
eBook
€8.99 €23.99
Paperback
€29.99
Subscription
Free Trial
Renews at €18.99p/m
eBook
€8.99 €23.99
Paperback
€29.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

ROS 2 from Scratch

Introduction to ROS 2 – What Is ROS 2?

Robot Operating System (ROS) can be confusing, as evidenced by its name. It’s difficult to know what it is exactly, what it contains, and what it does. Also, why do you even need ROS, and when should you use it?

Before getting started, it is okay to be confused—most people are. Although ROS is one of the best tools to learn and develop robotics applications, it also comes with a steep learning curve, with the first roadblock being understanding what it is.

In this quick first chapter, I will explain the terminology we will use throughout this book. You will then see why ROS exists, and what problems it can solve for you. After that, we will dive a bit deeper into the four pillars of ROS to understand what it is. You will also see a few examples of when and when not to use it.

By the end of this chapter, you will have a better understanding of the global picture behind ROS and be clear of the most common confusions...

Terminology

You might have seen the terms ROS, ROS 1, ROS 2, and other kinds of variations (with or without a space), which can be confusing.

Let’s clear this up now:

  • ROS 1 is (was) the first version of ROS
  • ROS 2 is the second and newer version of ROS and will be the focus of this book

In this book, I will use the following convention:

  • ROS: When talking about general ROS concepts, philosophy, and so on
  • ROS 1: When talking specifically about the first version of ROS. However, this will be quite rare since the focus here is on ROS 2
  • ROS 2: When talking about the second version of ROS

Note

I may sometimes write ROS or ROS 2 interchangeably since we won’t be focusing on ROS 1 here.

It’s not impossible that, in the future (when ROS 1 has completely disappeared), the name ROS 2 becomes ROS again. If you’ve heard about Angular, it started as AngularJS, after which they released Angular2, and then a few years later...

What is ROS, when should we use it, and why?

Before we start understanding what ROS is, let’s understand why we would need it.

Why ROS?

Let’s start with a big problem that occurs often in robotics.

Imagine that you just got a new project at your job, and you have to develop a robotics application, or you are doing a new research thesis. One very important thing to take into account is that in real life, any project or thesis will have a specific duration, from a few months to a few years.

Now, what will happen?

You start to design the robotics system you need for your project and soon realize that it will take a lot of time to develop the robot because all the existing solutions you found don’t match what you need. After a few weeks, you finalize the specifications, and you start building your robot. A few months in, you’re still developing the basic software for wheel control and navigation. You underestimated how much time it would take...

ROS 1 versus ROS 2

To be clear, this book is all about ROS 2, not ROS 1. You will start learning ROS 2 from zero experience. This section is probably the only time I will be talking that much about ROS 1.

A quick story of ROS, and how we got to ROS 2

ROS 1 (originally called ROS) was first developed in 2007. It quickly gained popularity and grew exponentially in the following years.

In 2014, the ROS 2 project was announced. Simply put, ROS 1 was a bit too limited for industrial applications (lack of real-time support, safety, and so on) and was only used in research/education. To solve this problem, the developers decided to make ROS more “industrial friendly,” as well as make it better, thanks to all the lessons learned from the beginning of ROS.

Now, why create ROS 2 and not just continue ROS with some new changes? Well, the changes were too big, and they would have completely broken compatibility with older versions. Thus, it was decided to create a completely...

Prerequisites for starting with ROS 2

To get started with ROS and this book, there are a few things you need to know.

Knowledge prerequisites

It is best that you have some knowledge of the following:

  • Linux command line: Since we’ll be using Ubuntu, being familiar with Linux is mandatory. You don’t need to be an expert—you just need to know the basics. Many tools in ROS 2 involve the command line, so knowing how to open a Terminal and write basic commands will help you tremendously.
  • Python programming: The two most common languages for ROS are Python and C++. Python is easier to get started with and allows you to prototype things faster. Hence, this is the language we will use for all detailed explanations. You need to know Python basics, and object-oriented programming (OOP) is a good plus as ROS 2 is heavily using OOP everywhere.
  • Optional: C++ programming. Even if the focus of the book is on Python, I still wanted to include C++ code for...

How to follow this book

The book is divided into three parts, including 14 chapters.

Each chapter can be followed individually, although for one chapter, you need the knowledge from all previous chapters.

If you got this book because you just want to get started from scratch, then it’s simple: follow the book in the order it’s been written. I have designed it specifically so that you learn the concepts one step at a time without having to think about what directions you should take.

Then, as you progress, feel free to come back to any chapter to clear up doubts. I encourage you to do that. The first time you learn about a concept, you don’t necessarily grasp all the subtleties. As you continue with this book and use the concept along with other new concepts, you often have ‘epiphany moments’, when everything clicks together.

If you already know some ROS 2 basics (or you’ve already read this book), then feel free to jump to any chapter...

Summary

In this introductory chapter, we cleared up some of the most common confusion points regarding ROS: its name, what it is and isn’t, when to use it, and why. You also learned more about the different ROS versions (ROS 1 and ROS 2), and you learned what kind of prerequisites you need to get started with ROS 2.

You should now have a better understanding of the big picture, and even if everything still seems a bit confusing, don’t worry too much—it will all make sense when you use the ROS 2 concepts and code with them.

Now, to be able to use ROS 2, we need to install it. This will be the focus of the next chapter and will help you get your environment 100% ready for ROS 2.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Build a strong foundation in ROS 2 and instill confidence for future robotics projects
  • Leverage best practices to create scalable ROS 2 applications with Python and C++
  • Follow a step-by-step process to create and simulate a custom robot using ROS 2
  • Purchase of the print or Kindle book includes a free PDF eBook

Description

ROS 2 from Scratch, written by the cofounder of a robotics company with years of experience in teaching and engineering, will equip you with the skills necessary to develop cutting-edge robotic systems efficiently. This book will help you understand why you should use Robot Operating System (ROS), clarifying what ROS is and isn’t. It focuses on applied learning—no unnecessary filler, no abstract theory, and no abrupt leaps into complex topics. You’ll discover how to install ROS 2, set up your environment, and explore concepts through hands-on experiments, as well as create a ROS 2 application for a custom robot. The chapters expand upon core concepts such as nodes, communication via topics, client-server interactions with services, complex behaviors using actions, runtime configurations with parameters, and seamless node orchestration via launch files. Each concept is clearly explained with the help of real-life analogies and practical examples, using Python and C++. The book will also guide you through creating a real-world project that incorporates TFs, URDF, RViz, and Gazebo. By the end of this book, you’ll be able to create new software for any robot in no time and easily join existing projects for new job roles, research endeavors, and beyond.

Who is this book for?

This book is for engineers, researchers, teachers, students, and hobbyists eager to learn ROS 2 from scratch and build real-world robotics applications efficiently. If you’re struggling to get started with ROS 2 or find existing tutorials overwhelming, then this book is for you. This book teaches you all the basics you need to create your own ROS 2 apps, without prior ROS knowledge. Basic Linux command line and Python programming skills (C++ optional for following the C++ code examples) are necessary.

What you will learn

  • Understand what ROS 2 is, when to use it, and how to use it
  • Write ROS 2 programs using nodes, topics, services, actions, and custom interfaces
  • Scale your application with parameters and launch files
  • Get a complete overview of how TFs work for any ROS-powered robot
  • Create a robot model (with URDF) and visualize TFs on RViz
  • Adapt the URDF to spawn and control your robot in the Gazebo simulator

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Nov 22, 2024
Length: 380 pages
Edition : 1st
Language : English
ISBN-13 : 9781835881415
Category :
Concepts :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Nov 22, 2024
Length: 380 pages
Edition : 1st
Language : English
ISBN-13 : 9781835881415
Category :
Concepts :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
Banner background image

Table of Contents

19 Chapters
Part 1:Getting Started with ROS 2 Chevron down icon Chevron up icon
Chapter 1: Introduction to ROS 2 – What Is ROS 2? Chevron down icon Chevron up icon
Chapter 2: Installing and Setting Up ROS 2 Chevron down icon Chevron up icon
Chapter 3: Uncovering ROS 2 Core Concepts Chevron down icon Chevron up icon
Part 2: Developing with ROS 2 – Python and C++ Chevron down icon Chevron up icon
Chapter 4: Writing and Building a ROS 2 Node Chevron down icon Chevron up icon
Chapter 5: Topics – Sending and Receiving Messages between Nodes Chevron down icon Chevron up icon
Chapter 6: Services – Client/Server Interaction between Nodes Chevron down icon Chevron up icon
Chapter 7: Actions – When Services Are Not Enough Chevron down icon Chevron up icon
Chapter 8: Parameters – Making Nodes More Dynamic Chevron down icon Chevron up icon
Chapter 9: Launch Files – Starting All Your Nodes at Once Chevron down icon Chevron up icon
Part 3: Creating and Simulating a Custom Robot with ROS 2 Chevron down icon Chevron up icon
Chapter 10: Discovering TFs with RViz Chevron down icon Chevron up icon
Chapter 11: Creating a URDF for a Robot Chevron down icon Chevron up icon
Chapter 12: Publishing TFs and Packaging the URDF Chevron down icon Chevron up icon
Chapter 13: Simulating a Robot in Gazebo Chevron down icon Chevron up icon
Chapter 14: Going Further – What To Do Next Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.