Parameter challenge
With this challenge, you will practice everything you’ve seen in this chapter: declaring and getting parameters in your code, providing parameters’ values at runtime, and saving the values inside a YAML file. We will just skip parameter callbacks, but feel free to add them if you want to practice those too.
As usual for challenges, I will first explain what the challenge is and then provide the Python solution. You can find the complete code for both Python and C++ in the book’s GitHub repository.
Challenge
We will continue to improve the turtle_controller
node. For this challenge, we want to be able to choose different settings at runtime:
- Pen color on the right side
- Pen color on the left side
- Velocity to publish on the
cmd_vel
topic
To do that, you will add these parameters:
color_1
: Instead of just arbitrarily choosing a color for when the turtle is on the right side, we rename the color ascolor_1
...