Crash after switching to LAND mode, Error Compass Variance, Error Velocity Variance

Hi guys.

So I’m trying to make a drone use the precision landing feature to land on a target by using a camera and sending vehicle.message_factory.landing_target_encode() MAVLINK messages using the dronekit API based on where the target is in the camera frame.

I compiled the APM:Copter 3.4 code from the master branch and everything looked ok, I enabled the precision landing feature, with precision landing type set to companion computer.

However, before running the code and make the drone land on the target I did a quick test flight with manual control (no code running on the companion computer) starting in stabilized mode but when I flipped to LAND mode all hell broke loose, the drone jerked wildly, I switched back to stabilized mode but couldn’t control it and it smashed into a wall.

Playing back the log in Mission Planner I noticed that as soon as I flipped to LAND mode I got “Error Compass Variance” and “Error Velocity Variance”. Now I’m pretty sure that after flipping back to stabilized mode I couldn’t get the drone to level out, I remember trying to get it under control but the drone just being stuck at full tilt and full throttle. However maybe I just panicked and didn’t realize the orientation of the drone, it all happened so fast.

I was under the impression that Precision Landing mode just operated as the normal LAND mode unless it got these MAVLINK messages with position adjustments and therefore when I flipped to LAND it would just land normally like we had done many times with the 3.3.3 firmware.

I’m basing this project on this: and my code is structured the same way running on a Raspberry Pi computer mounted on the drone and sending MAVLINK commands to Pixhawk using the dronekit API. We managed to make the raspberry fly the drone with dronekit with a simple takeoff and landing however the raspberry was not running any code when this crash happened.

I would be very happy if someone who knows this a bit better could help me review the log and see what went wrong, and if someone has some good information regarding the Precision Landing feature and how to use it with a companion computer, camera, image analysis and dronekit API (MAVLINK) that would be great.


Can anyone help me analyse the log and see if something went wrong?

I’ve had a quick look at your logs and it looks like it’s an issue with the EKF2 that we think is now fixed. I don’t fully understand what the issue was but it was related to the compass. The tell tale sign that it’s this bug is the AHRS2. Roll and ATT.Roll diverge suddenly. Basically the EKF2 (which is being used for attitude control) lost it’s attitude estimate so it’s no wonder you couldn’t control the vehicle any more.
No fun crashing for sure, this is one of the dangers of running “latest” instead of an official release sadly. In any case, we think that the EKF issues have been fixed in the official beta that just went out today.