ros2 / demos

Apache License 2.0
502 stars 330 forks source link

Fix the set_parameters_callback example program. #608

Closed clalancette closed 1 year ago

clalancette commented 1 year ago

In particular, the 'on_set_parameter_callback' callback was checking for undeclared parameters, but that could not have been a problem since 'allow_undeclared_parameters' is set to false by default.

Instead, change the logic in that callback to arbitrarily reject parameters > 5.0 (for param1) or < -5.0 (for param2). That is a much better demonstration of what this node should do.

Also add in a print during the constructor, telling the user what to expect.

clalancette commented 1 year ago

CI: