-
Notifications
You must be signed in to change notification settings - Fork 14.8k
control_allocator: Added linearization feature for 4 servo swash plates to prevent binding #23961
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
bresch
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I just added a couple of comments
src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessHelicopter.cpp
Outdated
Show resolved
Hide resolved
src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessHelicopter.cpp
Show resolved
Hide resolved
src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessHelicopter.cpp
Outdated
Show resolved
Hide resolved
src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessHelicopter.hpp
Outdated
Show resolved
Hide resolved
src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessHelicopter.hpp
Outdated
Show resolved
Hide resolved
|
Thanks very much for the comments @bresch. I'll make those changes and let you know once I've built and tested it again. |
|
@bresch in the requested changes, there was a semi-colon missing and |
src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessHelicopter.cpp
Outdated
Show resolved
Hide resolved
|
Hey @TedObrien thanks for the PR! One of the tests caught what appears to be an error here https://github.com/PX4/PX4-Autopilot/actions/runs/12006914552/job/33466430278?pr=23961#step:6:9100 |
|
Hi @mrpollo, sorry about that. I'm currently stumped as to why it's failing at that line, and only on Ubuntu 24.04, but have recreated the error. I'll try to work out why and request a review once it's sorted. Cheers! |
It's due to the newer GCC / CMake combo with updated warnings. We are moving to enforce those very strictly. |
|
@TedObrien Instead of having a parameter to enable the feature and one to specify the throw, could we just default the throw to -1 or 0 and only enable the feature if the throw is >0? @MaEtUgR Do you have other comments on this? |
|
Hi @bresch, sorry for the delay in getting back to you. That makes sense to me. I'll try and be explicit in the parameter description that setting the throw > 0 enables the linearization feature also. I could see someone thinking it needs to be set as part of a standard swash-plate set up otherwise. The two new parameters can currently be changed within the actuators tab. Do you think I should remove it, so the new throw parameter can only be accessed via the parameter list to avoid potential confusion? |
…o help prevent servo binding
Co-authored-by: Mathieu Bresciani <[email protected]>
Co-authored-by: Mathieu Bresciani <[email protected]>
… Update param description.
…standard swashplate setup.
… linearization feature
|
Thank you @TedObrien for the contribution! Sorry that it took so long but I finally went through in detail. I suggest you take it over and/or adjust to your liking while doing so such that we keep the same pull request. |
src/modules/control_allocator/ActuatorEffectiveness/ActuatorEffectivenessHelicopter.cpp
Outdated
Show resolved
Hide resolved
1e130d7 to
05851a8
Compare
MaEtUgR
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for following up
AFAIK Mathieu was waiting for me to have a look as well.
…es to prevent binding (#23961) * control_allocator: Added linearization feature for heli swashplates to help prevent servo binding * Apply suggestions from code review Co-authored-by: Mathieu Bresciani <[email protected]> * update description of CA_LIN_SERVO parameter * update variable name * add missing semi-colon * fix variable referenced before assignment * add missing indentation Co-authored-by: Mathieu Bresciani <[email protected]> * removed param unnecessary param * removed whitespace * remove CA_LIN_SERVO and enable feature if CA_MAX_SERVO_THROW > 0 plus Update param description. * remove CA_MAX_SVO_THROW from actuators tab to avoid confusion during standard swashplate setup. * added comment and fixed spelling mistake * fix spelling mistake * fix formatting * reduce CA_MAX_SVO_THROW short description length to stop test failure * ActuatorEffectivenessHelicopter: clarfification suggestions for servo linearization feature * remove NAN check. --------- Co-authored-by: Mathieu Bresciani <[email protected]> Co-authored-by: Matthias Grob <[email protected]>
Solved Problem
When using a 4 servo swash plate, non-linearity due to the rotation of the servo arm can cause servo misalignment and binding, particularly at high collective + cyclic inputs. This results in higher loads on servos.
Solution
Add 2 parameters,
CA_LIN_SERVOandCA_MAX_SVO_THROW, to account for the nonlinear output due to servo-arm rotation.CA_LIN_SERVO: Enables the feature.CA_MAX_SVO_THROW: Allows you to define the maximum throw of the servos in degrees. Set to 50 degrees by default.The feature works as follows:
CA_MAX_SVO_THROW(in radians)This feature was implemented in Ardupilot a while ago. I have used the same logic and added a parameter to adjust the max servo throw. The following links provide further information.
This requires a specific setup to work correctly. It assumes that the servo is centered on its physical throw and the swash plate in its mid position will give hover collective. The above links provide more detail about this.
Test coverage
Tested on a skynode (v5x) with a 4-servo swash plate
Disconnected one of the 4 linkages from the swash plate.
Commanded max collective/cyclic with

CA_LIN_SERVOdisabled and observed poor alignment of disconnected linkage and swash plate.Commanded max collective/cyclic with

CA_LIN_SERVOenabled and observed improvement in alignment between disconnected linkage and swash plate.