Unable to get position estimate with Optical Flow

Hi,
I am using optical flow with rangefinder (MTF-01) and trying to do loiter indoor. It fails because “need position estimate”. I have tried to switch to Loiter mid-air after taking off in stablized mode, and still fails. I have used the lua script to set origin, and still fails to get position estimate. The ek3 setting is as follows:
ek3_src2_posxy 0
ek3_src2_posz 2
ek3_src2_velxy 5
ek3_src2_velz 0
ek3_src2_yaw 1

I got readings at status from optical flow and rangefinder. I have followed the guides to calibrate the optical flow.

The log is at: 6 1-1-1980 8-00-00 am.bin - Google Drive

What did I do wrong? Please help.

Haven’t gone through your bin log file.
Basically, you need to follow this steps up to 1.9 with GPS mounted. Once GPS loiter flying is good (Use the roll and pitch sticks to rock the vehicle), then add the optical flow sensor and do a inflight optical flow calibration using GPS loiter mode. If you are happy, then you can remove GPS and GPS settings.

We use Hereflow optical flow sensor most of the time. Usually with an external lidar height sensor. We do not use the onboard liar height sensor. Be careful, the optical flow sensor has a FOV, so make sure can’t see landing gear, drone payload, drone wires. Check it out your flow sensor FOV degrees.

Not sure about loiter. I use flowhold to hold with optical flow it works.

1 Like

I have use loiter with calibrated optical flow sensor with EKx_SRC1_VELXY = 5 (Optical Flow) in indoor many times.



I’m facing an issue and I’m confused about the cause. It was working, then stopped, worked again once, and now it’s not working again. Could it be related to the latest firmware version? I’m on 4.5.6. Don’t mind the battery level error, I connected via USB, but the same issue happens with the battery connected.


“Need position estimate” and “ready to arm” at the same time with disabled fail safe. I also uploaded lua script to set origin.

Here are my parameters with 4.3.x. without a GPS mounted and not configured.

AHRS_GPS_USE,0
ARMING_CHECK,978422
CAN_P1_DRIVER,1 #for DroneCAN optical flow sensor
CAN_P2_DRIVER,0 #no device, no GPS
EK3_SRC_OPTIONS,0 # check is it because of this parameter.
EK3_SRC1_POSXY,0
EK3_SRC1_POSZ,2 #Not recommended, set 1
EK3_SRC1_VELXY,5
EK3_SRC1_VELZ,0
EK3_SRC1_YAW,1
EK3_SRC2_POSXY,0
EK3_SRC2_POSZ,2 #Not recommended, set 1
EK3_SRC2_VELXY,5
EK3_SRC2_VELZ,0
EK3_SRC2_YAW,1
EK3_SRC3_POSXY,0
EK3_SRC3_POSZ,2 #Not recommended, set 1
EK3_SRC3_VELXY,0
EK3_SRC3_VELZ,0
EK3_SRC3_YAW,0
FLOW_TYPE,6 #DroneCAN type
GPS_CAN_NODEID1,0
GPS_TYPE,1 #default, I just leave it
GPS_TYPE2,0

Thanks for your willingness to help, Jai. It’s not the first time. My parameters are the same as yours, except OF (I use px4flow). I also tried downgrading the firmware to version 4.4.4. I had tested Loiter on it before, and it worked, but now it doesn’t. Since then, I’ve updated the firmware twice, replaced the battery and props, configured FFT, added a compass, and ran autotune. During these actions, I didn’t check if Loiter was working. I recalibrated the compass and accelerometer, but nothing helps. At least it seems the issue isn’t the firmware version. I’ve done a clean install of 4.5.6 and reset all parameters. I’ll try setting it up from scratch. If I solve the problem, I’ll update here. If not, I’ll probably start a new thread on the forum.

Oh I see, this one not good enough. I tried and give up. Vision base, very bad result. I switch to optical flow sensor type, indefinite height claim the manufacturer.

I have a Here Flow. I tested it, but stabilization results were better with the PX4Flow. I also read on the forum that with a wide-angle lens, stabilization works well even at higher altitudes. I have the lens, but haven’t tested it yet. As a rangefinder, I’m using the TF Mini. Maybe, I’ll see if I can assess the advantages of Here Flow, as I haven’t tested stabilization above a few meters yet. Right now, I just want to get Loiter working.

Theoretically, there is no height limit, if you use a rangefinder capable of measuring your desired altitude above ground safely.

Practically, those relatively cheap optical flow systems are based on simple components also found in a computer mouse, focused on inifinity. From my experience, these systems are usable for position stabilization only in low altitudes up to 15m.

For high altitudes I developed my own implementation that even works in altitudes up to 120m but this requires optics with higher resolution, precise calibration and more computing power.

1 Like

I use MTF-01 OpFlow+Rangefinder and have problem when fly in OF loiter, and go to 15-20 m.
Drone hold position, but if I switch AltHold- I can’t back to Loiter- need position estimated.
Afte I down to 3-4 m were Rangefinder work- I have position so Loiter work again.
Also if you calibrate OF properly, you can use Flowhold. After tuning FlowHold params it work well.

Could you have enter into this situation?

When Copters have an optical flow sensor enabled (along with a rangefinder) and it is specified as the only horizontal position source (e.g. EK3_SRCx_VELXY=OpticalFlow and EK3_SRCx_POSXY=None) and the vehicle is flying in a pilot controlled mode requiring a position estimate (ie Loiter or PosHold) the vehicle will not climb above the rangefinder’s maximum altitude specified in RNGFNDx_MAX_CM. This is a safety mechanism because otherwise the EKF failsafe would trigger as the vehicle flew out of rangefinder range.

You may want to consider disabling the rangefinder onboard the optical flow sensor and coupled it with an external longer range rangefinder to see it resolved.

Yes. first time I use Matek opflow- I have 2 m about height limit in Loiter.
Now I installing TF-03 (180 m) rengefinder and will see it real distance messurement