modelado y control de un cuadricoptero, junio … · matematica aplicada (cuaterniones), electr´...

12
MODELADO Y CONTROL DE UN CUADRICOPTERO, JUNIO 2014 1 MODELADO Y CONTROL DE UN CUADRICOPTERO Autor: Sevilla Fern ´ andez, Luis Directores: Zamora Macho, Juan Luis. Porras Gal´ an, Jos ´ e. Fern´ andez Mart´ ınez, Ces ´ areo. Entidad colaboradora: ICAI – Universidad Pontificia Comillas. Resumen—El objetivo de la l´ ınea de trabajo donde se enmarca este proyecto es modelar y controlar un veh´ ıculo a´ ereo no tripulado (UAV) provisto de cuatro rotores (cuadric´ optero) accionados mediante motores brushless. El sistema de control permitir ´ a el vuelo estacionario, la navegaci´ on guiada mediante una emisora de radiocontrol y la navegaci´ on aut ´ onoma mediante sensores de distancia. Con el fin de poder utilizar el veh´ ıculo en docencia, se implantar ´ a tanto el modelo como las estrategias de control que se exploren en el entorno Matlab/Simulink. Index Terms—Cuadric ´ optero, UAV, Proyecto, ICAI, Comillas. 1. I NTRODUCCI ´ ON E N los ´ ultimos nos hemos sido testigos de un crecimiento importante en el desarrollo de veh´ ıculos ereos no tripulados (UAV), especialmente de despegue y aterrizaje vertical (VTOL), debido a sus m ´ ultiples aplicaciones tales como vigilancia de instalaciones, acceso a zonas de riesgo, captaci ´ on de im´ agenes ereas, etc. Adem´ as este tipo de plataformas son muy apropiadas para la docencia, pues integran una gran diversidad de ´ areas de conocimiento tales como mec´ anica del olido ıgido (momentos y tensores de inercia, matrices de rotaci ´ on, ´ angulos de Euler), matem´ atica aplicada (cuaterniones), electr ´ onica de potencia (controladores electr ´ onicos de velocidad), automatizaci ´ on (el control del veh´ ıculo), etc. El objetivo de la l´ ınea de trabajo donde se enmarca este proyecto es modelar y controlar un veh´ ıculo a´ ereo no tripulado provisto de cuatro rotores (cuadric´ optero) accionados mediante motores brushless para vuelo en interiores (ver figura 1). El sistema de control permitir´ a el vuelo estacionario, la navegaci ´ on guiada mediante una emisora de radiocontrol y la navegaci´ on aut´ onoma me- diante sensores de distancia. Con el fin de poder utilizar el veh´ ıculo en docencia, se desarrollar´ a tanto el modelo de simulaci ´ on, las estrategias de control y estimaci´ on de estado y los driver blocks de sensores y generaci´ on autom´ atica de c´ odigo en el entorno Matlab/Simulink. Adem´ as, este proyecto aportar´ a a la Universidad Ponti- ficia Comillas experiencia en la operaci ´ on de UAV para facilitar el desarrollo de nuevas l´ ıneas de investigaci ´ on en este ´ ambito. El cuadric ´ optero empleado en este proyecto (ver figura 1) est´ a accionado por cuatro motores brushless situados en los extremos de sus brazos y regulados a trav´ es de cuatro controladores electr´ onicos de velocidad (ESC). Cuenta con una tarjeta controladora Crius, con un micro- procesador ATMega 2560 de Arduino, y con una unidad inercial de medidas (IMU) compuesta por aceler´ ometros, gir´ oscopos y magnet ´ ometros. La comunicaci ´ on entre el dispositivo y el piloto se realiza a trav´ es de una emisora de radio control. Finalmente, la alimentaci´ on del dispo- sitivo se realiza mediante una bater´ ıa LiPo. Figura 1: Cuadric ´ optero y emisora 2. ESTADO DEL ARTE Los movimientos de traslaci ´ on y rotaci´ on de un cua- dric ´ optero se controlan mediante variaciones en la ve- locidad de giro de sus rotores que definen las fuerzas de empuje vertical en cada uno de ellos. As´ ı pues, para que el dispositivo ascienda/descienda se debe aumentar/disminuir la velocidad de rotaci ´ on de todos los motores simult´ aneamente. Las traslaciones en las

Upload: dinhdien

Post on 15-Feb-2019

234 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MODELADO Y CONTROL DE UN CUADRICOPTERO, JUNIO … · matematica aplicada (cuaterniones), electr´ onica de

MODELADO Y CONTROL DE UN CUADRICOPTERO, JUNIO 2014 1

MODELADO Y CONTROL DE UNCUADRICOPTEROAutor: Sevilla Fernandez, Luis

Directores: Zamora Macho, Juan Luis.Porras Galan, Jose.Fernandez Martınez, Cesareo.

Entidad colaboradora: ICAI – Universidad Pontificia Comillas.

Resumen—El objetivo de la lınea de trabajo donde se enmarca este proyecto es modelar y controlar un vehıculo aereo no tripulado

(UAV) provisto de cuatro rotores (cuadricoptero) accionados mediante motores brushless. El sistema de control permitira el vuelo

estacionario, la navegacion guiada mediante una emisora de radiocontrol y la navegacion autonoma mediante sensores de distancia.

Con el fin de poder utilizar el vehıculo en docencia, se implantara tanto el modelo como las estrategias de control que se exploren en

el entorno Matlab/Simulink.

Index Terms—Cuadricoptero, UAV, Proyecto, ICAI, Comillas.

1. INTRODUCCION

EN los ultimos anos hemos sido testigos de uncrecimiento importante en el desarrollo de vehıculos

aereos no tripulados (UAV), especialmente de despeguey aterrizaje vertical (VTOL), debido a sus multiplesaplicaciones tales como vigilancia de instalaciones,acceso a zonas de riesgo, captacion de imagenesaereas, etc. Ademas este tipo de plataformas sonmuy apropiadas para la docencia, pues integran unagran diversidad de areas de conocimiento tales comomecanica del solido rıgido (momentos y tensoresde inercia, matrices de rotacion, angulos de Euler),matematica aplicada (cuaterniones), electronica depotencia (controladores electronicos de velocidad),automatizacion (el control del vehıculo), etc.

