dynamic_reconfigure/Reviews
Contents
Package proposal
The dynamic_reconfigure package allows a node (the server) to get its configuration parameters in a way that allows parameters to be changed dynamically. The package provides:
- C++ and Python Server and Client APIs.
- GUI tool to dynamically reconfigure any node that uses the Server API.
- A command-line tool analogous to rosparam to dynamically reconfigure any node that uses the Server API.
The package satisfies the following proposed set of core requirements:
- Parameters are obtained from the parameter server at startup.
- Default values are automatically used when no parameter is specified on the parameter server.
- Parameters are maintained up to date on the parameter server when the node is reconfigured.
- Parameters are automatically clamped to be within their acceptable ranges before they are passed to the server code.
- Parameters are passed to the server code in a suitable data structure. In C++ this data structure must be a class in which the parameters are fields.
- The server code can adjust the parameter values it is given if they are illegal.
- Clients can atomically modify a subset of the parameters.
- Clients can be notified of changes to the parameters.
- It is easy for a client to determine when the parameters it set have been changed.
The package should satisfy the following proposed set of desirables:
- Documentation of the parameters can be autogenerated.
The following are hotly debated:
- How to communicate between the server and the client?
- Via the parameter server.
- Via service calls and topics.
- Using the action interface.
- What types are supported?
- Types that are supported from the C++ param API?
- Types that are supported by roslaunch?
- double, int32, string, bool?
- double, int32, string, bool + lists of these?
- Any message? (Need better support from roscpp.)
- How much effort should be put into making the GUI customizable by the nodes?
- Ability to have some parameters be advanced.
- Ability to dynamically change the ranges of the sliders.
- Ability to grey out certain fields.
- Ability to select different scales for the sliders (log scale, ...)
Give it a spin
Make sure you have run make twice in hokuyo_node/wge100_driver (autogeneration of messages is currently partly broken).
Bring up the robot.
Run
rosrun dynamic_reconfigure reconfigure_gui
Select what you want to reconfigure and reconfigure it.
If you don't want to bring up the robot, you can just run a hokuyo_node, a wge100_node or a wge100_multi_reconfigurator, and run the reconfigure_gui. You just won't be able to observe the result of your changes.
You can also play around with dynparam in the dynamic_reconfigure package.
Notes on current implementation
The description of the node's parameters is in the cfg directory (e.g. wge100_camera/cfg or hokuyo_node/cfg). In dynamic_reconfigure, I use message generation, but I don't like this implementation as in practice the message never seems to be built when you want it, and you can't atomically modify a subset of the parameters. I have started an alternate implementation in dynamic_reconfigure2 that uses a generic message. The code generation and C++ server API should be good, but I have stopped there pending the review meeting.
API Proposal
Still rough around the edges... dynamic_reconfigure works, but the C++ API sucks, and I don't like the message format. dynamic_reconfigure2 has only been partially ported to a new message format. Gives a better idea of what the C++ API should be like.
C++
Server
Have a look at dynamic_reconfigure2/test/testserver.cpp and dynamic_reconfigure
Client
Not implemented yet. Not sure how best to support modifying only selected parameters.
Python
Have a look at DynamicReconfigureServer and DynamicReconfigureClient in dynamic_reconfigure/src/dynamic_reconfigure/dynamic_reconfigure.py
Server
Have a look at wge100_camera/nodes/wge100_multi_configurator. This node is both a dynamic_reconfigure server and client. You configure it (server side), and it passes on its configuration to a list of wge100_camera nodes (client side). (Note that handling of configuration returned by wge100_node currently sucks.)
Client
Have a look at dynamic_reconfigure/dynparam for a simple example and dynamic_reconfigure/bin/reconfigure_gui for a more involved one.
Package review meeting notes
Create new package review
Enter the date in the appropriate box to generate a template for an API or code review meeting. Check the QAProcess page for more information.