dynamic_reconfigure icon indicating copy to clipboard operation
dynamic_reconfigure copied to clipboard

Make C++ Config instances have default values in constructor

Open lucasw opened this issue 6 years ago • 3 comments

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']

)

lucasw avatar May 18 '18 14:05 lucasw

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

mikaelarguedas avatar Sep 19 '18 00:09 mikaelarguedas

What's the status on this?

rowandempster avatar Mar 10 '21 17:03 rowandempster

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

lucasw avatar Oct 25 '21 00:10 lucasw