-
Notifications
You must be signed in to change notification settings - Fork 16
PID Tuning
In-order to align the drone with the ArUco marker we need to have a good controller. In our project we are using PID controller for the making the system stable.
The PID control scheme is named after its three correcting terms, whose sum constitutes the manipulated variable. The proportional, integral, and derivative terms are summed to calculate the output of the PID controller. Defining u(t) as the controller output, the final form of the PID algorithm is:
u(t) = P + I + D
Here the formulae for P,I and D are:
P = Kp*error
I += Ki*error*dt
D = Kd*(current_error - previous_error)/dt //if (dt != 0) condition should be considered
where,
`error = set_point - input`
`dt = current_time - last_time`
Kp is the proportional gain, a tuning parameter,
Ki is the integral gain, a tuning parameter,
Kd is the derivative gain, a tuning parameter,
Input is the distance between the drone position and ArUco marker which was given by the ArUco marker,
Set-point is the target pose that is the distance that drone has to make with the ArUco marker.
A PID controller continuously calculates an error value e(t) as the difference between a desired set-point and a measured process variable and applies a correction based on proportional, integral, and derivative terms.
By measuring the position and subtracting it from the set-point, the error (e) is found, and from it the controller calculates how much velocity to supply. The obvious method is proportional control: the velocity is set in proportion to the existing error.
An integral term increases action in relation not only to the error but also the time for which it has persisted. So, if applied force is not enough to bring the error to zero, this force will be increased as time pass. A pure "I" controller could bring the error to zero, however, it would be both slow reacting at the start (because action would be small at the beginning, needing time to get significant), brutal (the action increases as long as the error is positive, even if the error has started to approach zero), and slow to end (when the error switch side, this for some time will only reduce the strength of the action from "I", not make it switch side as well), prompting overshoot and oscillations (see below). Moreover, it could even move the system out of zero error.
A derivative term do not consider the error (meaning it cannot bring it to zero: a pure D controller cannot bring the system to its set point), but the rate of change of error, trying to bring this rate to zero.
Getting the gain(kp, ki, kd) values: Proportional is Present, Integration is Past and Derivative is Future. If the system must remain online, one tuning method is to first set Ki and Kd values to zero. Increase the Kp until the output of the loop oscillates, then the Kp should be set to approximately half of that value for a "quarter amplitude decay" type response. Then increase Ki until any offset is corrected in sufficient time for the process. However, too much Ki will cause instability. Finally, increase Kd, if required, until the loop is acceptably quick to reach its reference after a load disturbance.
But in our project we followed another method. Firstly, we set the Kd value. We gave some random value(0.1) and checked the system response and by the observation the system was responding slowly. So gradually increased Kd value until the system is responding quickly and there are no much jitters. then we set the Kp value. We gave some random value (0.1) at starting stage and increased gradually up-to getting good response, then Ki is increased until any offset is corrected in sufficient time.
In our project we have 4 parameters to which we have to set the PID values. Those are, 3-translation parameters (X, Y, Z) and one rotational parameter (Yaw). We set the PID values for all the 4 parameters and our PID values are:
For X: Kp = 0.075; Ki = 0.0075; Kd = 0.0125;
For Y: Kp = 0.075; Ki = 0.0075; Kd = 0.0125;
For Z: Kp = 0.15; Ki = 0.00125; Kd = 0.075;
For Yaw: Kp = 1.0; Ki = 0.0; Kd = 0.0;
PID Tuning flow chart
Refer to the PID Controller wiki for more information.
- Home
- Installation
- ArUco marker based stabalisation using PID
- Aligning drone with the marker 1.Aligning with aruco marker 2.Aligning with whycon marker
- Setup ArUco mapping package
- Emulating AR drone 2 in Rviz
- Mapping a simulated environment using Turtlebot and octomap
- 3D Navigation of Drone (Using MoveIt!)