Altitude Oscillation on Large Copter

I’m looking for some guidance on tuning a fairly large copter (G06 agricultural drone with 22” props). Firmware is 4.3.6, running on a Cube Orange.

I have completed a round of autotune in pitch and roll axes (AUTOTUNE_AGGR = 0.08) starting with the PID values suggested in the tuning Wiki for this size copter. The PID values derived from the autotune came reasonably close to the Wiki, and the roll and pitch values are also very similar to each other. At first it felt like a reasonable tune, but on later flights I noticed some oscillation, which appears to be in the Z axis, ie. bobbing up and down. Also, the logs show the PWM outputs for all four motors are modulating in sync.

I have also noticed some overshoot in the pitch axis eg. when pushing forward and then bringing the drone to a stop. The roll axis tune seems tighter, with actual and desired angle tracking closely.

I had a dig around on the oscillation issue and others have fixed this by increasing PSC_POSZ_P, but it had no effect in my case.

Log can be found here:Flight log

Flight video can be found here: Video

1 Like

Set these for a start, some are to gather data and some are to make small improvements.
The PSC values listed here should settle down some of the altitude oscillations.

ATC_ACCEL_Y_MAX,16000
ATC_INPUT_TC,0.20
ATC_THR_MIX_MAN,0.5
BATT_ARM_VOLT,22.10
BATT_CRT_VOLT,21.00
BATT_LOW_VOLT,21.60
BATT_FS_CRT_ACT,1
BATT_FS_LOW_ACT,2    //  or 3
BRD_BOOT_DELAY,3000  //  ensure the CAN GNSS unit always boots up first
INS_LOG_BAT_MASK,1
INS_LOG_BAT_OPT,4
LOG_BITMASK,180222
PSC_ACCZ_I,0.4
PSC_ACCZ_P,0.2
INS_HNTCH_ENABLE,1   //  write this then refresh params to see the rest
INS_HNTCH_MODE,1
INS_HNTCH_REF,0.17
INS_HNTCH_FREQ,40
INS_HNTCH_BW,20
INS_HNTCH_FM_RAT,0.7

Don’t try and avoid the battery failsafe values and actions - many have paid the price :frowning:
Is it a conventional Lipo battery or something slightly different?

Do you have the T-Motor motors and ESCs?
If so I think you should use:
MOT_THST_EXPO,0.6
otherwise try 0.72
You will want to use MissionPlanner motor test the recheck MOT_SPIN_ARM and MOT_SPIN_MIN after changing the expo value, and hover thrust will need a few seconds at a constant altitude to relearn.
Let us know exactly what motors and ESCs they are.

I think you have a spring centred throttle stick, you could set this
PILOT_THR_BHV,7

I think your PIDs are too low. Probably do a test flight with all the above parameter adjustments first, and the extra logging will tell us more before changing PIDs.
For the record I think they should go to this starting point:
ATC_RAT_PIT_D,0.003
ATC_RAT_PIT_I,0.110
ATC_RAT_PIT_P,0.110
ATC_RAT_RLL_D,0.003
ATC_RAT_RLL_I,0.110
ATC_RAT_RLL_P,0.110
ATC_RAT_YAW_I,0.03
ATC_RAT_YAW_P,0.3
If the previous flight was OK and altitude oscillations are gone or significantly reduced, you could try these PID values too. Just use Stabilise mode, or maybe AltHold so you can land fast if you have to.

Thanks for looking into this, Shawn, much appreciated!
I have changed the parameters as per your suggestions, apart from the PIDs, which I can try later, as you suggest.
In answer to your specific questions:

  1. It is using a conventional Lipo, ie. Tattu 6S 28,000mAh 25C
  2. It has a T-Motor arm set/power system, like this: arm set
    Just a quick note regarding your comment on the fail safes. I did actually have failsafe set for battery level, but for “Critical” level only (and using RTL option). I guess it makes sense to add “Low” level too, as you suggest, so I have added that.

Thanks,
Jacques

Definitely set the battery failsafe levels and actions how I listed them before.
The reason is: by the time a battery gets to critical level an RTL may not be possible. You want the RTL to start at Low level and at least make it some way home (or all the way home) before critical level triggers a Land.
A copter this large is expected to be working hard, you didnt buy/build this to carry just a Gopro, so better to be safe than sorry.
I even set BATT_LOW_TIMER,5 to initiate a “conservative” failsafe action and so the battery is never over-discharged.

For those T-Motor integrated sets I’ve found MOT_THST_EXPO,0.6 to be about right.
You will need to use the motor test to recheck MOT_SPIN_ARM and MOT_SPIN_MIN, then the next flight will need a short time to relearn hover thrust.

Thanks again for your advice, Shawn, the drone is flying much better now. :star_struck:
The parameters that resolved the Z-axis oscillations are PSC_ACCZ_I and PSC_ACCZ_P. I gather these need to be set as a function of MOT_THST_HOVER, which is quite low in this quadcopter without payload. I managed two test flights on Sunday (windy conditions!), the first test was just for the changes of the aforementioned parameters and then I did a further test after increasing the ATC_RAT_* gains you suggested. I did not increase these all the way to the values you suggested, rather I went roughly mid-way between your suggested values and what I had previously.

Log file after PSC_ACCZ_* changes only

Log file after PSC_ACCZ_* changes AND also ATC_RAT_* changes

Video after PSC_ACCZ_* changes AND also ATC_RAT_* changes

I also went with your suggestions on change of mode for harmonic notch filtering (throttle vs FFT). I may change back to FFT, but that’s for another day and I need to read up some more on this subject.

Really happy with how it is flying now, thanks for all your help, and would appreciate any further thoughts you may have, if you have time to look into the above logs.

Regards,
Jacques

Just some final adjustments:

INS_HNTCH_FREQ,53
INS_HNTCH_REF,0.21

I would still try the fully updated PIDs I suggested, but it is up to you of course.
This is why I mention it - the “actual” is red and blue, the “desired” is orange and green

If you do wish to leave them as they are, you could try increasing the D terms to my suggested values - this is only a small change and may take some of that undesired movement away

ATC_RAT_PIT_D,0.003
ATC_RAT_RLL_D,0.003

I think my suggested YAW values still might be a bit conservative, but baby-steps.
You could safely go to

ATC_RAT_YAW_I,0.05
ATC_RAT_YAW_P,0.5

I would stay with the throttle-based harmonic notch filter. There’s meant to be some improvements coming for these larger copters, so in-flight FFT finds the low frequencies more reliably, but until then throttle-based works well.

Hi Shawn, I have done another test flight, after increasing the PID values to your suggestions. I think it feels pretty good now, but interested to hear your thoughts if you have the time to take a look at the logs? I have noticed that actual vs desired in pitch access does not look as tight as that for roll axis, as there are some signs of overshoot in the logs. This is possibly due to a bigger polar moment of inertia in pitch axis, since there is a large battery at the rear and the payload is quite far forward to offset this.
Here is the log: 5-August test

Thanks for all your help on this.

Jacques

Sorry, just saw this now :frowning:
That log looked quite good. Attitude control is still a bit off but not bad. I would probably run Autotune.
With the GPS unit that far from the flight controller it will be worth setting these, in meters!

GPS_POS1_X,0
GPS_POS1_Y,0
GPS_POS1_Z,0

So 10 centimetres will be 0.10, for example.
Positive X is forward of the flight controller
Positive Y is to the right of the flight controller
Positive Z is down from the flight controller