Tuing PID parameters in QGroundcontrol (2)

Based on tips for tuning PX4 PID parameters written in my previous post [1] or even using the default values directly, you will be able to fly your vehicle freely in manual or stabilized flight mode.  

However, if you are using an unique vehicle (usually assembly by yourself and only equipped with sensors you desire) and struggling for finding the best PID parameters for your applications. I think following 8 tips will help you to get ideal PID parameters. 

This is the vehicle I made based on LHI QAV250 fiber frame, with TX2, high-speed camera, etc.[2] 

Tip1: Tuning order: Rate controller -> attitude controller -> position controller

The PX4 controllers are layered [3], which means a higher-level controller passes its results to a lower-level controller. Thus the PID tuning needs to be done from lowest-level controller to highest-level controller.

Tip2: Check if PWM_MIN is set correctly.

  1. Remove propellers
  2. Arm the vehicle and lower the throttle to the minimum
  3. Tilt the vehicle to all directions, about 60 degrees
  4. Check that no motors turn off

Tip3: Enable the high-rate logging profile

Revise the bitmask in SDLOG_PROFILE parameter.

Tip4: Tuning range

Typically increase gains by 20-30% per iteration, reducing to 5-10% for final fine tuning.

Tip5:  Set the same PID value in Roll and pitch ? 

Initially you can use the same values for roll and pitch, and once you have good values, you can fine-tune them by looking at roll and pitch response separately.

Tip6: Observe the flight performance for predicting tuning trend.

  • If the P gain is too high: you will see high-frequency oscillations.
  • If the P gain is too low:
    • the vehicle will react slowly to input changes.
    • In Acro mode the vehicle will drift, and you will constantly need to correct to keep it level.
  • If the D gain is too high: the motors become twitchy (and maybe hot), because the D term amplifies noise.
  • If the D gain is too low: you see overshoots after a step-input.
  • If the I gain is too high: you will see slow oscillations.
  • If the I gain is too low: this is best tested in Acro mode, by tilting the vehicle to one side about 45 degrees, and keeping it like that. It should keep the same angle. If it drifts back, increase the I gain. A low I gain is also visible in a log, when there is an offset between the desired and the actual rate over a longer time.

Tip7: Analysis the flight log to check if the parameters are well-tuned.

Tip8: It's necessary to enable Throttle PID Attenuation (TPA) if the throttle would be possible to exceed the hovering throttle. [4]


***Rate controller PID Parameters:


***A well-tuned vehicle in Acro mode will not tilt randomly towards one side, but keeps the attitude for tens of seconds even without any corrections.***


Reference:
[1] https://chuangrobot.blogspot.com/2019/01/tuing-pid-parameters-in-qgroundcontrol.html
[2] https://chuangrobot.blogspot.com/2019/04/making-open-source-quadrotor-using-lhi.html
[3] https://dev.px4.io/en/concept/architecture.html
[4] https://docs.px4.io/en/config_mc/pid_tuning_guide_multicopter.html#thrust_curve

留言

這個網誌中的熱門文章

Useful PX4 Parameters

Burn linux image to eMMC storage on Banana Pi M3