Can we get displacement from optical flow in python?

Hello guys,

I am trying to get displacement from optical flow in indoor/non-GPS environtment.

Can we get the displacement from python using dronekit?

I am also trying to integrate velocity (vx, vy, vz) to get displacement from vehicle.velocity parameter, but i dont know if using OF there will be NED or FRD?

Thank you, i appreciate the answer.

ok so, after a few days of looking for references, it turns out that there is a way to retrieve velocity parameters using dronekit from the callback function to get mavling message “OPTICAL_FLOW” which can provide velocity parameters (opt_m_x, opt_m_y) with angular speed compensated.

compared to using the vehicle.velocity parameter when there is no GPS/indoor, the mavlink message “OPTICAL_FLOW” can provide a better velocity estimate in my case (maybe filter/EKF for velocity when using vehicle.velocity will force velocity to do a reversal when there is no input or command on the flight controller so the displacement calculation always goes to zero?). however, I don’t know how the angular velocity compensation condition is for the optical flow sensor.