Barometer Drift Before Takeoff

As was previously discussed here (Feedback and assistance with new takeoff behaviour) and the 4.3.3-rc1 thread (Copter-4.3.3-rc1 available for beta testing!), I identified a bug which can lead to the aircraft attempting to navigate immediately on motor start. So as not to clutter those threads, I’ve started this one.

(1) Configure the arming parameters to allow:
(a) Arming when in AUTO
(b) Arming via radio switch
(2) Load a flight plan starting with a takeoff command, and at least one waypoint.
(3) Power up the aircraft, switch to AUTO (but do not arm), and allow the aircraft to sit for several minutes.
(4) Without changing flight mode, start the flight plan using the arm switch.

Intermittently, on completion of (4), the aircraft will immediately begin navigating to the next waypoint after motor start. This is done at zero or near-zero altitude, usually resulting in a dynamic rollover. While not consistent, the bug is reproducible, provided sufficient iterations are performed. Starting with a room-temperature autopilot and low outside temperatures (~35 deg. F) seems to improve the odds - presumably the reverse would also be true.

The workaround is to switch modes immediately before arming. This behavior has never been observed after a mode switch.

Two logs (including pre-arm lead-in) are attached below, one with 4.3.2, one with 4.3.3-rc1. In the case of the 4.3.3-rc1 example, the GCS altimeter displayed +3 ft. just before arming, with a takeoff target altitude of 10 ft. I do not know GCS altimeter reading for the 4.3.2 example. With 4.3.3-rc1, I also noticed a message reading “Terrain: clamping offset 18 to 15”.

Ok, so this is what I have so far:

  • Take off throttle is normal
  • Take off detection appears to be triggered from your vertical acceleration (low accel z of 0.65 m/s)
  • Mission immediately moves to waypoint 2 as soon as takeoff is detected
  • Target altitude drops from 1.147m to 0.31m
  • First waypoint is 3.04 m altitude
  • We have a message “clamping offset 18 to 15”

My theory is the altitude has drifted by 1.147 - 0.31 + 3.04 meters. Part of this may be due to the terrain camping message that is about 3m, part maybe the altitude drift.

I will have to discuss this with @rmackay9.

Thanks for looking into this!
Just for what it’s worth, I first observed this running with TERRAIN_ENABLE = 0. I don’t have any logs from back then (a couple years ago), but it was definitely the same symptoms.

As always, let me know if you need me to run specific tests.

No @Luke_Ionno, thank you for bringing this to our attention and for being so responsive to test requests!

I suspect this is something to do with your low take-off altitude, long wait in auto causing altitude drift and maybe the terrain handling. I am pretty sure I understand what is going on but I will need Randy to help understand some of the elements.


Quick update.

This issue is caused by the way Auto handles mission items. It sets the takeoff starting point as soon as it enters auto. Because you then wait for a long time before starting the takeoff the altitude is able to drift enough that it is above you final altitude. So it goes to the next waypoint as soon as you arm.

The fix is not initialising the first waypoint until the aircraft is armed and mission started. Randy and I will get it sorted.

Until then the fix is to switch to auto just before or just after arming.

Thanks for your help on this one!!!

1 Like

Excellent, thanks for the update!

So, as a hypothetical stop-gap measure, if I wrote a Lua script that recognizes a takeoff command, briefly switches to Guided mode and then back to Auto, before actually executing the takeoff, that should prevent the issue in the interim?

If it doesn’t have any problems with the mission that would work. The question is if the aircraft takes off on the first take-off command.

To avoid exactly that issue, I was planning on putting a dummy Wait (of substantial duration) at the start of the mission plan; then the script does a one-command look-ahead, sees the incoming takeoff, does the mode toggle, and then jumps to the takeoff.