[go: up one dir, main page]

0% found this document useful (0 votes)
113 views17 pages

2-PID Tuning Tutorial

Uploaded by

Jeremy Jiang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
113 views17 pages

2-PID Tuning Tutorial

Uploaded by

Jeremy Jiang
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

Part C: PID parameters tuning

Part C – 1: PID parameters explanation

The drone may not fly well with the initial PID parameters.
You can tune the PID parameters by yourself in the QGC.

P Gain
The P (proportional) gain is used to reach the input signal and reduce the tracking error. It is
responsible for a quick response and thus should be set as high as possible, but without
introducing oscillations.
⚫ 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.
Part C – 2: PID parameters explanation

I Gain
The I (integral) gain is used to reduce the steady error. If the desired rate is not reached, then you
can add the I gain into your system. It is important, but it should not be set too high.
⚫ If the I gain is too high: you will see slow oscillations.
⚫ If the I gain is too low: there is an offset between the desired and the actual value over a
longer time.
Part C – 3: PID parameters explanation

D Gain
The D (derivative) gain is used to predict the trend of derivation change. so it can produce
advanced control effect. When the D is properly selected, the overshoot can be reduced and the
adjustment time can be reduced.
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 will see overshoots after a step-input. Produce large time delay.
Part C – 4: Rate Controller

Rate & Attitude Controller

 sp  qsp q
P Controller PID Controller
τb
- -
 q

 - difference
q - attitude rates ( x)sp - setpoint(of x)

τb -control inputs (torques


around the body frame axes)
Part C – 5: Parameters tuning in QGC

In QGC, you can find the PID parameters in Vehicle Setup->Parameters->Multicopter Attitude Control.

⚫ For the rate PID controller, you can adjust the following parameters:
➢ Roll rate controller (MC_ROLLRATE_P, MC_ROLLRATE_I, MC_ROLLRATE_D);
➢ Pitch rate controller (MC_PITCHRATE_P, MC_PITCHRATE_I, MC_PITCHRATE_D);
➢ Yaw rate controller (MC_YAWRATE_P, MC_YAWRATE_I, MC_YAWRATE_D).
Part C – 6: Rate & Attitude Controller

Rate & Attitude Controller

 sp  qsp q
P Controller PID Controller
τb
- -
 q

 - attitude angle  - difference


q - attitude rates ( x)sp - setpoint(of x)

τb -
control inputs (torques
around the body frame axes)
Part C – 7: Parameters tuning in QGC

In QGC, you can find the PID parameters in Vehicle Setup->Parameters->Multicopter Attitude Control.

⚫ For the attitude P controller, you can adjust the following parameters:
➢ Roll controller (MC_ROLL_P);
➢ Pitch controller (MC_PITCH_P);
➢ Yaw controller (MC_YAW_P).
Part C – 8: Velocity & Position Controller (cascade control)

Velocity & Position Controller

rsp r
vsp v Fsp
P Controller PID Controller projzb
Z sp
- -
r v
 sp Conversion
 sp

r - position F - thrust  - difference

v - velocity Z - body vertical thrust ( x)sp - setpoint(of x)

projzb - vector projected


 - attitude  - yaw angle
onto body Z-axis
Part C – 9: Steps of Parameters tuning in QGC

1. Fly your drone stable and download the flight log


Part C – 10: Steps of Parameters tuning in QGC

2. Upload the flight log to the flight analysis website: https://review.px4.io/upload


Part C – 10: Steps of Parameters tuning in QGC

3. Tune the PID and fly your drone again


Part C – 10: Steps of Parameters tuning in QGC

4. Repeatedly adjust the PID to obtain good performance


Here are some general points to follow when tuning:
⚫ Only give P an initial value, and set I and D as zero. According to the response curve, we add I
and D into the system. https://review.px4.io/upload
⚫ All gains should be increased very slowly as large gains may cause dangerous oscillations!
Typically increase gains by 5-10% per iteration, reducing to 1-5% for final fine tuning.
⚫ Slowly increase the throttle and check for oscillations.
Part D: Fly your drone
All flying, including takeoff and landing, is controlled using the 4 basic commands:
roll, yaw, pitch and throttle.

•Arm the Drone


Before you can fly the drone it must first be armed. This will power all motors and actuators.
To arm the drone:
•First disengage the safety switch.
•Use the arm command for your drone - put the throttle stick in the bottom right corner.
•Takeoff
Now you can takeoff the drone manually by enabling Position Mode, Altitude Mode or
Manual/Stabilized Mode, arming the drone, and then raising the throttle stick above slowly.

•Landing
•You can land the drone manually by pressing the throttle stick down slowly until the drone lands.
•Use the disarm command for your drone - put the throttle stick in the bottom left corner.

You might also like