Optical flow messages -bad vision position

Hi there!
I’m trying to test Optical flow messages provided by [mavlink](optical flow #100)(Messages (common) · MAVLink Developer Guide)

I took as an example OpenMV cam solution which gets sensor camera parametrs and convert it to the mavlink optical flow message using struct library from python
This camers sends x/y shift + qulity parametrs,everything else are 0
According to test flights after adding lidar and colibrating the camera loiter should work well.
The problem is that I’m always getting ‘bad vision positon’ error in mission planner

however opt_m_x , opt_m_y and opt_qua are comming though and are not 0
Lidar is connected and sonarrange seems aslo calculated properly and >0

I tested 2 scenarions

  1. just passing random raw data via python script using pmvlink libray. As x/y should be of integer types, the minimum not zero value is 1 or -1 so ±1 shift seems reasonable to me assuming drone is always on the same location.

What looked wierd for me as well is that opt_m_x , opt_m_y sometimes bouncing too match for example from 0.0017 it can go occusionaly to 7, not sure it can be the problem and why it happens if values are not >1.



  1. second scenario just connecting open mv, result is the same -‘bad vision position’

testing and setup was made according to this docs
https://ardupilot.org/copter/docs/common-optical-flow-sensor-setup.html#common-optical-flow-sensor-setup
https://ardupilot.org/copter/docs/common-openmv-optflow.html

copter firmawe 4.5.6, flight controller pixhawk 6c

When script is run for the sitl drone simulation-no errors basically for the same firmawre.

Would appriciate any help or suggestions.

@Ketchyn,

A rangefinder is connected? FLOW_TYPE is set to “MAV”? I suspect that the camera is not outputting the flow message quickly enough. Is there a way to check it’s output rate?

Hi @rmackay9
FLOW_TYPE =5(MAVlink)
rangefinder is connected, I can see sonarrange messages in status tab
image

Regarding fps:
if I test using OpenMV camp its shows 120 fps
if I connect via RasperryPi and send raw data its just for loop inside while true ~frequensy is 300 gz

resolved
The problem in my case was actuly conflicting setting
VISO_TYPE which equaled mavlink.
So the behaviour of ardupilot is following:
If FLOW_TYPE=mavlink and optical flow messges(#100) don’t get transmitted you will see

BAD opt flow helth

message
If messages are coming but VISO_TYPE =mavlink then error message =‘Bad vision postion’
So if FLOW_TYPE=mavlink
VISO_TYPE should equal none