Quad takeoff & altitude hold in OFFBOARD with flow only (no gps) does not work

Hi everyone,

I’ve been facing significant issues with quads using optical flow for localization. Specifically, the drones struggle to reliably take off, often getting stuck on the ground. When they do manage to take off, they end up at incorrect altitudes.

The primary issue seems to be with the Local Position Z estimate, which appears to be miscalculated. While the drone is sitting on the ground with its props spinning, the local position Z continues to increase. This issue also manifests as very unstable altitude hold behavior, with the vehicle wandering up and down erratically.

Interestingly, when flying in Position mode or Altitude mode, the drone performs well with no issues in altitude or position hold. The problem seems specific to the takeoff process and transitions.

The bug report can be found here:

On hardware, I tested with Dexi quads equipped with ARK Pi6X Flow. If the altitude setpoint is below ~2m, the drone fails to take off. When it does take off, it overshoots the setpoint and then slowly drifts back down, almost to the ground, with occasional random altitude jumps.

Drone is not able to takeoff:
https://review.px4.io/plot_app?log=8c200263-a86e-40f5-882c-67180bf274ff
https://review.px4.io/plot_app?log=24083308-d27c-455c-a004-ffce9d693c28

Drone is not able to hold altitude:
https://review.px4.io/plot_app?log=515fd8e7-8d49-4860-961a-7d6925bca648
https://review.px4.io/plot_app?log=e9a25a26-9fdb-4d4f-b47b-6ead5d60c23f