El objetivo de la lınea de trabajo donde se enmarcaeste proyecto es modelar y controlar un vehıculo aereono tripulado provisto de cuatro rotores (cuadricoptero)accionados mediante motores brushless para vuelo eninteriores (ver figura 1). El sistema de control permitira elvuelo estacionario, la navegacion guiada mediante unaemisora de radiocontrol y la navegacion autonoma me-diante sensores de distancia. Con el fin de poder utilizarel vehıculo en docencia, se desarrollara tanto el modelode simulacion, las estrategias de control y estimacionde estado y los driver blocks de sensores y generacionautomatica de codigo en el entorno Matlab/Simulink.Ademas, este proyecto aportara a la Universidad Ponti-ficia Comillas experiencia en la operacion de UAV parafacilitar el desarrollo de nuevas lıneas de investigacionen este ambito.

El cuadricoptero empleado en este proyecto (ver figura1) esta accionado por cuatro motores brushless situados

en los extremos de sus brazos y regulados a travesde cuatro controladores electronicos de velocidad (ESC).Cuenta con una tarjeta controladora Crius, con un micro-procesador ATMega 2560 de Arduino, y con una unidadinercial de medidas (IMU) compuesta por acelerometros,giroscopos y magnetometros. La comunicacion entre eldispositivo y el piloto se realiza a traves de una emisorade radio control. Finalmente, la alimentacion del dispo-sitivo se realiza mediante una baterıa LiPo.

Figura 1: Cuadricoptero y emisora

2. ESTADO DEL ARTE

Los movimientos de traslacion y rotacion de un cua-dricoptero se controlan mediante variaciones en la ve-locidad de giro de sus rotores que definen las fuerzasde empuje vertical en cada uno de ellos. Ası pues,para que el dispositivo ascienda/descienda se debeaumentar/disminuir la velocidad de rotacion de todoslos motores simultaneamente. Las traslaciones en las

Page 2: MODELADO Y CONTROL DE UN CUADRICOPTERO, JUNIO … · matematica aplicada (cuaterniones), electr´ onica de

MODELADO Y CONTROL DE UN CUADRICOPTERO, JUNIO 2014 2

tres direcciones del espacio se producen generando unempuje diferencial entre dos rotores alternos. Ası pues,para producir un desplazamiento en la direccion x, sedebera reducir la velocidad del rotor 2 de la figura 2y aumentar la del 4. Finalmente, el incremento de lavelocidad de rotacion de los motores 1 y 3 permitira aldispositivo realizar una guinada dextrogira, mientrasque el aumento de la velocidad de 2 y 4 resulta en unaguinada levogira.

Figura 2: Esquema de los pares generados por los rotores

El modelado matematico de una aeronave es un temaampliamente estudiado en la literatura. En la actualidad,existe una gran variedad de modelos tanto para vuelosinteriores [1],[2],[3] como para vuelos exteriores, encuyo caso se incluyen los efectos aerodinamicos [4],[5].La correcta definicion de un modelo es crıtica tantopara el diseno de la estrategia de control como para losestudios de simulacion.

El control asume la disponibilidad de las variablesde estado, es decir la estimacion de la orientacion delcuadricoptero definida a partir de los angulos de Euler.Los estimadores de estado mas comunes para este tipode aplicacion son:

El filtro complementario [6]: se basa en una pon-deracion de la estimacion de los angulos de Eulerrealizada a partir de las medidas de los acelerome-tros y los giroscopos. Hace uso de un filtro pasobajo para eliminar el ruido del acelerometro (altafrecuencia) y de un filtro paso alto para eliminar elbias de los giroscopos (baja frecuencia).El filtro de Kalman [7]: Se trata de un algoritmo deestimacion de los angulos de Euler a partir de unmodelo estocastico del sistema de medida, basadoen los acelerometros y giroscopos.

En relacion a la estrategia de control, existe unagran variedad de algoritmos propuestos en laliteratura debido a que el modelo del cuadricopteroes multivariable y no lineal. Entre los algoritmospropuestos destacan los algoritmos basados en lateorıa de Lyapunov de H.Voos [1] y Bouabdallah[3], los controladores por realimentacion del estadocomo el control LQ disenado por Hoffmann [10] y los

controles PID como el disenado por Bouabdallah [11].Es importante remarcar que en internet hay disponibleuna gran variedad de firmwares para controladoresde vuelo basados en Arduino como el Multiwii o elMega-Pirate disponibles para el controlador Crius yel firmware APM para el controlador Ardu-Pilot. Sinembargo, no se conocen versiones disponibles para elentorno Matlab Simulink.

Finalmente, la aplicacion de cuadricopteros en cursosde control avanzado en distintas universidades esta au-mentando significativamente durante los ultimos anos,como por ejemplo en la Universidad de Hong Kong [12],la Universodad de Illinois o el Swiss Federal Institute ofTechnology, entre otros muchos casos.

3. MODELADO

El modelo matematico del cuadricoptero viene dadopor el conjunto de ecuaciones que describen el compor-tamiento fısico de la aeronave. En este proyecto se handesarrollado dos modelos:

Modelo no lineal completo. Conjunto de ecuacio-nes que permite representar de forma detallada elcomportamiento del cuadricoptero en vuelo. Lasentradas del modelo son las tensiones aplicadas alos cuatro motores brushless, y las salidas son lasposiciones y velocidades en los seis grados de liber-tad del cuadricoptero. La aplicacion fundamentalde este modelo es comparar diferentes estrategiasde control mediante una simulacion lo mas realistaposible, como un paso de validacion previo a laimplantacion del sistema de control en el equipo.Modelo simplificado. Este modelo incluye exclusi-vamente las dinamicas correspondientes a la orien-tacion del cuadricoptero, permitiendo disenar laestrategia de control que estabiliza la aeronave.

Cada uno de estos modelos requiere de un conjuntode parametros (dimensiones, masa, momentos de inerciay caracterısticas dinamicas de los sistemas propulsores),que deben ser adecuadamente estimados. Consecuente-mente, se ha desarrollado un modelo CAD y se hanrealizado pruebas del sistema de propulsion en un bancode ensayos.

En este proyecto se ha hecho uso del programa SolidEdge para obtener la representacion grafica (CAD) delcuadricoptero mostrada en la figura 3.

