Closed rmackay9 closed 2 years ago
@rmackay9 why didn't the mission-terrain-prearm checks pick this up? There's still the climb-away problem, but you shouldn't have been able to arm here, I think?
@peterbarker,
I had to look into this but it seems that a terrain failsafe can never be active before the vehicle is armed. Terrain failsafes only occur when the waypoint navigation library needs a terrain altitude for a waypoint or spline command and can't get it.
It also seems that if the terrain alt is not available when the takeoff command is started, it silently falls back to alt-above-current-alt.
So really this failure only happens if the terrain alt is available as the takeoff starts but is later lost.
We have pre-arm checks such that you should have the terrain around the waypoint items.
Ah. I see the problem. We only include waypoints, not takeoffs:
This has been resolved now by the PR linked above so closing.
The takeoff controller exits early if it cannot get a terrain altitude (see code here) leaving the position controller without any updates which can lead to a climb away.
This can be reproduced in SITL by doing the following:
All is well until the vehicle climbs above the rangefinder's range (40m) at which point, "auto takeoff: failed to get terrain offset" will be displayed but the vehicle will keep climbing until the pilot retakes control in another mode.
This quite a serious bug and exists in the stable 4.2 release. We should probably trigger a terrain failsafe if the vehicle is not landed. This bug is not present in 4.1 (and earlier)
Report to users is here on Discuss.