PWM: Servo center & asymetric deflection#25897
Conversation
|
For review: @mahima-yoga, @sfuhrer |
mahima-yoga
left a comment
There was a problem hiding this comment.
Didn't get through everything yet but since I am going on holiday for a few days I will post my partial review in case I don't manage to get through the rest today/tomorrow 😄
sfuhrer
left a comment
There was a problem hiding this comment.
We should start thinking about how to handle the transition from the current "trim on the control surface function" to "trim on the servo output".
- remove the function trim (but then how is trimming done for UAVCAN servos? And can we translate the settings on existing airframes to the PWM_TRIM?)
- display warning when the legacy fields are being altered ("consider setting PWM_TRIM instead of surface trim")
- set all surface trims to 0 when any PWM_TRIM is set to non-1500PWM
|
269797d to
2b53193
Compare
6d9b229 to
00ab877
Compare
sfuhrer
left a comment
There was a problem hiding this comment.
It's in a very good state. What I would still consider:
- default the _CENT params to -1, so keep it disabled and do the PWM range linearily from MIN to MAX
- hide the CENT params for motors in the UI (if complexity is reasonable)
89072cd to
264d53e
Compare
The default is now -1. Unfortunately, hiding these parameters is quite complex and would required large changes in mavlink, and maybe the groundstations, that I do not think are worth the effort. |
Signed-off-by: Silvan <silvan@auterion.com>
|
No flaws found |
|
@ttechnick I've added the event for the warning when TRIM settings are present and you add CENTER. |
sfuhrer
left a comment
There was a problem hiding this comment.
Ready to go now from my side. The transition (from TRIM to CENTER) is handled diligently, and docs are clean.
Let's squash-merge.
Add PWM_*_CENTERx for each servo. Use a bilinear transform to map actuator_servos to PWM signals. This solution only works for PWM based servos. Other types of servos are not affected. * PWM: Add servo trim option * PWM: Improve documentation of PWM trim feature * PWM: cleaner clamping and docs typo * update documentation & safety * add migration formula * rename param from trim to center * docs with center instead of trim * move clamping and reorder values * improve documentation * adress failing range check * improve documentation * CA: add event for setting CENTER with TRIM Signed-off-by: Silvan <silvan@auterion.com> --------- Signed-off-by: Silvan <silvan@auterion.com> Co-authored-by: Silvan <silvan@auterion.com>
Add PWM_*_CENTERx for each servo. Use a bilinear transform to map actuator_servos to PWM signals. This solution only works for PWM based servos. Other types of servos are not affected. * PWM: Add servo trim option * PWM: Improve documentation of PWM trim feature * PWM: cleaner clamping and docs typo * update documentation & safety * add migration formula * rename param from trim to center * docs with center instead of trim * move clamping and reorder values * improve documentation * adress failing range check * improve documentation * CA: add event for setting CENTER with TRIM Signed-off-by: Silvan <silvan@auterion.com> --------- Signed-off-by: Silvan <silvan@auterion.com> Co-authored-by: Silvan <silvan@auterion.com>
Add PWM_*_CENTERx for each servo. Use a bilinear transform to map actuator_servos to PWM signals. This solution only works for PWM based servos. Other types of servos are not affected. * PWM: Add servo trim option * PWM: Improve documentation of PWM trim feature * PWM: cleaner clamping and docs typo * update documentation & safety * add migration formula * rename param from trim to center * docs with center instead of trim * move clamping and reorder values * improve documentation * adress failing range check * improve documentation * CA: add event for setting CENTER with TRIM Signed-off-by: Silvan <silvan@auterion.com> --------- Signed-off-by: Silvan <silvan@auterion.com> Co-authored-by: Silvan <silvan@auterion.com>
Add PWM_*_CENTERx for each servo. Use a bilinear transform to map actuator_servos to PWM signals. This solution only works for PWM based servos. Other types of servos are not affected. * PWM: Add servo trim option * PWM: Improve documentation of PWM trim feature * PWM: cleaner clamping and docs typo * update documentation & safety * add migration formula * rename param from trim to center * docs with center instead of trim * move clamping and reorder values * improve documentation * adress failing range check * improve documentation * CA: add event for setting CENTER with TRIM Signed-off-by: Silvan <silvan@auterion.com> --------- Signed-off-by: Silvan <silvan@auterion.com> Co-authored-by: Silvan <silvan@auterion.com>

Solved Problem
Setting up servos is very tedious, because when you change the
PWM_MINandPWM_MAX, the neutral point also changes. Additionally, it was not possible to have different deflections for the positive and negative direction.Solution
PWM_*_CENTERxfor each servo.actuator_servostoPWMsignals.This solution only works for PWM based servos. Other types of servos are not affected.
Changelog Entry
For release notes:
Alternatives
We could also implement this feature for other types of servos.
Context
Illustration of the mapping form

actuator_servostopwmusing bilinear transform:Example Result:

Log (Bench):
https://review.px4.io/plot_app?log=5fed3401-4849-4417-a807-212a4ce540ab
Log (Flight):
https://review.px4.io/plot_app?log=899e5f98-3985-401c-8513-0f324339e625