Support setting parameters to unsigned intergers.#1759
Support setting parameters to unsigned intergers.#1759zouyonghao wants to merge 1 commit intoros2:masterfrom zouyonghao:master
Conversation
|
@zouyonghao thank you for posting PR and contribution ❗ is this related to #1743? could you describe a bit about what the actual problem is, i think it is better to discuss on what we are trying to fix as 1st. best, |
|
Hi @fujitatomoya , actually I didn't see #1743 before, I just want to use |
Signed-off-by: zouyonghao <yonghaoz1994@gmail.com>
|
Hi, @fujitatomoya . |
|
I think this only fixes construction of
i might be missing something else. |
|
I agree with you @fujitatomoya . unsigned_parameter: !uint32 123 |
wjwwood
left a comment
There was a problem hiding this comment.
Unfortunately this is by design, we do not want to ever be doing casting or truncating from unsigned to signed for the user. We would prefer instead to have the user cast the integer to an int64_t themselves, checking for these conditions and handling exceptional cases on their own.
So I would say this is a "won't fix". Sorry.
| if (int_value > INT32_MAX) { | ||
| throw std::runtime_error("Can not set a unsinged parameter to negitive value"); | ||
| } |
There was a problem hiding this comment.
We intentionally did not support unsigned integers being assigned into the signed integer parameters in order to avoid checks like this.
|
If instead you wanted to introduce a new parameter type, where the storage is So there would need to be a compelling case for adding the unsigned type to the parameter system. |
|
I'm going to close this as we don't want to include this feature, but please continue the conversation if you would like, and I can re-open the pull request if something changes during the discussion. Thanks for opening the pull request to begin with! |
|
Also, as I mentioned here: We might be able to support |
|
Here's a concrete example: I'm currently trying to use an ODrive motor controller for a robotics application. Many of the parameters on the ODrive are either uint32 or uint64 so I cannot use ROS parameters to configure these? |
No description provided.