Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass initial parameter values to node constructor #486

Merged
merged 8 commits into from
Jun 5, 2018

Conversation

sloretz
Copy link
Contributor

@sloretz sloretz commented May 31, 2018

PR complete, waiting for #481 to be merged first, then this needs to be targeted at master.

This allows the initial parameter values for a node to be passed in via it's constructor. These parameters are then immediately set on the node.

edit: invoked CI wrong, will wait to run until #481 is in.

blocks #477
requires #481

@sloretz sloretz added the in progress Actively being worked on (Kanban column) label May 31, 2018
@sloretz sloretz self-assigned this May 31, 2018
@sloretz sloretz changed the base branch from split_parametervariant to master June 1, 2018 18:51
@sloretz sloretz force-pushed the init_params_via_constructor branch from 9182182 to ec0500b Compare June 1, 2018 19:21
@sloretz
Copy link
Contributor Author

sloretz commented Jun 1, 2018

CI now that #481 has been merged.

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@sloretz
Copy link
Contributor Author

sloretz commented Jun 1, 2018

CI with 28ad77b

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
    • Java stack trace. Rebuild succeeded Build Status
  • Windows Build Status
    • Java stack trace. Rebuild succeeded Build Status

@sloretz sloretz added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Jun 1, 2018
@sloretz sloretz added this to the bouncy milestone Jun 4, 2018
@@ -50,6 +51,15 @@ NodeParameters::NodeParameters(
rmw_qos_profile_parameter_events,
use_intra_process,
allocator);

// TODO(sloretz) store initial values and use them when a parameter is created
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you explain this TODO a bit more for my understanding please? The impression I get is that one day we want the node to store a list of possible initial parameter values, but not actually set those parameters until a different step?

What we are doing here -- which at the moment is essentially passing in a list of initial parameters -- is not the end goal? Why not?

I have seen in the parent ticket that this is "Needed to initialize a node with parameters generated by roslaunch after it merges multiple yaml files together." but it wasn't enough for me to answer my own question

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The impression I get is that one day we want the node to store a list of possible initial parameter values, but not actually set those parameters until a different step?

Yeah, the TODO says what should happen here when (#475) is implemented. The reason for having a different step is to allow a node author to define parameters, including things like a read_only parameter that can be initialized but not modified. The parameter shouldn't be set until a node-author finishes defining parameters so that it's possible to error when a run-time user has a typo in their configuration.

What we are doing here -- which at the moment is essentially passing in a list of initial parameters -- is not the end goal? Why not?

Passing in parameters via constructor will still exist, but setting them right away instead of storing them is the back-up plan. If the whole feature doesn't get in by bouncy release then this at least allows run-time users to initialize parameters via the command line.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, 475 seems to be the missing piece in the explanation puzzle, thanks for explaining

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Referenced issue in TODO comment f30c64c

Copy link
Member

@mikaelarguedas mikaelarguedas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

{
rclcpp::init(0, NULL);
}
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: I know other tests don't all do it but it seems cleaner to have a tear down calling rclcpp::shutdown rather then just exiting the process

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added call to shutdown() in 04cb6a9

@@ -96,6 +96,7 @@ class Node : public std::enable_shared_from_this<Node>
const std::string & namespace_,
rclcpp::Context::SharedPtr context,
const std::vector<std::string> & arguments,
const std::vector<Parameter> & initial_values,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In my opinion, as a user, initial_values is not descriptive enough; I think we're relying on the type to convey extra information. When I first looked at this PR I thought "initial values for what?" (and then as you saw, I wondered why it wasn't just called "initial parameters", especially since it sets the names as well). Were there other names that you considered?

Copy link
Contributor Author

@sloretz sloretz Jun 5, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were there other names that you considered?

There were not

changed to initial_paramters plus added missing doxygen \param[in] initial_parameters in 29046af

@sloretz
Copy link
Contributor Author

sloretz commented Jun 5, 2018

CI as of ad83f5a

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

@sloretz sloretz merged commit 84c8d58 into master Jun 5, 2018
@sloretz sloretz deleted the init_params_via_constructor branch June 5, 2018 22:29
@sloretz sloretz removed the in review Waiting for review (Kanban column) label Jun 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants