Parameters – Making Nodes More Dynamic
We are now done with the basics of ROS 2 communications. In this chapter, we will continue to work on nodes, but this time by making them more dynamic with parameters.
To understand parameters, I will start with why we need them in the first place. Then, you will learn how to add parameters to your nodes so that you can customize them at runtime. You will also see how to load multiple parameters at once with YAML files and how to allow parameters to be modified in your code with parameter callbacks.
As a starting point, we will use the code inside the ch7
folder of the book’s GitHub repository (https://github.com/PacktPublishing/ROS-2-from-Scratch). If you skipped actions (Chapter 7), you can also start from the ch6
folder, which will work the same. The final code for this chapter will be in the ch8
folder.
By the end of this chapter, you will be able to add parameters to any of your nodes and handle parameters for other...