PX4FLOW and TFMINI Lidar with PIXHAWK Doesn't Seem To Work With GPS Disabled

Hey all,
We have a copter with v3.5 firmware, PIXHAWK, PX4FLOW, TFMINI Lidar for altitude (as per [How to make the TFMINI rangefinder talk I2C]). The optical flow is calibrated with scaling factors, lens is focused, and provides data when flying. The altitude seems to be accurate from the Lidar. The issue is when we disable the GPS and try to fly in just Optical Flow, we get EKF errors. More specifically, we can take off in LOITER mode but after a few seconds it gives and EKF VARIANCE error where the horizontal position gage goes into the orange. Also when taking off in Stabilize we cannot switch into LOITER or POSHOLD and get FLIGHT MODE FAILED. ALTHOLD seems to work fine.

Does anyone have any suggestions or guidance? I have the data logs downloaded from our last flights if anyone would like to see data plots.
Thank you for your time.



I assume that you have calibrated as per wiki and that AHRS-IMU-OF curves are in phase and same level.
What is the type of surface are you flying over ?
If you look at my videos, I use a good texture non reflective floor (rug) and good lighting so the x & Y are consistents.

@ppoirier We calibrated as per the wiki. The x and y plots are attached. The surface is a turf football field with painted lines. Also tried on asphalt parking lot. Both attempts were during sunny days.

You have to get the optical flow signals correlated (level & phases) based on a tilt & pitch rocking test:

Your test need to look as the picture of the wiki == Zoom to read accurately and adjust optical gain and delay to get perfect alignment.

Other issues seem to be the compass, this has to be stable as well

@ppoirier We reran the calibration. Somehow our scaling factors were both set to 1. I don’t recall changing them from the original calibration. Anyway the new calibration plots are attached. Does the scaling look sufficient? Took off in loiter and held very steady indoor. Will take outside and test and switch flight modes and report back to you later.
Thank you!

Oh Yes , just like the wiki, if the focus is setted to the average altitude , it should work like a charm :wink:

@ppoirier Took outside to test. Take off very stable in loiter with GPS disabled.
Takes off in loiter but after just a few seconds, EKF VARIANCE ERROR and goes into land. Looking at the EKF gage during the flight it shows the horizontal position jumping up into the orange and red. Sometimes the compass does the same thing. Also attempting to switch flight modes from Loiter to Stabilize or POSHOLD fails as well.

My sequence is like this
Start system and let EK3 stabilize
On Mission Planner set EKF Home with right button
Quad picture and real-time position showned
Take the Quad, lift it level and “walk” the quad in a square oy “8” pattern
Check for accuracy and altitude and heading
If all fine , takeoff loiter and hold it 2 Meter for 30 seconds it must be stable