Hello everyone, I am blowing air conditioning wrapped in a quilt of fish.
ROS2 parameters are actually implemented with the service, how did fish know?
Run a random node and you can see many more parameters related to the service using the following instructions.
ros2 service list
Copy the code
Like starting the turtle simulator
ros2 run turtlesim turtlesim_node
Copy the code
These additional services are used to manipulate the parameters of this node
/turtlesim/describe_parameters/turtlesim/get_parameter_types/turtlesim/get_parameters/turtlesim/list_parameters/turtlesi m/set_parameters/turtlesim/set_parameters_atomicallyCopy the code
How do we view parameters using a service?
Adjust the service manually
ros2 service call /turtlesim/list_parameters rcl_interfaces/srv/ListParameters "{prefixes: [],depth: 0}"
Copy the code
Here you can see the four parameters in the result
names=['background_b', 'background_g', 'background_r','use_sim_time']
Copy the code
Use ros2 param list to see if this is correct
ros2 param list
Copy the code
Are they the same?
conclusion
The above experiment tells us that the parameter operation of ROS2 is actually realized through service communication, and the parameter list acquisition, set and GET operations are to operate the corresponding service.
I am a small fish, welcome to follow the public account “Yu Xiang ROS” to join the technical exchange group! Learn ROS2 robot ~ together