How to publish data changed in Dynamic Reconfigure
Does anyone have an example code on how to read the data from "/node/parameter_updates"? Thanks a lot!
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
The easiest way is to use an existing dynamic reconfigure client which does the work of converting to or from messages on that topic into the cfg type which is delivered to a callbac, or published out via update_configuration()
: http://wiki.ros.org/dynamic_reconfigu... or http://wiki.ros.org/dynamic_reconfigu...
Or you can do the same on the server side.
But if you want to use the raw message (implementing your own custom client or server) you can:
$ rostopic info /example_server_node/parameter_updates
Type: dynamic_reconfigure/Config
...
$ rosmsg show dynamic_reconfigure/Config
dynamic_reconfigure/BoolParameter[] bools
string name
bool value
dynamic_reconfigure/IntParameter[] ints
string name
int32 value
dynamic_reconfigure/StrParameter[] strs
string name
string value
dynamic_reconfigure/DoubleParameter[] doubles
string name
float64 value
dynamic_reconfigure/GroupState[] groups
string name
bool state
int32 id
int32 parent
Using the above information you can populate a Config
message for publishing or decipher it in a subscriber callback. Use push_back for C++ or append in python to add IntParameters or any of the other types. You just need to use the same names in the right type slots as in the cfg file. (I believe if you only partially populate it still works, and extra names that don't match any in the cfg are ignored silently, but I haven't tried that)
I'm not sure how the groups work but if you rostopic echo an example with a group in it maybe it is self explanatory.
Asked: 2018-08-15 10:27:05 -0600
Seen: 1,639 times
Last updated: Aug 16 '18
What I really want to do is to publish the value change in dynamic configure into a topic. I want to use dynamic reconfigure to build a PID tuner. I look at the topic "/node/parameter_updates" but I have no idea how to get the value using the name.
I googled and saw that the values are mirrored in the parameter server and we can use getParamCache to check if any value is changed. Anyone has an example code that I can refer to? I just want to find an easy way to publish the value change in dynamic reconfigure into a topic. Thanks a lot!
Hi ytosclee, I am trying to accomplish the same task. Have you found a way to change the values on the parameter_updates message to update the PID gains?
Hi Funky_Watermelon, yes, the dynamic configure will create ROS parameters. So you can get/update the value using the ROS parameters.