Figura 3: Representacion CAD de la estructura del cua-dricoptero

Page 3: MODELADO Y CONTROL DE UN CUADRICOPTERO, JUNIO … · matematica aplicada (cuaterniones), electr´ onica de

MODELADO Y CONTROL DE UN CUADRICOPTERO, JUNIO 2014 3

Este programa permite calcular los parametrosmecanicos de la estructura incluidos en la tabla 1.

Parametros mecanicos de la estructuraMasa(Kg)

Volumen

(mm3 )

Ixx(Kgm2)

Iyy(Kgm2)

Izz(Kgm2)

0.2722 94059.7154 7,83 · 10−4 7,85 · 10−4 1,401 · 10−3

Parametros dinamicos de los rotoresKv

(rpm/v)Rm(Ω)

b(Ns/rad)

d(Nms/rad)

2900 0.6 5.44e-7 7.32e-9

Tabla 1: Parametros del cuadricoptero

Para la estimacion de los parametros dinamicos de losrotores se han realizado pruebas en el banco de ensayosmostrado en la figura 4. Las variables medidas durantelos ensayos son la tension, la corriente, la velocidad delos motores, la fuerza de empuje y el par de arrastre. Apartir de estas medidas, se han deducido los valores delos parametros dinamicos de los rotores mostrados en latabla 1.

Figura 4: Banco de ensayos

En ninguno de los modelos presentados se han in-cluido los efectos aerodinamicos que pueden afectar aldispositivo pues, tras un analisis de estos (especialmenteel efecto suelo y el efecto techo), se ha demostrado queno son relevantes en condiciones de vuelo en interiores.

4. ESTIMACION DE ESTADOS

En este proyecto se ha hecho uso de un filtro multipli-cativo extendido de Kalman, ya que resulta mas robustode cara a las vibraciones de la estructura. Se trata de unfiltro extendido porque se basa en un modelo no linealdel sistema de medida. Se dice tambien que es multipli-cativo porque, a pesar de que es capaz de realizar es-timaciones unicamente con giroscopos y acelerometros,pueden incluirse otros sensores (magnetometros, GPS,etc). Por contra, este filtro requiere de un alto nivel decomputacion y por tanto se ha hecho uso de cuater-niones para la obtencion de las variables estimadas. Uncuaternion [8] es un vector de cuatro componentes querepresenta de forma precisa la informacion contenida enlos angulos de Euler para simplificar las operaciones.Ası pues se hara uso de estos elementos matematicos

para aligerar la carga computacional del conjunto yademas evitar el gimbal lock [9].

La aplicacion de este filtro de Kalman comprendevarias fases de calculos complejos como se ilustra enla figura 5 a modo de ilustracion. Los detalles delfuncionamiento del mismo se pueden encontrar en lamemoria del proyecto.

Figura 5: Esquema de funcionamiento del filtro

En la figura 6 se muestran las estimaciones del angulode alabeo realizadas mediante el filtro de Kalman (verde)y de una variacion en dicho angulo por el filtro com-plementario (azul) durante la simulacion. Se ha incluidotambien el valor real del angulo (rojo) para facilitarla comparacion. Se puede observar que ambos filtrosson capaces de realizar una estimacion razonablementebuena, a pesar de existir ruido en las medidas. Sinembargo, el filtro de Kalman realiza una estimacion masprecisa que el filtro complementario.

9.5 10 10.5 11 11.5 12 12.5 13 13.5 14−8

−7

−6

−5

−4

−3

−2

−1

0

1

2

3Estimación del angulo de alabeo

Tiempo(s)

Áng

ulo(

º)

Filtro complementarioFiltro de KalmanReferencia

Figura 6: Estimacion de angulos de Euler en simulacion

5. DISENO DEL SISTEMA DE CONTROL

El sistema de control gestiona la regulacion del dis-positivo a traves de la aplicacion de unas senales demando (tensiones de los motores). En este estudio sehan disenado un conjunto de controladores basadosen el modelo simplificado a fin de abarcar un mayorrango de posibilidades. Posteriormente se ha hecho usodel modelo completo para su comparacion mediantesimulacion. Los algoritmos de control disenados son:

1. Control PID con ponderacion de la referencia conmecanismo anti-windup disenado por respuesta en

Page 4: MODELADO Y CONTROL DE UN CUADRICOPTERO, JUNIO … · matematica aplicada (cuaterniones), electr´ onica de

MODELADO Y CONTROL DE UN CUADRICOPTERO, JUNIO 2014 4

frecuencia. Se ha hecho uso de los ındices signifi-cativos (margen de fase, pulsacion de cruce, etc)recomendados por la literatura. La presencia delmecanismo anti-windup es esencial para evitar laacumulacion del error en la integracion cuando elmando satura.

2. Control PID incremental. Se trata de una modifica-cion realizada sobre el control PID anterior en laque se trabaja con incrementos en vez de con valo-res absolutos. La principal ventaja es que permitelimitar los incrementos del mando y que simplificala logica del mecanismo anti-windup.

3. Control por realimentacion de estado por posi-cionamiento de polos. Los polos del sistema enlazo cerrado se han seleccionado para optimizar larespuesta del sistema.

4. Regulador LQ por realimentacion de estado. Se hahecho uso de un modelo estocastico del sistemapara para obtener la matriz de ganancias de re-alimentacion del estado que permita minimizar elerror de seguimiento de la referencia y el esfuerzode control.

5. Control LQ por realimentacion de estado con ac-cion integral(LQI). Se ha anadido una accion inte-gral para corregir las perturbaciones en carga quepresenta el sistema.

Adicionalmente, se ha desarrollado un modelo delcuadricoptero sobre una motocicleta (pendulo invertido)para evaluar los algoritmos de control anteriores a lahora de estabilizar el cuadricoptero, mientras se reduceel riesgo de danar el dispositivo ante errores en laimplantacion y un mal ajuste del control.

6. IMPLEMENTACION

Al no existir experiencia previa en el uso anteriores decuadricopteros en la UPCO, una gran parte del trabajorealizado se ha destinado a construir y poner a puntoel cuadricoptero. Estas tareas incluyen el montaje dela estructura, la incorporacion de los elementos necesa-rios para su funcionamiento (ESC, rotores, la tarjeta decontrol, etc) y el conexionado de los mismos. Adicio-nalmente se ha disenado y construido una placa paramonitorizar la tension de la baterıa. Se trata del circuitomostrado en la figura 7 que incluye un divisor de tensioncon un buffer.

