Memuat
Memuat
A cascade controller keeps a quadcopter's roll, pitch, yaw and height stable despite wind.
0 views
A 1.2 kg quadcopter with three-axis Euler dynamics and angle kinematics. Angles are controlled by an outer P loop that commands body rates to an inner PID, height is controlled by a PID with weight feed-forward, and a matrix mixer splits commands among four motors with thrust limits and lag. Wind comes as a pulse, a sinusoidal gust and a downdraft.

Roll 10 degrees, pitch 8, yaw 45 and height 2 then 3 m are applied in steps; wind enters as torques and a force.
The angle error times a P gain becomes a body-rate command, then a rate PID produces the torque.
A height PID plus weight feed-forward, divided by cos roll and cos pitch, keeps the vertical lift constant.
A matrix Gain turns thrust and three torques into four thrust commands; motors are limited to 0 to 8 N with a 30 ms lag.
The three-axis Euler equations and angle kinematics are built from Integrators, Products and Trigonometric Functions.
Rotor speed from thrust, then electrical power from the motor efficiency plus a fixed loss.
System
A 1.2 kg quadcopter with 0.225 m arms, Ix = Iy = 0.015 and Iz = 0.028 kg m2, and up to 8 N of thrust per motor.
Scenario
A 26 s simulation with a 1 ms step, a roll wind pulse at 18-20 s and a downdraft at 22-23.5 s.
Note: A pure simulation model; it has not been validated against a physical drone and the PID gains are not tuned for specific hardware.
Simulink model quadcopter_kontrol_sikap.slx (standard block diagram); Builder script buat_model.m and runner jalankan.m; Result plots grafik_quadcopter (PNG) and metrik.json; Step-by-step PDF guide (coming soon, sent once finished); Video tutorial on building the model (coming soon); Requires MATLAB and Simulink (built in R2025b); the slh.m builder helper is included.
Yes. The .slx model opens in MATLAB with Simulink (built in R2025b; use the same or a newer release). Project 09 also needs the Communications Toolbox. The package includes the builder script and the runner, so you can also rebuild the model and rerun the plots yourself.
Yes. Parameters are kept in the Model Workspace, so you can change values such as gains, capacities and profiles and rerun the simulation. If you would like us to adapt or extend the model for you, message us on WhatsApp.
The project costs US$17. Use the "Buy via WhatsApp" button on this page; the project files are delivered after payment is confirmed.
Found a problem or have a suggestion for this project? Tell us on WhatsApp
Back to MATLAB Simulink portfolio