A simple matlab and simulink interface for the versatile control of quadrotor swarms, incorporating full quadrotor dynamics.
There are two primary Simulink diagrams:
-
ErskineSingleDrone: This is the structure of a single drone, taking a control input, performing the control, and outputting the state
-
ErskineMultiDrone: This simulates one or more swarms composed of the preceeding single drone type. Multiple swarms with the same initial conditions can be used to compare controllers
Both simulink diagrams must be initialized with their own launch files. As this model was developped for the simulation of quadrotor swarms in order to evaluate new algorithms, versatility and readability were prioritized over compile time and run time.
This model is initialized by the SingleQuadInit.m script. It computes the forward dynamic model of the quadrotor given the net thrust
$\begin{align} \dot{\bf p} &= {\bf v} \ \dot{\bf v} &= \frac{{\bf R}({\bf q})}{m}\begin{bmatrix}0\0\f \end{bmatrix}+ {\bf g} \ \dot{\bf q} &= -\frac{1}{2} \begin{bmatrix} 0 \ \boldsymbol{\omega} \end{bmatrix} \otimes {\bf q} \ \dot{\boldsymbol{\omega}} &= {\bf I}^{-1}\left( \boldsymbol{\tau} - \boldsymbol{\omega} \times {\bf I} \boldsymbol{\omega} \right) \end{align}$
where
In reality, the motor speeds of a quadrotors are controlled by an electronic speed controller (ESC), but for the sake of keeping this model simple, the propeller speeds
$\begin{align} \dot{\boldsymbol{\omega}}_p = k_m (\boldsymbol{\omega}_p^* - \boldsymbol{\omega}_p) \end{align}$
While quadrotor control often makes use of slow translational controllers and fast attitude controllers, for the sake of keeping a compact and simple diagram, here they are calculate both at once every loop. The controller can be selected by clicking on the drone block, and the types of control are listed below:
-
Position control
-
Velocity control
-
Acceleration control
-
Thrust Attitude control
-
Thrust Attitude Rate control
-
Thrust Moment control
Each controller outputs
Drone parameters are set by the SimSetup/setDefaultDroneParams.m functions, and are organized as:
- param.mechanical
- m
- l
- I
- param.motors
$\omega_{max}$ $\omega_{min}$ $\omega_{0}$ - gain
- kt_prop
- kd_prop
- allocation_matrix param.control
- position
- kp
- kd
- velocity
- kp
- attitude
- kp
- kd
- attitude_rate
- kp
- limits
- thrust
- max
- min
- thrust
- param.sensor
- position_noise
- velocity_noise
- attitude_noise
- gyroscope_noise
Quadrotor