Figura 7: Esquema del circuito de monitorizacion de latension de la baterıa

Otra de las principales tareas realizadas es la dedisenar los ”driver blocks” que permiten intercambiar

informacion entre el algoritmo de control programadoen Simulink y los sensores y actuadores instalados enel cuadricoptero. Estos ”driver blocks” han sido progra-mados en C++ e integrados en bloques de Simulink, locual supone una dificultad anadida por la novedad quesupone. Los drivers disenados son los siguientes:

Driver para la IMU. Con este driver se pretendeacceder a la informacion disponible en la IMU. Parasu programacion se ha hecho uso de la librerıaFreeIMU, originalmente escrita en C++.Driver para el transmisor-receptor RC. Este codigoes el que establece la comunicacion entre el receptorRC y el microcontrolador. Este codigo programadohace uso de interrupciones para evitar un excesode consumo de memoria por parte del microcon-trolador. Adicionalmente se ha incluido un filtro deSavitzky-Golay para reducir el nivel de ruido de lassenales.Driver para los ESC. Se trata de generar una senalPWM que permite variar la tension aplicada almotor.Driver para el lector de la tension de la baterıa.Este driver permite obtener la medida analogica dela tension en la baterıa.

Finalmente se ha programado un maquina de estadospara el arranque seguro del sistema y la gestion de las si-tuaciones de fallo. Esta maquina estados ha introducidoal sistema:

1. Elementos de seguridad como control de alturamaxima, arranque del sistema controlado o tensionmınima de la baterıa.

2. Variaciones en el algoritmo de control, como porejemplo la desactivacion de la accion integral du-rante el proceso de arranque para evitar que seacumule el error en la integracion.

3. Un arranque suave y controlado del sistema.

7. ENSAYOS

Los ensayos realizados sobre el cuadricoptero handemostrado que solo se precisa seleccionar el algoritmode control adecuado para realizar vuelos estables. Portanto, el montaje y conexionado de todos los elementosdel equipo es el adecuado. Ademas, la maquinade estados que se encarga de gestionar el arranquedel sistema ha sido evaluada ofreciendo resultadossatisfactorios.

Los ensayos realizados sobre todos los driversprogramados han ofrecido tambien resultados positivospermitiendo su aplicacion en futuros estudios. Enel caso de las senales obtenidas por el receptor RC,se ha observado cierto nivel de ruido en ella. Portanto, se ha disenado un filtro de Savitzky-Golaypara su cancelacion. Este filtro se ha usado tambienpara retrasar la senal de tension en la baterıa de formaque sea menos sensible a los picos presentes en la misma.

Page 5: MODELADO Y CONTROL DE UN CUADRICOPTERO, JUNIO … · matematica aplicada (cuaterniones), electr´ onica de

MODELADO Y CONTROL DE UN CUADRICOPTERO, JUNIO 2014 5

La figura 8 muestra la estimacion de los angulos deEuler en el sistema real realizada por el filtro de Kalmandisenado (azul) y la realizada por el estimador de laIMU (verde). La estimacion realizada por el filtro deKalman es mejor tanto con los rotores desconectadoscomo activos. Sin embargo se puede apreciar una derivao bias en la estimacion del angulo, debido a que no sehan podido usar los magnetometros en el filtro. Estaderiva puede tener un efecto importante en el controly debe ser estudiada en el futuro.

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7−80

−60

−40

−20

0

20

40Estimación corregida

Tiempo (s)

Áng

ulos

(º)

MEKFFiltro IMU

Figura 8: Estimacion del angulo de alabeo

En la figura 9 se muestran las respuestas temporalessuperpuestas de los controladores PID, de realimenta-cion de estado por posicionamiento de polos y por elmetodo LQ ante un escalon en la referencia obtenidasmediante simulacion. Como se puede observar, los tiem-pos de establecimiento con el control PID son menoresque los correspondientes a los controles basados en larealimentacion del estado.

0 0.5 1 1.5 2 2.5 30

1

2

3

4

5

6

7

8

9

10

11

Tiempo (s)

Áng

ulo

(º)

PIDRealimentaciónLQR

4 4.5 5 5.5 6 6.5 70

1

2

3

4

5

6

7

8

9

10

11

Tiempo (s)

Áng

ulo

(º)

7 7.5 8 8.5 9 9.5 100

1

2

3

4

5

6

7

8

9

10

11

Tiempo (s)

Áng

ulo

(º)

Figura 9: Respuesta de los tres controladores ante esca-lones de 10

o

La respuesta del control PID presenta un pequenosobrepaso mientras que las de los otros dos controlesson sobreamortiguadas. Si los angulos a introducir enla referencia son cercanos al valor unitario, la mejorrespuesta es la proporcionada por el control PID, dadoque su tiempo de establecimiento es el menor. Si porel contrario, se pretende trabajar con angulos de Eulermayores la respuesta sufre modificaciones indeseables,como ocurre con el angulo psi. Sin embargo, lasrespuestas de los controladores LQ y por realimentacionde estado no sufren este efecto. Consecuentemente,el control que se ensayara en el sistema real sera el

controlador LQ con accion integral.

Finalmente, se ha incluido la senal de mando de lafigura 10 proporcionada por el controlador LQ incre-mental con accion integral y mecanismo anti-windup alrealizar un ensayo real de estabilizacion del cuadricopte-ro. Tal respuesta no permite regular el dispositivo puesse trata de una senal que oscila entre los valores desaturacion fijados en el controlador. Queda como tareapendiente en futuros proyectos revisar el estimador deestado y las ganancias de la cadena de actuacion pararesolver este problema.

0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5120

140

160

180

200

220

240

260Mandos U1, U3

Tiempo(s)

Te

nsió

n(P

WM

)

Phi

Theta

0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5120

140

160

180

200

220

240

260Mandos U2, U4

Tiempo(s)

Te

nsió

n(P

WM

)

U2

U4

Figura 10: Mandos aplicados sobre el dispositivo con elcontrolador LQI

8. CONCLUSIONES

