Vehicle Attitude Drift - Snapdragon Flight

If the snapdragon flight is not calibrated correctly with the vehicle attitude data drift? I’m simply flying a lawn motor pattern and am noticing drift in the flight logs for the roll, pitch, and yaw.

Is the attitude information realtime? It looks like there is either some lag or it takes the sometime for the data to find a solution. While the just sitting on the ground and rotating the copter 90 degrees it takes a while for the yaw to settle. Is this normal? I will fly it this afternoon and provide flight data.

Here are two sd2log plots of the flights. You can clearly see the yaw drift in the first data set. during the straight legs of the run you can see a slope in the yaw reading. I’m confident that the aircraft does not have a constant rate yaw during each leg. Any ideas?

1 -
2 -

First let me say that I am not an expert at tuning the PX4 flight stack, beyond basic vehicle stability and control authority. Hopefully someone else can contribute their insights as well.

I looked at the changes in the magnetic field strength, and it correctly corresponds to the point in the vehicle trajectory where it rotates to begin the return path.

Are you using the onboard mag? If so, I would definitely recommend performing a calibration sequence from within QGC.

The onboard mag is more vulnerable to external noise sources than an external mag mounted away from the vehicle electronics.

Is the board precisely mounted relative to the front of the aircraft? Just wondering if it is slightly off, but I don’t know if this would cause yaw drift.

My next thought would be to explore the parameter values available in PX4 that control behavior of the attitude estimator. The fact that you observed an excessive delay before the yaw value stabilized might relate to a setting that controls the integration of sensor values. Then again sensor calibration issues might produce the same effect. Just thinking out loud a bit.

Jim W.

Looking at QGC and the available parameters to tweek I noticed that some are colored yellow. Does this indicate that the setting is not the default? Also does running through the calibration routines change these settings automatically or do I still need to set them manually?

Not sure which attitude estimator you used, so I will just talk about my experience.
I am using snapdragon with q estimator and lpe, and I noticed the yaw drift as well, more notable than pitch and roll.
Assume that you use the onboard mag, and set the param ATT_W_MAG to a nonzero value, then the drift might due to the noise in the mag. If you set ATT_W_MAG to zero, I guess you can still see a drift, which is because of the imperfect gyro calibration. A perfect calibration is not easy to implement in my point of view.
For the drift of pitch and roll, I suggest that you could have a look at the param ATT_W_ACC, if you use q estimator. A long convergence time might be related to low weight of acceleration correction.
If you use EKF2, I think the drift is due to gyro as well.
If you got any progress, I appreciate you can share.

langxm1223 - Glad I’m not the only one seeing this. I will definitely share my progress and results.

I did not select a mag so I’m assuming it defaulted to the on board. A few things I am going to try next are as follows.

  • Update to v1.5.1rc1
  • Change the various estimator combinations as suggested by langxm1223.
  • external mag (Any suggestions?)

I will freely post flight logs and such as I conduct each test.

I went out and did a sensor cal through QGC and ran a couple flights with v1.5.1rc1. One was run using EKF2 and the other use LPE and AQ. The results look a lot better.

  1. EKF2 -
  2. LPE_AQ -

At first glance I can’t say which one is better but the yaw drift is drastically reduced. (see above plot for comparisons).

This might be good enough for my mapping application but I need to attach a camera to be certain.

Thanks for the update. This is great information.

I tried to view your logs, but they never complete the rendering process. I will try again later in case the server is down or too busy.