Yaw drift with vision position estimate

I am sending vision position estimates to the arducopter over mavlink. The yaw in these messages is constant, yet AHRS.yaw drifts. More importantly, the yaw used by the attitude controller is also drifting during flight.

COMPASS_USE is false
COMPASS_USE2 is false
COMPASS_USE3 is false
AHRS_GPS_USE is disabled
GPS_TYPE is none
EK2_GPS_TYPE is 3 (no gps)

the below is while the drone is stationary.


recalibrating the compass seems to help temporarily. I recalibrated it yesterday and again today in the exact same location it is already drifting again. These tests are occurring inside of a metal building where i don’t expect the compass to perform super well. That is why i’m supplying attitude and position via vision_position_estimate messages. Is there some other setting I need to change so that the attitude used by the attitude controller is the attitude sent by these vision_position_estimate messages?

AFAIK the arducopter code does not thake the YAW information in the vision_position_estimate messages. So you need to change that.

It looks like yaw information is not merged here:

However, i’m not sure that code path is even used. The yaw information does seem to be used here:

The thing that is confusing me is that nobody else seems to be having this problem over in this series of blog posts Integration of ArduPilot and VIO tracking camera (Part 1): Getting started with the Intel Realsense T265 on Rasberry Pi 3B

I would think that people flying indoors with a T265 would also tend not to have good compass readings.

I have same thing with Optitrack system.
I use @chobitsfan tutorial based on ATT_POS_MOCAP.
EK2 and VISO yaw are ok, but AHRS yaw is drifting. It is observed more in CIRCLE mode for instance. AHRS yaw continuously drifts and adds error to navigation.

Are you using latest master with YAW GSF ?

I’m using 4.0.3 version. Sorry, I haven’t noticed that.