A modo de conclusion general del proyecto se puededecir que no se ha podido disenar un controlador capazde regular el comportamiento del cuadricoptero. Sin em-bargo, evaluando el volumen de aportaciones realizadas,sı se ha facilitado considerablemente el esfuerzo requeri-do para alcanzar este objetico en futuros proyectos. Lastareas realizadas con exito son las siguientes:

Se dispone de los modelos, tanto matematicos comoen CAD, para disenar un algoritmo de controladecuado.Los drivers programados realizan su funcion deforma adecuada.La maquina de estados gestiona el arranque deldispositivo adecuadamente.La monitorizacion del estado de la baterıa se llevaacabo de forma correcta.Se dispone del diagrama de bloques general di-senado para volcar el algoritmo al dispositivo.El cuadricoptero esta listo para volar de forma re-gulada, a falta de ajustar correctamente el algoritmode control y la estimacion de estado.

La causa principal por la cual el controlador no es capazde regular el dispositivo parece ser la estimacion de losangulos de Euler, bien por la deriva que presentan obien por una velocidad inadecuada de estimacion delos mismos. Existe tambien la posibilidad de que el fun-cionamiento incorrecto del controlador sea consecuenciade la conversion de la senal de mando, es decir, latransformacion de fuerzas acopladas de empuje a tensionen cada motor.

Page 6: MODELADO Y CONTROL DE UN CUADRICOPTERO, JUNIO … · matematica aplicada (cuaterniones), electr´ onica de

MODELADO Y CONTROL DE UN CUADRICOPTERO, JUNIO 2014 6

9. FUTURAS MEJORAS

Las mejoras que se proponen hacen referencia a mejo-rar el ajuste del algoritmo de estimacion de estado. Portanto se propone:

Incluir magnetometros en la estimacion de los angu-los de posicion de la aeronave. Para ello debera pro-gramarse un algoritmo de calibrado de los mag-netometros. El codigo del estimador ya esta prepa-rado para realizar la ampliacion.Implementacion de un sistema telemetrico para mo-nitorizar los ensayos en tiempo real.Disenar una carcasa que permita absorber las vibra-ciones de los rotores.

REFERENCIAS

[1] Holger Voos, Nonlinear Control of a QuadrotorMicro-UAV using Feedback-Linearization. Procee-dings of the 2009 IEEE International Conference onMechatronics. Malaga, Spain, April 2009.

[2] C BALAS and Dr J.F. Whidborne, Modelling andLinear Control of a Quadrotor. CRANFIELD UNI-VERSITY, September 2007.

[3] Bouabdallah, S., Murrieri, P. and Siegwart,R.,Towards autonomous indoor micro VTO,Autonomous Robots, France, 2005.

[4] Paul Pounds, Robert Mahony, Peter Corke, Mode-lling and Control of a Quad-Rotor Robot. AustralianNational University, 2006.

[5] McKerrow, P.,Modelling the Draganflyer four rotorhelicopter. IEEE International Conference on Robo-tics and Automation, April 2004.

[6] Robert W Klein, Flight control system employingcomplementary filter. Grumman Aerospace Corp,May 1987

[7] James K. Hall, Nathan B. Knoebel, Timothy W.McLain, Quaternion Attitude Estimation for Minia-ture Air Vehicles Using a Multiplicative ExtendedKalman Filter. Brigham Young University, Provo, UT84602.

[8] Nikolas Trawny and Stergios I. Roumeliotis, IndirectKalman Filter for 3D Attitude Estimation. A tuto-rial for quaternion algebra. University of Minnesota,March 2005.

[9] Manuel Kramer, Douglas J. Dapprich, Gyro stabili-zed inertial reference system with gimbal lock pre-vention means. The Charles Stark Draper Laboratory,Inc. October 1977.

[10] Hoffmann,G.M., Rajnarayan, D.G., Waslander, S.L.,Dostal, D., Jang, J.S. and Tomlin, C.J., The stanfordtestbed of autonomous rotorcraft for multi agentcontrol. Digital Avionics Systems Conference, 2004.

[11] Bouabdallah, S., Noth, A. and Siegwart, R., PIDvs LQ control techniques applied to an indoor mi-cro quadrotor. Swiss Federal Institute of Technology,2004

[12] Igor Gaponov,Anastasia Razinkova, QuadcopterDesign and Implementation as a Multidisciplinary

Engineering Course. IEEE International Conferenceon Teaching, Assessment, and Learning for Enginee-ring (TALE), August 2012.

Page 7: MODELADO Y CONTROL DE UN CUADRICOPTERO, JUNIO … · matematica aplicada (cuaterniones), electr´ onica de

MODELLING AND CONTROL OF A QUADCOPTER, JUNE 2014 7

MODELLING AND CONTROL OF AQUADCOPTER

Author: Sevilla Fernndez, Luis

Project managers: Zamora Macho, Juan Luis.Porras Galan, Jose.Fernandez Martınez, Cesareo.

Partner entity : ICAI Universidad Pontificia Comillas.

Abstract—The objective of the research path where this project is framed is to model and control an unmanned aerial vehicle (UAV)

provided with four rotors (quadcopter) powered by brushless motors. The control system will allow the system to hover, to fly guided

by a transmitter and to fly autonomously using proximity sensors. As this project is aimed to be applied in future courses within the

university, all the control strategies as well as the models created will be adapted to Matlab/Simulink.

Index Terms—Quadcopter, UAV, Thesis, ICAI, Comillas.

1 INTRODUCTION

W Ithin the last years, we have witnessed a greatgrowth on the development of unmanned aerial

vehicles, specially the vertical take-off landing kind.This is due to their multiple applications such as facilitysurveillance, access to risk areas, aerial imaging, etc.Besides, this kind of devices are quite useful withinthe academical world as they cover a wide range ofknowledge fields such as mechanics, mathematics,power electronics, control theory, etc.

The objective of the research path where this projectis framed, is to model and control an unmanned aerialvehicle (UAV) provided with four rotors (quadcopter)powered by brushless motors constrained to indoorflights (see figure 1). The control system will allow thesystem to hover, to fly guided by a transmitter andto fly autonomously using proximity sensors. As thisproject is aimed to be applied in future courses withinthe university, all the control strategies as well as themodels created will be adapted to Matlab/Simulink.Besides, this project will give the Pontifical Universityof Comillas experience in the UAV world in order toease the development of new research lines within thissubject.

