Book Image

Mastering ROS for Robotics Programming, Third edition - Third Edition

By : Lentin Joseph, Jonathan Cacace
Book Image

Mastering ROS for Robotics Programming, Third edition - Third Edition

By: Lentin Joseph, Jonathan Cacace

Overview of this book

The Robot Operating System (ROS) is a software framework used for programming complex robots. ROS enables you to develop software for building complex robots without writing code from scratch, saving valuable development time. Mastering ROS for Robotics Programming provides complete coverage of the advanced concepts using easy-to-understand, practical examples and step-by-step explanations of essential concepts that you can apply to your ROS robotics projects. The book begins by helping you get to grips with the basic concepts necessary for programming robots with ROS. You'll then discover how to develop a robot simulation, as well as an actual robot, and understand how to apply high-level capabilities such as navigation and manipulation from scratch. As you advance, you'll learn how to create ROS controllers and plugins and explore ROS's industrial applications and how it interacts with aerial robots. Finally, you'll discover best practices and methods for working with ROS efficiently. By the end of this ROS book, you'll have learned how to create various applications in ROS and build your first ROS robot.
Table of Contents (22 chapters)
1
Section 1 – ROS Programming Essentials
4
Section 2 – ROS Robot Simulation
11
Section 3 – ROS Robot Hardware Prototyping
15
Section 4 – Advanced ROS Programming

Why should we use ROS?

Robot Operating System (ROS) is a flexible framework that provides various tools and libraries for writing robotic software. It offers several powerful features to help developers in tasks such as message passing, distributed computing, code reusing, and implementing state-of-the-art algorithms for robotic applications. The ROS project was started in 2007 by Morgan Quigley and its development continued at Willow Garage, a robotics research lab for developing hardware and open source software for robots. The goal of ROS was to establish a standard way to program robots while offering off-the-shelf software components that can be easily integrated with custom robotic applications. There are many reasons to choose ROS as a programming framework, and some of them are as follows:

  • High-end capabilities: ROS comes with ready-to-use functionalities. For example, the Simultaneous Localization and Mapping (SLAM) and Adaptive Monte Carlo Localization (AMCL) packages in ROS can be used for having autonomous navigation in mobile robots, while the MoveIt package can be used for motion planning for robot manipulators. These capabilities can directly be used in our robot software without any hassle. In several cases, these packages are enough for having core robotics tasks on different platforms. Also, these capabilities are highly configurable; we can fine-tune each one using various parameters.
  • Tons of tools: The ROS ecosystem is packed with tons of tools for debugging, visualizing, and having a simulation. The tools, such as rqt_gui, RViz, and Gazebo, are some of the strongest open source tools for debugging, visualization, and simulation. A software framework that has this many tools is very rare.
  • Support for high-end sensors and actuators: ROS allows us to use different device drivers and the interface packages of various sensors and actuators in robotics. Such high-end sensors include 3D LIDAR, laser scanners, depth sensors, actuators, and more. We can interface these components with ROS without any hassle.
  • Inter-platform operability: The ROS message-passing middleware allows communication between different programs. In ROS, this middleware is known as nodes. These nodes can be programmed in any language that has ROS client libraries. We can write high-haveance nodes in C++ or C and other nodes in Python or Java.
  • Modularity: One of the issues that can occur in most standalone robotic applications is that if any of the threads of the main code crash, the entire robot application can stop. In ROS, the situation is different; we are writing different nodes for each process, and if one node crashes, the system can still work.
  • Concurrent resource handling: Handling a hardware resource via more than two processes is always a headache. Imagine that we want to process an image from a camera for face detection and motion detection; we can either write the code as a single entity that can do both, or we can write a single-threaded piece of code for concurrency. If we want to add more than two features to threads, the application behavior will become complex and difficult to debug. But in ROS, we can access devices using ROS topics from the ROS drivers. Any number of ROS nodes can subscribe to the image message from the ROS camera driver, and each node can have different functionalities. This can reduce the complexity in computation and also increase the debugging ability of the entire system.

The ROS community is growing very fast, and there are many users and developers worldwide. Most high-end robotics companies are now porting their software to ROS. This trend is also visible in industrial robotics, in which companies are switching from proprietary robotic applications to ROS.

Now that we know why it is convenient to study ROS, we can start introducing its core concepts. There are mainly three levels in ROS: the filesystem level, the computation graph level, and the community level. We will briefly have a look at each level.