Err: EKF_CHECK-2 in GUIDED mode with optical flow and rangefinder

Hello guys

I’m trying to control my quad copter indoor with scripts on Raspberry Pi. I’ve successfully mounted my quad with optical flow and a separate rangefinder, and I’ve made it to fly in loiter mode with my RC controller in GPS-denied conditions. And I followed the steps in The copter does not takeoff in Guided mode and EKF_GPS_TYPE = 3 (optical flow) , I am able to takeoff with my script!

But here comes the problem. Whenever the drone has took off, I would receive ‘EKF variance’ message from Mission Planner, and an ‘Err: EKF_CHECK-2’ was found in the log. The copter will then trigger the failsafe and switch to LAND.

I’m facing this issue with Copter-3.52 on my quad copter, and both Copter-3.52 and the latest Copter-3.6-dev with SITL (I disabled GPS and enable a virtual optical flow and a virtual rangefinder on SITL). I’ve also tried both EKF2 and EKF3, but the problem still exists.

Any help will be appreciated. Thank you!
Roger

Here’s a log of a bench test, and I did it without propellers. The first time I tried to arm the drone, lift it manually to tens of centimeters and then received an Err: EKF_CHECK-2. The second time I run the script, the drone simply arm and then receive an Err: EKF_CHECK-2 and disarmed.
https://drive.google.com/open?id=0B30Z6GiUX277b1RRa083SmpkTUE

Did you set EKF_GPS_TYPE -> 3 ?

Yes I did. And I believe that should be EK2_GPS_TYPE or EK3_GPS_TYPE in Copter-3.5. I had several successful flights with my RC controller before trying to control the drone with my Raspberry Pi.

Have you read this : The copter does not takeoff in Guided mode and EKF_GPS_TYPE = 3 (optical flow)

Yes, I have. And I followed the configurations as you mentioned in it, but the problem still exists.

I am testing with SITL, and now I found something very weird:

If I start the SITL at lng = 0, lat = 0 like this./ArduCopter.elf --home 0,0,0,270 --model quad, then right click on the MissionPlanner map near (0, 0), the copter behaves very well without any errors.

However, if the SITL was started at lng = -35, lat = 149 (this location is in the SITL documentation) like this ./ArduCopter.elf --home -35,149,584,270 --model quad, the simulated copter will takeoff, but when it’s in the air, it will report an ‘EKF_CHECK-2’ error.

I’m sure I have set GPS_TYPE = 0, but it seems that the copter is still receiving position information. Is this caused by SITL? I will do another bench test on my real copter tomorrow.

Humm, maybe something has changed since, I could set home using right click from any locations on SITL without errors… Will have to check this one…

For the live test:
Just make sure you get your home fixed before arming. And I recommend you “walk” the quad around -like a square pattern- making sure it shows the same on display and the altitude is good as well. Thean take-off with radio in loiter and switch to guided and send some goto within the square you walked , then you can d land and try takeoff guided.

I had several tests on my real copter today, and it worked! There seems to be something wrong with my SITL.

And now I have another problem. How can I control the yaw in script with optical flow and rangefinder? I tried condition_yaw in Randy’s red-balloon finder, it works with SITL, but my real copter doesn’t respond to the command. Perhaps I should open another topic for this :grimacing: