Autotune and AutoTrim

Just wanted to know… This is not a problem.
Hardware:

  • APM 2.6
  • External GPS / Compass) located roughly 50mm (1.968 inch) above the APM.
  • Separate Battery and 5 volts voltage regulator for Receiver (FrSKy D8R-II in CCPM mode) and APM.
  • Speed Controllers: Dlux 70 A.
  • Motors: Turnigy 3020B
  • Space in between motors: 760mm (29.92 inches)
  • Props: 330 x 102 (13 x 4 inches)
  • Main battery: 4S 8,000 mAH

Software: V 3.1.4 ( I am aware 3.2-rc1 exists :wink: )

After following recommended procedures, flew in stabilize, alt hold and loiter without problem (in no wind condition). As wind seemed to alter quite a bit the loiter mode, I decided to do an “Autotune”.
I got then an extraordinary stable aircraft :mrgreen:

However wanted to have a great stability in Alt hold and stabilize.

So allocated the [Save Trim] to channel 7, flew in ‘no wind’ condition. Used the Tx trims to get an almost perfect hover, landed, disarmed the Aircraft and activate the [Save Trim] channel.

Next flight with Tx trims back to 0 showed that the trims values were saved in the EEPROM because it was almost perfect in Stabilize and Alt hold modes.

Encouraged by the great results landed and next flight armed the motors in [Loiter mode] take off in that mode and the aircraft behaved pretty well.

So what am I writing about? Well the Loiter mode has lost the extraordinary stability it has at the beginning: About 1 to 2 meters horizontal movements in both x an y…

Question: Is it better to do Trim (or auto trim) [color=#FF0000]before[/color] autotune?

Sorry for the long post, but without details it is hard for anyone to comment.
Thank you in advance for your comments.
Henri

Getting your trim sorted out before you do autotune is a decent idea, but only because it might make it easier to keep the copter in the area during autotune. Sounds like you got a perfectly fine trim and tune.

Loiter varies quite a bit due to GPS variability. Problems are highly unlikely to be caused by attitude controller tuning, and certainly have nothing to do with trim. If you’re trying to get a perfect loiter, there are 3 things you need: great GPS, great accelerometers, great compass.

GPS: every time we release a trivial change to the code that couldn’t possibly affect loiter, people come out of the woodwork saying it ruined their perfect loiter. Well, impossible. We didn’t ruin it, the sunspots did. That meter that you are complaining about is 3 nanoseconds at the speed of light (timing that is how the GPS measures position.)

Nonetheless, it might be possible to improve it. Make sure it is away from possible sources of interference, particularly FRSky radios, video transmitters and fpv cameras.

Accelerometers: Vibration. There’s also the calibration routine.

Compass: This is the fun one. It is a bit finicky. You’ve got to get a bunch of things right:

  • Hard-iron error. This is from magnetic material near the compass. Doing the calibration well should eliminate this source of error.
  • Soft-iron error. This is from metals that deform magnetic fields. We don’t correct for this one yet. Keep the compass away from materials that have high magnetic permeability
  • Motor interference. Move the compass as far away from high-current wires as possible, then run the compassmot calibration.
  • Declination error. COMPASS_AUTODEC pretty much always gets this right.