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

add example of registering custom parameter validation callbacks #273

Merged
merged 2 commits into from
Aug 3, 2018

Conversation

mikaelarguedas
Copy link
Member

fixes ros2/examples#164

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

@mikaelarguedas mikaelarguedas added the in progress Actively being worked on (Kanban column) label Aug 2, 2018
Copy link
Member

@wjwwood wjwwood left a comment

Choose a reason for hiding this comment

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

Seems reasonable to me.

result.successful = false;
} else {
RCLCPP_INFO(this->get_logger(),
"parameter '%s' has changed and is now %s",
Copy link
Member

Choose a reason for hiding this comment

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

Might want to quote the second %s.

Copy link
Member

Choose a reason for hiding this comment

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

Or use a : %s

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, I purposefully avoided the quoting as I was afraid it could confuse users into thinking that a string value was set and not an integer.
I went for the 2nd approach in 6109880

Copy link
Contributor

@clalancette clalancette left a comment

Choose a reason for hiding this comment

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

This is great! The only other thing I might look for is an example that uses std::bind to pass an arbitrary argument into the param_change_callback along with the parameters. It is "just" reusing std::bind, but it is convenient to see the example all put together. However, I won't block this PR for that, it is just a nice-to-have if you feel like adding it in. Thanks.

@mikaelarguedas
Copy link
Member Author

The only other thing I might look for is an example that uses std::bind to pass an arbitrary argument into the param_change_callback along with the parameters.

I think we would need another story to justify passing extra arguments to this callback as currently its only purpose is to check for parity and I have a hard time finding a variable to pass in that would make sense.

@mikaelarguedas mikaelarguedas added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Aug 2, 2018
@mikaelarguedas
Copy link
Member Author

@clalancette Posting new comment instead of editing to sent notification:

I think we would need another story to justify passing extra arguments to this callback

I'm open to suggestions for this.
If we don't find anything compelling by tomorrow I'm planning on merging this as is.

@clalancette
Copy link
Contributor

clalancette commented Aug 3, 2018

If we don't find anything compelling by tomorrow I'm planning on merging this as is.

Nothing really compelling comes to mind, so I'd say go ahead and merge. We can always revisit later.

@mikaelarguedas
Copy link
Member Author

Sounds good, thanks for the review!

@mikaelarguedas mikaelarguedas merged commit 367a9f9 into master Aug 3, 2018
@mikaelarguedas mikaelarguedas deleted the rejecting_parameter_change_example branch August 3, 2018 17:31
@mikaelarguedas mikaelarguedas removed the in review Waiting for review (Kanban column) label Aug 3, 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.

Add a parameter example
3 participants