The quadcopter that will be used is powered by fourbrushless motors, placed at the end of the structures’arms, which are driven by four electronic speed con-trollers (ESC). It includes a Crius microcontroller chipcard with an Arduino ATMega 2560 processor, as well asan inertial measure unit (IMU) made up of gyroscopes,accelerometers and magnetometers. The communicationbetween the device and the pilot is done by a radio

control system. Finally, the power supply for the devicewill be performed by LiPo batteries.

Fig. 1: Quadcopter and RC transmitter

2 STATE OF THE ART

The quadcopter translation and rotation movementsare performed shifting the rotation speed of its rotors.Consequently, in order for the UAV to ascend/descendvertically, the speed of all the motors must be in-creased/decreased simultaneously. Increasing the angu-lar speed of motors 1 and 3 will make the quadcopterto rotate clockwise, whereas the increase in the speedof motors 2 and 4 with result in a counter-clockwiserotation. Finally, the vehicle can be made to fly in eitherdirection horizontally: for instance, reducing the speedof motor 4 and increasing the speed of motor 2 will resultin the frame roll, making the device fly to the left.

Page 8: MODELADO Y CONTROL DE UN CUADRICOPTERO, JUNIO … · matematica aplicada (cuaterniones), electr´ onica de

MODELLING AND CONTROL OF A QUADCOPTER, JUNE 2014 8

Fig. 2: Schematics on torques generated by each motorof a quadrotor

The modelling of this kind of devices, where themathematical description of the quadcopter is deduced,has been widely studied along the last decades.Therefore, now a days there is a wide variety of modelsfor indoor flights [1],[2],[3] as well as for outdoor flights[4],[5] to work with. The main difference between thetwo groups is that outdoor flights models include theaero-dynamical effects. The definition of a precise modelis critical for both the design of the controller and thesimulation tests.

The control strategy assumes that the state variablesare available, that’s to say, the estimation of the quad-copter attitude from the Euler angles. The most commonstate observers within this subject are:

• The complementary filter [6]: The estimation ofthe attitude angles, done with the measures ofboth accelerometers and gyroscopes, is properlyweighted in order to obtain an accurate andrelatively noise-free estimation. The noise carried inthe accelerometer measures (high frequency noise)is filtered by a low pass filter, as well as the biasfrom the gyroscopes (low frequency) is removed bya high pass filter.

• A Kalman filter [7]: It is an algorithm used toestimate the Euler angles of a device based on thestochastic model of the measure system, using theaccelerometers and the gyroscopes included in theIMU.

Related to the control strategy, there have beendeveloped a wide variety of algorithms due the factthat the quadcopter model is a multi-variable non-linear model. Within the proposed algorithms, theLyapunov based controllers developed by H.Voos[1]and Bouabdallah [3] stand out, although it may be alsoused state-feedback controllers such as the LQ regulatordesigned by Hoffman [10] or the PID controller designedby Bouabdallah [11].

It may be important to highlight that there are manyPID controller firmwares available in the Internet. TheArduino based controller chip cards such Crius orthe Ardu-Pilot offer the Multiwii or the Mega-Pirate

algorithms, easing the implementation of a controllersoftware to the quadcopter used. Nevertheless, thereare not firmwares available for the Matlab Simulinkenvironment.

The use of this kind of devices on advanced controlcourses in different Universities is increasing along thelast few years, such as the Hong Kong University [12],the Illinois University or Swiss Federal Institute of Tech-nology, among others.

3 MODELLING

The mathematical model of the quadcopter is definedby the set of equations which describe the physics of thespaceship. In this project, there have been developed thetwo following models:

• Full non-lineal model. Set of equations which allowto accurately represent the flight behaviour of thequadcopter. The inputs to the model are the fourvoltages applied to the bushless motors, and theoutputs are the position and speed values alongthe six degrees of freedom of the quadcopter. Themain use for this algorithm is to compare differentcontrol strategies in order to make the simulation asmuch accurate as possible, thus it can be seen as avalidation test before using it in the real device.

• Simplified model This model includes thedynamics corresponding to the attitude of thequadcopter exclusively, allowing to design thecontrol strategy which makes the spaceship stable.

Each of these models requires a set of parameters(dimensions, mass, inertia momentums and the thrustsystems dynamics) which must be accurately estimated.Consequently, a CAD model has been developed andsome tests have been carried out over the thrust systemson the test bench built for this purpose. In this project, ithas been used Solid Edge in order to obtain the graphicrepresentation (CAD) of the quadcopter shown in figure3.

Fig. 3: CAD representation of the quadcopter structure

This program allows to compute the mechanical pa-rameters of the structure, which have been included inthe table 1.

Page 9: MODELADO Y CONTROL DE UN CUADRICOPTERO, JUNIO … · matematica aplicada (cuaterniones), electr´ onica de

MODELLING AND CONTROL OF A QUADCOPTER, JUNE 2014 9

Mechanical parameters for the structureMass(Kg)

Volume

(mm3 )

Ixx(Kgm2)

Iyy(Kgm2)

Izz(Kgm2)

0.2722 94059.7154 7.83 · 10−4 7.85 · 10−4 1.401 · 10−3

Dynamic parameter for the motorsKv

(rpm/v)Rm(Ω)

b(Ns/rad)

d(Nms/rad)

2900 0.6 5.44e-7 7.32e-9

TABLE 1: Parameters for the quadcopter

In order to estimate the dynamic parameters for therotors, there have been performed a set of tests on thetest bench shown in figure 4. The variables measuredduring the test are the voltage, the current, the rotationalspeed, the thrust and the torque. The values of theparameters shown in table 1 has been deduced from theset of measures that were described above.

Fig. 4: Test bench

None of the models introduced above includes theaero-dynamical effects which may affect the dynamicsof this kind of devices, because it has being proved thatthey are not relevant for indoor flights.

4 STATE ESTIMATION

In order to achieve a proper estimation of the attitudeangles, a multiplicative extended Kalman filter has beendesigned. This robust algorithm, able to handle a signifi-cant noise in the measures, is able to achieve the attitudeestimation using only gyroscopes and accelerometersalthough it can also use other sensors such as the mag-netometers, a GPS, etc. Besides, it is said that this is anextended filter because it is based on a non-lineal modelof the measures system. On the other hand, this filterrequires a high computational cost. Therefore, quater-nions have been used in order to obtain the estimatedvariables. A quaternion [8] is a four dimensional vectorwhich accurately represents the information containedin the attitude angles. Thus, this mathematical elementswill be used in order to reduced the computational costof the system as well as to avoid the gimbal lock [9].

The mathematical process of the Kalman filter involvesa number of complex computation steps as it is shown,as an illustration, in figure 5. The detailed process isdeeply described in the proyect memory.

Fig. 5: Estimation process for the Kalman filter

Figure 6 shows the attitude estimation of the pitchangle gathered by the Kalman filter designed (green) aswell as the estimation performed by the complementaryfilter (blue) during the simulation. The real value ofthat angle (red) has also been included in order to easethe comparison. As it can be seen, both filters are wellcapable of performing an accurate estimation, despitethe noise contained in the measures. Nevertheless, theKalman filter performs a more precise estimation thanthe complementary filter.

9.5 10 10.5 11 11.5 12 12.5 13 13.5 14−8

−7

−6

−5

−4

−3

−2

−1

0

1

2

3Estimación del angulo de alabeo

Tiempo(s)

Áng

ulo(

º)

Filtro complementarioFiltro de KalmanReferencia

Fig. 6: Attitude angles estimation during the simulations

5 CONTROL SYSTEM DESIGN

The control systems handles the regulation of the devicethrough the controller signal applied in the motors. Inorder to cover a wider range of possibilities, it has beendeveloped a set of controllers based on the simplifiedmodel. Afterwards, the full model has been used tovalidate them through simulations. The control algo-rithms designed are:

1) Referenced weighted PID controller with anti-windup, design through frequency response. Thedesign has used the meaningful indicators (phasemargin, cross frequency, etc.) recommended by theliterature. The anti-windup mechanism is criticalin order to avoid the error accumulation in theintegral action of the controller, when a saturationtakes places in the actuators.

2) Incremental PID controller. It is a slight modifica-tion over the former PID controller as it works withincrements instead of absolute values. The main

Page 10: MODELADO Y CONTROL DE UN CUADRICOPTERO, JUNIO … · matematica aplicada (cuaterniones), electr´ onica de

MODELLING AND CONTROL OF A QUADCOPTER, JUNE 2014 10

advantage of this modification is that it allows toset a constraint on the control signal as well as itsimplifies the anti-windup logic.

3) State feedback controller designed by pole place-ment. The close loop poles of the system habe beenchosen to optimize the system response.

4) State feedback LQ regulator. The stochastic modelof the system has been used to obtain the statefeedback gain matrix which allows to minimize thereference tracking error and the control effort.

5) State feedback LQ regulator with integral action(LQI). An integral action has been added to theformer LQ controller in order to reject the loaddisturbances present in the system.

In addition, it has been developed a model of thequadcopter placed on a Lego Motorbike (modelled asa inverted pendulum) in order to test the control al-gorithms while stabilizing the device. This new modelreduces the risk of damaging the quadcopter againstimplementation errors or an inappropriate fit of thequadcopters’ paramenters.

6 IMPLEMENTATION

As there is no previous experience on the use of quad-copters within the UPCO, a great amount of the job donehas gone to build and set the device. This tasks includethe assembly of the structure, the placing of the requiredelements (ESC, rotors, controller chip card, etc.) as wellas their connection. In addition, a chip card has beenboth designed and built to monitor the battery charge.The circuit, shown in figure 7, is made up of a voltagedivisor with a buffer.

Fig. 7: Layout of the monitoring circuit for the batterycharge

Another set of tasks is the design of the driver blockswhich allow to exchange information between the con-trol algorithm programmed in Simulink and the sensorsand actuators placed on the quadcopter. These drivershave been programmed in C++ and integrated intoSimulink blocks, thus they add additional challenges dueto the newness introduced.

• Driver for the IMU. This driver is intended to accessto the information available in the IMU. In order toease its programming, the library FreeIMU has beenused, originally programmed in C++.

• Driver for the RC system. This code sets thecommunication between the RC receptor and themicrocontroller card. The programmed code uses

interruptions in order to lighten the memory con-sumption of the microprocessor. In addition, aSavitzky-Golay filter has been designed in order toreduce the amount of noises carried by the signals.

• Driver for the ESC. It produced a PWM signalwhich allows to shift the voltage applied in themotors.

• Driver for the monitoring system of the batterycharge. This driver gets the analogue measure ofthe battery voltage.

Finally, a state machine has been programmed in orderto ensure a safe and smooth start up as well as themanagement of the fault situations. The state machinehas introduced to the system:

1) Safety features such as the maximum altitudecontrol, the regulated start up and the minimumcharge of the battery.

2) Variations over the control algorithm, such as thedisconnection of the integral action during the startup process in order to avoid the error accumulationin the integral action.

3) A smooth and regulated start up.

7 TESTS

The tests performed over the quadcopter have shownthat it only requires to choose the proper controlalgorithm to perform stable flights. Therefore, theassembly and connection of all the system elementshave been properly done. Besides, the state machine incharge of handling the start up of the system has beentested throwing positive results.

The tests carried out over the programmed drivershave also shown positive results, allowing to be used infuture studies among this field. Regarding the obtainedsignals from the RC receptor, it has been identified asignificant amount of noise. Thus, a Savitzky-Golayfilter has been designed in order to reject it. This filterhas also been used to set up a delay in the voltagesignal coming from the battery, so that I will be lesssensitive to the present peaks.

Figure 8 shows the estimation of the Euler angles inthe real system, done by the Kalman filter designed(blue) and by the IMU estimator (green). The estimationperformed by the Kalman filter is better than the onedone by the other estimator, even if the motors areturned on. Nevertheless, a drift on the estimation can beappreciated, due to the lack of magnetometer measuresduring the estimation process. This drift may have animportant effect on the control efficiency and should bestudied in the near future.

Page 11: MODELADO Y CONTROL DE UN CUADRICOPTERO, JUNIO … · matematica aplicada (cuaterniones), electr´ onica de

MODELLING AND CONTROL OF A QUADCOPTER, JUNE 2014 11

0 0.1 0.2 0.3 0.4 0.5 0.6 0.7−80

−60

−40

−20

0

20

