Skip to content

Conversation

niklaut
Copy link
Contributor

@niklaut niklaut commented May 28, 2025

Solved Problem

When attaching a UAVCAN servo, the output does not work.
The UAVCAN message that gets sent is uavcan.equipment.actuator.ArrayCommand, but all command_values are in the range [1, 3], while the COMMAND_TYPE_UNITLESS expects a range of [-1, +1].

Solution

The formula for conversion was wrong, the input is [1000, 2000] and should map to [-1, +1]. The subtraction was -1, instead of -3.

Changelog Entry

For release notes:

Bugfix: Fix UAVCAN actuator output conversion

Test coverage

  • Tested in hardware

Input [1000us, 2000us] -> [-1, 1] output.
@niklaut niklaut requested a review from bkueng May 28, 2025 09:28
@MaEtUgR
Copy link
Member

MaEtUgR commented Jun 2, 2025

the input is [1000, 2000]

Where is that from? As I understand it, UAVCAN servos currently need to be configured in the Actuator tab with an output range of [0, 1000] because the input is of type uint16_t. We want to switch to float to support arbitrary units and negative values for reversible motors, simulations, UAVCAN, and non-PWM rover ESCs, .... Related PR: #21656

If you now change the input range for UAVCAN servos from [0, 1000] to [1000, 2000] then it would break all existing configurations for UAVCAN servos and users would need to adjust to it (FYI @TedObrien). I'd suggest to keep the current [0, 1000] input range and then when we finally support floats make it [-1, 1] directly instead of some temporary positive integer range.

Please correct me if I misunderstood.

@niklaut
Copy link
Contributor Author

niklaut commented Jun 2, 2025

The issue was miscommunicated to me and this is not the solution and didn't help.

@niklaut niklaut closed this Jun 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants