What is a ROS 2 parameter?
You have already experimented a bit with parameters in Chapter 3, where you ran a node with different settings.
I am now going to start from scratch again and explain parameters with a real-life example.
Why parameters?
Let’s start with a problem to understand the need for parameters. I will use a camera driver as an example—we won’t write the node; it’s just for the explanation.
This camera driver connects to a USB camera, reads images, and publishes them on a ROS 2 topic. This is classic behavior for any ROS 2 hardware driver.
Inside this node, you will have some variables for different kinds of settings. Here are some examples:
- USB device name
- Frames per second (FPS)
- Simulation mode
Let’s say the camera you’re working on is connected to the /dev/ttyUSB0
port (typical USB port name on Linux). You want to set 60
FPS and not use the simulation mode (false
). Those are the values...