40Estimación corregida

Tiempo (s)

Áng

ulos

(º)

MEKFFiltro IMU

Fig. 8: Pith angle estimation

Figure 9 shows the simulated overlapped timeresponses of the PID controller, the state feedback con-troller designed by pole placement and by the LQmethod, when a step is introduced in the reference. Asit can be seen, the settling times for the PID controllerresponses are smaller than the controllers based on astate feedback.

0 0.5 1 1.5 2 2.5 30

1

2

3

4

5

6

7

8

9

10

11

Tiempo (s)

Áng

ulo

(º)

PIDRealimentaciónLQR

4 4.5 5 5.5 6 6.5 70

1

2

3

4

5

6

7

8

9

10

11

Tiempo (s)

Áng

ulo

(º)

7 7.5 8 8.5 9 9.5 100

1

2

3

4

5

6

7

8

9

10

11

Tiempo (s)

Áng

ulo

(º)

Fig. 9: Time response of the three main controllers whena 10

o step is applied in the system

The PID controller response shows a small overshootwhile the responses of the other two controlles are over-damped responses. If the angles that will be introducedin the reference are close to the unitary values, the bestresponse is the PID’s as its settling time is the smallest.If, instead, the angles introduced as references are biggerthan the unit, then the response suffers undesirablemodifications, as it happens with the yaw angle.Nevertheless, the state feedback controlled responsesdo not suffer this shift. Consequently, the controller thatwill be tested in the real system will be the LQI regulator.

Finally, the control signal to stabilize the quadcopterwith the incremental LQI with anti-windup has beenincluded in figure 10. That response shows that thecontrol is unable to regulate the device as the signalsranges between the minimum and maximum saturationvalues set in the controller. Therefore, the state estimatorand the gains from the actuator chain should be studiedin future research among this field, in order to solvethese problems.

0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5120

140

160

180

200

220

240

260Mandos U1, U3

Tiempo(s)

Tensió

n(P

WM

)

Phi

Theta

0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 0.4 0.45 0.5120

140

160

180

200

220

240

260Mandos U2, U4

Tiempo(s)

Tensió

n(P

WM

)

U2

U4

Fig. 10: Control signals applied in the device with theLQI controller

8 CONCLUSIONS

The general conclusion of this project is that it hasnot been possible to design a proper controller able toregulate the quadcopter behaviour. Nevertheless, look-ing to the volume of contributions done, it can be saidthat this project has considerably eased the requiredeffort to achieve the main goal of this project in fu-ture works. The tasks successfully performed are thefollowing:

• It has been created a set of models both mathe-matical and graphical (CAD) which can be used todesign a proper controller.

• The programmed drivers work properly.• The state machine handles the start up of the device

appropriately.• The monitoring of battery charge is done correctly.• It has been designed a detailed block diagram pre-

pared to be loaded into the quadcopter’s microcon-troller card.

• The quadcopter is ready to fly properly controlledas long as the proper algorithm and state estimationis provided.

The main cause of the controller inability to regulatethe device seems to be the incorrect estimation of theattitude angles, rather by the drift they show up orby the inappropriate estimation speed of these angles.There is also the chance that the incorrect operation ofthe controller is due to conversion chain of the controlsignal, changing from coupled thrust forces to eachmotor voltage.

9 FUTURE IMPROVEMENTS

The improvements proposed lead into an improvementof the state estimation algorithm. Therefore, it is recom-mended to:

• Include the magnetometers into the attitude estima-tion of the quadcopter. In order to achieve such atask, a calibration algorithm for the magnetometershould be programmed. The Kalman filter code isalready prepared for this enlargement.

• Implement a telemetric system in order to monitorin realtime the tests performed.

• Design a casing which allows to absorb the vibra-tions from the rotors.

Page 12: MODELADO Y CONTROL DE UN CUADRICOPTERO, JUNIO … · matematica aplicada (cuaterniones), electr´ onica de

MODELLING AND CONTROL OF A QUADCOPTER, JUNE 2014 12

REFERENCES

[1] Holger Voos, Nonlinear Control of a QuadrotorMicro-UAV using Feedback-Linearization. Proceed-ings of the 2009 IEEE International Conference onMechatronics. Mlaga, Spain, April 2009.

[2] C BALAS and Dr J.F. Whidborne, Modelling andLinear Control of a Quadrotor. CRANFIELD UNI-VERSITY, September 2007.

[3] Bouabdallah, S., Murrieri, P. and Siegwart,R.,Towards autonomous indoor micro VTO,Autonomous Robots, France, 2005.

[4] Paul Pounds, Robert Mahony, Peter Corke, Mod-elling and Control of a Quad-Rotor Robot. AustralianNational University, 2006.

[5] McKerrow, P.,Modelling the Draganflyer four ro-tor helicopter. IEEE International Conference onRobotics and Automation, April 2004.

[6] Robert W Klein, Flight control system employingcomplementary filter. Grumman Aerospace Corp,May 1987

[7] James K. Hall, Nathan B. Knoebel, Timothy W.McLain, Quaternion Attitude Estimation for Minia-ture Air Vehicles Using a Multiplicative ExtendedKalman Filter. Brigham Young University, Provo, UT84602.

[8] Nikolas Trawny and Stergios I. Roumeliotis, IndirectKalman Filter for 3D Attitude Estimation. A tuto-rial for quaternion algebra. University of Minnesota,March 2005.

[9] Manuel Kramer, Douglas J. Dapprich, Gyro stabi-lized inertial reference system with gimbal lock pre-vention means. The Charles Stark Draper Laboratory,Inc. October 1977.

[10] Hoffmann,G.M., Rajnarayan, D.G., Waslander, S.L.,Dostal, D., Jang, J.S. and Tomlin, C.J., The stanfordtestbed of autonomous rotorcraft for multi agentcontrol. Digital Avionics Systems Conference, 2004.

[11] Bouabdallah, S., Noth, A. and Siegwart, R., PIDvs LQ control techniques applied to an indoor mi-cro quadrotor. Swiss Federal Institute of Technology,2004

[12] Igor Gaponov,Anastasia Razinkova, QuadcopterDesign and Implementation as a MultidisciplinaryEngineering Course. IEEE International Conferenceon Teaching, Assessment, and Learning for Engineer-ing (TALE), August 2012.