You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There seem to be some issues with the handling of array parameters. I'm encountering problems with setting parameters and getting my application terminated, because of
Wrong parameter type, parameter {myParam} is of type {integer}, setting it to {integer_array} is not allowed.
Changing out element_bounds to bounds will demote the parameter to a single integer and cause the error at the start. Removing the validation block will fix the problem.
This uses the method rclcpp::Parameter::get_value with the template argument passed into the bounds method. The problem is that the template argument is int64_t and the parameter type is correctly integer_array. This is the reason for the separate bounds and element_bounds validation methods as you have discovered.
How do we make this error more useful (or earlier, maybe compile time?). The error message correctly states that the types don't match but doesn't say where the error occurred.
For a better run-time error, we could catch that exception in the validator functions and add to the text explaining where the error occurred (and what the user could do about it).
Ideally, we'd catch this at compile time, though, or better-yet make the problem disappear and eliminate the need for the user to know about bounds and element_bounds. All the information is there at compile time to insert the code that does what the user expects.
There seem to be some issues with the handling of array parameters. I'm encountering problems with setting parameters and getting my application terminated, because of
Working configuration:
parameters.yaml
config.yaml
bounds demoting array to single integer
parameters.yaml
Changing out element_bounds to bounds will demote the parameter to a single integer and cause the error at the start. Removing the validation block will fix the problem.
No default_value demotes to single integer
parameters.yaml
Removing the default_value key will also demote the array. Removing the validation block will change nothing.
Something fishy is going on here, could you have a look? Thank you <3
The text was updated successfully, but these errors were encountered: