PID altitude control of quadcopter
71 views (last 30 days)
Show older comments
Hello everyone,
I am designing a flight control algorithm for a UAV. In the first step, I am just designing control just altitude using PID.
I gave an step input of 50 m after 10 s as the reference altitude.
Problem 1: when i ran the simulink model, the UAV is going high and high.
Problem 2: The altitude starts rising after 3 s, even though the reference signal is 0 for first 10 s.
I tried tuning PID with simulink tuning app and with ZN method, but not getting required output.
I am attaching my simulink model for reference.
i have selected motor and propeller from T motors. The website link and other required information are mentioned in the model.
Currently, I am interpolating rpm data from the available throttle and rpm data from the website.
correct me if i am wrong here, the output of PID control is PWM and 50% throttle setting can be assumed to be 50% of voltage supply?
Do i need to add PWM block after PID block?
Thanks and regards,
Dhruvil Chavada
4 Comments
Sam Chak
on 27 May 2023
To design (rather than blindly tune) a stabilizing PID controller, it is advisable to obtain the equations of motion that describe the takeoff and hovering motion of the quadcopter. This approach is known as model-based design.
If you can provide the ordinary differential equations for the takeoff and hovering motion, I can take a look at the math and suggest a stable reference model that you can track using the PID or another simple nonlinear controller.
Answers (1)
Sam Chak
on 1 Jun 2023
The following example is based on the pure math analysis on the contineous-time equations of motion given in your note. Thus, PWM is not considered in the design.
The Moment equations of motion (attitude model) are
... Eq. (1)
If assuming small angles on , then the Euler rate can be expressed as follows:
... Eq. (2)
and the Moment equations of motion become
... Eq. (3)
From Eq. (3), if the Control Moments are defined as
... Eq. (4)
where is assumed to be known, and are the PID controllers to be designed, then Eq. (3) can be 'flattened' to decoupled Double Integrator Systems
... Eq. (5)
which allows the Engineer to design some control laws based on simple knowledge of differential equations.
In the absence of external disturbances, state-feedback PD controllers are sufficient to stabilize the systems in Eq. (5) based on the knowledge of . Multiplying with the moment of inertia, it becomes
where
Iy = 5;
wy = 1; % tune this parameter to tune kp and kd simultaneously
kd = 2*Iy*wy % derivative gain
kp = Iy*wy^2 % proportional gain
Gp = tf(1, [1 0]);
Gv = tf(1, [Iy 0]);
G1 = feedback(Gv, kd);
G2 = series(kp, series(G1, Gp));
Gcl = minreal(feedback(G2, 1))
step(Gcl, 20), grid on
If the Euler angular rate signals cannot be accurately measured, then the output-feedback PD controllers (PID controller block in Simulink) should be used. The autotuner feature can be used, if you understand how it works.
Also take note that in your note, the actuation dynamics (rotors) are not considered in the design. In practice, there will be a slight delay in the signal transmission. Anyhow, you can try this design approach assuming that the nominal model is known.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!