Using Optical Flow as the sole horizontal positioning source

Hi there!
I’m working on a project that’s basically an aerial CCTV system with automatic deployment. The drone, due to certain circumstances, remains asleep for the most time, and when an external trigger comes, a companion computer (linux-based) is supposed to instantaneously launch the drone and make it stay above its zone.

When GPS fix is available, taking-off is fairly simple, MAVlink takeoff command does everything that’s needed in MODE_GUIDED. The drone takes-off, and stays in one spot in the air.

However, without GPS fix, the MODE_GUIDED will now allow take-off, even with OPFLOW sensor working. Other modes, such as GUIDED_NOGPS or FLOW_HOLD do not accept takeoff command over MAVlink.

My question is - how to achieve autonomous takeoff with companion computer without GPS fix, only with OPFLOW sensor?

Setup:
FC: F405
FC ← MAVLink (UART) → CompanionComputer (Linux)
Take-off conditions: No GPS Fix, OPFLOW sensor good, all calibrations good, no manual control (only MAVLink with companion computer).
OPFLOW position holding, when operated by hand for testing purposes, is very good at relevant altitudes.

Thanks for any sort of help in advance!

You need to right click on the map and set EKF origin here. You can also do this via a mavlink script. Then you can takeoff

“Need position estimate” - I cannot takeoff in guided without GPS, no matter what I click (even setting home and ekf origin). What am I doing wrong?

That error should be solved once you set EKF origin. You should see a drone icon on the map where you clicked. This is like a false location of the drone so that the EKF has an origin to do its calculations with respect to. If you still are getting the error, I think you may not have configured EK3_SRC1 to use OpticalFlow for the position estimate. Set the altitude source to either rangefinder (preferred) or baro.

Here, read this: OF setup

I don’t see an option to set opflow as a position source. Only XY velocity. Is there anything else I should do? I’m still getting the Need Position Estimate error.

Yeah right, velocity source.

I have it set up exactly like this shows, and still cannot arm in guided due to “Need Position Estimate”. All arming checks skipped, altitude source set to baro. :frowning:

Can you try setting GPS1_TYPE to None? And you really need to enable arming checks though

Arm: Need Position Estimate
It’s so frustrating

Disable GPS arming check. And try to set ekf origin somewhere else and try one more time. If this doesn’t solve your issue, I’m sure someone else will sort it out.

Same thing unfortunately :frowning:

Do you have a rangefinder?

Baro only - and set up as altitude source

There is a chance that you need a rangefinder anyway as someone stated in this thread but personally, I’m not sure. Arm: need position estimate in Loiter - #7 by snktshrma

I tried now in SITL with rangefinder type set to SITL, and same thing happens :confused:

Did you configure your optical flow correctly? What sensor do you use?

Matek OptFlow sensor (MCP). In SITL I have it configured as SITL

This? MatekSys Optical Flow 3901-L0X — Copter documentation

Yup, this one exactly

It has a rangefinder. Please set up all parameters as stated in that doc

1 Like