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

Remove mode_req_local_alt from Descend mode and handle it in FW position controller #23840

Merged
merged 3 commits into from
Oct 25, 2024

Conversation

sfuhrer
Copy link
Contributor

@sfuhrer sfuhrer commented Oct 22, 2024

Solved Problem

I recently crashed a VTOL vehicle in FW after disabling both GPS and baro fusion in air, which made it switch from AUTO to TERMINATE mode.

Solution

  • remove mode requirement for a valid altitude estimate from DESCEND
  • similar to what is done for MC handle invalid v/vz in the FW position controller. For FW we in case of invalid v/vz measurements would likely just want the thrust to be 0, such that the vehicle glides down to the ground while still tracking the loiter (assuming it doesn't stall).

Changelog Entry

For release notes:

Improvement: Remove mode_req_local_alt from Descend mode and handle it in FW position controller

Test coverage

Can be easily tested in SITL: Disable Baro fusion (EKF2_BARO_CTRL), then takeoff in auto mode, then disable GPS fusion --> with current main it goes to Termination mode, with this PR to Descend.

Jaeyoung-Lim
Jaeyoung-Lim previously approved these changes Oct 23, 2024
Copy link
Member

@Jaeyoung-Lim Jaeyoung-Lim left a comment

Choose a reason for hiding this comment

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

Sorry for the crash.

LGTM, just one minor point that you can decide whether to incorporate

src/modules/fw_pos_control/FixedwingPositionControl.cpp Outdated Show resolved Hide resolved
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.

It looks good but I gave it a spin on multicopter and even though it does the right thing in the end the flight task produces invalid setpoints I assume because the wrong one is ran. And the only thing preventing a worse outcome is the emergency failsafe inside the controller 👀 Let me check, there must be a simple fix.
grafik

@MaEtUgR
Copy link
Member

MaEtUgR commented Oct 23, 2024

I'm on it. I think it's because I broke the order here 0770478#diff-2ece9759fa20e22b2e0af81c3f3b5892b934c8535b65d0eea103aa342fe997fdL43 🤦‍♂️

MaEtUgR
MaEtUgR previously approved these changes Oct 23, 2024
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.

I found the mistake I made in #21192
a) The big one is that I changed the order of the horizontal and vertical acceleration setpoint and in the case you don't have a vertical velocity estimate (like here) it broke.
b) The smaller but not negligible one was that I reduced the downwards acceleration to a too low value in hindsight. It's too risky that the hover thrust is not perfectly accurate and this results in an ascent instead.

I fixed both in the one last commit, please quickly double-check.

@sfuhrer sfuhrer force-pushed the pr-do-not-require-altitude-for-descend-main branch from e0b4ed5 to 749876c Compare October 23, 2024 17:02
Also descend with more acceleration again to avoid the risk of ascending instead of descending because of a wrong hover thrust estimate.
@MaEtUgR
Copy link
Member

MaEtUgR commented Oct 23, 2024

@sfuhrer I readded my commit (only) 👍

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.

Thanks for looking into that before other people accidentally crash even though they don't have to 🙏

@sfuhrer sfuhrer merged commit cac0133 into main Oct 25, 2024
57 checks passed
@sfuhrer sfuhrer deleted the pr-do-not-require-altitude-for-descend-main branch October 25, 2024 12:06
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.

3 participants