This MATLAB project demonstrates the implementation of a Linear Quadratic Regulator (LQR) controller and Luenberger Observer for a UAV (Unmanned Aerial Vehicle).
- Effectively simulate the dynamics of a quadrotor in MATLAB/Simulink.
- Design a controller for trajectory tracking that can handle linear trajectories, using the Linear Quadratic Regulator (LQR).
- Evaluate the performance of the closed-loop system through simulations to ensure that it meets the design specifications.
- Introduce a constant external force disturbance in the model that simulates a constant wind.
- Design a linear controller that can automatically compensate for the disturbance.
- Visualize the quadrotor's motion and the results of the tracking controllers in a real-time animated plot to analyze and present the system's behavior.
- Clone or download the repository to your local machine.
- Open MATLAB and navigate to the project directory.
model_LQR_Obsever.m
: The main script that executes the UAV LQR & Integrator & obsever. Modify this file to adjust the control gains and cost function weights.Basic_Linear_model.m
: Basic UAV’s Model script.QRotorSimulation.slx
: Simulation of LQR controller design. Modify this file to adjust the control gains and cost function weights.skew.m
: functions for calculate the skew matrix.visualization.m
: UAV path visualization.
- Open
model_LQR_Obsever.m
andBasic_Linear_model.m
in MATLAB and run it get the controller gain. - Open
QRotorSimulation.slx
,there are four part of different situations, run it for simulation respectively. - Specify the initial conditions, desired states, and other control parameters.
- use
visualization.m
or UAV toolbox to watch the flight path
- Integrator: Model with integrator part to against the wind distribution.
- Basic: Basic model with no wind condition.
- BasicNoWind:Basic model with wind condition.
- VObserver: Model without velocity state use Luenberger Obsever.