Repeatable problem: Altitude estimation suddenly wrong, but all altitude sensors report correct data...?

Hi,
my quadrotor was flying great and without any issues until yesterday. It suddenly dropped 5 meters down (while it was flying at 6 meters height) while in Auto mode. I am looking for someone who has an explanation for this behaviour. I checked the log files, and everything seems to be very fine, except for the z-acceleration of all three accelerometers. Here is a description:

  • ArduCopter V3.6.4 (6c4da9e3)
  • Time in log file where error occurs: 17:17:16.630
  • RTK GPS, Rangefinder, two pressure sensors all report the correct thing. However the fused altitude estimation is wrong.
  • All three accelerometers report a sudden increase of the z-acceleration (= z-acc becomes less negative -> Copter is thought to fall down?? Doesn’t make sense… Apparently, the autopilot thinks that the copter suddenly goes up. The axis seems to be inverted?)
  • The error EKF_PRIMARY-1 is reported
  • Motor_PWM is decreased by the autopilot, copter drops by 5 meters
  • Throttle channel input (= channel 3) is not touched
  • Vibration levels: No clipping, VibeXYZ maximum is 28-37, mean is 4-15

I would be very happy if someone could assist me with finding the cause of the problem, thanks!!

LOG-File:
https://drive.google.com/file/d/1lJC13Nr7LGpjDrlWN2kt0eUf9ZqA9xob/view?usp=sharing

It seems EKF suddenly went haywire, the EKF4.SH goes through the roof, means that altitude estimation went off. The change in acc.z and throttle drop is all caused by the EKF switch initiated by values above. However I don’t see any explanation in the log why EKF went haywire.

Thanks a lot for your input! So, when I look into the logs, I see the “EKF haywire-effect” happening exactly 0.121 seconds before the accelerometers report a change. Is this delta t large enough to safely say that the AccZ change is a result of the “EKF-haywire-thing”?
Any idea anyone why this is happening? I noticed that the rangefinder (RFND.STAT1) is switched on and off quite often during this time (because the altitude is exactly at the limit where the rangefinder starts to be ignored). Could this be a reason?

Yes, timing indicate that.

Regarding the rangefinder, It could be the cause or just a coincidence.However the difference between baro alt/rangefinder alt and estimated alt in not so big, so it should not cause such switch.

Today it happened again. Twice. Both times it happened while I was at about 80 m respectively 100 m AGL during an auto mission. Again, Barometers an GPS and Acc report correct values, but suddenly the EKF goes crazy (indicated, as Eosbandi noted, by NKF4.SH going above 1). Vibration levels are always below 30 on all axes.

What is happening…?

The copter is a regular quadrotor with 18" props and 5 kg weight. The only ‘special thing’ about this copter is that it has a 1 meter long, vertical boom, where we attached a sensor and the Here+ RTK GPS. We have compensated for this setup by entering the correct distances for GPS_POS1_Z = -1.18 m and INS_POS1/2/3_Z = 0.08 m .

So my only guess is that this might affect the EKF… :roll_eyes: (because there are not many people flying with a INS_POS different from zero)

I am really scared by this issue although I am a very good pilot and I can always recover in stabilize (or acro). But the copter and the sensor are pretty expensive, so I would really prefer to know what is going on…

Here are the two logs:
Log1, Problem happening at 15:23:49
Download
Image:

Log2: Problem happening at 16:00:54
Download
Image:

@Willa,

“EKF goes crazy” means that the position estimate goes far off and the vehicle suddenly moves horizontally or does it means something else?

One thing that looks suspicious is the number of satellites is dropping a few times.

The GPS also seems to be switching between RTK float and RTK fixed. I wonder if it might be good to test with no RTK GPS and see if it behaves more reliably. That would at least point to whether the problem is with the RTK or not (although I suspect it is).

The GPS seems to be reporting regularly (i.e. regular 5hz update rate) so if it is the GPS then the issueis within the data from the GPS…

@rmackay9
Sorry I didn’t mention that in my last post: Everything is fine except for a sudden error in the altitude estimation. as a result, the copter removes throttle, and is dropping quite dramatically. XY-Position control seems to stay fine (as far as I can tell for a copter flying at 80m altitude). Iwill try without RTK, although I don’t see why this would affect the altitude estimate, especially because the GPS data looks relatively ok… I will also set EK2_RNG_USE_HGT to -1 .

1 Like

Ok great. I’ve put it in the wiki in a few places that EK2_RNG_USE_HGT should be left at -1 so hopefully that resolves the problem. I suspect it will.

Problem solved, thank you. I changed two parameters: EK2_RNG_USE_HGT was set to -1, and the max descend speed in auto was reduced to 1 m/s. I flew the same mission multiple times, and also some other manoeuvres that were causing the issue. But this time everything was fine! Hoooray Arducopter!

1 Like

@Willa,

Excellent! Really great that it’s sorted out.

Hi @Willa have you love the problem yet, I also met the same problem when upgrade to V3.6.10

Yes:
EK2_RNG_USE_HGT was set to -1 to solve the problem.

Maybe mine is another problem, I didn’t use ranger finder and EK2_RNG_USE_HGT is -1, I just reduce EK2_VELD_M_NSE to 0.3 the situation disappear in 3 times flight but when apply the params to another same drone, it appear again