ros / dynamic_reconfigure

BSD 3-Clause "New" or "Revised" License
48 stars 111 forks source link

Make C++ Config instances have default values in constructor #107

Open lucasw opened 6 years ago

lucasw commented 6 years ago

This generates a header with an initializer list with all the default values, previously the defaults were loaded in only when the server ran.

This works now:

...
gen.add("str_param", str_t, 1, "string", "test")
...
#include <dynamic_reconfigure_example/ExampleConfig.h>
...
dynamic_reconfigure_example::ExampleConfig config;
ROS_INFO_STREAM(config.str_param);

For #33

(There isn't a corresponding class created for python (would that be useful?), the defaults can be accessed currently like this:

from dynamic_reconfigure_example.cfg import ExampleConfig
print ExampleConfig.defaults['str_param']

)

mikaelarguedas commented 5 years ago

Sorry @lucasw for the wait and thanks for the contribution!

The line number comments came in by default and I would rather not have them, how to get rid of them?

There doesn't seem to be an no option to disable them in dynamic_reconfigure ATM.

A unit test would be good but haven't looked into that.

:+1: A unit test for this would be great

Haven't looked at why there is redundant code in parameter_generator_catkin.py and parameter_generator.py

parameter_generator.py was for rosbuild support and is now deprecated, it will be removed in a future ROS Distribution. I would recommend not modifying it in this PR and keep scope the changes to parameter_generator_catkin.py

There isn't a corresponding class created for python

Yeah it would make sense to have the symmetric in Python, though it shouldn't block the C++ version from moving forward as there is an easy way to get them


@ros-pull-request-builder retest this please

rowandempster commented 3 years ago

What's the status on this?

lucasw commented 2 years ago

Rebased this on noetic-devel, which causes the melodic build check to fail?