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

Bug: set_parameter will ignore everything but the first parameter #108

Closed
mojomex opened this issue Dec 15, 2023 · 2 comments
Closed

Bug: set_parameter will ignore everything but the first parameter #108

mojomex opened this issue Dec 15, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@mojomex
Copy link
Collaborator

mojomex commented Dec 15, 2023

Some callbacks for parameter changes (registered via rclcpp::Node::add_on_set_parameters_callback) use short-circuit || operators to chain multiple get_param calls, e.g.:

get_param(p, "sensor_model", sensor_model_str) ||
get_param(p, "return_mode", return_mode_str) || 
get_param(p, "host_ip", new_param.host_ip)

As soon as one of those parameters is found, get_param returns true, thus stopping execution early (short-circuit operator).

The correct operator to use would be the | operator, which does not short-circuit and thus all get_param statements are executed:

get_param(p, "sensor_model", sensor_model_str) |
get_param(p, "return_mode", return_mode_str) |
get_param(p, "host_ip", new_param.host_ip)

Functions exhibiting this behavior:

@mojomex mojomex added the bug Something isn't working label Dec 15, 2023
@mojomex
Copy link
Collaborator Author

mojomex commented Sep 26, 2024

Fixed by #127, #148, #147, #151.

@mojomex mojomex closed this as completed Sep 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant