Quadrotor

Example

Quadrotor/

Where you can find this quadrotor

M. Hehn and R. D’Andrea, “A flying inverted pendulum,” ICRA, Shanghai, China, 2011, pp. 763–770.

Problem Description

  • The state vector of the quadrotor is x = [X,\dot{X} , Y ,\dot{Y} ,Z ,\dot{Z} ,\gamma ,\beta ,\alpha ]^{T}\in\mathbb{R}^{9}, where (X,Y,Z) and (\gamma,\beta,\alpha) are the position and angles of the quadrotor, respectively. The state is bounded by [-0.2,-0.2,-0.2]^T \leq [\gamma,\beta,\alpha]^T \leq [0.2,0.2,0.2]^T.

  • The input vector is u=[a,\omega_{X},\omega_{Y},\omega_{Z}]^T, where a represents the thrust and (\omega_{X},\omega_{Y},\omega_{Z}) the rotational rates. The control input is bounded by [0,-1,-1,-1]^T \leq u \leq [11,1,1,1]^T.

  • The dynamics of the quadrotor are given by the following equations:

\begin{align} &\ddot{X} = a(\cos\gamma\sin\beta\cos\alpha+\sin\gamma\sin\alpha)\\ &\ddot{Y} = a(\cos\gamma\sin\beta\sin\alpha-\sin\gamma\cos\alpha)\\ &\ddot{Z} = a\cos\gamma\cos\beta-g\\ &\dot{\gamma} = (\omega_{X}\cos\gamma+\omega_{Y}\sin\gamma)/\cos\beta\\ &\dot{\beta} = -\omega_{X}\sin\gamma+\omega_{Y}\cos\gamma\\ &\dot{\alpha} = \omega_{X}\cos\gamma\tan\beta + \omega_{Y}\sin\gamma\tan\beta+\omega_{Z} \end{align}

The task is to control the quadrotor to track a given position reference.

OCP in ParNMPC

  • The state constraints are softened by introducing a slack variable s\geq 0 with a quadratic penalty on s.

Closed-loop Simulation using ParNMPC

Step 1. NMPC problem formulation

See Workflow of ParNMPC > NMPC Problem Formulation.

Example

Quadrotor/NMPC_Problem_Formulation.m

See Workflow of ParNMPC > Code Generation and Deployment > Simulink.

  1. Code generation

    Example

    Quadrotor/Simu_Simulink_Setup.m

  2. Deployment

    Example

    Quadrotor/Simu_Simulink.slx