Yaw oscillation in loiter but not in alt hold, after autotune

After doing a autotune of yaw only in Loiter mode The Copter has a stable hover in Alt hold but in Loiter there is an oscillation see attached logs. Why do I get an oscillation in Loiter and not Alt hold.

David Ardis

Hi David
Almost always Yaw shows signs of instability when Pitch and Roll are not doing so well.
And in Loiter these issues often show up more than expected because the copter is trying to accurately hold a position, of follow a wandering position - more on this below.

If your copter is relatively symmetrical then copy the Roll PIDs over to Pitch.

Compass is somewhat affected by throttle, it would be nice but not essential to do the Compass/Motor calibration - be aware it can be dangerous and you have to follow the instructions precisely.

If you look closely there’s noise or small oscillations on all Pitch, Roll and Yaw. None of them are any different between flight modes and none of them are particularly bad. What I think you are seeing is the copter trying to follow a wandering GPS position.

Your GPS position is part of the problem. Blue is the reported GPS position, and Red is where Ardupilot thinks it is based on all the sensors.

And you can see in this graph the Number of Sats drops occasionally (not so bad) and HDOP goes up (bad). The “Delta” is the time variation between the GPS unit sending updates to the flight controller. Ideally this should be a straight line.

The GPS units get like this with their default configuration because they are trying to utilise every constellation and processing all that info in a timely manner gets beyond their capabilities.
Set this to limit the constellations and give the GPS unit a fighting chance:

You can see on the motor outputs there is quite a lot of oscillation, more than visible in the attitude.

Put in these Harmonic Notch Filter settings and do another test flight, hover in Althold for a while and some gentle movements, nothing radical
INS_HNTCH_ENABLE,1 ← set this then refresh params to see the rest

If there is stability run a Pitch and Roll Autotune and let’s see how that works out.

You could possibly lower MOT_SPIN_ARM,0.14 to about 0.12 but check for reliable start up. If not then you might want to slightly increase MOT_SPIN_MIN but ensure you’ll still be able to descend, you should be fine though.