Control Allocation: rework motor stop logic for FW low thrust#26494
Draft
Control Allocation: rework motor stop logic for FW low thrust#26494
Conversation
🔎 FLASH Analysispx4_fmu-v5x [Total VM Diff: -56 byte (-0 %)]px4_fmu-v6x [Total VM Diff: -40 byte (-0 %)]Updated: 2026-02-18T17:16:23 |
Signed-off-by: Silvan <silvan@auterion.com>
Signed-off-by: Silvan <silvan@auterion.com>
Signed-off-by: Silvan <silvan@auterion.com>
…ish_actuator_controls Motors can be stopped, if: - the thrust setpoint is NaN (new) - the flight phase needs stopping of that motor - they failed In the first two cases, we still want the slew rate to apply, therefore we will (in a later commit) add them both in front of the slew rate.
The stopped motor mask is currently a shared piece of state that is used
for two purposes:
- stopping motors due to the flight phase
- stopping motors due to low thrust (removed in previous commit)
To handle the shared state more neatly we store the two conditions that
stop motors separately:
- For stopping motors because they are not used in the current flight
phase, the bitmask _stopped_motors_mask_due_to_flight_phase is used.
By default it is 0, and individual ActuatorEffectiveness* classes may
update it in setFlightPhase
- For stopping motors due to NaN thrust setpoint, we have the flags
_{forwards,upwards}_motors_stopped_by_thrust with their setters
- in getStoppedMotors, the two are combined to form the overall rotors
stopped mask
By separating the reasons like this we remove the need of carrying over
state in the different setFlightPhase methods (&=, |=).
introducing more variables than strictly necessary to clearly specify what is input and what is output. no functional change
The mask is stored in the effectiveness source and applied *before* the slew rate limit is applied.
While in VehicleThrustSetpoint.msg we define the NaN = turn off motors convention for all directions, there is not really a use case for turning off upwards motors _due to low thrust_. Either we do it only for forward which is actually used, or we revert this but also introduce it for sideways rotors so all crazy vehicles could work.
3349084 to
bd0d885
Compare
Contributor
|
Added my commits addressing the open TODO, and rebased on main (only one small conflict with #25799). Detailed explanation & SITL testing results will follow (after that one and possibly more small fixes) |
…ttle of NaN To accomodate for the previous change (giving pusher throttle of NaN if pusher assist not used)
Contributor
|
I have extracted some of my changes into a separate PR: #26530. That one only fixes the issue with the output slew rate not applying when the output becomes NaN. Then we can decide on defining NaN=stop motors in thrust setpoints, or a different solution to be able to turn off motors in fixed-wing even with higher min PWM (tiltrotor/tailsitter) without being in a rush. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces #24684
Solved Problem
The 2% threshold is very hidden in the CA module, plus it means that a 0 thrust input is not slew rated inside the CA.
Solution
Handle the logic in the FW rate controller, and define in the
VehicleThrustSetpoint.msgthatNANthrust meansstop motor (disarmed value). That way, when there is a throttle spike to 0 from the controller the slew rate in the CA is still applied.It also removes quite some complexity and code bloat from CA.
Changelog Entry
For release notes:
Alternatives
#24684
Test coverage
None.
Context