Abrupt Yaw Movement During UAV Takeoff at 1.5 Meters Altitude

Hello everyone,

I’m experiencing an issue with my UAV where it undergoes an abrupt yaw movement during takeoff. This unexpected change in yaw direction happens consistently when the UAV gains more than 1.5 meters of altitude.

Log1: https://review.px4.io/plot_app?log=0dc14ec1-4bc2-4299-89db-a76d0d2c4628

Log2: https://review.px4.io/plot_app?log=6335ff02-0917-4acd-bd09-cfe7947dc7e5

I believe the issue may be related to the magnetometer settings, specifically the EKF2_MAG_TYPE parameter, which I have set it to 0-Automatic. I am flying outdoors, thus I guess I am not suffering disturbances from large structures. Furthermore, I tested this with firmware 1.13.3 and 1.14.3, same result on both firmware.

Has anyone else experienced similar issues or can provide insights into how to resolve this?

Any chance you’re taking off over concrete with a strong magnetic field?

There is no magnetic field, we tested taking off from the grass with same results. We moved the GPS(and its compass) above one of the motors but didn’t help, because yaw jump of 11deg is present in 0.13sec. Also, it seems to happen a correlation between thrust and magnetic field.
One of the latest log, where it is not flying very well
https://review.px4.io/plot_app?log=aa5edf92-3790-443d-ac58-9ebf533bac11

Exactly. Can you move the external mag (with the GPS) further away from power electronics/wiring/motors?

Thank you @JulianOes for your response.
Done, extMag moved further.
EKF2_GPS_POS_X goes from -0.017 to -0.045 and
EKF2_GPS_POS_Z goes from -0.138 to -0.174
Same 2 yaw jumps happened at 0.41 and 0.48s.
I read that it could corresponds due to estimator doing a heading reset because it is still close to ground, at 1.5m height. However, this seems not to be the case.
I tested all weight configuration cal_magx_prio between internal and external mag, but it can be always observed, so I have no clues currently.

My fear is that if it could happen during flight, that yaw reading jumps (but no drone’s physical yaw) and pilot sends input but the response will be in other direction.

Thanks for your time

Are you sure that your external mag is used and that it is far away from motor wiring? It’s still measuring a lot of the motor current:

And the estimator also flags a yaw problem:

Hi Julian,
The correlation finally ‘disappeared’ by changing the GPS model.
After dozens of tests:

  • GPS moved to all locations
  • Tested Here3+
  • Tested Freefly
  • Tested H-RTK F9P Helical
  • Internal / External magnetometer all weighing combinations
  • RTK / no-RTK
  • Different estimator params
  • PX4 1.11 and 1.14.3 (current)
  • Using a Lidar, seeing that pointcloud is displaced when doing roll+yaw and returning the same point.
    However, UAV still suffer from some kind of issue with the yaw estimator (with Freefly the yaw jump happened at 15 meters with risky behaviour)
    So with Holybro GPS, a small yaw jump is still observable during takeoff [11:05] (no magnetic field, and no estimator flags).
    I am wondering if there are configuration that can be applied to either improve the estimator or filtering those situations to avoid sudden yaw jumps in the air.
    Thanks in advance for your knowledge
    Best

After testing a Mosaic-H with dual antenna, it is providing with heading so I would use that.
Probably no more jumps are going to be observed, except if mags are used in case of fallback mechanism.
In this case, do people leave the mags uninitialized or configured without prio?

In other UAV, tested the EKF2_mag_type:
[1]: Magnetic heading

[2]: 3 Axis heading (all time)

[5]: None magnetic fusion:

Option 5 is the one that makes no yaw JUMP.
However, a local_pos_invalid_relaxed flag is raised, and it requires to raise UAV in Altitude and then change to pos in the air.
For now it is a workaround, but maybe you know a better solution to this issue @JulianOes
Thanks in advance