PX4 Optical Flow sensor test without GPS causes X,Y drift

Hi,

I am trying to test an optical flow position hold module I have created with a camera, lidar and raspberry pi. I am sending the OPTICAL_FLOW_RAD and DISTANCE_SENSOR message but during my test flight I couldn’t turn on position hold without the GPS.

What should I be looking at or parameters should I be changing to test this properly? I have included the log below. It is activating a failsafe which I think is because velocity is too high but it was within 30m of the starting location during the entire flight.

https://review.px4.io/plot_app?log=1b17692f-c707-4cc1-a3b0-dff1f7ca3f0c

Thanks

Hi, you need to feed the integration_timespan_us field. Also, check the other fields (some need to be set to NAN, not 0): PX4-Autopilot/src/modules/mavlink/mavlink_receiver.cpp at a0a2bdaea51b351cba9899095e74c6c4a1b42360 · PX4/PX4-Autopilot · GitHub

Then do some bench tests, you should see the estimator_status_flags.cs_opt_flow' getting set when the estimator is actually using optical flow data. And the vehicle_optical_flowmessage should also exist (check using thelistener vehicle_optical_flow` command in the mavlink shell).

Thank a lot, I will try and make those changes and conduct a new test flight.

Could you also share how you accessed that data from the log file? I am relatively new to drones and mavlink so I was wondering what is the best tool/code to use when analyzing logs this thoroughly?

Thanks again!

I’m using this tool: Log Analysis using PlotJuggler | PX4 Guide (main)

You can also write commands (e.g.: listener estimator_ststus_flags) in QGC: MAVLink Console (Analyze View) | QGC Guide (4.3)

And make sure to double check that the EKF is consuming your data (i.e.: check the flag I mentioned in my previous message) before doing another test flight.