Nonlinear Model Predictive Control (NMPC) for Drone. This implementation is based on acados and inspired by A Comparative Study of Nonlinear MPC and Differential-Flatness-Based Control for Quadrotor Agile Flight. The visualization is done using MATLAB as shown below:
-
Install acados and its dependencies, refer to the acados official documentation.
-
Clone this repository:
git clone https://github.com/KafuuChikai/drone_mpc.git cd drone_mpc
drone_opt.py
: Contains the implementation of the drone optimizer.drone_model.py
: Contains the definition of the drone model.
Run the optimizer:
python drone_opt.py
After running drone_opt.py
, the drone state and control data files drone_state.csv
and drone_control.csv
will be generated.
-
Use the MATLAB script
/data_test/data_show.m
for visualization. -
First, import the position state from
drone_state.csv
as a variablep
(shapetime_step x 3
). -
Then, run
data_show.m
in MATLAB to visualize the results.