In the previous chapters, we have seen how to create our robot, mount some sensors and actuators, and move it through the virtual world using a joystick or the keyboard. In this chapter, you will learn what is probably one of the most powerful features in ROS, something that will let you move your robot autonomously.
Thanks to the community and the shared code, ROS has many algorithms that can be used for navigation.
First of all, in this chapter, you will learn all the necessary ways to configure the navigation stack with your robot. In the next chapter, you will learn how to configure and launch the navigation stack on the simulated robot, giving goals and configuring some parameters to get the best results. In particular, we will cover the following topics in this chapter:
tf
library—showing the transformation of one physical element to the other from the frame; for example, the data received using a sensor or the command for the desired position of an actuator. tf
is a library for keeping track of the coordinate frames.In order to understand the navigation stack, you should think of it as a set of algorithms that use the sensors of the robot and the odometry so that you can control the robot using a standard message. It can move your robot without any problems, such as crashing, getting stuck in a location, or getting lost to another position.
You would assume that this stack can be easily used with any robot. This is almost true, but it is necessary to tune some configuration files and write some nodes to use the stack.
The robot must satisfy some requirements before it uses the navigation stack:
The following diagram shows you how the navigation stacks are organized. You can see three groups of boxes with colors (gray and white) and dotted lines. The plain white boxes indicate the stacks that are provided by ROS, and they have all the nodes to make your robot really autonomous:
In the following sections, we will see how to create the parts marked in gray in the diagram. These parts depend on the platform used; this means that it is necessary to write code to adapt the platform to be used in ROS and to be used by the navigation stack.