ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The dynamic reconfigure server has an undocumented updateConfig method, which appears to do what you're looking for: https://github.com/ros/dynamic_reconfigure/blob/4e643b94a2487f6b70b9483e2ea657bc3b6a1030/include/dynamic_reconfigure/server.h#L99

To use it, it looks like you also need to have an external mutex for controlling access to the dynamic_reconfigure config.

Not tested, but this _might_ work:

boost::recursive_mutex config_mutex;
dynamic_reconfigure::Server<dynamic_tutorials::TutorialsConfig> server;
dynamic_reconfigure::Server<dynamic_tutorials::TutorialsConfig>::CallbackType f;

f = boost::bind(&callback, _1, _2);
server.setCallback(f);

dynamic_tutorials::TutorialsConfig new_config;
server.updateConfig(new_config);

Note that the dynamic_recofigure::Server API doesn't require that the mutex be locked before calling updateConfig; it does the appropriate locking internally.