Open mojomex opened 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.:
rclcpp::Node::add_on_set_parameters_callback
||
get_param
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).
true
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:
Will be fixed once PRs
are merged into main.
main
Some callbacks for parameter changes (registered via
rclcpp::Node::add_on_set_parameters_callback
) use short-circuit||
operators to chain multipleget_param
calls, e.g.:As soon as one of those parameters is found,
get_param
returnstrue
, thus stopping execution early (short-circuit operator).The correct operator to use would be the
|
operator, which does not short-circuit and thus allget_param
statements are executed:Functions exhibiting this behavior: