Quadcopter Manual Tuning PID

Hello,
I have built a drone for a project and would like to understand more about the manual PID tuning of quadcopters. I have gone through the tuning links and wanted to know why do we only reduce (multiply by 50%)?
Couldn’t we increase the values of the ATC_RAT P and I parameters for roll and pitch?
If they are increased, what would happen?
Also when entering the initial tuning parameter information that asks for battery and prop information. How can a mission planner distinguish between a quad with 2 or 3 blade props? Or does the number of blades on the propeller not matter? Also, does Mission Planner factor in the drone’s weight or does this also not matter?

Details regarding my quadcopter:
Propeller: 14 inches, 3 blades, pitch 7
Battery: 6S LiPo
Weight: around 8.5lbs (3.86 kg)
Motors: 750W, 340KV
Frame: X-frame

1 Like

The initial tuning parameter tools is only to provide some safe values so you have a staring point. The manual and autotuning process will address the details of the weight and props.

The first steps of reducing the PID values by 50% is to eliminate any oscillations, and again, to get the drone flyable enough that you can proceed with the rest of the tuning.

First, in stabilized mode hover the drone and make sure it even works.
Second, hover in Alt-hold mode to get the hover throttle values and the data for the notch filter. Make sure the filter is set first before going on to the PIDs.
Third, if the drone is flying well enough that it can handle sharp stick inputs (doesn’t need to be pretty, just needs to be safe and functional) then you can try auto tune, or work through the tune values manually. This is where you’ll be increasing the PIDs. Manual tuning of Roll and Pitch — Copter documentation

1 Like

Okay, I will make sure to follow this process.

Thank you!

Hi Allister,

My team and I have started the tuning process but we are unsure of how to check for oscillations. Could you please inform us how we can check for this? We had 3 flights whereby the 1st one crashed.
There were various issues with controlling the vertical acceleration of the drone so the MOT_THST_HOVER (0.2 was the default), PSC_ACCZ_P (0.5 was the default), and PSC_ACCZ_I (1.0 was the default) parameters were constantly changed after each flight. Do you think with these flights we can move on to the AltHold flight mode to get hover throttle and data for the notch filter?

The flight was done indoors and a level horizon, accel, and compass calibration were done each time. We also disabled the internal compass.

First Flight bin file

Second Flight bin file

Third Flight tlog file

Thank you

Don’t use modes like land yet. Just keep it to the basics. Stabilized for now. As per the tuning guide Initial Tuning Flight — Copter documentation reduce your PID values by 50% and try stabilized again. Your motors are all over the place, and the pitch/roll movements aren’t smooth, especially for an indoor flight. Try to hover it for about 30 seconds. If you’re comfortable with that and you don’t see any issues then try Alt-hold. Post your .bin logs here. Don’t post tlogs, they are useless for tuning.

1 Like

Okay, we’ll follow this process during our next test run.

Thank you!

OK, I see a mistake!

INS_ACCEL_FILTER 1
should be
INS_ACCEL_FILTER 10

Also dont recalibrate everything if it was done properly. That wont necessarily cause an issue by itself, but is not needed, over-complicates your process and may lead to other errors.

Also set these before the next test flight

INS_HNTCH_ENABLE,1  // set this then refresh params to see the rest
INS_HNTCH_MODE,3
INS_HNTCH_FREQ,60
INS_HNTCH_BW,30
ATC_ANG_RLL_P,6.0
ATC_ANG_PIT_P,6.0
ATC_RAT_RLL_P,0.10
ATC_RAT_RLL_I,0.10
ATC_RAT_RLL_D,0.0055
ATC_RAT_PIT_P,0.10
ATC_RAT_PIT_I,0.10
ATC_RAT_PIT_D,0.0055

And ensure your ESCs have these BLHELI32 settings:

  • Low RPM Power Protect = OFF
  • Low Voltage Protection = OFF (rely on the flight controller battery settings)
  • Temperature Protection = 90
  • Motor Timing = Auto

Now let’s see that .bin log file :slight_smile:

1 Like

Thank you very much for all the help. It is highly appreciated.

Regarding the Notch Filter mode setup, my team had planned on going with mode 4 since our cube orange can carry out In-Flight FFT.

Also please find our latest flight log here Flight Test 4

Please note that this test was carried out before your suggestions were received. Regarding this log, my teammates and I ran into the issue of being unable to read the RCOUT and ESC RPM values. Do you perhaps know why this happened?

Thank you.

Definitely use the INS_HNTCH_MODE,3 settings I provided.
Although the FFT is there and works well for small props/high frequencies, it currently has trouble with large props/low frequencies and is prone to targeting a harmonic instead of the base frequency. It’s better/easier/lighter load to just use the motor RPM when it’s available anyway.

I cant see a reason for this. I even compared your parameters from the different logs.
Maybe set
BRD_BOOT_DELAY,3000
I set this as a default now after I had some weirdness a couple of times probably due to sparks and interference when plugging in the battery.

Thank you for the explanation. Could you also please explain how you arrived at these parameter values?

INS_HNTCH_ENABLE,1 // set this then refresh params to see the rest
INS_HNTCH_MODE,3
INS_HNTCH_FREQ,60
INS_HNTCH_BW,30

Thanks, we’ll be sure to set this up before we fly again.

INS_HNTCH_MODE,3 will use the RPM to calculate the exact frequency, for example 50Hz = 3000RPM (divide by 60)
There’s no actual requirment to change INS_HNTCH_FREQ and INS_HNTCH_BW from the default 80/40 - but it’s just me that likes to have the correct values there for reference, and in case you need to change to throttle-based notch for some unknown reason.

I’ve got my Initial parameters spreadsheet with estimates that are near enough based on prop size, from experience and data gathered. The actual frequency/RPM will depend on a lot of other factors rather than just prop size. Take off weight, propellor properties, motor properties… the list goes on.

You will see there you can plug in your prop size, battery cells and chemistry, and then after flights put in your hover thrust value where indicated in red.

Note that INS_HNTCH_REF and INS_HNTCH_FM_RAT are only altered from the default value of 1 when using throttle-based harmonic notch filtering. Leave them at defaults when using RPM for FFT based notch filtering.

2 Likes

Thank you for all your help and advice. We will make use of the calculated values (where necessary) and follow your instructions.

Thank you once again!

Hello xfacta,

I set up the values as instructed and the drone rose too quickly and in the process of landing it crashed. The logs are attached here Flight Test

I know we are not meant to use LAND mode but we have a beginner pilot who is not used to manual landing when in LAND mode he still uses the throttle controller to reduce it.

Thank you!

It’s a bit hard to say for sure, but it looks a bit like there was a yaw input possibly when landing gear was just starting to touch the ground.
The poor attitude control will be coming from the the oscillating motor outputs and probably the Y axis vibrations.

Set these:

ATC_THR_MIX_MAN,0.1 // until control is better
FENCE_ENABLE,1
FENCE_TYPE,3
GPS_GNSS_MODE,7 // or 67 whichever is more reliable for you
INS_HNTCH_REF,1 // was zero meaning the HNOTCH wont work
MOT_SPIN_MIN,0.13

and start by reducing the PIDs further to see if those oscillations can be tamed

ATC_ANG_RLL_P,4.0
ATC_ANG_PIT_P,4.0
ATC_RAT_RLL_P,0.09
ATC_RAT_RLL_I,0.09
ATC_RAT_RLL_D,0.003
ATC_RAT_PIT_P,0.09
ATC_RAT_PIT_I,0.09
ATC_RAT_PIT_D,0.003

And you will have to follow the manual tuning guide until the copter is stable enough to fly around normally and then run Autotune.
https://ardupilot.org/copter/docs/ac_rollpitchtuning.html#manual-tuning-of-roll-and-pitch

1 Like