AUTO.LAND going to the origin with optical flow

Hello,

I am trying to setup a small quadrotor for indoor use.
We have been resorting to an External Positioning System (Optitrack), but we are now trying to setup a drone with optical flow only.

The estimates seem to be very decent: POSITION mode holds well, and we can control the drone in OFFBOARD mode using the position estimates. However, we observed this weird behavior while testing, in which switching to AUTO.LAND mode would drive the drone to the origin, instead of landing at the current position.

Here is some relevant information:
Firmware version: v1.14.2 (modified to incorporate this pull request: Fix scaling issue with thoneflow/holybro optical flow pmw3901 uart driver by dirksavage88 · Pull Request #22611 · PX4/PX4-Autopilot · GitHub)
Flight controller: Kakute H7 v2 (no SD card, so I cant provide logs)
Optical Flow sensor: Holybro PMW3901
Lidar Sensor: Holybro ST VL53L1X Lidar

Hey, were you able to solve this issue? I am facing the same problem.

Hello!

Sorry for the late response.
I actually had stopped working on this after posting, and only got back to it today. Actually, this problem also occurs if I use, for example, the mocap data, the issue seems to occur when there is no global position estimate (no GPS data).

I have not solved it yet, but I was searching again and I believe that this should be solved by #23845#23845. This was not merged yet though. I will try to apply these changes to a local version of PX4 and test it. I will get back to you with an update once I test it.

Hello again!

Just getting back to you with an update. I tested these changes, first using Mocap and optical flow data, and then using only optical flow plus altimeter, and I can confirm that the drone now lands at the same place where I triggered the land command.