Skip to content
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

FW Rate Controller: fix saturation logic for VTOLs with differential thrust enabled #21713

Merged
merged 3 commits into from
Jun 19, 2023

Conversation

sfuhrer
Copy link
Contributor

@sfuhrer sfuhrer commented Jun 12, 2023

Context: #21501 (comment)

Solved Problem

Actuator saturation logic in the FW rate controller was not working as intended if the actuators for a certain axis aren't in the matrix 1 (servo matrix) for VTOL. That led to the rate controller being very often disabled as the controller thought it the axis was saturated. That in turn leads to very bad rate tracking.
It is most prominent when flying a Quad tailsitter without control surfaces, as in this case all 3 axis are affected.

Solution

Add logic for when to use which allocation matrix.

Changelog Entry

For release notes:

Bugfix: fix actuator saturation handling for VTOLs with differential thrust in fixed-wing flight

Alternatives

We need to work towards keeping this customization per vehicle in the allocation.

Test coverage

SITL tested.

I would port this to 1.14.

@MaEtUgR
Copy link
Member

MaEtUgR commented Jun 14, 2023

led to the rate controller being very often disabled

You mean integrator part I assume?

We had similar problems on helicopters. The allocation now does some interfacing with the saturation logic, it works but is not ideal:

void ActuatorEffectivenessHelicopter::getUnallocatedControl(int matrix_index, control_allocator_status_s &status)
{
// Note: the values '-1', '1' and '0' are just to indicate a negative,
// positive or no saturation to the rate controller. The actual magnitude is not used.
if (_saturation_flags.roll_pos) {
status.unallocated_torque[0] = 1.f;
} else if (_saturation_flags.roll_neg) {
status.unallocated_torque[0] = -1.f;
}
if (_saturation_flags.pitch_pos) {
status.unallocated_torque[1] = 1.f;
} else if (_saturation_flags.pitch_neg) {
status.unallocated_torque[1] = -1.f;
}
if (_saturation_flags.yaw_pos) {
status.unallocated_torque[2] = 1.f;
} else if (_saturation_flags.yaw_neg) {
status.unallocated_torque[2] = -1.f;
}
if (_saturation_flags.thrust_pos) {
status.unallocated_thrust[2] = 1.f;
} else if (_saturation_flags.thrust_neg) {
status.unallocated_thrust[2] = -1.f;
}
}

towards keeping this customization per vehicle in the allocation

Definitely 💯

@MaEtUgR MaEtUgR force-pushed the pr-fw-rate-c-quad-tail-saturation-fix-main branch from a9ee838 to 1c6088b Compare June 14, 2023 16:50
MaEtUgR
MaEtUgR previously approved these changes Jun 14, 2023
Copy link
Member

@MaEtUgR MaEtUgR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sfuhrer I reworked it 😇 What do you think? Please check if it really works as expected.

@MaEtUgR MaEtUgR force-pushed the pr-fw-rate-c-quad-tail-saturation-fix-main branch from 1c6088b to 687c049 Compare June 14, 2023 18:42
MaEtUgR
MaEtUgR previously approved these changes Jun 14, 2023
MaEtUgR and others added 2 commits June 15, 2023 17:12
This helps for more complicated cases where certain axes are controlled
through and get feedback from a different allocator.
Co-authored-by: Silvan Fuhrer <silvan@auterion.com>
@sfuhrer sfuhrer force-pushed the pr-fw-rate-c-quad-tail-saturation-fix-main branch from 687c049 to 31a18e5 Compare June 15, 2023 15:21
@sfuhrer
Copy link
Contributor Author

sfuhrer commented Jun 15, 2023

@MaEtUgR thanks a lot for the rework, much cleaner and it now even does what it was intended to do.
I've rebased and squashed the commits, ready to go from my side.

@sfuhrer sfuhrer force-pushed the pr-fw-rate-c-quad-tail-saturation-fix-main branch from bfba259 to 35b49bc Compare June 16, 2023 13:40
MaEtUgR
MaEtUgR previously approved these changes Jun 16, 2023
Copy link
Member

@MaEtUgR MaEtUgR left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

…esn't have VTOL module built

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
@sfuhrer sfuhrer force-pushed the pr-fw-rate-c-quad-tail-saturation-fix-main branch from 35b49bc to 5ce63a6 Compare June 16, 2023 14:26
@sfuhrer
Copy link
Contributor Author

sfuhrer commented Jun 16, 2023

CI was complaining about _param_vt_fw_difthr_en being int and not int32_t. Addressed and force pushed.

@sfuhrer sfuhrer merged commit 4632fbd into main Jun 19, 2023
83 of 85 checks passed
@sfuhrer sfuhrer deleted the pr-fw-rate-c-quad-tail-saturation-fix-main branch June 19, 2023 08:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hybrid VTOL 🛩️🚁 Multirotor + Fixedwing!
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants