Use optical flow via mavlink

Hi,

I have been tryin’ to fly my quad in loiter using optical flow via mavlink.
From what I read I sent the SET_GPS_GLOBAL_ORIGIN to init the EKF and then the Vision_Position_Delta message to the ArduCopter.

Furthermore, i have set the following parameters flags:
AHRS_EKF_TYPE = 1
EK2_ENABLE = 1
EK3_ENABLE = 0
EK2_GPS_TYPE = 3
EK2_POSNE_M_NSE = 0.1
EK2_VELD_M_NSE = 0.1
EK2_VELNE_M_NSE = 0.1
BRD_RTC_TYPES = 2
GPS_TYPE = 0
COMPASS_USE = 0

However, inspecting the EKF flags the horizontal flags are not up. attached a screenshot of the MavLink inspector:

One more question, how can I sent the altitude via mavlink, I am uncertain which topic I can use. I am currently converting my altitude read to A2D for the pixracer to read.

Hai,

I am actually using MAVROS which has its roots in Mavlink. but that said I am not an expert in Mavlink. Still, I hope I can give you some information which will help you understand the concept.

About parameters:
AHRS_EKF_TYPE = 2 (this should be 2)
COMPASS_USE = 1 (I believe this should be 1, what was the reason for disabling this?, I don’t know if you have any specific reasons)

Which flight mode are you using?
you can give attitude commands by SET_ATTITUDE_TARGET in Guided and Guided_no GPS modes.
and you can use SET_POSITION_TARGET_LOCAL_NED in Guided mode.
you can refer this site for more details: https://ardupilot.org/dev/docs/copter-commands-in-guided-mode.html#copter-commands-in-guided-mode-set-attitude-target

Hi,

Regarding the Compass use, i based it on this thread (Integration of ArduPilot and VIO tracking camera (Part 4): non-ROS bridge to MAVLink in Python).
Have tried to enable the compass but that didn’t help either, the ekf is still not initializing and working properly.
I am planning to use the Loiter mode.
Currently i am trying a different approach of sending the optical flow raw data via mavlink and using the EKF3. It looks promising although I would have preferred sending velocity and not optical flow.

I think I was unclear regarding the altitude. My problem wasn’t giving the altitude commands but providing the APM the altitude data from my own sensor via mavlink.

Thanks for your help