tier4 / nebula

Apache License 2.0
45 stars 42 forks source link

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

Open mojomex opened 8 months ago

mojomex commented 8 months ago

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 commented 2 months ago

Will be fixed once PRs

are merged into main.