Skip to content

Read only parameters#495

Merged
wjwwood merged 48 commits intomasterfrom
read_only_parameters
Apr 23, 2019
Merged

Read only parameters#495
wjwwood merged 48 commits intomasterfrom
read_only_parameters

Conversation

@sloretz
Copy link
Copy Markdown
Contributor

@sloretz sloretz commented Jun 8, 2018

This adds Node::create_parameter() and a boolean allow_undeclared_parameters to the node's constructor. Parameters may be given a type, a default value, and a bool indicating whether or not they're read only. Read only parameters are initialized, but may not be changed after initialization.

The features work except for a test failure in test_time_source.cpp, and I have no idea why. The failure symptom is the on_parameter_event callback in TimeSource does not get called.

The time_source test passes if I step through the problem area in GDB. That is, I set a breakpoint at the start of the failing test then set a break point inside TimeSource::on_parameter_event. If I hit 'c' for continue the test fails and the breakpoint is not reached. If I instead hit n repeatedly then the breakpoint is reached in the spin() call and the test passes.

There are a couple missing features. Since this PR adds the concept of declaring parameters, it should be possible for a node to error if a run-time user tries to set an undeclared parameter. This could be done with a method that throws if any undeclared parameters where provided, but a node-author would be responsible for calling this method after all parameters have been declared.

Other nodes may allow undeclared parameters (like the observation source parameters in obstacle layer in costmap 2d). If they pass allow_undeclared_parameters = true to the constructor then the initial parameters provided by a run-time user are immediately set on a node. A future enhancement could let a node say parameters starting with foo.bar. may be undeclared.

requires #488

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

10 participants