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

Copter: auto takeoff may trigger terrain failsafe #21489

Merged
merged 1 commit into from
Aug 19, 2022

Conversation

rmackay9
Copy link
Contributor

@rmackay9 rmackay9 commented Aug 19, 2022

This resolves issue #21488 which can lead to a "climb away" in Auto during the Takeoff command with Frame = Terrain.

Below is a screenshot of a SITL test confirming that with the setup mentioned in the issue, the terrain failsafe is correctly triggered and the vehicle RTLs home.
takeoff-terr-fs-test-ok

Additional testing we should do includes:

  • Confirm the behaviour when the terrain failsafe triggers while the vehicle is landed (it should just disarm) -- auto_takeoff_start silently falls back to alt-above-current-alt
  • Test the payload place command that may also run takeoff_run() -- payload place never uses takeoff with terrain following
  • Test in Guided mode which may also run auto_takeoff_run() although it doesn't seem to have the same bug -- GUIDED mode has a special check to catch exactly this problem (see code here) although it is still possible to trigger the problem by reducing RNGFND1_MAX_CM after takeoff (e.g. purposely fail the rangefinder). The fix in this PR resolves this very rare failure in Guided mode as well.

Copy link
Contributor

@peterbarker peterbarker left a comment

Choose a reason for hiding this comment

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

This looks like the right fix.

However, I am unable to reproduce the problem as the mission-terrain-prearm check does not allow me to arm the Copter.

@peterbarker
Copy link
Contributor

I've created an autotest which tries to reproduce the bug and fails - it dies with a prearm check, as it should

@rmackay9
Copy link
Contributor Author

@peterbarker,

Great, thanks for the approval.

I've conversely almost never seen the pre-arm failure you mention. I wonder if in your tests you've been disabling the terrain database instead of the rangefinder? I've put the exact steps in issue #21488

Anyway, txs again.

@rmackay9 rmackay9 merged commit 658298e into ArduPilot:master Aug 19, 2022
@rmackay9 rmackay9 deleted the copter-takeoff-terr-fix branch August 19, 2022 23:52
@rmackay9 rmackay9 added this to 4.2.3-rc3 in Copter 4.2 Aug 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Copter 4.2
4.2.3-rc3
Plane 4.2
Awaiting triage
Development

Successfully merging this pull request may close these issues.

None yet

2 participants