Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Hands-On ROS for Robotics Programming

You're reading from  Hands-On ROS for Robotics Programming

Product type Book
Published in Feb 2020
Publisher Packt
ISBN-13 9781838551308
Pages 432 pages
Edition 1st Edition
Languages
Concepts
Author (1):
Bernardo Ronquillo Japón Bernardo Ronquillo Japón
Profile icon Bernardo Ronquillo Japón

Table of Contents (19) Chapters

Preface Section 1: Physical Robot Assembly and Testing
Assembling the Robot Unit Testing of GoPiGo3 Getting Started with ROS Section 2: Robot Simulation with Gazebo
Creating the Virtual Two-Wheeled ROS Robot Simulating Robot Behavior with Gazebo Section 3: Autonomous Navigation Using SLAM
Programming in ROS - Commands and Tools Robot Control and Simulation Virtual SLAM and Navigation Using Gazebo SLAM for Robot Navigation Section 4: Adaptive Robot Behavior Using Machine Learning
Applying Machine Learning in Robotics Machine Learning with OpenAI Gym Achieve a Goal through Reinforcement Learning Assessment Other Books You May Enjoy

SLAM for Robot Navigation

In this chapter, you will deep dive into robot navigation, a ubiquitous task in robotics engineering. Typical use cases include self-driving cars and transporting materials in a factory. You will find that the map we generated previously by applying SLAM (Simultaneous localization and mapping) is used for path planning along the way. Given an initial pose, the robot will travel along the optimal path and should be capable of reacting to dynamic events, that is, it should be able to avoid the obstacles (static or dynamic) that appeared after the map was built.

This chapter is a natural extension of the previous one. In the previous chapter, you gained a practical understanding of SLAM and navigation, and you did that inside the Gazebo simulator using a virtual model of GoPiGo3. Now, you are ready to complete the exercise again with a physical robot. By...

Technical requirements

In this chapter, we will make use of the code located in the Chapter9_GoPiGo_SLAM folder (https://github.com/PacktPublishing/Hands-On-ROS-for-Robotics-Programming/tree/master/Chapter9_GoPiGo_SLAM). Copy its files to the ROS workspace so that they're available and leave the rest outside the src folder. This way, you will have a cleaner ROS environment:

$ cp -R ~/Hands-On-ROS-for-Robotics-Programming/Chapter9_GoPiGo_SLAM ~/catkin_ws/src/

The code in the aforementioned folder contains two new ROS packages, each one located within a folder that has the same name:

  • ydlidar, the officially supported ROS package for the selected LDS.
  • gopigo3_navigation, the top-level package for performing navigation with GoPiGo3.

You will use both on the laptop environment, but in the robot that is, the Raspberry Pi you will only need ydlidar since the...

Preparing an LDS for your robot

Before you begin, you should take some time to review all the documentation provided by the manufacturer EAI. You can find all the resources at http://www.ydlidar.com/download. Pay special attention to the following items:

  • The YDLIDAR X4 user manual, to get familiar with the hardware and install it safely with your robot.
  • The YDLIDAR X4 ROS manual, located within the compressed ROS.zip file. The ros folder inside corresponds to the ROS package, but you should clone it from GitHub to make sure you get the latest version and stay updated. Follow the instructions at https://github.com/EAIBOT/ydlidar to get the most recent version of the code.
EAI has removed CAD (short for Computer-Aided Design) models from the download page.
  • The YDLIDAR X4 development manual, which describes the communication protocol so that you can build your own driver to control...

Creating a navigation application in ROS

An application that provides a robot with navigation capabilities has to take into account the following points:

  • Sensing: This provides us with the ability to acquire motion data so that the robot is able to estimate its position in real time. This kind of information is known as robot odometry. There are two main sources of sensor data: the encoders, which let us know the rotation of the robot wheels, and the IMU sensor, which provides acceleration and rotation information about the robot as a whole. Generally speaking, data from encoders is used the most, although it may be combined with IMU data to improve the accuracy of the pose estimation. This is an advanced topic called fusion sensor, which is out of the scope of this book.
  • Localization/pose estimation: As a result of odometry and the current map of the environment, the AMCL...

Practicing navigation with GoPiGo3

In this section, we'll cover the steps that we followed in the Practising SLAM and navigation with GoPiGo3 section of the previous chapter by substituting the virtual robot and the Gazebo simulator with the actual GoPiGo3 and the physical environment, respectively.

Building a map of the environment

First, let's consider a physical environment that's simple enough for our learning purposes. This can be seen in the following photograph:

Be aware that this almost-square space has three limiting sides and one step that cannot be detected by the laser sensor because it is below the floor level of the robot.

Going to ROS, the first step consists of mapping the environment so that...

Summary

In this chapter, you finally completed an autonomous task using GoPiGo3. This is only the entry point to the fascinating field of artificial intelligence applied to robotics. The most obvious functionality to be built on top of robot navigation is self-driving, which is the functionality that is currently being implemented by many vehicle manufacturers to make safer and more comfortable vehicles for the end users.

In the fourth and last part of this book, you will learn how machine learning techniques are applied nowadays to build smarter robots.

Questions

  1. Which of these sensors is of the LDS type?

A) LIDAR
B) Ultrasonic distance sensor
C) Capacitive sensors

  1. Where does the ROS master node have to live to perform navigation?

A) In the robot
B) In the robot and the laptop
C) In either the robot or the laptop

  1. What will happen if an obstacle is placed in the environment after the map has been built?

A) The robot will not detect it and may crash with it if it interferes with the planned path.
B) The local path planning will be taken into account to provide a modified path that avoids the obstacle.
C) You should rebuild the map with the new conditions before proceeding to the navigation task.

  1. Can you perform navigation without previously running SLAM with the robot?

A) No, because you have to build the map with the same robot that you will use for navigation.
B) Yes, the only condition is that you provide a premade map...

Further reading

The main resource that you can read in order to deepen your knowledge of SLAM is the official documentation of the ROS Navigation Stack, which is located at http://wiki.ros.org/navigation. For those of you who are interested, here are some additional references:

  • ROS Navigation: Concepts and Tutorial, Federal University of Technology, Longhi R., Schneider A., Fabro J., Becker T., and Amilgar V. (2018), Parana, Curitiba, Brazil.
  • Lidar design, use, and calibration concepts for correct environmental detection, in IEEE Transactions on Robotics and Automation, M. D. Adams (2000) vol. 16, no. 6, pp. 753-761, Dec. 2000, doi: 10.1109/70.897786. URL: http://ieeexplore.ieee.org/stamp/stamp.jsp?tp=&arnumber=897786&isnumber=19436.
  • The LIDAR Odometry in the SLAM, V. Kirnos, V. Antipov, A. Priorov, and V. Kokovkina, 23rd Conference of Open Innovations Association (FRUCT...
lock icon The rest of the chapter is locked
You have been reading a chapter from
Hands-On ROS for Robotics Programming
Published in: Feb 2020 Publisher: Packt ISBN-13: 9781838551308
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}