# PID altitude control of quadcopter

123 ビュー (過去 30 日間)
Dhruvilkumar Chavada 2023 年 5 月 25 日

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 件のコメント2 件の古いコメントを表示2 件の古いコメントを非表示
Sam Chak 2023 年 5 月 27 日
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.
Dhruvilkumar Chavada 2023 年 6 月 1 日
I have attached the pdf for mathematical model containing all forces and moments and equations of motions for the same.
The actual quadcopter has 4 tilit rotor, thus i have included force and moment vectoring while calculation total force and moments.
I have a doubt regarding PWM block. Do i need to insert PWM block after PID or no?

サインインしてコメントする。

### 回答 (1 件)

Sam Chak 2023 年 6 月 1 日
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
kd = 10
kp = Iy*wy^2 % proportional gain
kp = 5
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))
Gcl = 1 ------------- s^2 + 2 s + 1 Continuous-time transfer function.
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.

サインインしてコメントする。

### カテゴリ

Help Center および File ExchangeGuidance, Navigation, and Control (GNC) についてさらに検索

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by