teppo luukkonen

38
Teppo Luukkonen Modelling and control of quadcopter School of Science Mat-2.4108 Independent research project in applied mathematics Espoo, August 22, 2011 A? Aalto University School of Science This document can be stored and made available to the public on the open internet pages of Aalto University. All other rights are reserved. ii Contents Contents ii 1 Introduction 1 2 Mathematical model of quadcopter 2 2.1 Newton-Euler equations . . . . . . . . . . . . . . . . . . . . . . . . . 4 2.2 Euler-Lagrange equations . . . . . . . . . . . . . . . . . . . . . . . . . 5 2.3 Aerodynamical effects . . . . . . . . . . . . . . . . . . . . . . . . . . 6 3 Simulation 7 4 Stabilisation of quadcopter 10 5 Trajectory control 13 5.1 Heuristic method for trajectory generation . . . . . . . . . . . . . . . 14 5.2 Integrated PD controller . . . . . . . . . . . . . . . . . . . . . . . . . 18 6 Conclusion 21 References 23 1 Introduction Quadcopter, also known as quadrotor, is a helicopter with four rotors. The rotors are directed upwards and they are placed in a square formation with equal distance from the center of mass of the quadcopter. The quadcopter is controlled by adjusting the angular velocities of the rotors which are spun by electric motors. Quadcopter

Upload: vijayputra

Post on 16-Jul-2016

95 views

Category:

Documents


3 download

DESCRIPTION

this is the discription of quadrotor working function

TRANSCRIPT

Teppo LuukkonenModelling and control of quadcopterSchool of ScienceMat-24108Independent research project in applied mathematicsEspoo August 22 2011

A Aalto University

School of ScienceThis document can be stored and made available to the public on the open internetpages of Aalto University All other rights are reservediiContentsContents ii1 Introduction 12 Mathematical model of quadcopter 221 Newton-Euler equations 422 Euler-Lagrange equations 523 Aerodynamical effects 63 Simulation 74 Stabilisation of quadcopter 105 Trajectory control 1351 Heuristic method for trajectory generation 1452 Integrated PD controller 186 Conclusion 21References 231 IntroductionQuadcopter also known as quadrotor is a helicopter with four rotors The rotorsare directed upwards and they are placed in a square formation with equal distancefrom the center of mass of the quadcopter The quadcopter is controlled by adjustingthe angular velocities of the rotors which are spun by electric motors Quadcopteris a typical design for small unmanned aerial vehicles (UAV) because of the simplestructure Quadcopters are used in surveillance search and rescue constructioninspections and several other applicationsQuadcopter has received considerable attention from researchers as the complexphenomena of the quadcopter has generated several areas of interest The basicdynamical model of the quadcopter is the starting point for all of the studies but

more complex aerodynamic properties has been introduced as well [1 2] Differentcontrol methods has been researched including PID controllers [3 4 5 6] backsteppingcontrol [7 8] nonlinear H1 control [9] LQR controllers [6] and nonlinearcontrollers with nested saturations [10 11] Control methods require accurate informationfrom the position and attitude measurements performed with a gyroscopean accelerometer and other measuring devices such as GPS and sonar and lasersensors [12 13]The purpose of this paper is to present the basics of quadcopter modelling andcontrol as to form a basis for further research and development in the area Thisis pursued with two aims The first aim is to study the mathematical model of thequadcopter dynamics The second aim is to develop proper methods for stabilisationand trajectory control of the quadcopter The challenge in controlling a quadcopteris that the quadcopter has six degrees of freedom but there are only four controlinputsThis paper presents the differential equations of the quadcopter dynamics They arederived from both the Newton-Euler equations and the Euler-Lagrange equationswhich are both used in the study of quadcopters The behaviour of the model isexamined by simulating the flight of the quadcopter Stabilisation of the quadcopteris conducted by utilising a PD controller The PD controller is a simple controlmethod which is easy to implement as the control method of the quadcopter Asimple heuristic method is developed to control the trajectory of the flight Thena PD controller is integrated into the heuristic method to reduce the effect of thefluctuations in quadcopter behaviour caused by random external forcesThe following section presents the mathematical model of a quadcopter In thethird section the mathematical model is tested by simulating the quadcopter withgiven control inputs The fourth section presents a PD controller to stabilise the

quadcopter In the fifth section a heuristic method including a PD controller ispresented to control the trajectory of quadcopter flight The last section containsthe conlusion of the paper22 Mathematical model of quadcopterThe quadcopter structure is presented in Figure 1 including the corresponding angularvelocities torques and forces created by the four rotors (numbered from 1 to4)y xz__ yB xBzBf1_M1

1f2_M2

2f3_M3

3f4_M4

4Figure 1 The inertial and body frames of a quadcopterThe absolute linear position of the quadcopter is defined in the inertial frame xyzaxeswith _ The attitude ie the angular position is defined in the inertial framewith three Euler angles _ Pitch angle _ determines the rotation of the quadcopteraround the y-axis Roll angle _ determines the rotation around the x-axis and yawangle around the z-axis Vector q contains the linear and angular position vectors_ =xyz

_ =__ q =____ (1)The origin of the body frame is in the center of mass of the quadcopter In the bodyframe the linear velocities are determined by VB and the angular velocities by _VB =vxBvyBvzB _ =pqr (2)The rotation matrix from the body frame to the inertial frame isR =C C_ C S_S_ minus S C_ C S_C_ + S S_S C_ S S_S_ + C C_ S S_C_ minus C S_minusS_ C_S_ C_C_ (3)in which Sx = sin(x) and Cx = cos(x) The rotation matrix R is orthogonal thusRminus1 = RT which is the rotation matrix from the inertial frame to the body frame3The transformation matrix for angular velocities from the inertial frame to the bodyframe is W_ and from the body frame to the inertial frame is Wminus1

_ as shown in[14]_˙ =Wminus1_ __ =W_ _˙ ˙__˙˙ =1 S_T_ C_T_0 C_ minusS_0 S_C_ C_C_pqr pqr =1 0 minusS_0 C_ C_S_0 minusS_ C_C_˙__˙˙ (4)in which Tx = tan(x) The matrix W_ is invertible if _ 6= (2k minus 1)_2 (k isin Z)

The quadcopter is assumed to have symmetric structure with the four arms alignedwith the body x- and y-axes Thus the inertia matrix is diagonal matrix I in whichIxx = IyyI =Ixx 0 00 Iyy 00 0 Izz (5)The angular velocity of rotor i denoted with i creates force fi in the direction ofthe rotor axis The angular velocity and acceleration of the rotor also create torque_Mi around the rotor axisfi = k 2i _Mi = b 2i + IM ˙ i (6)in which the lift constant is k the drag constant is b and the inertia moment of therotor is IM Usually the effect of ˙ i is considered small and thus it is omittedThe combined forces of rotors create thrust T in the direction of the body z-axisTorque _B consists of the torques __ __ and _ in the direction of the correspondingbody frame anglesT =X4i=1fi = kX4i=12i TB =00T (7)_B =____

_ =l k (minus22 + 24)l k (minus21 + 23)X4i=1_Mi

(8)in which l is the distance between the rotor and the center of mass of the quadcopterThus the roll movement is acquired by decreasing the 2nd rotor velocityand increasing the 4th rotor velocity Similarly the pitch movement is acquired bydecreasing the 1st rotor velocity and increasing the 3th rotor velocity Yaw movementis acquired by increasing the the angular velocities of two opposite rotors anddecreasing the velocities of the other two421 Newton-Euler equationsThe quadcopter is assumed to be rigid body and thus Newton-Euler equations canbe used to describe its dynamics In the body frame the force required for theacceleration of mass m ˙VB and the centrifugal force _ times (mVB) are equal to thegravity RTG and the total thrust of the rotors TBm ˙VB + _ times (mVB) = RTG + TB (9)In the inertial frame the centrifugal force is nullified Thus only the gravitationalforce and the magnitude and direction of the thrust are contributing in the accelerationof the quadcoptermuml_ = G+ RTBumlxumlyumlz

= minusg001 + TmC S_C_ + S S_S S_C_ minus C S_C_C_ (10)In the body frame the angular acceleration of the inertia I_˙ the centripetal forces_ times (I_) and the gyroscopic forces 1048576 are equal to the external torque _I_˙ + _ times (I_) + 1048576 = _ _˙ = Iminus1minuspqr timesIxx pIyy qIzz r minus Irpqr times00

1 1048576 + _p˙q˙r˙ =(Iyy minus Izz) q rIxx(Izz minus Ixx) p rIyy(Ixx minus Iyy) p qIzz minus IrqIxxminuspIyy0 1048576 +__Ixx__Iyy_ Izz (11)in which 1048576 = 1minus2 +3 minus4 The angular accelerations in the inertial frame arethen attracted from the body frame accelerations with the transformation matrixWminus1_ and its time derivativeuml_ = ddt1048576Wminus1_ __= ddt1048576Wminus1

___ +Wminus1_ _˙=0 ˙_C_T_ + _˙S_C2_ minus˙_S_C_ + _˙C_C2_0 minus˙_S_ minus˙_C_0 ˙_ C_C_ + ˙ _S_T_C_ minus˙_S_C_ + _˙C_T_C_ _ +Wminus1

_ _˙ (12)522 Euler-Lagrange equationsThe Lagrangian L is the sum of the translational Etrans and rotational Erot energiesminus potential energy EpotL (q q˙) = Etrans + Erot minus Epot= (m2) _˙T _˙ + (12) _T I _ minus mgz(13)As shown in [10] the Euler-Lagrange equations with external forces and torques are_f__=ddt_Lq˙_minusLq (14)The linear and angular components do not depend on each other thus they can bestudied separately The linear external force is the total thrust of the rotors Thelinear Euler-Lagrange equations aref = RTB = muml_ + mg0

01 (15)which is equivalent with Equation (10)The Jacobian matrix J (_) from _ to _˙ isJ (_) = J =WT_ IW_=Ixx 0 minusIxxS_0 IyyC2_ + IzzS2_ (Iyy minus Izz)C_S_C_minusIxxS_ (Iyy minus Izz)C_S_C_ IxxS2_ + IyyS2_C2_ + IzzC2_C2_(16)Thus the rotational energy Erot can be expressed in the inertial frame asErot = (12) _T I _ = (12) uml_T J uml_ (17)The external angular force is the torques of the rotors The angular Euler-Lagrangeequations are_ = _B = J uml_ +ddt(J) _˙ minus12_1048576_˙T J _˙_= J _uml + C (_ _˙ ) _˙ (18)in which the matrix C (_ _˙ ) is the Coriolis term containing the gyroscopic andcentripetal terms6The matrix C (_ _˙ ) has the form as shown in [9]C (_ _˙ ) =

C11 C12 C13C21 C22 C23C31 C32 C33 C11 = 0C12 = (Iyy minus Izz)(˙_ C_S_ + ˙ S2_C_) + (Izz minus Iyy) ˙ C2_C_ minus Ixx ˙ C_C13 = (Izz minus Iyy) ˙ C_S_C2_C21 = (Izz minus Iyy)(˙_ C_S_ + ˙ S_C_) + (Iyy minus Izz) ˙ C2_C_ + Ixx ˙ C_C22 = (Izz minus Iyy)˙ _C_S_C23 = minusIxx ˙ S_C_ + Iyy ˙ S2_S_C_ + Izz ˙ C2_S_C_C31 = (Iyy minus Izz) ˙ C2_S_C_ minus Ixx _˙C_C32 = (Izz minus Iyy)(˙_ C_S_S_ + ˙_S2_C_) + (Iyy minus Izz)˙ _C2_C_+Ixx ˙ S_C_ minus Iyy ˙ S2_S_C_ minus Izz ˙ C2_S_C_C33 = (Iyy minus Izz)˙ _C_S_C2_ minus Iyy _˙S2_C_S_ minus Izz ˙_C2_C_S_ + Ixx ˙_C_S_(19)Equation (18) leads to the differential equations for the angular accelerations whichare equivalent with Equations (11) and (12)uml_ = Jminus1 (_B minus C (_ _˙ ) _˙ ) (20)23 Aerodynamical effectsThe preceding model is a simplification of complex dynamic interactions To enforcemore realistical behaviour of the quadcopter drag force generated by the airresistance is included This is devised to Equations (10) and (15) with the diagonalcoefficient matrix associating the linear velocities to the force slowing the movementas in [15]umlxumly

umlz = minusg001 +TmC S_C_ + S S_S S_C_ minus C S_C_C_minus1mAx 0 00 Ay 00 0 Azx˙y˙z˙ (21)in which Ax Ay and Az are the drag force coefficients for velocities in the correspondingdirections of the inertial frameSeveral other aerodynamical effects could be included in the model For exampledependence of thrust on angle of attack blade flapping and airflow distruptions havebeen studied in [1] and [2] The influence of aerodynamical effects are complicatedand the effects are difficult to model Also some of the effects have significant effectonly in high velocities Thus these effects are excluded from the model and thepresented simple model is used

73 SimulationThe mathematical model of the quadcopter is implemented for simulation in Matlab2010 with Matlab programming language Parameter values from [3] are used in thesimulations and are presented in Table 1 The values of the drag force coefficientsAx Ay and Az are selected such as the quadcopter will slow down and stop whenangles _ and _ are stabilised to zero valuesTable 1 Parameter values for simulationParameter Value Unitg 981 ms2m 0468 kgl 0225 mk 2980 10minus6b 1140 10minus7IM 3357 10minus5 kg m2Parameter Value UnitIxx 4856 10minus3 kg m2Iyy 4856 10minus3 kg m2Izz 8801 10minus3 kg m2Ax 025 kgsAy 025 kgsAz 025 kgsThe mathematical model is tested by simulating a quadcopter with an example caseas following The quadcopter is initially in a stable state in which the values of allpositions and angles are zero the body frame of the quadcopter is congruent withthe inertial frame The total thrust is equal to the hover thrust the thrust equal togravity The simulation progresses at 00001 second intervals to total elapsed timeof two seconds The control inputs the angular velocities of the four rotors areshown in Figure 2 the inertial positions x y and z in Figure 3 and the angles _ _and in Figure 4For the first 025 seconds the quadcopter ascended by increasing all of the rotorvelocities from the hover thrust Then the ascend is stopped by decreasing the rotorvelocities significantly for the following 025 seconds Consequently the quadcopterascended 01 meters in the first 05 seconds After the ascend the quadcopter is

stable againNext the quadcopter is put into a roll motion by increasing the velocity of thefourth rotor and decreasing the velocity of the second rotor for 025 seconds Theacceleration of the roll motion is stopped by decreasing the velocity of the fourthand increasing the velocity of the second rotor for 025 seconds Thus after 05seconds in roll motion the roll angle _ had increased approx 25 degrees Becauseof the roll angle the quadcopter accelerated in the direction of the negative y-axisThen similar to the roll motion a pitch motion is created by increasing the velocityof the third rotor and decreasing the velocity of the first The motion is stoppedby decreasing the velocity of the third rotor and increasing the velocity of the firstrotor Due to the pitch movement the pitch angle _ had increased approximately822 degrees The acceleration of the quadcopter in the direction of the positive x-axisis caused by the pitch angleFinally the quadcopter is turned in the direction of the yaw angle by increasingthe velocities of the first and the third rotors and decreasing the velocities of thesecond and the fourth rotors The yaw motion is stopped by decreasing the velocitiesof the first and the third rotors and increasing the velocities of the second and thefourth rotors Consequently the yaw angle increases approximately 10 degreesDuring the whole simulation the total thrust of the rotors had remained close to theinitial total thrust Thus the deviations of the roll and pitch angles from the zerovalues decrease the value of the thrust in the direction of the z-axis Consequentlythe quadcopter accelerates in the direction of the negative z-axis and is descending0 02 04 06 08 1 12 14 16 18 2550575600625650675700Time t (s)Control input i (rads)1234

Figure 2 Control inputs i0 02 04 06 08 1 12 14 16 18 2

minus25minus2minus15minus1minus05005115Time t (s)Position (m)Position xPosition yPosition z

Figure 3 Positions x y and z90 02 04 06 08 1 12 14 16 18 2minus5051015202530Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 4 Angles _ _ and 104 Stabilisation of quadcopterTo stabilise the quadcopter a PID controller is utilised Advantages of the PIDcontroller are the simple structure and easy implementation of the controller Thegeneral form of the PID controller ise(t) = xd(t) minus x(t)u(t) = KP e(t) + KIZ t0e(_ ) d _ + KDd e(t)d t [16](22)in which u(t) is the control input e(t) is the difference between the desired statexd(t) and the present state x(t) and KP KI and KD are the parameters for theproportional integral and derivative elements of the PID controllerIn a quadcopter there are six states positions _ and angles _ but only four controlinputs the angular velocities of the four rotors i The interactions between thestates and the total thrust T and the torques _ created by the rotors are visible fromthe quadcopter dynamics defined by Equations (10) (11) and (12) The total thrustT affects the acceleration in the direction of the z-axis and holds the quadcopter inthe air Torque __ has an affect on the acceleration of angle _ torque __ affects theacceleration of angle _ and torque _ contributes in the acceleration of angle

Hence the PD controller for the quadcopter is chosen as similarly as in [4]T = (g + KzD (z˙d minus z˙) + KzP (zd minus z)) mC_C___ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Ixx__ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Iyy_ =_K D_ ˙d minus ˙ _+ K P ( d minus )_Izz(23)in which also the gravity g and mass m and moments of inertia I of the quadcopterare consideredThe correct angular velocities of rotors i can be calculated from Equations (7) and(8) with values from Equation (23)21 = T4kminus __2klminus_ 4b22 = T

4kminus__2kl+_ 4b23 = T4k+ __2klminus_ 4b24 = T4k+__2kl+_ 4b(24)The performance of the PD controller is tested by simulating the stabilisation ofa quadcopter The PD controller parameters are presented in Table 2 The initialcondition of the quadcopter is for position _ = [0 0 1]T in meters and for angles11_ = [10 10 10]T in degrees The desired position for altitude is zd = 0 The purposeof the stabilisation is stable hovering thus _d = [0 0 0]TTable 2 Parameters of the PD controllerParameter ValueKzD 25K_D 175K_D 175K D 175Parameter ValueKzP 15K_P 6K_P 6K P 6The control inputs i the positions _ and the angles _ during the simulation are

presented in Figures 5 6 and 7 The altitude and the angles are stabilised to zerovalue after 5 seconds However the positions x and y deviated from the zero valuesbecause of the non-zero values of the angles Before the quadcopter is stabilisedto hover it has already moved over 1 meters in the direction of the positive x axisand 05 meters in the direction of the negative y axis This is because the controlmethod of the PD contoller does not consider the accelerations in the directions ofx and y Thus another control method should be constructed to give a control onall of positions and angles of the quadcopter0 1 2 3 4 5 6550560570580590600610620630

Time t (s)Control input i (rads)1234

Figure 5 Control inputs i0 1 2 3 4 5 6minus06minus04minus02002040608112

Time t (s)Position (m)Position xPosition yPosition z

Figure 6 Positions x y and z120 1 2 3 4 5 6minus20246810

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 7 Angles _ _ and 135 Trajectory controlThe purpose of trajectory control is to move the quadcopter from the original locationto the desired location by controlling the rotor velocities of the quadcopterFinding optimal trajectory for a quadcopter is a difficult task because of complexdynamics However a simple control method is able to control the quadcopteradequately Thus a heuristic approach is studied and developed hereThe basis of the development of a control method is the study of the interactions and

dependances between states state derivatives and control inputs These interactionsand dependances are defined by Equations (7) (8) (20) and (21) and presented inFigure 8The given control inputs i define the total thrust T and the torques __ __ and _ The torques affect the angular accelerations depending on the current angles andangular velocities The angles _ can be integrated from the angular velocities _˙ which are integrated from the angular accelerations uml_ The linear accelerations uml_depend on the total thrust T the angles _ and the linear velocities _˙ The linearposition _ is integrated from the linear accelerations uml_ through the linear velocities_˙Hence to find proper control inputs i for given states _ this line of thought has tobe done in reverse___HHHjT_-- _uml - _˙ - _I K_uml - _˙ - _IFigure 8 Interactions between states state derivatives and control inputsOne method is to generate linear accelerations which accomplish the wanted trajectoryaccording to positions x y and z for each time t From Equation (21) threeequations are receivedTB =00T = RT

muml_ +00g +Ax 0 00 Ay 00 0 Az _˙ (25)in which _uml _˙ and are desired trajectory values as well as angles _ and _ and totalthrust T are unknown values to be solvedFrom this equation the required angles _ and _ and the total thrust T for each timet can be calculated as shown in [5]14_ = arcsin dx S minus dy C d2x + d2y + (dz + g)2_ = arctan_dx C + dy S dz + g_T = m(dx (S_C C_ + S S_) + dy (S_S C_ minus C S_)+( dz + g )C_C_) (26)in whichdx = xuml + Axx˙mdy = yuml+ Ayy˙mdz = zuml+ Azz˙m(27)

When the values of the angles _ and _ are known the angular velocities and accelerationscan be calculated from them with simple derivation With the angularvelocities and accelerations the torques _ can be solved from Equation (20) Whenthe torques and thrust are known the control inputs i can be calculated fromEquation (24)51 Heuristic method for trajectory generationThe generation of proper accelerations uml_ is difficult because the composition of thethird and fourth derivatives of the position jerk and jounce has to be reasonableThe influence of the jounce values is visible in the composition of the control inputsi High jounce values will mean high control input values and thus the jounceshave to be considered closely when generating the accelerationsA heuristic method can be used to generate jounce values The method utilises asymmetric structure in jouce function f(t) to control the derivatives One influencialpart of the function is defined by three sine functions as followingf(t) =a sin10485761b _ t_ 0 le t le bminusa sin10485761b _ t minus __ b le t le 3ba sin10485761b _ t minus 3__ 3b le t le 4b(28)The structure of the function is visualised in Figure 9 The sine functions are usedto give a smooth function These three sine functions form a function in whichthe first half increases acceleration to certain value and then the second half of the

function decreases it back to zero This acceleration generates constant velocityMirror image of the function can be used to decelerate the velocity back to zeroThe final position depends on the parameters a and b of the sine functions presented15in Equation (28) and the time c between the accelerating part and the deceleratingpart the mirror image of the jounceaaab2bba sin10485761b _ t_minusa sin1048576 12b _ t minus __a sin10485761b _ t minus 3__Jounce (ms4)Time t (s)Figure 9 Heuristic method for the generation of jounce functionsUnfortunately the method does not give optimal trajectories Thus a dynamicoptimisation model and a suitable algorithm would be needed to calculate optimallythe trajectory of the quadcopter However the method presented is easy to use togenerate proper values of jounce which will achieve the wanted trajectoryThe functionality of the method is studied with an example simulation Jounce ofposition x is created according to Equation (28) with parameters a = 1 b = 05and c = 2 The position x and its derivatives derived from the planned jounce arepresented in Figure 10 The jounce could also be generated simultaneously for y andz However in this example only position x is considered because the relationship

between the jounce of position x and the control inputs 1 and 3 controlling theangle _ is more visible160 1 2 3 4 5 6 7minus1minus08minus06minus04minus020020406081Time t (s)Jounce (ms4)

(a) Jounce0 1 2 3 4 5 6 7minus04minus03minus02minus01001020304

Time t (s)Jerk (ms3)

(b) Jerk0 1 2 3 4 5 6 7minus02minus015minus01minus00500050101502Time t (s)Acceleration (ms2)

(c) Acceleration0 1 2 3 4 5 6 7minus002000200400600801012014016018

Time t (s)Velocity (ms)

(d) Velocity0 1 2 3 4 5 6 7001020304050607

Time t (s)Position (m)

(e) PositionFigure 10 Planned position x and its derivatives with given jounceThe simulation of the example case is performed with previously given accelerationsand velocities of position x The planned value of angle is zero for each time tFirst the required angles _ and _ and thrust T are solved from Equation (26) foreach time t The angular velocities and accelerations are calculated from the solvedangles with derivation Then the torques are solved using the angular velocitiesand accelerations Finally the control inputs are solved Then the simulation isperformed with given control inputsThe calculated control inputs are presented in Figure 11 The simulated positions_ are presented in Figure 12 and the simulated angles _ in Figure 13 Accordingto Figure 12 the simulated position x is the same as the planned position x inFigure 10(e) and the values of the positions y and z stay as zeroes The angle _increases during the acceleration and then stabilises to a constant value to generate

the constant acceleration required to compensate the drag force caused by theplanned constant velocity Finally the angle is changed to the opposite direction todecelerate the quadcopter to a haltThe shape of the calculated control inputs 1 and 3 in Figure 11 are similar toplanned jounce in Figure 10(a) The shape of the simulated angle _ follows theshape of the planned acceleration umlx The shapes of the control inputs and theangles differ from the planned values of the jounce and the acceleration because thedrag force caused by the velocity has to be compensated170 1 2 3 4 5 6 76203620462056206620762086209621

Time t (s)Control input i (rads)1234

Figure 11 Control inputs i0 1 2 3 4 5 6001020304050607

Time t (s)Position (m)Position xPosition yPosition z

Figure 12 Positions x y and z0 1 2 3 4 5 6 7minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 13 Angles _ _ and The method can also be used even if there are unmodeled linear forces wind forexample which affect the linear accelerations and consequently the position of thequadcopter If the trajectory is calculated in shorter distances it is possible tocorrect the trajectory with new calculation from the current but inaccurate locationto the next checkpoint Example of this method is presented in Figure 14 Thearrows with dash lines indicate the planned trajectory in the x y-plane and thesolid arrows indicate the realised trajectory The black squares mark the start and

the finish positions and the white squares mark the checkpoints for the trajectory18The control inputs are calculated from the current location of the quadcopter to thenext checkpoint but because of random and unmodelled forces the realised positionmarked with X differs from the planned If the quadcopter is close enough to thetarget checkpoint the target checkpoint is changed to the next one and new controlinputs are calculated After repeating this and going through all of the checkpointsthe quadcopter reaches the final destinationFigure 14 Example of checkpoint flight pattern with external disturbancesThe biggest weakness in the proposed method is that it works as shown only if thequadcopter starts from a stable attitude the angles _ and _ and their derivativesare zeros and there are no external forces influencing the attitude during the flightSmall deviations in the angles can result into a huge deviation in the trajectory Oneway to solve this problem is to stabilise the quadcopter at each checkpoint with aPD controller proposed earlier or by using the heuristic method to angles Howeverif the angular disturbances are continuous the benefit from temporary stabilisationis only momentary52 Integrated PD controllerAnother method to take into account the possible deviations in the angles is tointegrate a PD controller into the heuristic method This is a simplified version ofthe proposed control method in [5] The required values dx dy and dz in Equation(26) are given by the PD controller considering the deviations between the currentand desired values (subscript d) of the positions _ velocities _˙ and accelerations _umldx = KxP (xd minus x) + KxD (x˙ d minus x˙ ) + KxDD (xumld minus xuml) dy = KyP (yd minus y) + KyD (y˙d minus y˙) + KyDD (yumld minus yuml) dz = KzP (zd minus z) + KzD (z˙d minus z˙) + KzDD (zumld minus zuml) (29)Then the commanded angles _c and _c and thrust T are given by Equation (26)The torques _ are controlled by the PD controller in Equation (30) same as in

19Equation (23) The control inputs can be solved with the calculated thrust andtorques by using Equation (24)__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Ixx__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Iyy_ =_K P ( d minus ) + K D_˙ d minus ˙ __Izz(30)The performance of the PD controller is demonstrated with an example case inwhich for all positions x y and z and their derivatives the values are same as inFigure 10 The simulation is performed with the PD parameters presented in Table3Table 3 Parameters of the PD controllerVariable Parameter valuei KiP KiD KiDDx 185 075 100y 855 075 100z 185 075 100_ 300 075 -_ 300 075 - 300 075 -The results of the simulation are presented Figures 15 - 17 The simulated controlinputs are presented in Figure 15 the simulated positions in Figure 16 and the

simulated angles in Figure 17 The position of the quadcopter is close to the plannedposition after 6 seconds but the position keeps fluctuating close to the planned valuesfor several seconds The angles variate greatly during the simulation to achieve thewanted positions velocities and accelerations The values of the control inputsoscillated during the acceleration but then their behaviour became more stable0 2 4 6 8 10 12 14618619620621622623624625626

Time t (s)Control input i (rads)1234

Figure 15 Control inputs i200 2 4 6 8 10 12 14minus0100102030405060708

Time t (s)Position (m)Position xPosition yPosition z

Figure 16 Positions x y and z0 2 4 6 8 10 12 14minus15minus125minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 17 Angles _ _ and The proposed integrated PD controller performed well in the example case Howeverthe performance of the controller is highly depended on the parameter values If theparameter values are small the controller will not respond quickly enough to followthe planned trajectory If the parameter values are substantial the quadcopter cannot perform the required drastic changes in the angular velocities of the rotor andthe control inputs calculated from Equation (24) can be infeasible with certaintorques Thus the use of equations considering the torques and the control inputsrequires a method to calculate the best feasible torques and from them the bestcontrol inputs Another possible method would be to variate the PD parameters

according to the current positions and angles and their derivatives but it is extremelydifficult216 ConclusionThis paper studied mathematical modelling and control of a quadcopter The mathematicalmodel of quadcopter dynamics was presented and the differential equationswere derived from the Newton-Euler and the Euler-Lagrange equations The modelwas verified by simulating the flight of a quadcopter with Matlab Stabilisation ofattitude of the quadcopter was done by utilising a PD controller A heuristic methodwas developed to control the trajectory of the quadcopter The PD contoller wasintegrated into the heuristic method for better response to disturbances in the flightconditions of the quadcopterThe simulation proved the presented mathematical model to be realistic in modellingthe position and attitude of the quadcopter The simulation results also showedthat the PD controller was efficient in stabilising the quadcopter to the desiredaltitude and attitude However the PD controller did not considered positions xand y Thus the values of x and y variated from their original values during thestabilisation process This was a result of the deviation of the roll and pitch anglesfrom zero valuesAccording to the simulation results the proposed heuristic method produced goodflight trajectories The heuristic method required only three parameters to generatethe values for the jounce of the position The position and its other derivatives werecalculated from the jounce values The total thrust and the pitch and roll angles toachieve given accelerations were solved from the linear differential equations Thenthe torques were determined by the angular accelerations and angular velocitiescalculated from the angles Finally the required control inputs were solved from thetotal thrust and the torques The simulation results indicated that the quadcopter

could be controlled accurately with the control inputs given by the methodThe proposed heuristic method does not consider unmodelled disturbances suchas wind and thus the PD controller was integrated into the control method Theintegrated PD controller operated well in the example simulation The quadcopterfollowed the given trajectory and began to stabilise after reaching the final destinationHowever the PD controller can perform poorly if the parameter values arenot properly selected and are too small or highThe presented mathematical model only consists of the basic structures of the quadcopterdynamics Several aerodynamical effects were excluded which can lead tounrealiable behaviour Also the electric motors spinning the fours rotors were notmodelled The behaviour of a motor is easily included in the model but would requireestimation of the parameter values of the motor The position and attitudeinformation was assumed to be accurate in the model and the simulations Howeverthe measuring devices in real life are not perfectly accurate as random variationsand errors occur Hence the effects of imprecise information to the flight of thequadcopter should be studied as well Also methods to enhance the accuracy of themeasurements should be researched and implemented to improve all aspects required22for robust quadcopter manoeuvresThe presented model and control methods were tested only with simulations Realexperimental prototype of a quadcopter should be constructed to achieve more realisticand reliable results Even though the construction of a real quadcopter and theestimation of all the model parameters are laborious tasks a real quadcopter wouldbring significant benefits to the research With a real propotype the theoreticalframework and the simulation results could be compared to real-life measurementsThis paper did not include these higlighted matters in the study but presentedthe basics of quadcopter modelling and control This paper can thus be used as a

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

more complex aerodynamic properties has been introduced as well [1 2] Differentcontrol methods has been researched including PID controllers [3 4 5 6] backsteppingcontrol [7 8] nonlinear H1 control [9] LQR controllers [6] and nonlinearcontrollers with nested saturations [10 11] Control methods require accurate informationfrom the position and attitude measurements performed with a gyroscopean accelerometer and other measuring devices such as GPS and sonar and lasersensors [12 13]The purpose of this paper is to present the basics of quadcopter modelling andcontrol as to form a basis for further research and development in the area Thisis pursued with two aims The first aim is to study the mathematical model of thequadcopter dynamics The second aim is to develop proper methods for stabilisationand trajectory control of the quadcopter The challenge in controlling a quadcopteris that the quadcopter has six degrees of freedom but there are only four controlinputsThis paper presents the differential equations of the quadcopter dynamics They arederived from both the Newton-Euler equations and the Euler-Lagrange equationswhich are both used in the study of quadcopters The behaviour of the model isexamined by simulating the flight of the quadcopter Stabilisation of the quadcopteris conducted by utilising a PD controller The PD controller is a simple controlmethod which is easy to implement as the control method of the quadcopter Asimple heuristic method is developed to control the trajectory of the flight Thena PD controller is integrated into the heuristic method to reduce the effect of thefluctuations in quadcopter behaviour caused by random external forcesThe following section presents the mathematical model of a quadcopter In thethird section the mathematical model is tested by simulating the quadcopter withgiven control inputs The fourth section presents a PD controller to stabilise the

quadcopter In the fifth section a heuristic method including a PD controller ispresented to control the trajectory of quadcopter flight The last section containsthe conlusion of the paper22 Mathematical model of quadcopterThe quadcopter structure is presented in Figure 1 including the corresponding angularvelocities torques and forces created by the four rotors (numbered from 1 to4)y xz__ yB xBzBf1_M1

1f2_M2

2f3_M3

3f4_M4

4Figure 1 The inertial and body frames of a quadcopterThe absolute linear position of the quadcopter is defined in the inertial frame xyzaxeswith _ The attitude ie the angular position is defined in the inertial framewith three Euler angles _ Pitch angle _ determines the rotation of the quadcopteraround the y-axis Roll angle _ determines the rotation around the x-axis and yawangle around the z-axis Vector q contains the linear and angular position vectors_ =xyz

_ =__ q =____ (1)The origin of the body frame is in the center of mass of the quadcopter In the bodyframe the linear velocities are determined by VB and the angular velocities by _VB =vxBvyBvzB _ =pqr (2)The rotation matrix from the body frame to the inertial frame isR =C C_ C S_S_ minus S C_ C S_C_ + S S_S C_ S S_S_ + C C_ S S_C_ minus C S_minusS_ C_S_ C_C_ (3)in which Sx = sin(x) and Cx = cos(x) The rotation matrix R is orthogonal thusRminus1 = RT which is the rotation matrix from the inertial frame to the body frame3The transformation matrix for angular velocities from the inertial frame to the bodyframe is W_ and from the body frame to the inertial frame is Wminus1

_ as shown in[14]_˙ =Wminus1_ __ =W_ _˙ ˙__˙˙ =1 S_T_ C_T_0 C_ minusS_0 S_C_ C_C_pqr pqr =1 0 minusS_0 C_ C_S_0 minusS_ C_C_˙__˙˙ (4)in which Tx = tan(x) The matrix W_ is invertible if _ 6= (2k minus 1)_2 (k isin Z)

The quadcopter is assumed to have symmetric structure with the four arms alignedwith the body x- and y-axes Thus the inertia matrix is diagonal matrix I in whichIxx = IyyI =Ixx 0 00 Iyy 00 0 Izz (5)The angular velocity of rotor i denoted with i creates force fi in the direction ofthe rotor axis The angular velocity and acceleration of the rotor also create torque_Mi around the rotor axisfi = k 2i _Mi = b 2i + IM ˙ i (6)in which the lift constant is k the drag constant is b and the inertia moment of therotor is IM Usually the effect of ˙ i is considered small and thus it is omittedThe combined forces of rotors create thrust T in the direction of the body z-axisTorque _B consists of the torques __ __ and _ in the direction of the correspondingbody frame anglesT =X4i=1fi = kX4i=12i TB =00T (7)_B =____

_ =l k (minus22 + 24)l k (minus21 + 23)X4i=1_Mi

(8)in which l is the distance between the rotor and the center of mass of the quadcopterThus the roll movement is acquired by decreasing the 2nd rotor velocityand increasing the 4th rotor velocity Similarly the pitch movement is acquired bydecreasing the 1st rotor velocity and increasing the 3th rotor velocity Yaw movementis acquired by increasing the the angular velocities of two opposite rotors anddecreasing the velocities of the other two421 Newton-Euler equationsThe quadcopter is assumed to be rigid body and thus Newton-Euler equations canbe used to describe its dynamics In the body frame the force required for theacceleration of mass m ˙VB and the centrifugal force _ times (mVB) are equal to thegravity RTG and the total thrust of the rotors TBm ˙VB + _ times (mVB) = RTG + TB (9)In the inertial frame the centrifugal force is nullified Thus only the gravitationalforce and the magnitude and direction of the thrust are contributing in the accelerationof the quadcoptermuml_ = G+ RTBumlxumlyumlz

= minusg001 + TmC S_C_ + S S_S S_C_ minus C S_C_C_ (10)In the body frame the angular acceleration of the inertia I_˙ the centripetal forces_ times (I_) and the gyroscopic forces 1048576 are equal to the external torque _I_˙ + _ times (I_) + 1048576 = _ _˙ = Iminus1minuspqr timesIxx pIyy qIzz r minus Irpqr times00

1 1048576 + _p˙q˙r˙ =(Iyy minus Izz) q rIxx(Izz minus Ixx) p rIyy(Ixx minus Iyy) p qIzz minus IrqIxxminuspIyy0 1048576 +__Ixx__Iyy_ Izz (11)in which 1048576 = 1minus2 +3 minus4 The angular accelerations in the inertial frame arethen attracted from the body frame accelerations with the transformation matrixWminus1_ and its time derivativeuml_ = ddt1048576Wminus1_ __= ddt1048576Wminus1

___ +Wminus1_ _˙=0 ˙_C_T_ + _˙S_C2_ minus˙_S_C_ + _˙C_C2_0 minus˙_S_ minus˙_C_0 ˙_ C_C_ + ˙ _S_T_C_ minus˙_S_C_ + _˙C_T_C_ _ +Wminus1

_ _˙ (12)522 Euler-Lagrange equationsThe Lagrangian L is the sum of the translational Etrans and rotational Erot energiesminus potential energy EpotL (q q˙) = Etrans + Erot minus Epot= (m2) _˙T _˙ + (12) _T I _ minus mgz(13)As shown in [10] the Euler-Lagrange equations with external forces and torques are_f__=ddt_Lq˙_minusLq (14)The linear and angular components do not depend on each other thus they can bestudied separately The linear external force is the total thrust of the rotors Thelinear Euler-Lagrange equations aref = RTB = muml_ + mg0

01 (15)which is equivalent with Equation (10)The Jacobian matrix J (_) from _ to _˙ isJ (_) = J =WT_ IW_=Ixx 0 minusIxxS_0 IyyC2_ + IzzS2_ (Iyy minus Izz)C_S_C_minusIxxS_ (Iyy minus Izz)C_S_C_ IxxS2_ + IyyS2_C2_ + IzzC2_C2_(16)Thus the rotational energy Erot can be expressed in the inertial frame asErot = (12) _T I _ = (12) uml_T J uml_ (17)The external angular force is the torques of the rotors The angular Euler-Lagrangeequations are_ = _B = J uml_ +ddt(J) _˙ minus12_1048576_˙T J _˙_= J _uml + C (_ _˙ ) _˙ (18)in which the matrix C (_ _˙ ) is the Coriolis term containing the gyroscopic andcentripetal terms6The matrix C (_ _˙ ) has the form as shown in [9]C (_ _˙ ) =

C11 C12 C13C21 C22 C23C31 C32 C33 C11 = 0C12 = (Iyy minus Izz)(˙_ C_S_ + ˙ S2_C_) + (Izz minus Iyy) ˙ C2_C_ minus Ixx ˙ C_C13 = (Izz minus Iyy) ˙ C_S_C2_C21 = (Izz minus Iyy)(˙_ C_S_ + ˙ S_C_) + (Iyy minus Izz) ˙ C2_C_ + Ixx ˙ C_C22 = (Izz minus Iyy)˙ _C_S_C23 = minusIxx ˙ S_C_ + Iyy ˙ S2_S_C_ + Izz ˙ C2_S_C_C31 = (Iyy minus Izz) ˙ C2_S_C_ minus Ixx _˙C_C32 = (Izz minus Iyy)(˙_ C_S_S_ + ˙_S2_C_) + (Iyy minus Izz)˙ _C2_C_+Ixx ˙ S_C_ minus Iyy ˙ S2_S_C_ minus Izz ˙ C2_S_C_C33 = (Iyy minus Izz)˙ _C_S_C2_ minus Iyy _˙S2_C_S_ minus Izz ˙_C2_C_S_ + Ixx ˙_C_S_(19)Equation (18) leads to the differential equations for the angular accelerations whichare equivalent with Equations (11) and (12)uml_ = Jminus1 (_B minus C (_ _˙ ) _˙ ) (20)23 Aerodynamical effectsThe preceding model is a simplification of complex dynamic interactions To enforcemore realistical behaviour of the quadcopter drag force generated by the airresistance is included This is devised to Equations (10) and (15) with the diagonalcoefficient matrix associating the linear velocities to the force slowing the movementas in [15]umlxumly

umlz = minusg001 +TmC S_C_ + S S_S S_C_ minus C S_C_C_minus1mAx 0 00 Ay 00 0 Azx˙y˙z˙ (21)in which Ax Ay and Az are the drag force coefficients for velocities in the correspondingdirections of the inertial frameSeveral other aerodynamical effects could be included in the model For exampledependence of thrust on angle of attack blade flapping and airflow distruptions havebeen studied in [1] and [2] The influence of aerodynamical effects are complicatedand the effects are difficult to model Also some of the effects have significant effectonly in high velocities Thus these effects are excluded from the model and thepresented simple model is used

73 SimulationThe mathematical model of the quadcopter is implemented for simulation in Matlab2010 with Matlab programming language Parameter values from [3] are used in thesimulations and are presented in Table 1 The values of the drag force coefficientsAx Ay and Az are selected such as the quadcopter will slow down and stop whenangles _ and _ are stabilised to zero valuesTable 1 Parameter values for simulationParameter Value Unitg 981 ms2m 0468 kgl 0225 mk 2980 10minus6b 1140 10minus7IM 3357 10minus5 kg m2Parameter Value UnitIxx 4856 10minus3 kg m2Iyy 4856 10minus3 kg m2Izz 8801 10minus3 kg m2Ax 025 kgsAy 025 kgsAz 025 kgsThe mathematical model is tested by simulating a quadcopter with an example caseas following The quadcopter is initially in a stable state in which the values of allpositions and angles are zero the body frame of the quadcopter is congruent withthe inertial frame The total thrust is equal to the hover thrust the thrust equal togravity The simulation progresses at 00001 second intervals to total elapsed timeof two seconds The control inputs the angular velocities of the four rotors areshown in Figure 2 the inertial positions x y and z in Figure 3 and the angles _ _and in Figure 4For the first 025 seconds the quadcopter ascended by increasing all of the rotorvelocities from the hover thrust Then the ascend is stopped by decreasing the rotorvelocities significantly for the following 025 seconds Consequently the quadcopterascended 01 meters in the first 05 seconds After the ascend the quadcopter is

stable againNext the quadcopter is put into a roll motion by increasing the velocity of thefourth rotor and decreasing the velocity of the second rotor for 025 seconds Theacceleration of the roll motion is stopped by decreasing the velocity of the fourthand increasing the velocity of the second rotor for 025 seconds Thus after 05seconds in roll motion the roll angle _ had increased approx 25 degrees Becauseof the roll angle the quadcopter accelerated in the direction of the negative y-axisThen similar to the roll motion a pitch motion is created by increasing the velocityof the third rotor and decreasing the velocity of the first The motion is stoppedby decreasing the velocity of the third rotor and increasing the velocity of the firstrotor Due to the pitch movement the pitch angle _ had increased approximately822 degrees The acceleration of the quadcopter in the direction of the positive x-axisis caused by the pitch angleFinally the quadcopter is turned in the direction of the yaw angle by increasingthe velocities of the first and the third rotors and decreasing the velocities of thesecond and the fourth rotors The yaw motion is stopped by decreasing the velocitiesof the first and the third rotors and increasing the velocities of the second and thefourth rotors Consequently the yaw angle increases approximately 10 degreesDuring the whole simulation the total thrust of the rotors had remained close to theinitial total thrust Thus the deviations of the roll and pitch angles from the zerovalues decrease the value of the thrust in the direction of the z-axis Consequentlythe quadcopter accelerates in the direction of the negative z-axis and is descending0 02 04 06 08 1 12 14 16 18 2550575600625650675700Time t (s)Control input i (rads)1234

Figure 2 Control inputs i0 02 04 06 08 1 12 14 16 18 2

minus25minus2minus15minus1minus05005115Time t (s)Position (m)Position xPosition yPosition z

Figure 3 Positions x y and z90 02 04 06 08 1 12 14 16 18 2minus5051015202530Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 4 Angles _ _ and 104 Stabilisation of quadcopterTo stabilise the quadcopter a PID controller is utilised Advantages of the PIDcontroller are the simple structure and easy implementation of the controller Thegeneral form of the PID controller ise(t) = xd(t) minus x(t)u(t) = KP e(t) + KIZ t0e(_ ) d _ + KDd e(t)d t [16](22)in which u(t) is the control input e(t) is the difference between the desired statexd(t) and the present state x(t) and KP KI and KD are the parameters for theproportional integral and derivative elements of the PID controllerIn a quadcopter there are six states positions _ and angles _ but only four controlinputs the angular velocities of the four rotors i The interactions between thestates and the total thrust T and the torques _ created by the rotors are visible fromthe quadcopter dynamics defined by Equations (10) (11) and (12) The total thrustT affects the acceleration in the direction of the z-axis and holds the quadcopter inthe air Torque __ has an affect on the acceleration of angle _ torque __ affects theacceleration of angle _ and torque _ contributes in the acceleration of angle

Hence the PD controller for the quadcopter is chosen as similarly as in [4]T = (g + KzD (z˙d minus z˙) + KzP (zd minus z)) mC_C___ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Ixx__ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Iyy_ =_K D_ ˙d minus ˙ _+ K P ( d minus )_Izz(23)in which also the gravity g and mass m and moments of inertia I of the quadcopterare consideredThe correct angular velocities of rotors i can be calculated from Equations (7) and(8) with values from Equation (23)21 = T4kminus __2klminus_ 4b22 = T

4kminus__2kl+_ 4b23 = T4k+ __2klminus_ 4b24 = T4k+__2kl+_ 4b(24)The performance of the PD controller is tested by simulating the stabilisation ofa quadcopter The PD controller parameters are presented in Table 2 The initialcondition of the quadcopter is for position _ = [0 0 1]T in meters and for angles11_ = [10 10 10]T in degrees The desired position for altitude is zd = 0 The purposeof the stabilisation is stable hovering thus _d = [0 0 0]TTable 2 Parameters of the PD controllerParameter ValueKzD 25K_D 175K_D 175K D 175Parameter ValueKzP 15K_P 6K_P 6K P 6The control inputs i the positions _ and the angles _ during the simulation are

presented in Figures 5 6 and 7 The altitude and the angles are stabilised to zerovalue after 5 seconds However the positions x and y deviated from the zero valuesbecause of the non-zero values of the angles Before the quadcopter is stabilisedto hover it has already moved over 1 meters in the direction of the positive x axisand 05 meters in the direction of the negative y axis This is because the controlmethod of the PD contoller does not consider the accelerations in the directions ofx and y Thus another control method should be constructed to give a control onall of positions and angles of the quadcopter0 1 2 3 4 5 6550560570580590600610620630

Time t (s)Control input i (rads)1234

Figure 5 Control inputs i0 1 2 3 4 5 6minus06minus04minus02002040608112

Time t (s)Position (m)Position xPosition yPosition z

Figure 6 Positions x y and z120 1 2 3 4 5 6minus20246810

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 7 Angles _ _ and 135 Trajectory controlThe purpose of trajectory control is to move the quadcopter from the original locationto the desired location by controlling the rotor velocities of the quadcopterFinding optimal trajectory for a quadcopter is a difficult task because of complexdynamics However a simple control method is able to control the quadcopteradequately Thus a heuristic approach is studied and developed hereThe basis of the development of a control method is the study of the interactions and

dependances between states state derivatives and control inputs These interactionsand dependances are defined by Equations (7) (8) (20) and (21) and presented inFigure 8The given control inputs i define the total thrust T and the torques __ __ and _ The torques affect the angular accelerations depending on the current angles andangular velocities The angles _ can be integrated from the angular velocities _˙ which are integrated from the angular accelerations uml_ The linear accelerations uml_depend on the total thrust T the angles _ and the linear velocities _˙ The linearposition _ is integrated from the linear accelerations uml_ through the linear velocities_˙Hence to find proper control inputs i for given states _ this line of thought has tobe done in reverse___HHHjT_-- _uml - _˙ - _I K_uml - _˙ - _IFigure 8 Interactions between states state derivatives and control inputsOne method is to generate linear accelerations which accomplish the wanted trajectoryaccording to positions x y and z for each time t From Equation (21) threeequations are receivedTB =00T = RT

muml_ +00g +Ax 0 00 Ay 00 0 Az _˙ (25)in which _uml _˙ and are desired trajectory values as well as angles _ and _ and totalthrust T are unknown values to be solvedFrom this equation the required angles _ and _ and the total thrust T for each timet can be calculated as shown in [5]14_ = arcsin dx S minus dy C d2x + d2y + (dz + g)2_ = arctan_dx C + dy S dz + g_T = m(dx (S_C C_ + S S_) + dy (S_S C_ minus C S_)+( dz + g )C_C_) (26)in whichdx = xuml + Axx˙mdy = yuml+ Ayy˙mdz = zuml+ Azz˙m(27)

When the values of the angles _ and _ are known the angular velocities and accelerationscan be calculated from them with simple derivation With the angularvelocities and accelerations the torques _ can be solved from Equation (20) Whenthe torques and thrust are known the control inputs i can be calculated fromEquation (24)51 Heuristic method for trajectory generationThe generation of proper accelerations uml_ is difficult because the composition of thethird and fourth derivatives of the position jerk and jounce has to be reasonableThe influence of the jounce values is visible in the composition of the control inputsi High jounce values will mean high control input values and thus the jounceshave to be considered closely when generating the accelerationsA heuristic method can be used to generate jounce values The method utilises asymmetric structure in jouce function f(t) to control the derivatives One influencialpart of the function is defined by three sine functions as followingf(t) =a sin10485761b _ t_ 0 le t le bminusa sin10485761b _ t minus __ b le t le 3ba sin10485761b _ t minus 3__ 3b le t le 4b(28)The structure of the function is visualised in Figure 9 The sine functions are usedto give a smooth function These three sine functions form a function in whichthe first half increases acceleration to certain value and then the second half of the

function decreases it back to zero This acceleration generates constant velocityMirror image of the function can be used to decelerate the velocity back to zeroThe final position depends on the parameters a and b of the sine functions presented15in Equation (28) and the time c between the accelerating part and the deceleratingpart the mirror image of the jounceaaab2bba sin10485761b _ t_minusa sin1048576 12b _ t minus __a sin10485761b _ t minus 3__Jounce (ms4)Time t (s)Figure 9 Heuristic method for the generation of jounce functionsUnfortunately the method does not give optimal trajectories Thus a dynamicoptimisation model and a suitable algorithm would be needed to calculate optimallythe trajectory of the quadcopter However the method presented is easy to use togenerate proper values of jounce which will achieve the wanted trajectoryThe functionality of the method is studied with an example simulation Jounce ofposition x is created according to Equation (28) with parameters a = 1 b = 05and c = 2 The position x and its derivatives derived from the planned jounce arepresented in Figure 10 The jounce could also be generated simultaneously for y andz However in this example only position x is considered because the relationship

between the jounce of position x and the control inputs 1 and 3 controlling theangle _ is more visible160 1 2 3 4 5 6 7minus1minus08minus06minus04minus020020406081Time t (s)Jounce (ms4)

(a) Jounce0 1 2 3 4 5 6 7minus04minus03minus02minus01001020304

Time t (s)Jerk (ms3)

(b) Jerk0 1 2 3 4 5 6 7minus02minus015minus01minus00500050101502Time t (s)Acceleration (ms2)

(c) Acceleration0 1 2 3 4 5 6 7minus002000200400600801012014016018

Time t (s)Velocity (ms)

(d) Velocity0 1 2 3 4 5 6 7001020304050607

Time t (s)Position (m)

(e) PositionFigure 10 Planned position x and its derivatives with given jounceThe simulation of the example case is performed with previously given accelerationsand velocities of position x The planned value of angle is zero for each time tFirst the required angles _ and _ and thrust T are solved from Equation (26) foreach time t The angular velocities and accelerations are calculated from the solvedangles with derivation Then the torques are solved using the angular velocitiesand accelerations Finally the control inputs are solved Then the simulation isperformed with given control inputsThe calculated control inputs are presented in Figure 11 The simulated positions_ are presented in Figure 12 and the simulated angles _ in Figure 13 Accordingto Figure 12 the simulated position x is the same as the planned position x inFigure 10(e) and the values of the positions y and z stay as zeroes The angle _increases during the acceleration and then stabilises to a constant value to generate

the constant acceleration required to compensate the drag force caused by theplanned constant velocity Finally the angle is changed to the opposite direction todecelerate the quadcopter to a haltThe shape of the calculated control inputs 1 and 3 in Figure 11 are similar toplanned jounce in Figure 10(a) The shape of the simulated angle _ follows theshape of the planned acceleration umlx The shapes of the control inputs and theangles differ from the planned values of the jounce and the acceleration because thedrag force caused by the velocity has to be compensated170 1 2 3 4 5 6 76203620462056206620762086209621

Time t (s)Control input i (rads)1234

Figure 11 Control inputs i0 1 2 3 4 5 6001020304050607

Time t (s)Position (m)Position xPosition yPosition z

Figure 12 Positions x y and z0 1 2 3 4 5 6 7minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 13 Angles _ _ and The method can also be used even if there are unmodeled linear forces wind forexample which affect the linear accelerations and consequently the position of thequadcopter If the trajectory is calculated in shorter distances it is possible tocorrect the trajectory with new calculation from the current but inaccurate locationto the next checkpoint Example of this method is presented in Figure 14 Thearrows with dash lines indicate the planned trajectory in the x y-plane and thesolid arrows indicate the realised trajectory The black squares mark the start and

the finish positions and the white squares mark the checkpoints for the trajectory18The control inputs are calculated from the current location of the quadcopter to thenext checkpoint but because of random and unmodelled forces the realised positionmarked with X differs from the planned If the quadcopter is close enough to thetarget checkpoint the target checkpoint is changed to the next one and new controlinputs are calculated After repeating this and going through all of the checkpointsthe quadcopter reaches the final destinationFigure 14 Example of checkpoint flight pattern with external disturbancesThe biggest weakness in the proposed method is that it works as shown only if thequadcopter starts from a stable attitude the angles _ and _ and their derivativesare zeros and there are no external forces influencing the attitude during the flightSmall deviations in the angles can result into a huge deviation in the trajectory Oneway to solve this problem is to stabilise the quadcopter at each checkpoint with aPD controller proposed earlier or by using the heuristic method to angles Howeverif the angular disturbances are continuous the benefit from temporary stabilisationis only momentary52 Integrated PD controllerAnother method to take into account the possible deviations in the angles is tointegrate a PD controller into the heuristic method This is a simplified version ofthe proposed control method in [5] The required values dx dy and dz in Equation(26) are given by the PD controller considering the deviations between the currentand desired values (subscript d) of the positions _ velocities _˙ and accelerations _umldx = KxP (xd minus x) + KxD (x˙ d minus x˙ ) + KxDD (xumld minus xuml) dy = KyP (yd minus y) + KyD (y˙d minus y˙) + KyDD (yumld minus yuml) dz = KzP (zd minus z) + KzD (z˙d minus z˙) + KzDD (zumld minus zuml) (29)Then the commanded angles _c and _c and thrust T are given by Equation (26)The torques _ are controlled by the PD controller in Equation (30) same as in

19Equation (23) The control inputs can be solved with the calculated thrust andtorques by using Equation (24)__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Ixx__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Iyy_ =_K P ( d minus ) + K D_˙ d minus ˙ __Izz(30)The performance of the PD controller is demonstrated with an example case inwhich for all positions x y and z and their derivatives the values are same as inFigure 10 The simulation is performed with the PD parameters presented in Table3Table 3 Parameters of the PD controllerVariable Parameter valuei KiP KiD KiDDx 185 075 100y 855 075 100z 185 075 100_ 300 075 -_ 300 075 - 300 075 -The results of the simulation are presented Figures 15 - 17 The simulated controlinputs are presented in Figure 15 the simulated positions in Figure 16 and the

simulated angles in Figure 17 The position of the quadcopter is close to the plannedposition after 6 seconds but the position keeps fluctuating close to the planned valuesfor several seconds The angles variate greatly during the simulation to achieve thewanted positions velocities and accelerations The values of the control inputsoscillated during the acceleration but then their behaviour became more stable0 2 4 6 8 10 12 14618619620621622623624625626

Time t (s)Control input i (rads)1234

Figure 15 Control inputs i200 2 4 6 8 10 12 14minus0100102030405060708

Time t (s)Position (m)Position xPosition yPosition z

Figure 16 Positions x y and z0 2 4 6 8 10 12 14minus15minus125minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 17 Angles _ _ and The proposed integrated PD controller performed well in the example case Howeverthe performance of the controller is highly depended on the parameter values If theparameter values are small the controller will not respond quickly enough to followthe planned trajectory If the parameter values are substantial the quadcopter cannot perform the required drastic changes in the angular velocities of the rotor andthe control inputs calculated from Equation (24) can be infeasible with certaintorques Thus the use of equations considering the torques and the control inputsrequires a method to calculate the best feasible torques and from them the bestcontrol inputs Another possible method would be to variate the PD parameters

according to the current positions and angles and their derivatives but it is extremelydifficult216 ConclusionThis paper studied mathematical modelling and control of a quadcopter The mathematicalmodel of quadcopter dynamics was presented and the differential equationswere derived from the Newton-Euler and the Euler-Lagrange equations The modelwas verified by simulating the flight of a quadcopter with Matlab Stabilisation ofattitude of the quadcopter was done by utilising a PD controller A heuristic methodwas developed to control the trajectory of the quadcopter The PD contoller wasintegrated into the heuristic method for better response to disturbances in the flightconditions of the quadcopterThe simulation proved the presented mathematical model to be realistic in modellingthe position and attitude of the quadcopter The simulation results also showedthat the PD controller was efficient in stabilising the quadcopter to the desiredaltitude and attitude However the PD controller did not considered positions xand y Thus the values of x and y variated from their original values during thestabilisation process This was a result of the deviation of the roll and pitch anglesfrom zero valuesAccording to the simulation results the proposed heuristic method produced goodflight trajectories The heuristic method required only three parameters to generatethe values for the jounce of the position The position and its other derivatives werecalculated from the jounce values The total thrust and the pitch and roll angles toachieve given accelerations were solved from the linear differential equations Thenthe torques were determined by the angular accelerations and angular velocitiescalculated from the angles Finally the required control inputs were solved from thetotal thrust and the torques The simulation results indicated that the quadcopter

could be controlled accurately with the control inputs given by the methodThe proposed heuristic method does not consider unmodelled disturbances suchas wind and thus the PD controller was integrated into the control method Theintegrated PD controller operated well in the example simulation The quadcopterfollowed the given trajectory and began to stabilise after reaching the final destinationHowever the PD controller can perform poorly if the parameter values arenot properly selected and are too small or highThe presented mathematical model only consists of the basic structures of the quadcopterdynamics Several aerodynamical effects were excluded which can lead tounrealiable behaviour Also the electric motors spinning the fours rotors were notmodelled The behaviour of a motor is easily included in the model but would requireestimation of the parameter values of the motor The position and attitudeinformation was assumed to be accurate in the model and the simulations Howeverthe measuring devices in real life are not perfectly accurate as random variationsand errors occur Hence the effects of imprecise information to the flight of thequadcopter should be studied as well Also methods to enhance the accuracy of themeasurements should be researched and implemented to improve all aspects required22for robust quadcopter manoeuvresThe presented model and control methods were tested only with simulations Realexperimental prototype of a quadcopter should be constructed to achieve more realisticand reliable results Even though the construction of a real quadcopter and theestimation of all the model parameters are laborious tasks a real quadcopter wouldbring significant benefits to the research With a real propotype the theoreticalframework and the simulation results could be compared to real-life measurementsThis paper did not include these higlighted matters in the study but presentedthe basics of quadcopter modelling and control This paper can thus be used as a

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

quadcopter In the fifth section a heuristic method including a PD controller ispresented to control the trajectory of quadcopter flight The last section containsthe conlusion of the paper22 Mathematical model of quadcopterThe quadcopter structure is presented in Figure 1 including the corresponding angularvelocities torques and forces created by the four rotors (numbered from 1 to4)y xz__ yB xBzBf1_M1

1f2_M2

2f3_M3

3f4_M4

4Figure 1 The inertial and body frames of a quadcopterThe absolute linear position of the quadcopter is defined in the inertial frame xyzaxeswith _ The attitude ie the angular position is defined in the inertial framewith three Euler angles _ Pitch angle _ determines the rotation of the quadcopteraround the y-axis Roll angle _ determines the rotation around the x-axis and yawangle around the z-axis Vector q contains the linear and angular position vectors_ =xyz

_ =__ q =____ (1)The origin of the body frame is in the center of mass of the quadcopter In the bodyframe the linear velocities are determined by VB and the angular velocities by _VB =vxBvyBvzB _ =pqr (2)The rotation matrix from the body frame to the inertial frame isR =C C_ C S_S_ minus S C_ C S_C_ + S S_S C_ S S_S_ + C C_ S S_C_ minus C S_minusS_ C_S_ C_C_ (3)in which Sx = sin(x) and Cx = cos(x) The rotation matrix R is orthogonal thusRminus1 = RT which is the rotation matrix from the inertial frame to the body frame3The transformation matrix for angular velocities from the inertial frame to the bodyframe is W_ and from the body frame to the inertial frame is Wminus1

_ as shown in[14]_˙ =Wminus1_ __ =W_ _˙ ˙__˙˙ =1 S_T_ C_T_0 C_ minusS_0 S_C_ C_C_pqr pqr =1 0 minusS_0 C_ C_S_0 minusS_ C_C_˙__˙˙ (4)in which Tx = tan(x) The matrix W_ is invertible if _ 6= (2k minus 1)_2 (k isin Z)

The quadcopter is assumed to have symmetric structure with the four arms alignedwith the body x- and y-axes Thus the inertia matrix is diagonal matrix I in whichIxx = IyyI =Ixx 0 00 Iyy 00 0 Izz (5)The angular velocity of rotor i denoted with i creates force fi in the direction ofthe rotor axis The angular velocity and acceleration of the rotor also create torque_Mi around the rotor axisfi = k 2i _Mi = b 2i + IM ˙ i (6)in which the lift constant is k the drag constant is b and the inertia moment of therotor is IM Usually the effect of ˙ i is considered small and thus it is omittedThe combined forces of rotors create thrust T in the direction of the body z-axisTorque _B consists of the torques __ __ and _ in the direction of the correspondingbody frame anglesT =X4i=1fi = kX4i=12i TB =00T (7)_B =____

_ =l k (minus22 + 24)l k (minus21 + 23)X4i=1_Mi

(8)in which l is the distance between the rotor and the center of mass of the quadcopterThus the roll movement is acquired by decreasing the 2nd rotor velocityand increasing the 4th rotor velocity Similarly the pitch movement is acquired bydecreasing the 1st rotor velocity and increasing the 3th rotor velocity Yaw movementis acquired by increasing the the angular velocities of two opposite rotors anddecreasing the velocities of the other two421 Newton-Euler equationsThe quadcopter is assumed to be rigid body and thus Newton-Euler equations canbe used to describe its dynamics In the body frame the force required for theacceleration of mass m ˙VB and the centrifugal force _ times (mVB) are equal to thegravity RTG and the total thrust of the rotors TBm ˙VB + _ times (mVB) = RTG + TB (9)In the inertial frame the centrifugal force is nullified Thus only the gravitationalforce and the magnitude and direction of the thrust are contributing in the accelerationof the quadcoptermuml_ = G+ RTBumlxumlyumlz

= minusg001 + TmC S_C_ + S S_S S_C_ minus C S_C_C_ (10)In the body frame the angular acceleration of the inertia I_˙ the centripetal forces_ times (I_) and the gyroscopic forces 1048576 are equal to the external torque _I_˙ + _ times (I_) + 1048576 = _ _˙ = Iminus1minuspqr timesIxx pIyy qIzz r minus Irpqr times00

1 1048576 + _p˙q˙r˙ =(Iyy minus Izz) q rIxx(Izz minus Ixx) p rIyy(Ixx minus Iyy) p qIzz minus IrqIxxminuspIyy0 1048576 +__Ixx__Iyy_ Izz (11)in which 1048576 = 1minus2 +3 minus4 The angular accelerations in the inertial frame arethen attracted from the body frame accelerations with the transformation matrixWminus1_ and its time derivativeuml_ = ddt1048576Wminus1_ __= ddt1048576Wminus1

___ +Wminus1_ _˙=0 ˙_C_T_ + _˙S_C2_ minus˙_S_C_ + _˙C_C2_0 minus˙_S_ minus˙_C_0 ˙_ C_C_ + ˙ _S_T_C_ minus˙_S_C_ + _˙C_T_C_ _ +Wminus1

_ _˙ (12)522 Euler-Lagrange equationsThe Lagrangian L is the sum of the translational Etrans and rotational Erot energiesminus potential energy EpotL (q q˙) = Etrans + Erot minus Epot= (m2) _˙T _˙ + (12) _T I _ minus mgz(13)As shown in [10] the Euler-Lagrange equations with external forces and torques are_f__=ddt_Lq˙_minusLq (14)The linear and angular components do not depend on each other thus they can bestudied separately The linear external force is the total thrust of the rotors Thelinear Euler-Lagrange equations aref = RTB = muml_ + mg0

01 (15)which is equivalent with Equation (10)The Jacobian matrix J (_) from _ to _˙ isJ (_) = J =WT_ IW_=Ixx 0 minusIxxS_0 IyyC2_ + IzzS2_ (Iyy minus Izz)C_S_C_minusIxxS_ (Iyy minus Izz)C_S_C_ IxxS2_ + IyyS2_C2_ + IzzC2_C2_(16)Thus the rotational energy Erot can be expressed in the inertial frame asErot = (12) _T I _ = (12) uml_T J uml_ (17)The external angular force is the torques of the rotors The angular Euler-Lagrangeequations are_ = _B = J uml_ +ddt(J) _˙ minus12_1048576_˙T J _˙_= J _uml + C (_ _˙ ) _˙ (18)in which the matrix C (_ _˙ ) is the Coriolis term containing the gyroscopic andcentripetal terms6The matrix C (_ _˙ ) has the form as shown in [9]C (_ _˙ ) =

C11 C12 C13C21 C22 C23C31 C32 C33 C11 = 0C12 = (Iyy minus Izz)(˙_ C_S_ + ˙ S2_C_) + (Izz minus Iyy) ˙ C2_C_ minus Ixx ˙ C_C13 = (Izz minus Iyy) ˙ C_S_C2_C21 = (Izz minus Iyy)(˙_ C_S_ + ˙ S_C_) + (Iyy minus Izz) ˙ C2_C_ + Ixx ˙ C_C22 = (Izz minus Iyy)˙ _C_S_C23 = minusIxx ˙ S_C_ + Iyy ˙ S2_S_C_ + Izz ˙ C2_S_C_C31 = (Iyy minus Izz) ˙ C2_S_C_ minus Ixx _˙C_C32 = (Izz minus Iyy)(˙_ C_S_S_ + ˙_S2_C_) + (Iyy minus Izz)˙ _C2_C_+Ixx ˙ S_C_ minus Iyy ˙ S2_S_C_ minus Izz ˙ C2_S_C_C33 = (Iyy minus Izz)˙ _C_S_C2_ minus Iyy _˙S2_C_S_ minus Izz ˙_C2_C_S_ + Ixx ˙_C_S_(19)Equation (18) leads to the differential equations for the angular accelerations whichare equivalent with Equations (11) and (12)uml_ = Jminus1 (_B minus C (_ _˙ ) _˙ ) (20)23 Aerodynamical effectsThe preceding model is a simplification of complex dynamic interactions To enforcemore realistical behaviour of the quadcopter drag force generated by the airresistance is included This is devised to Equations (10) and (15) with the diagonalcoefficient matrix associating the linear velocities to the force slowing the movementas in [15]umlxumly

umlz = minusg001 +TmC S_C_ + S S_S S_C_ minus C S_C_C_minus1mAx 0 00 Ay 00 0 Azx˙y˙z˙ (21)in which Ax Ay and Az are the drag force coefficients for velocities in the correspondingdirections of the inertial frameSeveral other aerodynamical effects could be included in the model For exampledependence of thrust on angle of attack blade flapping and airflow distruptions havebeen studied in [1] and [2] The influence of aerodynamical effects are complicatedand the effects are difficult to model Also some of the effects have significant effectonly in high velocities Thus these effects are excluded from the model and thepresented simple model is used

73 SimulationThe mathematical model of the quadcopter is implemented for simulation in Matlab2010 with Matlab programming language Parameter values from [3] are used in thesimulations and are presented in Table 1 The values of the drag force coefficientsAx Ay and Az are selected such as the quadcopter will slow down and stop whenangles _ and _ are stabilised to zero valuesTable 1 Parameter values for simulationParameter Value Unitg 981 ms2m 0468 kgl 0225 mk 2980 10minus6b 1140 10minus7IM 3357 10minus5 kg m2Parameter Value UnitIxx 4856 10minus3 kg m2Iyy 4856 10minus3 kg m2Izz 8801 10minus3 kg m2Ax 025 kgsAy 025 kgsAz 025 kgsThe mathematical model is tested by simulating a quadcopter with an example caseas following The quadcopter is initially in a stable state in which the values of allpositions and angles are zero the body frame of the quadcopter is congruent withthe inertial frame The total thrust is equal to the hover thrust the thrust equal togravity The simulation progresses at 00001 second intervals to total elapsed timeof two seconds The control inputs the angular velocities of the four rotors areshown in Figure 2 the inertial positions x y and z in Figure 3 and the angles _ _and in Figure 4For the first 025 seconds the quadcopter ascended by increasing all of the rotorvelocities from the hover thrust Then the ascend is stopped by decreasing the rotorvelocities significantly for the following 025 seconds Consequently the quadcopterascended 01 meters in the first 05 seconds After the ascend the quadcopter is

stable againNext the quadcopter is put into a roll motion by increasing the velocity of thefourth rotor and decreasing the velocity of the second rotor for 025 seconds Theacceleration of the roll motion is stopped by decreasing the velocity of the fourthand increasing the velocity of the second rotor for 025 seconds Thus after 05seconds in roll motion the roll angle _ had increased approx 25 degrees Becauseof the roll angle the quadcopter accelerated in the direction of the negative y-axisThen similar to the roll motion a pitch motion is created by increasing the velocityof the third rotor and decreasing the velocity of the first The motion is stoppedby decreasing the velocity of the third rotor and increasing the velocity of the firstrotor Due to the pitch movement the pitch angle _ had increased approximately822 degrees The acceleration of the quadcopter in the direction of the positive x-axisis caused by the pitch angleFinally the quadcopter is turned in the direction of the yaw angle by increasingthe velocities of the first and the third rotors and decreasing the velocities of thesecond and the fourth rotors The yaw motion is stopped by decreasing the velocitiesof the first and the third rotors and increasing the velocities of the second and thefourth rotors Consequently the yaw angle increases approximately 10 degreesDuring the whole simulation the total thrust of the rotors had remained close to theinitial total thrust Thus the deviations of the roll and pitch angles from the zerovalues decrease the value of the thrust in the direction of the z-axis Consequentlythe quadcopter accelerates in the direction of the negative z-axis and is descending0 02 04 06 08 1 12 14 16 18 2550575600625650675700Time t (s)Control input i (rads)1234

Figure 2 Control inputs i0 02 04 06 08 1 12 14 16 18 2

minus25minus2minus15minus1minus05005115Time t (s)Position (m)Position xPosition yPosition z

Figure 3 Positions x y and z90 02 04 06 08 1 12 14 16 18 2minus5051015202530Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 4 Angles _ _ and 104 Stabilisation of quadcopterTo stabilise the quadcopter a PID controller is utilised Advantages of the PIDcontroller are the simple structure and easy implementation of the controller Thegeneral form of the PID controller ise(t) = xd(t) minus x(t)u(t) = KP e(t) + KIZ t0e(_ ) d _ + KDd e(t)d t [16](22)in which u(t) is the control input e(t) is the difference between the desired statexd(t) and the present state x(t) and KP KI and KD are the parameters for theproportional integral and derivative elements of the PID controllerIn a quadcopter there are six states positions _ and angles _ but only four controlinputs the angular velocities of the four rotors i The interactions between thestates and the total thrust T and the torques _ created by the rotors are visible fromthe quadcopter dynamics defined by Equations (10) (11) and (12) The total thrustT affects the acceleration in the direction of the z-axis and holds the quadcopter inthe air Torque __ has an affect on the acceleration of angle _ torque __ affects theacceleration of angle _ and torque _ contributes in the acceleration of angle

Hence the PD controller for the quadcopter is chosen as similarly as in [4]T = (g + KzD (z˙d minus z˙) + KzP (zd minus z)) mC_C___ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Ixx__ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Iyy_ =_K D_ ˙d minus ˙ _+ K P ( d minus )_Izz(23)in which also the gravity g and mass m and moments of inertia I of the quadcopterare consideredThe correct angular velocities of rotors i can be calculated from Equations (7) and(8) with values from Equation (23)21 = T4kminus __2klminus_ 4b22 = T

4kminus__2kl+_ 4b23 = T4k+ __2klminus_ 4b24 = T4k+__2kl+_ 4b(24)The performance of the PD controller is tested by simulating the stabilisation ofa quadcopter The PD controller parameters are presented in Table 2 The initialcondition of the quadcopter is for position _ = [0 0 1]T in meters and for angles11_ = [10 10 10]T in degrees The desired position for altitude is zd = 0 The purposeof the stabilisation is stable hovering thus _d = [0 0 0]TTable 2 Parameters of the PD controllerParameter ValueKzD 25K_D 175K_D 175K D 175Parameter ValueKzP 15K_P 6K_P 6K P 6The control inputs i the positions _ and the angles _ during the simulation are

presented in Figures 5 6 and 7 The altitude and the angles are stabilised to zerovalue after 5 seconds However the positions x and y deviated from the zero valuesbecause of the non-zero values of the angles Before the quadcopter is stabilisedto hover it has already moved over 1 meters in the direction of the positive x axisand 05 meters in the direction of the negative y axis This is because the controlmethod of the PD contoller does not consider the accelerations in the directions ofx and y Thus another control method should be constructed to give a control onall of positions and angles of the quadcopter0 1 2 3 4 5 6550560570580590600610620630

Time t (s)Control input i (rads)1234

Figure 5 Control inputs i0 1 2 3 4 5 6minus06minus04minus02002040608112

Time t (s)Position (m)Position xPosition yPosition z

Figure 6 Positions x y and z120 1 2 3 4 5 6minus20246810

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 7 Angles _ _ and 135 Trajectory controlThe purpose of trajectory control is to move the quadcopter from the original locationto the desired location by controlling the rotor velocities of the quadcopterFinding optimal trajectory for a quadcopter is a difficult task because of complexdynamics However a simple control method is able to control the quadcopteradequately Thus a heuristic approach is studied and developed hereThe basis of the development of a control method is the study of the interactions and

dependances between states state derivatives and control inputs These interactionsand dependances are defined by Equations (7) (8) (20) and (21) and presented inFigure 8The given control inputs i define the total thrust T and the torques __ __ and _ The torques affect the angular accelerations depending on the current angles andangular velocities The angles _ can be integrated from the angular velocities _˙ which are integrated from the angular accelerations uml_ The linear accelerations uml_depend on the total thrust T the angles _ and the linear velocities _˙ The linearposition _ is integrated from the linear accelerations uml_ through the linear velocities_˙Hence to find proper control inputs i for given states _ this line of thought has tobe done in reverse___HHHjT_-- _uml - _˙ - _I K_uml - _˙ - _IFigure 8 Interactions between states state derivatives and control inputsOne method is to generate linear accelerations which accomplish the wanted trajectoryaccording to positions x y and z for each time t From Equation (21) threeequations are receivedTB =00T = RT

muml_ +00g +Ax 0 00 Ay 00 0 Az _˙ (25)in which _uml _˙ and are desired trajectory values as well as angles _ and _ and totalthrust T are unknown values to be solvedFrom this equation the required angles _ and _ and the total thrust T for each timet can be calculated as shown in [5]14_ = arcsin dx S minus dy C d2x + d2y + (dz + g)2_ = arctan_dx C + dy S dz + g_T = m(dx (S_C C_ + S S_) + dy (S_S C_ minus C S_)+( dz + g )C_C_) (26)in whichdx = xuml + Axx˙mdy = yuml+ Ayy˙mdz = zuml+ Azz˙m(27)

When the values of the angles _ and _ are known the angular velocities and accelerationscan be calculated from them with simple derivation With the angularvelocities and accelerations the torques _ can be solved from Equation (20) Whenthe torques and thrust are known the control inputs i can be calculated fromEquation (24)51 Heuristic method for trajectory generationThe generation of proper accelerations uml_ is difficult because the composition of thethird and fourth derivatives of the position jerk and jounce has to be reasonableThe influence of the jounce values is visible in the composition of the control inputsi High jounce values will mean high control input values and thus the jounceshave to be considered closely when generating the accelerationsA heuristic method can be used to generate jounce values The method utilises asymmetric structure in jouce function f(t) to control the derivatives One influencialpart of the function is defined by three sine functions as followingf(t) =a sin10485761b _ t_ 0 le t le bminusa sin10485761b _ t minus __ b le t le 3ba sin10485761b _ t minus 3__ 3b le t le 4b(28)The structure of the function is visualised in Figure 9 The sine functions are usedto give a smooth function These three sine functions form a function in whichthe first half increases acceleration to certain value and then the second half of the

function decreases it back to zero This acceleration generates constant velocityMirror image of the function can be used to decelerate the velocity back to zeroThe final position depends on the parameters a and b of the sine functions presented15in Equation (28) and the time c between the accelerating part and the deceleratingpart the mirror image of the jounceaaab2bba sin10485761b _ t_minusa sin1048576 12b _ t minus __a sin10485761b _ t minus 3__Jounce (ms4)Time t (s)Figure 9 Heuristic method for the generation of jounce functionsUnfortunately the method does not give optimal trajectories Thus a dynamicoptimisation model and a suitable algorithm would be needed to calculate optimallythe trajectory of the quadcopter However the method presented is easy to use togenerate proper values of jounce which will achieve the wanted trajectoryThe functionality of the method is studied with an example simulation Jounce ofposition x is created according to Equation (28) with parameters a = 1 b = 05and c = 2 The position x and its derivatives derived from the planned jounce arepresented in Figure 10 The jounce could also be generated simultaneously for y andz However in this example only position x is considered because the relationship

between the jounce of position x and the control inputs 1 and 3 controlling theangle _ is more visible160 1 2 3 4 5 6 7minus1minus08minus06minus04minus020020406081Time t (s)Jounce (ms4)

(a) Jounce0 1 2 3 4 5 6 7minus04minus03minus02minus01001020304

Time t (s)Jerk (ms3)

(b) Jerk0 1 2 3 4 5 6 7minus02minus015minus01minus00500050101502Time t (s)Acceleration (ms2)

(c) Acceleration0 1 2 3 4 5 6 7minus002000200400600801012014016018

Time t (s)Velocity (ms)

(d) Velocity0 1 2 3 4 5 6 7001020304050607

Time t (s)Position (m)

(e) PositionFigure 10 Planned position x and its derivatives with given jounceThe simulation of the example case is performed with previously given accelerationsand velocities of position x The planned value of angle is zero for each time tFirst the required angles _ and _ and thrust T are solved from Equation (26) foreach time t The angular velocities and accelerations are calculated from the solvedangles with derivation Then the torques are solved using the angular velocitiesand accelerations Finally the control inputs are solved Then the simulation isperformed with given control inputsThe calculated control inputs are presented in Figure 11 The simulated positions_ are presented in Figure 12 and the simulated angles _ in Figure 13 Accordingto Figure 12 the simulated position x is the same as the planned position x inFigure 10(e) and the values of the positions y and z stay as zeroes The angle _increases during the acceleration and then stabilises to a constant value to generate

the constant acceleration required to compensate the drag force caused by theplanned constant velocity Finally the angle is changed to the opposite direction todecelerate the quadcopter to a haltThe shape of the calculated control inputs 1 and 3 in Figure 11 are similar toplanned jounce in Figure 10(a) The shape of the simulated angle _ follows theshape of the planned acceleration umlx The shapes of the control inputs and theangles differ from the planned values of the jounce and the acceleration because thedrag force caused by the velocity has to be compensated170 1 2 3 4 5 6 76203620462056206620762086209621

Time t (s)Control input i (rads)1234

Figure 11 Control inputs i0 1 2 3 4 5 6001020304050607

Time t (s)Position (m)Position xPosition yPosition z

Figure 12 Positions x y and z0 1 2 3 4 5 6 7minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 13 Angles _ _ and The method can also be used even if there are unmodeled linear forces wind forexample which affect the linear accelerations and consequently the position of thequadcopter If the trajectory is calculated in shorter distances it is possible tocorrect the trajectory with new calculation from the current but inaccurate locationto the next checkpoint Example of this method is presented in Figure 14 Thearrows with dash lines indicate the planned trajectory in the x y-plane and thesolid arrows indicate the realised trajectory The black squares mark the start and

the finish positions and the white squares mark the checkpoints for the trajectory18The control inputs are calculated from the current location of the quadcopter to thenext checkpoint but because of random and unmodelled forces the realised positionmarked with X differs from the planned If the quadcopter is close enough to thetarget checkpoint the target checkpoint is changed to the next one and new controlinputs are calculated After repeating this and going through all of the checkpointsthe quadcopter reaches the final destinationFigure 14 Example of checkpoint flight pattern with external disturbancesThe biggest weakness in the proposed method is that it works as shown only if thequadcopter starts from a stable attitude the angles _ and _ and their derivativesare zeros and there are no external forces influencing the attitude during the flightSmall deviations in the angles can result into a huge deviation in the trajectory Oneway to solve this problem is to stabilise the quadcopter at each checkpoint with aPD controller proposed earlier or by using the heuristic method to angles Howeverif the angular disturbances are continuous the benefit from temporary stabilisationis only momentary52 Integrated PD controllerAnother method to take into account the possible deviations in the angles is tointegrate a PD controller into the heuristic method This is a simplified version ofthe proposed control method in [5] The required values dx dy and dz in Equation(26) are given by the PD controller considering the deviations between the currentand desired values (subscript d) of the positions _ velocities _˙ and accelerations _umldx = KxP (xd minus x) + KxD (x˙ d minus x˙ ) + KxDD (xumld minus xuml) dy = KyP (yd minus y) + KyD (y˙d minus y˙) + KyDD (yumld minus yuml) dz = KzP (zd minus z) + KzD (z˙d minus z˙) + KzDD (zumld minus zuml) (29)Then the commanded angles _c and _c and thrust T are given by Equation (26)The torques _ are controlled by the PD controller in Equation (30) same as in

19Equation (23) The control inputs can be solved with the calculated thrust andtorques by using Equation (24)__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Ixx__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Iyy_ =_K P ( d minus ) + K D_˙ d minus ˙ __Izz(30)The performance of the PD controller is demonstrated with an example case inwhich for all positions x y and z and their derivatives the values are same as inFigure 10 The simulation is performed with the PD parameters presented in Table3Table 3 Parameters of the PD controllerVariable Parameter valuei KiP KiD KiDDx 185 075 100y 855 075 100z 185 075 100_ 300 075 -_ 300 075 - 300 075 -The results of the simulation are presented Figures 15 - 17 The simulated controlinputs are presented in Figure 15 the simulated positions in Figure 16 and the

simulated angles in Figure 17 The position of the quadcopter is close to the plannedposition after 6 seconds but the position keeps fluctuating close to the planned valuesfor several seconds The angles variate greatly during the simulation to achieve thewanted positions velocities and accelerations The values of the control inputsoscillated during the acceleration but then their behaviour became more stable0 2 4 6 8 10 12 14618619620621622623624625626

Time t (s)Control input i (rads)1234

Figure 15 Control inputs i200 2 4 6 8 10 12 14minus0100102030405060708

Time t (s)Position (m)Position xPosition yPosition z

Figure 16 Positions x y and z0 2 4 6 8 10 12 14minus15minus125minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 17 Angles _ _ and The proposed integrated PD controller performed well in the example case Howeverthe performance of the controller is highly depended on the parameter values If theparameter values are small the controller will not respond quickly enough to followthe planned trajectory If the parameter values are substantial the quadcopter cannot perform the required drastic changes in the angular velocities of the rotor andthe control inputs calculated from Equation (24) can be infeasible with certaintorques Thus the use of equations considering the torques and the control inputsrequires a method to calculate the best feasible torques and from them the bestcontrol inputs Another possible method would be to variate the PD parameters

according to the current positions and angles and their derivatives but it is extremelydifficult216 ConclusionThis paper studied mathematical modelling and control of a quadcopter The mathematicalmodel of quadcopter dynamics was presented and the differential equationswere derived from the Newton-Euler and the Euler-Lagrange equations The modelwas verified by simulating the flight of a quadcopter with Matlab Stabilisation ofattitude of the quadcopter was done by utilising a PD controller A heuristic methodwas developed to control the trajectory of the quadcopter The PD contoller wasintegrated into the heuristic method for better response to disturbances in the flightconditions of the quadcopterThe simulation proved the presented mathematical model to be realistic in modellingthe position and attitude of the quadcopter The simulation results also showedthat the PD controller was efficient in stabilising the quadcopter to the desiredaltitude and attitude However the PD controller did not considered positions xand y Thus the values of x and y variated from their original values during thestabilisation process This was a result of the deviation of the roll and pitch anglesfrom zero valuesAccording to the simulation results the proposed heuristic method produced goodflight trajectories The heuristic method required only three parameters to generatethe values for the jounce of the position The position and its other derivatives werecalculated from the jounce values The total thrust and the pitch and roll angles toachieve given accelerations were solved from the linear differential equations Thenthe torques were determined by the angular accelerations and angular velocitiescalculated from the angles Finally the required control inputs were solved from thetotal thrust and the torques The simulation results indicated that the quadcopter

could be controlled accurately with the control inputs given by the methodThe proposed heuristic method does not consider unmodelled disturbances suchas wind and thus the PD controller was integrated into the control method Theintegrated PD controller operated well in the example simulation The quadcopterfollowed the given trajectory and began to stabilise after reaching the final destinationHowever the PD controller can perform poorly if the parameter values arenot properly selected and are too small or highThe presented mathematical model only consists of the basic structures of the quadcopterdynamics Several aerodynamical effects were excluded which can lead tounrealiable behaviour Also the electric motors spinning the fours rotors were notmodelled The behaviour of a motor is easily included in the model but would requireestimation of the parameter values of the motor The position and attitudeinformation was assumed to be accurate in the model and the simulations Howeverthe measuring devices in real life are not perfectly accurate as random variationsand errors occur Hence the effects of imprecise information to the flight of thequadcopter should be studied as well Also methods to enhance the accuracy of themeasurements should be researched and implemented to improve all aspects required22for robust quadcopter manoeuvresThe presented model and control methods were tested only with simulations Realexperimental prototype of a quadcopter should be constructed to achieve more realisticand reliable results Even though the construction of a real quadcopter and theestimation of all the model parameters are laborious tasks a real quadcopter wouldbring significant benefits to the research With a real propotype the theoreticalframework and the simulation results could be compared to real-life measurementsThis paper did not include these higlighted matters in the study but presentedthe basics of quadcopter modelling and control This paper can thus be used as a

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

_ =__ q =____ (1)The origin of the body frame is in the center of mass of the quadcopter In the bodyframe the linear velocities are determined by VB and the angular velocities by _VB =vxBvyBvzB _ =pqr (2)The rotation matrix from the body frame to the inertial frame isR =C C_ C S_S_ minus S C_ C S_C_ + S S_S C_ S S_S_ + C C_ S S_C_ minus C S_minusS_ C_S_ C_C_ (3)in which Sx = sin(x) and Cx = cos(x) The rotation matrix R is orthogonal thusRminus1 = RT which is the rotation matrix from the inertial frame to the body frame3The transformation matrix for angular velocities from the inertial frame to the bodyframe is W_ and from the body frame to the inertial frame is Wminus1

_ as shown in[14]_˙ =Wminus1_ __ =W_ _˙ ˙__˙˙ =1 S_T_ C_T_0 C_ minusS_0 S_C_ C_C_pqr pqr =1 0 minusS_0 C_ C_S_0 minusS_ C_C_˙__˙˙ (4)in which Tx = tan(x) The matrix W_ is invertible if _ 6= (2k minus 1)_2 (k isin Z)

The quadcopter is assumed to have symmetric structure with the four arms alignedwith the body x- and y-axes Thus the inertia matrix is diagonal matrix I in whichIxx = IyyI =Ixx 0 00 Iyy 00 0 Izz (5)The angular velocity of rotor i denoted with i creates force fi in the direction ofthe rotor axis The angular velocity and acceleration of the rotor also create torque_Mi around the rotor axisfi = k 2i _Mi = b 2i + IM ˙ i (6)in which the lift constant is k the drag constant is b and the inertia moment of therotor is IM Usually the effect of ˙ i is considered small and thus it is omittedThe combined forces of rotors create thrust T in the direction of the body z-axisTorque _B consists of the torques __ __ and _ in the direction of the correspondingbody frame anglesT =X4i=1fi = kX4i=12i TB =00T (7)_B =____

_ =l k (minus22 + 24)l k (minus21 + 23)X4i=1_Mi

(8)in which l is the distance between the rotor and the center of mass of the quadcopterThus the roll movement is acquired by decreasing the 2nd rotor velocityand increasing the 4th rotor velocity Similarly the pitch movement is acquired bydecreasing the 1st rotor velocity and increasing the 3th rotor velocity Yaw movementis acquired by increasing the the angular velocities of two opposite rotors anddecreasing the velocities of the other two421 Newton-Euler equationsThe quadcopter is assumed to be rigid body and thus Newton-Euler equations canbe used to describe its dynamics In the body frame the force required for theacceleration of mass m ˙VB and the centrifugal force _ times (mVB) are equal to thegravity RTG and the total thrust of the rotors TBm ˙VB + _ times (mVB) = RTG + TB (9)In the inertial frame the centrifugal force is nullified Thus only the gravitationalforce and the magnitude and direction of the thrust are contributing in the accelerationof the quadcoptermuml_ = G+ RTBumlxumlyumlz

= minusg001 + TmC S_C_ + S S_S S_C_ minus C S_C_C_ (10)In the body frame the angular acceleration of the inertia I_˙ the centripetal forces_ times (I_) and the gyroscopic forces 1048576 are equal to the external torque _I_˙ + _ times (I_) + 1048576 = _ _˙ = Iminus1minuspqr timesIxx pIyy qIzz r minus Irpqr times00

1 1048576 + _p˙q˙r˙ =(Iyy minus Izz) q rIxx(Izz minus Ixx) p rIyy(Ixx minus Iyy) p qIzz minus IrqIxxminuspIyy0 1048576 +__Ixx__Iyy_ Izz (11)in which 1048576 = 1minus2 +3 minus4 The angular accelerations in the inertial frame arethen attracted from the body frame accelerations with the transformation matrixWminus1_ and its time derivativeuml_ = ddt1048576Wminus1_ __= ddt1048576Wminus1

___ +Wminus1_ _˙=0 ˙_C_T_ + _˙S_C2_ minus˙_S_C_ + _˙C_C2_0 minus˙_S_ minus˙_C_0 ˙_ C_C_ + ˙ _S_T_C_ minus˙_S_C_ + _˙C_T_C_ _ +Wminus1

_ _˙ (12)522 Euler-Lagrange equationsThe Lagrangian L is the sum of the translational Etrans and rotational Erot energiesminus potential energy EpotL (q q˙) = Etrans + Erot minus Epot= (m2) _˙T _˙ + (12) _T I _ minus mgz(13)As shown in [10] the Euler-Lagrange equations with external forces and torques are_f__=ddt_Lq˙_minusLq (14)The linear and angular components do not depend on each other thus they can bestudied separately The linear external force is the total thrust of the rotors Thelinear Euler-Lagrange equations aref = RTB = muml_ + mg0

01 (15)which is equivalent with Equation (10)The Jacobian matrix J (_) from _ to _˙ isJ (_) = J =WT_ IW_=Ixx 0 minusIxxS_0 IyyC2_ + IzzS2_ (Iyy minus Izz)C_S_C_minusIxxS_ (Iyy minus Izz)C_S_C_ IxxS2_ + IyyS2_C2_ + IzzC2_C2_(16)Thus the rotational energy Erot can be expressed in the inertial frame asErot = (12) _T I _ = (12) uml_T J uml_ (17)The external angular force is the torques of the rotors The angular Euler-Lagrangeequations are_ = _B = J uml_ +ddt(J) _˙ minus12_1048576_˙T J _˙_= J _uml + C (_ _˙ ) _˙ (18)in which the matrix C (_ _˙ ) is the Coriolis term containing the gyroscopic andcentripetal terms6The matrix C (_ _˙ ) has the form as shown in [9]C (_ _˙ ) =

C11 C12 C13C21 C22 C23C31 C32 C33 C11 = 0C12 = (Iyy minus Izz)(˙_ C_S_ + ˙ S2_C_) + (Izz minus Iyy) ˙ C2_C_ minus Ixx ˙ C_C13 = (Izz minus Iyy) ˙ C_S_C2_C21 = (Izz minus Iyy)(˙_ C_S_ + ˙ S_C_) + (Iyy minus Izz) ˙ C2_C_ + Ixx ˙ C_C22 = (Izz minus Iyy)˙ _C_S_C23 = minusIxx ˙ S_C_ + Iyy ˙ S2_S_C_ + Izz ˙ C2_S_C_C31 = (Iyy minus Izz) ˙ C2_S_C_ minus Ixx _˙C_C32 = (Izz minus Iyy)(˙_ C_S_S_ + ˙_S2_C_) + (Iyy minus Izz)˙ _C2_C_+Ixx ˙ S_C_ minus Iyy ˙ S2_S_C_ minus Izz ˙ C2_S_C_C33 = (Iyy minus Izz)˙ _C_S_C2_ minus Iyy _˙S2_C_S_ minus Izz ˙_C2_C_S_ + Ixx ˙_C_S_(19)Equation (18) leads to the differential equations for the angular accelerations whichare equivalent with Equations (11) and (12)uml_ = Jminus1 (_B minus C (_ _˙ ) _˙ ) (20)23 Aerodynamical effectsThe preceding model is a simplification of complex dynamic interactions To enforcemore realistical behaviour of the quadcopter drag force generated by the airresistance is included This is devised to Equations (10) and (15) with the diagonalcoefficient matrix associating the linear velocities to the force slowing the movementas in [15]umlxumly

umlz = minusg001 +TmC S_C_ + S S_S S_C_ minus C S_C_C_minus1mAx 0 00 Ay 00 0 Azx˙y˙z˙ (21)in which Ax Ay and Az are the drag force coefficients for velocities in the correspondingdirections of the inertial frameSeveral other aerodynamical effects could be included in the model For exampledependence of thrust on angle of attack blade flapping and airflow distruptions havebeen studied in [1] and [2] The influence of aerodynamical effects are complicatedand the effects are difficult to model Also some of the effects have significant effectonly in high velocities Thus these effects are excluded from the model and thepresented simple model is used

73 SimulationThe mathematical model of the quadcopter is implemented for simulation in Matlab2010 with Matlab programming language Parameter values from [3] are used in thesimulations and are presented in Table 1 The values of the drag force coefficientsAx Ay and Az are selected such as the quadcopter will slow down and stop whenangles _ and _ are stabilised to zero valuesTable 1 Parameter values for simulationParameter Value Unitg 981 ms2m 0468 kgl 0225 mk 2980 10minus6b 1140 10minus7IM 3357 10minus5 kg m2Parameter Value UnitIxx 4856 10minus3 kg m2Iyy 4856 10minus3 kg m2Izz 8801 10minus3 kg m2Ax 025 kgsAy 025 kgsAz 025 kgsThe mathematical model is tested by simulating a quadcopter with an example caseas following The quadcopter is initially in a stable state in which the values of allpositions and angles are zero the body frame of the quadcopter is congruent withthe inertial frame The total thrust is equal to the hover thrust the thrust equal togravity The simulation progresses at 00001 second intervals to total elapsed timeof two seconds The control inputs the angular velocities of the four rotors areshown in Figure 2 the inertial positions x y and z in Figure 3 and the angles _ _and in Figure 4For the first 025 seconds the quadcopter ascended by increasing all of the rotorvelocities from the hover thrust Then the ascend is stopped by decreasing the rotorvelocities significantly for the following 025 seconds Consequently the quadcopterascended 01 meters in the first 05 seconds After the ascend the quadcopter is

stable againNext the quadcopter is put into a roll motion by increasing the velocity of thefourth rotor and decreasing the velocity of the second rotor for 025 seconds Theacceleration of the roll motion is stopped by decreasing the velocity of the fourthand increasing the velocity of the second rotor for 025 seconds Thus after 05seconds in roll motion the roll angle _ had increased approx 25 degrees Becauseof the roll angle the quadcopter accelerated in the direction of the negative y-axisThen similar to the roll motion a pitch motion is created by increasing the velocityof the third rotor and decreasing the velocity of the first The motion is stoppedby decreasing the velocity of the third rotor and increasing the velocity of the firstrotor Due to the pitch movement the pitch angle _ had increased approximately822 degrees The acceleration of the quadcopter in the direction of the positive x-axisis caused by the pitch angleFinally the quadcopter is turned in the direction of the yaw angle by increasingthe velocities of the first and the third rotors and decreasing the velocities of thesecond and the fourth rotors The yaw motion is stopped by decreasing the velocitiesof the first and the third rotors and increasing the velocities of the second and thefourth rotors Consequently the yaw angle increases approximately 10 degreesDuring the whole simulation the total thrust of the rotors had remained close to theinitial total thrust Thus the deviations of the roll and pitch angles from the zerovalues decrease the value of the thrust in the direction of the z-axis Consequentlythe quadcopter accelerates in the direction of the negative z-axis and is descending0 02 04 06 08 1 12 14 16 18 2550575600625650675700Time t (s)Control input i (rads)1234

Figure 2 Control inputs i0 02 04 06 08 1 12 14 16 18 2

minus25minus2minus15minus1minus05005115Time t (s)Position (m)Position xPosition yPosition z

Figure 3 Positions x y and z90 02 04 06 08 1 12 14 16 18 2minus5051015202530Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 4 Angles _ _ and 104 Stabilisation of quadcopterTo stabilise the quadcopter a PID controller is utilised Advantages of the PIDcontroller are the simple structure and easy implementation of the controller Thegeneral form of the PID controller ise(t) = xd(t) minus x(t)u(t) = KP e(t) + KIZ t0e(_ ) d _ + KDd e(t)d t [16](22)in which u(t) is the control input e(t) is the difference between the desired statexd(t) and the present state x(t) and KP KI and KD are the parameters for theproportional integral and derivative elements of the PID controllerIn a quadcopter there are six states positions _ and angles _ but only four controlinputs the angular velocities of the four rotors i The interactions between thestates and the total thrust T and the torques _ created by the rotors are visible fromthe quadcopter dynamics defined by Equations (10) (11) and (12) The total thrustT affects the acceleration in the direction of the z-axis and holds the quadcopter inthe air Torque __ has an affect on the acceleration of angle _ torque __ affects theacceleration of angle _ and torque _ contributes in the acceleration of angle

Hence the PD controller for the quadcopter is chosen as similarly as in [4]T = (g + KzD (z˙d minus z˙) + KzP (zd minus z)) mC_C___ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Ixx__ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Iyy_ =_K D_ ˙d minus ˙ _+ K P ( d minus )_Izz(23)in which also the gravity g and mass m and moments of inertia I of the quadcopterare consideredThe correct angular velocities of rotors i can be calculated from Equations (7) and(8) with values from Equation (23)21 = T4kminus __2klminus_ 4b22 = T

4kminus__2kl+_ 4b23 = T4k+ __2klminus_ 4b24 = T4k+__2kl+_ 4b(24)The performance of the PD controller is tested by simulating the stabilisation ofa quadcopter The PD controller parameters are presented in Table 2 The initialcondition of the quadcopter is for position _ = [0 0 1]T in meters and for angles11_ = [10 10 10]T in degrees The desired position for altitude is zd = 0 The purposeof the stabilisation is stable hovering thus _d = [0 0 0]TTable 2 Parameters of the PD controllerParameter ValueKzD 25K_D 175K_D 175K D 175Parameter ValueKzP 15K_P 6K_P 6K P 6The control inputs i the positions _ and the angles _ during the simulation are

presented in Figures 5 6 and 7 The altitude and the angles are stabilised to zerovalue after 5 seconds However the positions x and y deviated from the zero valuesbecause of the non-zero values of the angles Before the quadcopter is stabilisedto hover it has already moved over 1 meters in the direction of the positive x axisand 05 meters in the direction of the negative y axis This is because the controlmethod of the PD contoller does not consider the accelerations in the directions ofx and y Thus another control method should be constructed to give a control onall of positions and angles of the quadcopter0 1 2 3 4 5 6550560570580590600610620630

Time t (s)Control input i (rads)1234

Figure 5 Control inputs i0 1 2 3 4 5 6minus06minus04minus02002040608112

Time t (s)Position (m)Position xPosition yPosition z

Figure 6 Positions x y and z120 1 2 3 4 5 6minus20246810

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 7 Angles _ _ and 135 Trajectory controlThe purpose of trajectory control is to move the quadcopter from the original locationto the desired location by controlling the rotor velocities of the quadcopterFinding optimal trajectory for a quadcopter is a difficult task because of complexdynamics However a simple control method is able to control the quadcopteradequately Thus a heuristic approach is studied and developed hereThe basis of the development of a control method is the study of the interactions and

dependances between states state derivatives and control inputs These interactionsand dependances are defined by Equations (7) (8) (20) and (21) and presented inFigure 8The given control inputs i define the total thrust T and the torques __ __ and _ The torques affect the angular accelerations depending on the current angles andangular velocities The angles _ can be integrated from the angular velocities _˙ which are integrated from the angular accelerations uml_ The linear accelerations uml_depend on the total thrust T the angles _ and the linear velocities _˙ The linearposition _ is integrated from the linear accelerations uml_ through the linear velocities_˙Hence to find proper control inputs i for given states _ this line of thought has tobe done in reverse___HHHjT_-- _uml - _˙ - _I K_uml - _˙ - _IFigure 8 Interactions between states state derivatives and control inputsOne method is to generate linear accelerations which accomplish the wanted trajectoryaccording to positions x y and z for each time t From Equation (21) threeequations are receivedTB =00T = RT

muml_ +00g +Ax 0 00 Ay 00 0 Az _˙ (25)in which _uml _˙ and are desired trajectory values as well as angles _ and _ and totalthrust T are unknown values to be solvedFrom this equation the required angles _ and _ and the total thrust T for each timet can be calculated as shown in [5]14_ = arcsin dx S minus dy C d2x + d2y + (dz + g)2_ = arctan_dx C + dy S dz + g_T = m(dx (S_C C_ + S S_) + dy (S_S C_ minus C S_)+( dz + g )C_C_) (26)in whichdx = xuml + Axx˙mdy = yuml+ Ayy˙mdz = zuml+ Azz˙m(27)

When the values of the angles _ and _ are known the angular velocities and accelerationscan be calculated from them with simple derivation With the angularvelocities and accelerations the torques _ can be solved from Equation (20) Whenthe torques and thrust are known the control inputs i can be calculated fromEquation (24)51 Heuristic method for trajectory generationThe generation of proper accelerations uml_ is difficult because the composition of thethird and fourth derivatives of the position jerk and jounce has to be reasonableThe influence of the jounce values is visible in the composition of the control inputsi High jounce values will mean high control input values and thus the jounceshave to be considered closely when generating the accelerationsA heuristic method can be used to generate jounce values The method utilises asymmetric structure in jouce function f(t) to control the derivatives One influencialpart of the function is defined by three sine functions as followingf(t) =a sin10485761b _ t_ 0 le t le bminusa sin10485761b _ t minus __ b le t le 3ba sin10485761b _ t minus 3__ 3b le t le 4b(28)The structure of the function is visualised in Figure 9 The sine functions are usedto give a smooth function These three sine functions form a function in whichthe first half increases acceleration to certain value and then the second half of the

function decreases it back to zero This acceleration generates constant velocityMirror image of the function can be used to decelerate the velocity back to zeroThe final position depends on the parameters a and b of the sine functions presented15in Equation (28) and the time c between the accelerating part and the deceleratingpart the mirror image of the jounceaaab2bba sin10485761b _ t_minusa sin1048576 12b _ t minus __a sin10485761b _ t minus 3__Jounce (ms4)Time t (s)Figure 9 Heuristic method for the generation of jounce functionsUnfortunately the method does not give optimal trajectories Thus a dynamicoptimisation model and a suitable algorithm would be needed to calculate optimallythe trajectory of the quadcopter However the method presented is easy to use togenerate proper values of jounce which will achieve the wanted trajectoryThe functionality of the method is studied with an example simulation Jounce ofposition x is created according to Equation (28) with parameters a = 1 b = 05and c = 2 The position x and its derivatives derived from the planned jounce arepresented in Figure 10 The jounce could also be generated simultaneously for y andz However in this example only position x is considered because the relationship

between the jounce of position x and the control inputs 1 and 3 controlling theangle _ is more visible160 1 2 3 4 5 6 7minus1minus08minus06minus04minus020020406081Time t (s)Jounce (ms4)

(a) Jounce0 1 2 3 4 5 6 7minus04minus03minus02minus01001020304

Time t (s)Jerk (ms3)

(b) Jerk0 1 2 3 4 5 6 7minus02minus015minus01minus00500050101502Time t (s)Acceleration (ms2)

(c) Acceleration0 1 2 3 4 5 6 7minus002000200400600801012014016018

Time t (s)Velocity (ms)

(d) Velocity0 1 2 3 4 5 6 7001020304050607

Time t (s)Position (m)

(e) PositionFigure 10 Planned position x and its derivatives with given jounceThe simulation of the example case is performed with previously given accelerationsand velocities of position x The planned value of angle is zero for each time tFirst the required angles _ and _ and thrust T are solved from Equation (26) foreach time t The angular velocities and accelerations are calculated from the solvedangles with derivation Then the torques are solved using the angular velocitiesand accelerations Finally the control inputs are solved Then the simulation isperformed with given control inputsThe calculated control inputs are presented in Figure 11 The simulated positions_ are presented in Figure 12 and the simulated angles _ in Figure 13 Accordingto Figure 12 the simulated position x is the same as the planned position x inFigure 10(e) and the values of the positions y and z stay as zeroes The angle _increases during the acceleration and then stabilises to a constant value to generate

the constant acceleration required to compensate the drag force caused by theplanned constant velocity Finally the angle is changed to the opposite direction todecelerate the quadcopter to a haltThe shape of the calculated control inputs 1 and 3 in Figure 11 are similar toplanned jounce in Figure 10(a) The shape of the simulated angle _ follows theshape of the planned acceleration umlx The shapes of the control inputs and theangles differ from the planned values of the jounce and the acceleration because thedrag force caused by the velocity has to be compensated170 1 2 3 4 5 6 76203620462056206620762086209621

Time t (s)Control input i (rads)1234

Figure 11 Control inputs i0 1 2 3 4 5 6001020304050607

Time t (s)Position (m)Position xPosition yPosition z

Figure 12 Positions x y and z0 1 2 3 4 5 6 7minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 13 Angles _ _ and The method can also be used even if there are unmodeled linear forces wind forexample which affect the linear accelerations and consequently the position of thequadcopter If the trajectory is calculated in shorter distances it is possible tocorrect the trajectory with new calculation from the current but inaccurate locationto the next checkpoint Example of this method is presented in Figure 14 Thearrows with dash lines indicate the planned trajectory in the x y-plane and thesolid arrows indicate the realised trajectory The black squares mark the start and

the finish positions and the white squares mark the checkpoints for the trajectory18The control inputs are calculated from the current location of the quadcopter to thenext checkpoint but because of random and unmodelled forces the realised positionmarked with X differs from the planned If the quadcopter is close enough to thetarget checkpoint the target checkpoint is changed to the next one and new controlinputs are calculated After repeating this and going through all of the checkpointsthe quadcopter reaches the final destinationFigure 14 Example of checkpoint flight pattern with external disturbancesThe biggest weakness in the proposed method is that it works as shown only if thequadcopter starts from a stable attitude the angles _ and _ and their derivativesare zeros and there are no external forces influencing the attitude during the flightSmall deviations in the angles can result into a huge deviation in the trajectory Oneway to solve this problem is to stabilise the quadcopter at each checkpoint with aPD controller proposed earlier or by using the heuristic method to angles Howeverif the angular disturbances are continuous the benefit from temporary stabilisationis only momentary52 Integrated PD controllerAnother method to take into account the possible deviations in the angles is tointegrate a PD controller into the heuristic method This is a simplified version ofthe proposed control method in [5] The required values dx dy and dz in Equation(26) are given by the PD controller considering the deviations between the currentand desired values (subscript d) of the positions _ velocities _˙ and accelerations _umldx = KxP (xd minus x) + KxD (x˙ d minus x˙ ) + KxDD (xumld minus xuml) dy = KyP (yd minus y) + KyD (y˙d minus y˙) + KyDD (yumld minus yuml) dz = KzP (zd minus z) + KzD (z˙d minus z˙) + KzDD (zumld minus zuml) (29)Then the commanded angles _c and _c and thrust T are given by Equation (26)The torques _ are controlled by the PD controller in Equation (30) same as in

19Equation (23) The control inputs can be solved with the calculated thrust andtorques by using Equation (24)__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Ixx__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Iyy_ =_K P ( d minus ) + K D_˙ d minus ˙ __Izz(30)The performance of the PD controller is demonstrated with an example case inwhich for all positions x y and z and their derivatives the values are same as inFigure 10 The simulation is performed with the PD parameters presented in Table3Table 3 Parameters of the PD controllerVariable Parameter valuei KiP KiD KiDDx 185 075 100y 855 075 100z 185 075 100_ 300 075 -_ 300 075 - 300 075 -The results of the simulation are presented Figures 15 - 17 The simulated controlinputs are presented in Figure 15 the simulated positions in Figure 16 and the

simulated angles in Figure 17 The position of the quadcopter is close to the plannedposition after 6 seconds but the position keeps fluctuating close to the planned valuesfor several seconds The angles variate greatly during the simulation to achieve thewanted positions velocities and accelerations The values of the control inputsoscillated during the acceleration but then their behaviour became more stable0 2 4 6 8 10 12 14618619620621622623624625626

Time t (s)Control input i (rads)1234

Figure 15 Control inputs i200 2 4 6 8 10 12 14minus0100102030405060708

Time t (s)Position (m)Position xPosition yPosition z

Figure 16 Positions x y and z0 2 4 6 8 10 12 14minus15minus125minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 17 Angles _ _ and The proposed integrated PD controller performed well in the example case Howeverthe performance of the controller is highly depended on the parameter values If theparameter values are small the controller will not respond quickly enough to followthe planned trajectory If the parameter values are substantial the quadcopter cannot perform the required drastic changes in the angular velocities of the rotor andthe control inputs calculated from Equation (24) can be infeasible with certaintorques Thus the use of equations considering the torques and the control inputsrequires a method to calculate the best feasible torques and from them the bestcontrol inputs Another possible method would be to variate the PD parameters

according to the current positions and angles and their derivatives but it is extremelydifficult216 ConclusionThis paper studied mathematical modelling and control of a quadcopter The mathematicalmodel of quadcopter dynamics was presented and the differential equationswere derived from the Newton-Euler and the Euler-Lagrange equations The modelwas verified by simulating the flight of a quadcopter with Matlab Stabilisation ofattitude of the quadcopter was done by utilising a PD controller A heuristic methodwas developed to control the trajectory of the quadcopter The PD contoller wasintegrated into the heuristic method for better response to disturbances in the flightconditions of the quadcopterThe simulation proved the presented mathematical model to be realistic in modellingthe position and attitude of the quadcopter The simulation results also showedthat the PD controller was efficient in stabilising the quadcopter to the desiredaltitude and attitude However the PD controller did not considered positions xand y Thus the values of x and y variated from their original values during thestabilisation process This was a result of the deviation of the roll and pitch anglesfrom zero valuesAccording to the simulation results the proposed heuristic method produced goodflight trajectories The heuristic method required only three parameters to generatethe values for the jounce of the position The position and its other derivatives werecalculated from the jounce values The total thrust and the pitch and roll angles toachieve given accelerations were solved from the linear differential equations Thenthe torques were determined by the angular accelerations and angular velocitiescalculated from the angles Finally the required control inputs were solved from thetotal thrust and the torques The simulation results indicated that the quadcopter

could be controlled accurately with the control inputs given by the methodThe proposed heuristic method does not consider unmodelled disturbances suchas wind and thus the PD controller was integrated into the control method Theintegrated PD controller operated well in the example simulation The quadcopterfollowed the given trajectory and began to stabilise after reaching the final destinationHowever the PD controller can perform poorly if the parameter values arenot properly selected and are too small or highThe presented mathematical model only consists of the basic structures of the quadcopterdynamics Several aerodynamical effects were excluded which can lead tounrealiable behaviour Also the electric motors spinning the fours rotors were notmodelled The behaviour of a motor is easily included in the model but would requireestimation of the parameter values of the motor The position and attitudeinformation was assumed to be accurate in the model and the simulations Howeverthe measuring devices in real life are not perfectly accurate as random variationsand errors occur Hence the effects of imprecise information to the flight of thequadcopter should be studied as well Also methods to enhance the accuracy of themeasurements should be researched and implemented to improve all aspects required22for robust quadcopter manoeuvresThe presented model and control methods were tested only with simulations Realexperimental prototype of a quadcopter should be constructed to achieve more realisticand reliable results Even though the construction of a real quadcopter and theestimation of all the model parameters are laborious tasks a real quadcopter wouldbring significant benefits to the research With a real propotype the theoreticalframework and the simulation results could be compared to real-life measurementsThis paper did not include these higlighted matters in the study but presentedthe basics of quadcopter modelling and control This paper can thus be used as a

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

_ as shown in[14]_˙ =Wminus1_ __ =W_ _˙ ˙__˙˙ =1 S_T_ C_T_0 C_ minusS_0 S_C_ C_C_pqr pqr =1 0 minusS_0 C_ C_S_0 minusS_ C_C_˙__˙˙ (4)in which Tx = tan(x) The matrix W_ is invertible if _ 6= (2k minus 1)_2 (k isin Z)

The quadcopter is assumed to have symmetric structure with the four arms alignedwith the body x- and y-axes Thus the inertia matrix is diagonal matrix I in whichIxx = IyyI =Ixx 0 00 Iyy 00 0 Izz (5)The angular velocity of rotor i denoted with i creates force fi in the direction ofthe rotor axis The angular velocity and acceleration of the rotor also create torque_Mi around the rotor axisfi = k 2i _Mi = b 2i + IM ˙ i (6)in which the lift constant is k the drag constant is b and the inertia moment of therotor is IM Usually the effect of ˙ i is considered small and thus it is omittedThe combined forces of rotors create thrust T in the direction of the body z-axisTorque _B consists of the torques __ __ and _ in the direction of the correspondingbody frame anglesT =X4i=1fi = kX4i=12i TB =00T (7)_B =____

_ =l k (minus22 + 24)l k (minus21 + 23)X4i=1_Mi

(8)in which l is the distance between the rotor and the center of mass of the quadcopterThus the roll movement is acquired by decreasing the 2nd rotor velocityand increasing the 4th rotor velocity Similarly the pitch movement is acquired bydecreasing the 1st rotor velocity and increasing the 3th rotor velocity Yaw movementis acquired by increasing the the angular velocities of two opposite rotors anddecreasing the velocities of the other two421 Newton-Euler equationsThe quadcopter is assumed to be rigid body and thus Newton-Euler equations canbe used to describe its dynamics In the body frame the force required for theacceleration of mass m ˙VB and the centrifugal force _ times (mVB) are equal to thegravity RTG and the total thrust of the rotors TBm ˙VB + _ times (mVB) = RTG + TB (9)In the inertial frame the centrifugal force is nullified Thus only the gravitationalforce and the magnitude and direction of the thrust are contributing in the accelerationof the quadcoptermuml_ = G+ RTBumlxumlyumlz

= minusg001 + TmC S_C_ + S S_S S_C_ minus C S_C_C_ (10)In the body frame the angular acceleration of the inertia I_˙ the centripetal forces_ times (I_) and the gyroscopic forces 1048576 are equal to the external torque _I_˙ + _ times (I_) + 1048576 = _ _˙ = Iminus1minuspqr timesIxx pIyy qIzz r minus Irpqr times00

1 1048576 + _p˙q˙r˙ =(Iyy minus Izz) q rIxx(Izz minus Ixx) p rIyy(Ixx minus Iyy) p qIzz minus IrqIxxminuspIyy0 1048576 +__Ixx__Iyy_ Izz (11)in which 1048576 = 1minus2 +3 minus4 The angular accelerations in the inertial frame arethen attracted from the body frame accelerations with the transformation matrixWminus1_ and its time derivativeuml_ = ddt1048576Wminus1_ __= ddt1048576Wminus1

___ +Wminus1_ _˙=0 ˙_C_T_ + _˙S_C2_ minus˙_S_C_ + _˙C_C2_0 minus˙_S_ minus˙_C_0 ˙_ C_C_ + ˙ _S_T_C_ minus˙_S_C_ + _˙C_T_C_ _ +Wminus1

_ _˙ (12)522 Euler-Lagrange equationsThe Lagrangian L is the sum of the translational Etrans and rotational Erot energiesminus potential energy EpotL (q q˙) = Etrans + Erot minus Epot= (m2) _˙T _˙ + (12) _T I _ minus mgz(13)As shown in [10] the Euler-Lagrange equations with external forces and torques are_f__=ddt_Lq˙_minusLq (14)The linear and angular components do not depend on each other thus they can bestudied separately The linear external force is the total thrust of the rotors Thelinear Euler-Lagrange equations aref = RTB = muml_ + mg0

01 (15)which is equivalent with Equation (10)The Jacobian matrix J (_) from _ to _˙ isJ (_) = J =WT_ IW_=Ixx 0 minusIxxS_0 IyyC2_ + IzzS2_ (Iyy minus Izz)C_S_C_minusIxxS_ (Iyy minus Izz)C_S_C_ IxxS2_ + IyyS2_C2_ + IzzC2_C2_(16)Thus the rotational energy Erot can be expressed in the inertial frame asErot = (12) _T I _ = (12) uml_T J uml_ (17)The external angular force is the torques of the rotors The angular Euler-Lagrangeequations are_ = _B = J uml_ +ddt(J) _˙ minus12_1048576_˙T J _˙_= J _uml + C (_ _˙ ) _˙ (18)in which the matrix C (_ _˙ ) is the Coriolis term containing the gyroscopic andcentripetal terms6The matrix C (_ _˙ ) has the form as shown in [9]C (_ _˙ ) =

C11 C12 C13C21 C22 C23C31 C32 C33 C11 = 0C12 = (Iyy minus Izz)(˙_ C_S_ + ˙ S2_C_) + (Izz minus Iyy) ˙ C2_C_ minus Ixx ˙ C_C13 = (Izz minus Iyy) ˙ C_S_C2_C21 = (Izz minus Iyy)(˙_ C_S_ + ˙ S_C_) + (Iyy minus Izz) ˙ C2_C_ + Ixx ˙ C_C22 = (Izz minus Iyy)˙ _C_S_C23 = minusIxx ˙ S_C_ + Iyy ˙ S2_S_C_ + Izz ˙ C2_S_C_C31 = (Iyy minus Izz) ˙ C2_S_C_ minus Ixx _˙C_C32 = (Izz minus Iyy)(˙_ C_S_S_ + ˙_S2_C_) + (Iyy minus Izz)˙ _C2_C_+Ixx ˙ S_C_ minus Iyy ˙ S2_S_C_ minus Izz ˙ C2_S_C_C33 = (Iyy minus Izz)˙ _C_S_C2_ minus Iyy _˙S2_C_S_ minus Izz ˙_C2_C_S_ + Ixx ˙_C_S_(19)Equation (18) leads to the differential equations for the angular accelerations whichare equivalent with Equations (11) and (12)uml_ = Jminus1 (_B minus C (_ _˙ ) _˙ ) (20)23 Aerodynamical effectsThe preceding model is a simplification of complex dynamic interactions To enforcemore realistical behaviour of the quadcopter drag force generated by the airresistance is included This is devised to Equations (10) and (15) with the diagonalcoefficient matrix associating the linear velocities to the force slowing the movementas in [15]umlxumly

umlz = minusg001 +TmC S_C_ + S S_S S_C_ minus C S_C_C_minus1mAx 0 00 Ay 00 0 Azx˙y˙z˙ (21)in which Ax Ay and Az are the drag force coefficients for velocities in the correspondingdirections of the inertial frameSeveral other aerodynamical effects could be included in the model For exampledependence of thrust on angle of attack blade flapping and airflow distruptions havebeen studied in [1] and [2] The influence of aerodynamical effects are complicatedand the effects are difficult to model Also some of the effects have significant effectonly in high velocities Thus these effects are excluded from the model and thepresented simple model is used

73 SimulationThe mathematical model of the quadcopter is implemented for simulation in Matlab2010 with Matlab programming language Parameter values from [3] are used in thesimulations and are presented in Table 1 The values of the drag force coefficientsAx Ay and Az are selected such as the quadcopter will slow down and stop whenangles _ and _ are stabilised to zero valuesTable 1 Parameter values for simulationParameter Value Unitg 981 ms2m 0468 kgl 0225 mk 2980 10minus6b 1140 10minus7IM 3357 10minus5 kg m2Parameter Value UnitIxx 4856 10minus3 kg m2Iyy 4856 10minus3 kg m2Izz 8801 10minus3 kg m2Ax 025 kgsAy 025 kgsAz 025 kgsThe mathematical model is tested by simulating a quadcopter with an example caseas following The quadcopter is initially in a stable state in which the values of allpositions and angles are zero the body frame of the quadcopter is congruent withthe inertial frame The total thrust is equal to the hover thrust the thrust equal togravity The simulation progresses at 00001 second intervals to total elapsed timeof two seconds The control inputs the angular velocities of the four rotors areshown in Figure 2 the inertial positions x y and z in Figure 3 and the angles _ _and in Figure 4For the first 025 seconds the quadcopter ascended by increasing all of the rotorvelocities from the hover thrust Then the ascend is stopped by decreasing the rotorvelocities significantly for the following 025 seconds Consequently the quadcopterascended 01 meters in the first 05 seconds After the ascend the quadcopter is

stable againNext the quadcopter is put into a roll motion by increasing the velocity of thefourth rotor and decreasing the velocity of the second rotor for 025 seconds Theacceleration of the roll motion is stopped by decreasing the velocity of the fourthand increasing the velocity of the second rotor for 025 seconds Thus after 05seconds in roll motion the roll angle _ had increased approx 25 degrees Becauseof the roll angle the quadcopter accelerated in the direction of the negative y-axisThen similar to the roll motion a pitch motion is created by increasing the velocityof the third rotor and decreasing the velocity of the first The motion is stoppedby decreasing the velocity of the third rotor and increasing the velocity of the firstrotor Due to the pitch movement the pitch angle _ had increased approximately822 degrees The acceleration of the quadcopter in the direction of the positive x-axisis caused by the pitch angleFinally the quadcopter is turned in the direction of the yaw angle by increasingthe velocities of the first and the third rotors and decreasing the velocities of thesecond and the fourth rotors The yaw motion is stopped by decreasing the velocitiesof the first and the third rotors and increasing the velocities of the second and thefourth rotors Consequently the yaw angle increases approximately 10 degreesDuring the whole simulation the total thrust of the rotors had remained close to theinitial total thrust Thus the deviations of the roll and pitch angles from the zerovalues decrease the value of the thrust in the direction of the z-axis Consequentlythe quadcopter accelerates in the direction of the negative z-axis and is descending0 02 04 06 08 1 12 14 16 18 2550575600625650675700Time t (s)Control input i (rads)1234

Figure 2 Control inputs i0 02 04 06 08 1 12 14 16 18 2

minus25minus2minus15minus1minus05005115Time t (s)Position (m)Position xPosition yPosition z

Figure 3 Positions x y and z90 02 04 06 08 1 12 14 16 18 2minus5051015202530Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 4 Angles _ _ and 104 Stabilisation of quadcopterTo stabilise the quadcopter a PID controller is utilised Advantages of the PIDcontroller are the simple structure and easy implementation of the controller Thegeneral form of the PID controller ise(t) = xd(t) minus x(t)u(t) = KP e(t) + KIZ t0e(_ ) d _ + KDd e(t)d t [16](22)in which u(t) is the control input e(t) is the difference between the desired statexd(t) and the present state x(t) and KP KI and KD are the parameters for theproportional integral and derivative elements of the PID controllerIn a quadcopter there are six states positions _ and angles _ but only four controlinputs the angular velocities of the four rotors i The interactions between thestates and the total thrust T and the torques _ created by the rotors are visible fromthe quadcopter dynamics defined by Equations (10) (11) and (12) The total thrustT affects the acceleration in the direction of the z-axis and holds the quadcopter inthe air Torque __ has an affect on the acceleration of angle _ torque __ affects theacceleration of angle _ and torque _ contributes in the acceleration of angle

Hence the PD controller for the quadcopter is chosen as similarly as in [4]T = (g + KzD (z˙d minus z˙) + KzP (zd minus z)) mC_C___ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Ixx__ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Iyy_ =_K D_ ˙d minus ˙ _+ K P ( d minus )_Izz(23)in which also the gravity g and mass m and moments of inertia I of the quadcopterare consideredThe correct angular velocities of rotors i can be calculated from Equations (7) and(8) with values from Equation (23)21 = T4kminus __2klminus_ 4b22 = T

4kminus__2kl+_ 4b23 = T4k+ __2klminus_ 4b24 = T4k+__2kl+_ 4b(24)The performance of the PD controller is tested by simulating the stabilisation ofa quadcopter The PD controller parameters are presented in Table 2 The initialcondition of the quadcopter is for position _ = [0 0 1]T in meters and for angles11_ = [10 10 10]T in degrees The desired position for altitude is zd = 0 The purposeof the stabilisation is stable hovering thus _d = [0 0 0]TTable 2 Parameters of the PD controllerParameter ValueKzD 25K_D 175K_D 175K D 175Parameter ValueKzP 15K_P 6K_P 6K P 6The control inputs i the positions _ and the angles _ during the simulation are

presented in Figures 5 6 and 7 The altitude and the angles are stabilised to zerovalue after 5 seconds However the positions x and y deviated from the zero valuesbecause of the non-zero values of the angles Before the quadcopter is stabilisedto hover it has already moved over 1 meters in the direction of the positive x axisand 05 meters in the direction of the negative y axis This is because the controlmethod of the PD contoller does not consider the accelerations in the directions ofx and y Thus another control method should be constructed to give a control onall of positions and angles of the quadcopter0 1 2 3 4 5 6550560570580590600610620630

Time t (s)Control input i (rads)1234

Figure 5 Control inputs i0 1 2 3 4 5 6minus06minus04minus02002040608112

Time t (s)Position (m)Position xPosition yPosition z

Figure 6 Positions x y and z120 1 2 3 4 5 6minus20246810

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 7 Angles _ _ and 135 Trajectory controlThe purpose of trajectory control is to move the quadcopter from the original locationto the desired location by controlling the rotor velocities of the quadcopterFinding optimal trajectory for a quadcopter is a difficult task because of complexdynamics However a simple control method is able to control the quadcopteradequately Thus a heuristic approach is studied and developed hereThe basis of the development of a control method is the study of the interactions and

dependances between states state derivatives and control inputs These interactionsand dependances are defined by Equations (7) (8) (20) and (21) and presented inFigure 8The given control inputs i define the total thrust T and the torques __ __ and _ The torques affect the angular accelerations depending on the current angles andangular velocities The angles _ can be integrated from the angular velocities _˙ which are integrated from the angular accelerations uml_ The linear accelerations uml_depend on the total thrust T the angles _ and the linear velocities _˙ The linearposition _ is integrated from the linear accelerations uml_ through the linear velocities_˙Hence to find proper control inputs i for given states _ this line of thought has tobe done in reverse___HHHjT_-- _uml - _˙ - _I K_uml - _˙ - _IFigure 8 Interactions between states state derivatives and control inputsOne method is to generate linear accelerations which accomplish the wanted trajectoryaccording to positions x y and z for each time t From Equation (21) threeequations are receivedTB =00T = RT

muml_ +00g +Ax 0 00 Ay 00 0 Az _˙ (25)in which _uml _˙ and are desired trajectory values as well as angles _ and _ and totalthrust T are unknown values to be solvedFrom this equation the required angles _ and _ and the total thrust T for each timet can be calculated as shown in [5]14_ = arcsin dx S minus dy C d2x + d2y + (dz + g)2_ = arctan_dx C + dy S dz + g_T = m(dx (S_C C_ + S S_) + dy (S_S C_ minus C S_)+( dz + g )C_C_) (26)in whichdx = xuml + Axx˙mdy = yuml+ Ayy˙mdz = zuml+ Azz˙m(27)

When the values of the angles _ and _ are known the angular velocities and accelerationscan be calculated from them with simple derivation With the angularvelocities and accelerations the torques _ can be solved from Equation (20) Whenthe torques and thrust are known the control inputs i can be calculated fromEquation (24)51 Heuristic method for trajectory generationThe generation of proper accelerations uml_ is difficult because the composition of thethird and fourth derivatives of the position jerk and jounce has to be reasonableThe influence of the jounce values is visible in the composition of the control inputsi High jounce values will mean high control input values and thus the jounceshave to be considered closely when generating the accelerationsA heuristic method can be used to generate jounce values The method utilises asymmetric structure in jouce function f(t) to control the derivatives One influencialpart of the function is defined by three sine functions as followingf(t) =a sin10485761b _ t_ 0 le t le bminusa sin10485761b _ t minus __ b le t le 3ba sin10485761b _ t minus 3__ 3b le t le 4b(28)The structure of the function is visualised in Figure 9 The sine functions are usedto give a smooth function These three sine functions form a function in whichthe first half increases acceleration to certain value and then the second half of the

function decreases it back to zero This acceleration generates constant velocityMirror image of the function can be used to decelerate the velocity back to zeroThe final position depends on the parameters a and b of the sine functions presented15in Equation (28) and the time c between the accelerating part and the deceleratingpart the mirror image of the jounceaaab2bba sin10485761b _ t_minusa sin1048576 12b _ t minus __a sin10485761b _ t minus 3__Jounce (ms4)Time t (s)Figure 9 Heuristic method for the generation of jounce functionsUnfortunately the method does not give optimal trajectories Thus a dynamicoptimisation model and a suitable algorithm would be needed to calculate optimallythe trajectory of the quadcopter However the method presented is easy to use togenerate proper values of jounce which will achieve the wanted trajectoryThe functionality of the method is studied with an example simulation Jounce ofposition x is created according to Equation (28) with parameters a = 1 b = 05and c = 2 The position x and its derivatives derived from the planned jounce arepresented in Figure 10 The jounce could also be generated simultaneously for y andz However in this example only position x is considered because the relationship

between the jounce of position x and the control inputs 1 and 3 controlling theangle _ is more visible160 1 2 3 4 5 6 7minus1minus08minus06minus04minus020020406081Time t (s)Jounce (ms4)

(a) Jounce0 1 2 3 4 5 6 7minus04minus03minus02minus01001020304

Time t (s)Jerk (ms3)

(b) Jerk0 1 2 3 4 5 6 7minus02minus015minus01minus00500050101502Time t (s)Acceleration (ms2)

(c) Acceleration0 1 2 3 4 5 6 7minus002000200400600801012014016018

Time t (s)Velocity (ms)

(d) Velocity0 1 2 3 4 5 6 7001020304050607

Time t (s)Position (m)

(e) PositionFigure 10 Planned position x and its derivatives with given jounceThe simulation of the example case is performed with previously given accelerationsand velocities of position x The planned value of angle is zero for each time tFirst the required angles _ and _ and thrust T are solved from Equation (26) foreach time t The angular velocities and accelerations are calculated from the solvedangles with derivation Then the torques are solved using the angular velocitiesand accelerations Finally the control inputs are solved Then the simulation isperformed with given control inputsThe calculated control inputs are presented in Figure 11 The simulated positions_ are presented in Figure 12 and the simulated angles _ in Figure 13 Accordingto Figure 12 the simulated position x is the same as the planned position x inFigure 10(e) and the values of the positions y and z stay as zeroes The angle _increases during the acceleration and then stabilises to a constant value to generate

the constant acceleration required to compensate the drag force caused by theplanned constant velocity Finally the angle is changed to the opposite direction todecelerate the quadcopter to a haltThe shape of the calculated control inputs 1 and 3 in Figure 11 are similar toplanned jounce in Figure 10(a) The shape of the simulated angle _ follows theshape of the planned acceleration umlx The shapes of the control inputs and theangles differ from the planned values of the jounce and the acceleration because thedrag force caused by the velocity has to be compensated170 1 2 3 4 5 6 76203620462056206620762086209621

Time t (s)Control input i (rads)1234

Figure 11 Control inputs i0 1 2 3 4 5 6001020304050607

Time t (s)Position (m)Position xPosition yPosition z

Figure 12 Positions x y and z0 1 2 3 4 5 6 7minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 13 Angles _ _ and The method can also be used even if there are unmodeled linear forces wind forexample which affect the linear accelerations and consequently the position of thequadcopter If the trajectory is calculated in shorter distances it is possible tocorrect the trajectory with new calculation from the current but inaccurate locationto the next checkpoint Example of this method is presented in Figure 14 Thearrows with dash lines indicate the planned trajectory in the x y-plane and thesolid arrows indicate the realised trajectory The black squares mark the start and

the finish positions and the white squares mark the checkpoints for the trajectory18The control inputs are calculated from the current location of the quadcopter to thenext checkpoint but because of random and unmodelled forces the realised positionmarked with X differs from the planned If the quadcopter is close enough to thetarget checkpoint the target checkpoint is changed to the next one and new controlinputs are calculated After repeating this and going through all of the checkpointsthe quadcopter reaches the final destinationFigure 14 Example of checkpoint flight pattern with external disturbancesThe biggest weakness in the proposed method is that it works as shown only if thequadcopter starts from a stable attitude the angles _ and _ and their derivativesare zeros and there are no external forces influencing the attitude during the flightSmall deviations in the angles can result into a huge deviation in the trajectory Oneway to solve this problem is to stabilise the quadcopter at each checkpoint with aPD controller proposed earlier or by using the heuristic method to angles Howeverif the angular disturbances are continuous the benefit from temporary stabilisationis only momentary52 Integrated PD controllerAnother method to take into account the possible deviations in the angles is tointegrate a PD controller into the heuristic method This is a simplified version ofthe proposed control method in [5] The required values dx dy and dz in Equation(26) are given by the PD controller considering the deviations between the currentand desired values (subscript d) of the positions _ velocities _˙ and accelerations _umldx = KxP (xd minus x) + KxD (x˙ d minus x˙ ) + KxDD (xumld minus xuml) dy = KyP (yd minus y) + KyD (y˙d minus y˙) + KyDD (yumld minus yuml) dz = KzP (zd minus z) + KzD (z˙d minus z˙) + KzDD (zumld minus zuml) (29)Then the commanded angles _c and _c and thrust T are given by Equation (26)The torques _ are controlled by the PD controller in Equation (30) same as in

19Equation (23) The control inputs can be solved with the calculated thrust andtorques by using Equation (24)__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Ixx__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Iyy_ =_K P ( d minus ) + K D_˙ d minus ˙ __Izz(30)The performance of the PD controller is demonstrated with an example case inwhich for all positions x y and z and their derivatives the values are same as inFigure 10 The simulation is performed with the PD parameters presented in Table3Table 3 Parameters of the PD controllerVariable Parameter valuei KiP KiD KiDDx 185 075 100y 855 075 100z 185 075 100_ 300 075 -_ 300 075 - 300 075 -The results of the simulation are presented Figures 15 - 17 The simulated controlinputs are presented in Figure 15 the simulated positions in Figure 16 and the

simulated angles in Figure 17 The position of the quadcopter is close to the plannedposition after 6 seconds but the position keeps fluctuating close to the planned valuesfor several seconds The angles variate greatly during the simulation to achieve thewanted positions velocities and accelerations The values of the control inputsoscillated during the acceleration but then their behaviour became more stable0 2 4 6 8 10 12 14618619620621622623624625626

Time t (s)Control input i (rads)1234

Figure 15 Control inputs i200 2 4 6 8 10 12 14minus0100102030405060708

Time t (s)Position (m)Position xPosition yPosition z

Figure 16 Positions x y and z0 2 4 6 8 10 12 14minus15minus125minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 17 Angles _ _ and The proposed integrated PD controller performed well in the example case Howeverthe performance of the controller is highly depended on the parameter values If theparameter values are small the controller will not respond quickly enough to followthe planned trajectory If the parameter values are substantial the quadcopter cannot perform the required drastic changes in the angular velocities of the rotor andthe control inputs calculated from Equation (24) can be infeasible with certaintorques Thus the use of equations considering the torques and the control inputsrequires a method to calculate the best feasible torques and from them the bestcontrol inputs Another possible method would be to variate the PD parameters

according to the current positions and angles and their derivatives but it is extremelydifficult216 ConclusionThis paper studied mathematical modelling and control of a quadcopter The mathematicalmodel of quadcopter dynamics was presented and the differential equationswere derived from the Newton-Euler and the Euler-Lagrange equations The modelwas verified by simulating the flight of a quadcopter with Matlab Stabilisation ofattitude of the quadcopter was done by utilising a PD controller A heuristic methodwas developed to control the trajectory of the quadcopter The PD contoller wasintegrated into the heuristic method for better response to disturbances in the flightconditions of the quadcopterThe simulation proved the presented mathematical model to be realistic in modellingthe position and attitude of the quadcopter The simulation results also showedthat the PD controller was efficient in stabilising the quadcopter to the desiredaltitude and attitude However the PD controller did not considered positions xand y Thus the values of x and y variated from their original values during thestabilisation process This was a result of the deviation of the roll and pitch anglesfrom zero valuesAccording to the simulation results the proposed heuristic method produced goodflight trajectories The heuristic method required only three parameters to generatethe values for the jounce of the position The position and its other derivatives werecalculated from the jounce values The total thrust and the pitch and roll angles toachieve given accelerations were solved from the linear differential equations Thenthe torques were determined by the angular accelerations and angular velocitiescalculated from the angles Finally the required control inputs were solved from thetotal thrust and the torques The simulation results indicated that the quadcopter

could be controlled accurately with the control inputs given by the methodThe proposed heuristic method does not consider unmodelled disturbances suchas wind and thus the PD controller was integrated into the control method Theintegrated PD controller operated well in the example simulation The quadcopterfollowed the given trajectory and began to stabilise after reaching the final destinationHowever the PD controller can perform poorly if the parameter values arenot properly selected and are too small or highThe presented mathematical model only consists of the basic structures of the quadcopterdynamics Several aerodynamical effects were excluded which can lead tounrealiable behaviour Also the electric motors spinning the fours rotors were notmodelled The behaviour of a motor is easily included in the model but would requireestimation of the parameter values of the motor The position and attitudeinformation was assumed to be accurate in the model and the simulations Howeverthe measuring devices in real life are not perfectly accurate as random variationsand errors occur Hence the effects of imprecise information to the flight of thequadcopter should be studied as well Also methods to enhance the accuracy of themeasurements should be researched and implemented to improve all aspects required22for robust quadcopter manoeuvresThe presented model and control methods were tested only with simulations Realexperimental prototype of a quadcopter should be constructed to achieve more realisticand reliable results Even though the construction of a real quadcopter and theestimation of all the model parameters are laborious tasks a real quadcopter wouldbring significant benefits to the research With a real propotype the theoreticalframework and the simulation results could be compared to real-life measurementsThis paper did not include these higlighted matters in the study but presentedthe basics of quadcopter modelling and control This paper can thus be used as a

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

The quadcopter is assumed to have symmetric structure with the four arms alignedwith the body x- and y-axes Thus the inertia matrix is diagonal matrix I in whichIxx = IyyI =Ixx 0 00 Iyy 00 0 Izz (5)The angular velocity of rotor i denoted with i creates force fi in the direction ofthe rotor axis The angular velocity and acceleration of the rotor also create torque_Mi around the rotor axisfi = k 2i _Mi = b 2i + IM ˙ i (6)in which the lift constant is k the drag constant is b and the inertia moment of therotor is IM Usually the effect of ˙ i is considered small and thus it is omittedThe combined forces of rotors create thrust T in the direction of the body z-axisTorque _B consists of the torques __ __ and _ in the direction of the correspondingbody frame anglesT =X4i=1fi = kX4i=12i TB =00T (7)_B =____

_ =l k (minus22 + 24)l k (minus21 + 23)X4i=1_Mi

(8)in which l is the distance between the rotor and the center of mass of the quadcopterThus the roll movement is acquired by decreasing the 2nd rotor velocityand increasing the 4th rotor velocity Similarly the pitch movement is acquired bydecreasing the 1st rotor velocity and increasing the 3th rotor velocity Yaw movementis acquired by increasing the the angular velocities of two opposite rotors anddecreasing the velocities of the other two421 Newton-Euler equationsThe quadcopter is assumed to be rigid body and thus Newton-Euler equations canbe used to describe its dynamics In the body frame the force required for theacceleration of mass m ˙VB and the centrifugal force _ times (mVB) are equal to thegravity RTG and the total thrust of the rotors TBm ˙VB + _ times (mVB) = RTG + TB (9)In the inertial frame the centrifugal force is nullified Thus only the gravitationalforce and the magnitude and direction of the thrust are contributing in the accelerationof the quadcoptermuml_ = G+ RTBumlxumlyumlz

= minusg001 + TmC S_C_ + S S_S S_C_ minus C S_C_C_ (10)In the body frame the angular acceleration of the inertia I_˙ the centripetal forces_ times (I_) and the gyroscopic forces 1048576 are equal to the external torque _I_˙ + _ times (I_) + 1048576 = _ _˙ = Iminus1minuspqr timesIxx pIyy qIzz r minus Irpqr times00

1 1048576 + _p˙q˙r˙ =(Iyy minus Izz) q rIxx(Izz minus Ixx) p rIyy(Ixx minus Iyy) p qIzz minus IrqIxxminuspIyy0 1048576 +__Ixx__Iyy_ Izz (11)in which 1048576 = 1minus2 +3 minus4 The angular accelerations in the inertial frame arethen attracted from the body frame accelerations with the transformation matrixWminus1_ and its time derivativeuml_ = ddt1048576Wminus1_ __= ddt1048576Wminus1

___ +Wminus1_ _˙=0 ˙_C_T_ + _˙S_C2_ minus˙_S_C_ + _˙C_C2_0 minus˙_S_ minus˙_C_0 ˙_ C_C_ + ˙ _S_T_C_ minus˙_S_C_ + _˙C_T_C_ _ +Wminus1

_ _˙ (12)522 Euler-Lagrange equationsThe Lagrangian L is the sum of the translational Etrans and rotational Erot energiesminus potential energy EpotL (q q˙) = Etrans + Erot minus Epot= (m2) _˙T _˙ + (12) _T I _ minus mgz(13)As shown in [10] the Euler-Lagrange equations with external forces and torques are_f__=ddt_Lq˙_minusLq (14)The linear and angular components do not depend on each other thus they can bestudied separately The linear external force is the total thrust of the rotors Thelinear Euler-Lagrange equations aref = RTB = muml_ + mg0

01 (15)which is equivalent with Equation (10)The Jacobian matrix J (_) from _ to _˙ isJ (_) = J =WT_ IW_=Ixx 0 minusIxxS_0 IyyC2_ + IzzS2_ (Iyy minus Izz)C_S_C_minusIxxS_ (Iyy minus Izz)C_S_C_ IxxS2_ + IyyS2_C2_ + IzzC2_C2_(16)Thus the rotational energy Erot can be expressed in the inertial frame asErot = (12) _T I _ = (12) uml_T J uml_ (17)The external angular force is the torques of the rotors The angular Euler-Lagrangeequations are_ = _B = J uml_ +ddt(J) _˙ minus12_1048576_˙T J _˙_= J _uml + C (_ _˙ ) _˙ (18)in which the matrix C (_ _˙ ) is the Coriolis term containing the gyroscopic andcentripetal terms6The matrix C (_ _˙ ) has the form as shown in [9]C (_ _˙ ) =

C11 C12 C13C21 C22 C23C31 C32 C33 C11 = 0C12 = (Iyy minus Izz)(˙_ C_S_ + ˙ S2_C_) + (Izz minus Iyy) ˙ C2_C_ minus Ixx ˙ C_C13 = (Izz minus Iyy) ˙ C_S_C2_C21 = (Izz minus Iyy)(˙_ C_S_ + ˙ S_C_) + (Iyy minus Izz) ˙ C2_C_ + Ixx ˙ C_C22 = (Izz minus Iyy)˙ _C_S_C23 = minusIxx ˙ S_C_ + Iyy ˙ S2_S_C_ + Izz ˙ C2_S_C_C31 = (Iyy minus Izz) ˙ C2_S_C_ minus Ixx _˙C_C32 = (Izz minus Iyy)(˙_ C_S_S_ + ˙_S2_C_) + (Iyy minus Izz)˙ _C2_C_+Ixx ˙ S_C_ minus Iyy ˙ S2_S_C_ minus Izz ˙ C2_S_C_C33 = (Iyy minus Izz)˙ _C_S_C2_ minus Iyy _˙S2_C_S_ minus Izz ˙_C2_C_S_ + Ixx ˙_C_S_(19)Equation (18) leads to the differential equations for the angular accelerations whichare equivalent with Equations (11) and (12)uml_ = Jminus1 (_B minus C (_ _˙ ) _˙ ) (20)23 Aerodynamical effectsThe preceding model is a simplification of complex dynamic interactions To enforcemore realistical behaviour of the quadcopter drag force generated by the airresistance is included This is devised to Equations (10) and (15) with the diagonalcoefficient matrix associating the linear velocities to the force slowing the movementas in [15]umlxumly

umlz = minusg001 +TmC S_C_ + S S_S S_C_ minus C S_C_C_minus1mAx 0 00 Ay 00 0 Azx˙y˙z˙ (21)in which Ax Ay and Az are the drag force coefficients for velocities in the correspondingdirections of the inertial frameSeveral other aerodynamical effects could be included in the model For exampledependence of thrust on angle of attack blade flapping and airflow distruptions havebeen studied in [1] and [2] The influence of aerodynamical effects are complicatedand the effects are difficult to model Also some of the effects have significant effectonly in high velocities Thus these effects are excluded from the model and thepresented simple model is used

73 SimulationThe mathematical model of the quadcopter is implemented for simulation in Matlab2010 with Matlab programming language Parameter values from [3] are used in thesimulations and are presented in Table 1 The values of the drag force coefficientsAx Ay and Az are selected such as the quadcopter will slow down and stop whenangles _ and _ are stabilised to zero valuesTable 1 Parameter values for simulationParameter Value Unitg 981 ms2m 0468 kgl 0225 mk 2980 10minus6b 1140 10minus7IM 3357 10minus5 kg m2Parameter Value UnitIxx 4856 10minus3 kg m2Iyy 4856 10minus3 kg m2Izz 8801 10minus3 kg m2Ax 025 kgsAy 025 kgsAz 025 kgsThe mathematical model is tested by simulating a quadcopter with an example caseas following The quadcopter is initially in a stable state in which the values of allpositions and angles are zero the body frame of the quadcopter is congruent withthe inertial frame The total thrust is equal to the hover thrust the thrust equal togravity The simulation progresses at 00001 second intervals to total elapsed timeof two seconds The control inputs the angular velocities of the four rotors areshown in Figure 2 the inertial positions x y and z in Figure 3 and the angles _ _and in Figure 4For the first 025 seconds the quadcopter ascended by increasing all of the rotorvelocities from the hover thrust Then the ascend is stopped by decreasing the rotorvelocities significantly for the following 025 seconds Consequently the quadcopterascended 01 meters in the first 05 seconds After the ascend the quadcopter is

stable againNext the quadcopter is put into a roll motion by increasing the velocity of thefourth rotor and decreasing the velocity of the second rotor for 025 seconds Theacceleration of the roll motion is stopped by decreasing the velocity of the fourthand increasing the velocity of the second rotor for 025 seconds Thus after 05seconds in roll motion the roll angle _ had increased approx 25 degrees Becauseof the roll angle the quadcopter accelerated in the direction of the negative y-axisThen similar to the roll motion a pitch motion is created by increasing the velocityof the third rotor and decreasing the velocity of the first The motion is stoppedby decreasing the velocity of the third rotor and increasing the velocity of the firstrotor Due to the pitch movement the pitch angle _ had increased approximately822 degrees The acceleration of the quadcopter in the direction of the positive x-axisis caused by the pitch angleFinally the quadcopter is turned in the direction of the yaw angle by increasingthe velocities of the first and the third rotors and decreasing the velocities of thesecond and the fourth rotors The yaw motion is stopped by decreasing the velocitiesof the first and the third rotors and increasing the velocities of the second and thefourth rotors Consequently the yaw angle increases approximately 10 degreesDuring the whole simulation the total thrust of the rotors had remained close to theinitial total thrust Thus the deviations of the roll and pitch angles from the zerovalues decrease the value of the thrust in the direction of the z-axis Consequentlythe quadcopter accelerates in the direction of the negative z-axis and is descending0 02 04 06 08 1 12 14 16 18 2550575600625650675700Time t (s)Control input i (rads)1234

Figure 2 Control inputs i0 02 04 06 08 1 12 14 16 18 2

minus25minus2minus15minus1minus05005115Time t (s)Position (m)Position xPosition yPosition z

Figure 3 Positions x y and z90 02 04 06 08 1 12 14 16 18 2minus5051015202530Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 4 Angles _ _ and 104 Stabilisation of quadcopterTo stabilise the quadcopter a PID controller is utilised Advantages of the PIDcontroller are the simple structure and easy implementation of the controller Thegeneral form of the PID controller ise(t) = xd(t) minus x(t)u(t) = KP e(t) + KIZ t0e(_ ) d _ + KDd e(t)d t [16](22)in which u(t) is the control input e(t) is the difference between the desired statexd(t) and the present state x(t) and KP KI and KD are the parameters for theproportional integral and derivative elements of the PID controllerIn a quadcopter there are six states positions _ and angles _ but only four controlinputs the angular velocities of the four rotors i The interactions between thestates and the total thrust T and the torques _ created by the rotors are visible fromthe quadcopter dynamics defined by Equations (10) (11) and (12) The total thrustT affects the acceleration in the direction of the z-axis and holds the quadcopter inthe air Torque __ has an affect on the acceleration of angle _ torque __ affects theacceleration of angle _ and torque _ contributes in the acceleration of angle

Hence the PD controller for the quadcopter is chosen as similarly as in [4]T = (g + KzD (z˙d minus z˙) + KzP (zd minus z)) mC_C___ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Ixx__ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Iyy_ =_K D_ ˙d minus ˙ _+ K P ( d minus )_Izz(23)in which also the gravity g and mass m and moments of inertia I of the quadcopterare consideredThe correct angular velocities of rotors i can be calculated from Equations (7) and(8) with values from Equation (23)21 = T4kminus __2klminus_ 4b22 = T

4kminus__2kl+_ 4b23 = T4k+ __2klminus_ 4b24 = T4k+__2kl+_ 4b(24)The performance of the PD controller is tested by simulating the stabilisation ofa quadcopter The PD controller parameters are presented in Table 2 The initialcondition of the quadcopter is for position _ = [0 0 1]T in meters and for angles11_ = [10 10 10]T in degrees The desired position for altitude is zd = 0 The purposeof the stabilisation is stable hovering thus _d = [0 0 0]TTable 2 Parameters of the PD controllerParameter ValueKzD 25K_D 175K_D 175K D 175Parameter ValueKzP 15K_P 6K_P 6K P 6The control inputs i the positions _ and the angles _ during the simulation are

presented in Figures 5 6 and 7 The altitude and the angles are stabilised to zerovalue after 5 seconds However the positions x and y deviated from the zero valuesbecause of the non-zero values of the angles Before the quadcopter is stabilisedto hover it has already moved over 1 meters in the direction of the positive x axisand 05 meters in the direction of the negative y axis This is because the controlmethod of the PD contoller does not consider the accelerations in the directions ofx and y Thus another control method should be constructed to give a control onall of positions and angles of the quadcopter0 1 2 3 4 5 6550560570580590600610620630

Time t (s)Control input i (rads)1234

Figure 5 Control inputs i0 1 2 3 4 5 6minus06minus04minus02002040608112

Time t (s)Position (m)Position xPosition yPosition z

Figure 6 Positions x y and z120 1 2 3 4 5 6minus20246810

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 7 Angles _ _ and 135 Trajectory controlThe purpose of trajectory control is to move the quadcopter from the original locationto the desired location by controlling the rotor velocities of the quadcopterFinding optimal trajectory for a quadcopter is a difficult task because of complexdynamics However a simple control method is able to control the quadcopteradequately Thus a heuristic approach is studied and developed hereThe basis of the development of a control method is the study of the interactions and

dependances between states state derivatives and control inputs These interactionsand dependances are defined by Equations (7) (8) (20) and (21) and presented inFigure 8The given control inputs i define the total thrust T and the torques __ __ and _ The torques affect the angular accelerations depending on the current angles andangular velocities The angles _ can be integrated from the angular velocities _˙ which are integrated from the angular accelerations uml_ The linear accelerations uml_depend on the total thrust T the angles _ and the linear velocities _˙ The linearposition _ is integrated from the linear accelerations uml_ through the linear velocities_˙Hence to find proper control inputs i for given states _ this line of thought has tobe done in reverse___HHHjT_-- _uml - _˙ - _I K_uml - _˙ - _IFigure 8 Interactions between states state derivatives and control inputsOne method is to generate linear accelerations which accomplish the wanted trajectoryaccording to positions x y and z for each time t From Equation (21) threeequations are receivedTB =00T = RT

muml_ +00g +Ax 0 00 Ay 00 0 Az _˙ (25)in which _uml _˙ and are desired trajectory values as well as angles _ and _ and totalthrust T are unknown values to be solvedFrom this equation the required angles _ and _ and the total thrust T for each timet can be calculated as shown in [5]14_ = arcsin dx S minus dy C d2x + d2y + (dz + g)2_ = arctan_dx C + dy S dz + g_T = m(dx (S_C C_ + S S_) + dy (S_S C_ minus C S_)+( dz + g )C_C_) (26)in whichdx = xuml + Axx˙mdy = yuml+ Ayy˙mdz = zuml+ Azz˙m(27)

When the values of the angles _ and _ are known the angular velocities and accelerationscan be calculated from them with simple derivation With the angularvelocities and accelerations the torques _ can be solved from Equation (20) Whenthe torques and thrust are known the control inputs i can be calculated fromEquation (24)51 Heuristic method for trajectory generationThe generation of proper accelerations uml_ is difficult because the composition of thethird and fourth derivatives of the position jerk and jounce has to be reasonableThe influence of the jounce values is visible in the composition of the control inputsi High jounce values will mean high control input values and thus the jounceshave to be considered closely when generating the accelerationsA heuristic method can be used to generate jounce values The method utilises asymmetric structure in jouce function f(t) to control the derivatives One influencialpart of the function is defined by three sine functions as followingf(t) =a sin10485761b _ t_ 0 le t le bminusa sin10485761b _ t minus __ b le t le 3ba sin10485761b _ t minus 3__ 3b le t le 4b(28)The structure of the function is visualised in Figure 9 The sine functions are usedto give a smooth function These three sine functions form a function in whichthe first half increases acceleration to certain value and then the second half of the

function decreases it back to zero This acceleration generates constant velocityMirror image of the function can be used to decelerate the velocity back to zeroThe final position depends on the parameters a and b of the sine functions presented15in Equation (28) and the time c between the accelerating part and the deceleratingpart the mirror image of the jounceaaab2bba sin10485761b _ t_minusa sin1048576 12b _ t minus __a sin10485761b _ t minus 3__Jounce (ms4)Time t (s)Figure 9 Heuristic method for the generation of jounce functionsUnfortunately the method does not give optimal trajectories Thus a dynamicoptimisation model and a suitable algorithm would be needed to calculate optimallythe trajectory of the quadcopter However the method presented is easy to use togenerate proper values of jounce which will achieve the wanted trajectoryThe functionality of the method is studied with an example simulation Jounce ofposition x is created according to Equation (28) with parameters a = 1 b = 05and c = 2 The position x and its derivatives derived from the planned jounce arepresented in Figure 10 The jounce could also be generated simultaneously for y andz However in this example only position x is considered because the relationship

between the jounce of position x and the control inputs 1 and 3 controlling theangle _ is more visible160 1 2 3 4 5 6 7minus1minus08minus06minus04minus020020406081Time t (s)Jounce (ms4)

(a) Jounce0 1 2 3 4 5 6 7minus04minus03minus02minus01001020304

Time t (s)Jerk (ms3)

(b) Jerk0 1 2 3 4 5 6 7minus02minus015minus01minus00500050101502Time t (s)Acceleration (ms2)

(c) Acceleration0 1 2 3 4 5 6 7minus002000200400600801012014016018

Time t (s)Velocity (ms)

(d) Velocity0 1 2 3 4 5 6 7001020304050607

Time t (s)Position (m)

(e) PositionFigure 10 Planned position x and its derivatives with given jounceThe simulation of the example case is performed with previously given accelerationsand velocities of position x The planned value of angle is zero for each time tFirst the required angles _ and _ and thrust T are solved from Equation (26) foreach time t The angular velocities and accelerations are calculated from the solvedangles with derivation Then the torques are solved using the angular velocitiesand accelerations Finally the control inputs are solved Then the simulation isperformed with given control inputsThe calculated control inputs are presented in Figure 11 The simulated positions_ are presented in Figure 12 and the simulated angles _ in Figure 13 Accordingto Figure 12 the simulated position x is the same as the planned position x inFigure 10(e) and the values of the positions y and z stay as zeroes The angle _increases during the acceleration and then stabilises to a constant value to generate

the constant acceleration required to compensate the drag force caused by theplanned constant velocity Finally the angle is changed to the opposite direction todecelerate the quadcopter to a haltThe shape of the calculated control inputs 1 and 3 in Figure 11 are similar toplanned jounce in Figure 10(a) The shape of the simulated angle _ follows theshape of the planned acceleration umlx The shapes of the control inputs and theangles differ from the planned values of the jounce and the acceleration because thedrag force caused by the velocity has to be compensated170 1 2 3 4 5 6 76203620462056206620762086209621

Time t (s)Control input i (rads)1234

Figure 11 Control inputs i0 1 2 3 4 5 6001020304050607

Time t (s)Position (m)Position xPosition yPosition z

Figure 12 Positions x y and z0 1 2 3 4 5 6 7minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 13 Angles _ _ and The method can also be used even if there are unmodeled linear forces wind forexample which affect the linear accelerations and consequently the position of thequadcopter If the trajectory is calculated in shorter distances it is possible tocorrect the trajectory with new calculation from the current but inaccurate locationto the next checkpoint Example of this method is presented in Figure 14 Thearrows with dash lines indicate the planned trajectory in the x y-plane and thesolid arrows indicate the realised trajectory The black squares mark the start and

the finish positions and the white squares mark the checkpoints for the trajectory18The control inputs are calculated from the current location of the quadcopter to thenext checkpoint but because of random and unmodelled forces the realised positionmarked with X differs from the planned If the quadcopter is close enough to thetarget checkpoint the target checkpoint is changed to the next one and new controlinputs are calculated After repeating this and going through all of the checkpointsthe quadcopter reaches the final destinationFigure 14 Example of checkpoint flight pattern with external disturbancesThe biggest weakness in the proposed method is that it works as shown only if thequadcopter starts from a stable attitude the angles _ and _ and their derivativesare zeros and there are no external forces influencing the attitude during the flightSmall deviations in the angles can result into a huge deviation in the trajectory Oneway to solve this problem is to stabilise the quadcopter at each checkpoint with aPD controller proposed earlier or by using the heuristic method to angles Howeverif the angular disturbances are continuous the benefit from temporary stabilisationis only momentary52 Integrated PD controllerAnother method to take into account the possible deviations in the angles is tointegrate a PD controller into the heuristic method This is a simplified version ofthe proposed control method in [5] The required values dx dy and dz in Equation(26) are given by the PD controller considering the deviations between the currentand desired values (subscript d) of the positions _ velocities _˙ and accelerations _umldx = KxP (xd minus x) + KxD (x˙ d minus x˙ ) + KxDD (xumld minus xuml) dy = KyP (yd minus y) + KyD (y˙d minus y˙) + KyDD (yumld minus yuml) dz = KzP (zd minus z) + KzD (z˙d minus z˙) + KzDD (zumld minus zuml) (29)Then the commanded angles _c and _c and thrust T are given by Equation (26)The torques _ are controlled by the PD controller in Equation (30) same as in

19Equation (23) The control inputs can be solved with the calculated thrust andtorques by using Equation (24)__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Ixx__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Iyy_ =_K P ( d minus ) + K D_˙ d minus ˙ __Izz(30)The performance of the PD controller is demonstrated with an example case inwhich for all positions x y and z and their derivatives the values are same as inFigure 10 The simulation is performed with the PD parameters presented in Table3Table 3 Parameters of the PD controllerVariable Parameter valuei KiP KiD KiDDx 185 075 100y 855 075 100z 185 075 100_ 300 075 -_ 300 075 - 300 075 -The results of the simulation are presented Figures 15 - 17 The simulated controlinputs are presented in Figure 15 the simulated positions in Figure 16 and the

simulated angles in Figure 17 The position of the quadcopter is close to the plannedposition after 6 seconds but the position keeps fluctuating close to the planned valuesfor several seconds The angles variate greatly during the simulation to achieve thewanted positions velocities and accelerations The values of the control inputsoscillated during the acceleration but then their behaviour became more stable0 2 4 6 8 10 12 14618619620621622623624625626

Time t (s)Control input i (rads)1234

Figure 15 Control inputs i200 2 4 6 8 10 12 14minus0100102030405060708

Time t (s)Position (m)Position xPosition yPosition z

Figure 16 Positions x y and z0 2 4 6 8 10 12 14minus15minus125minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 17 Angles _ _ and The proposed integrated PD controller performed well in the example case Howeverthe performance of the controller is highly depended on the parameter values If theparameter values are small the controller will not respond quickly enough to followthe planned trajectory If the parameter values are substantial the quadcopter cannot perform the required drastic changes in the angular velocities of the rotor andthe control inputs calculated from Equation (24) can be infeasible with certaintorques Thus the use of equations considering the torques and the control inputsrequires a method to calculate the best feasible torques and from them the bestcontrol inputs Another possible method would be to variate the PD parameters

according to the current positions and angles and their derivatives but it is extremelydifficult216 ConclusionThis paper studied mathematical modelling and control of a quadcopter The mathematicalmodel of quadcopter dynamics was presented and the differential equationswere derived from the Newton-Euler and the Euler-Lagrange equations The modelwas verified by simulating the flight of a quadcopter with Matlab Stabilisation ofattitude of the quadcopter was done by utilising a PD controller A heuristic methodwas developed to control the trajectory of the quadcopter The PD contoller wasintegrated into the heuristic method for better response to disturbances in the flightconditions of the quadcopterThe simulation proved the presented mathematical model to be realistic in modellingthe position and attitude of the quadcopter The simulation results also showedthat the PD controller was efficient in stabilising the quadcopter to the desiredaltitude and attitude However the PD controller did not considered positions xand y Thus the values of x and y variated from their original values during thestabilisation process This was a result of the deviation of the roll and pitch anglesfrom zero valuesAccording to the simulation results the proposed heuristic method produced goodflight trajectories The heuristic method required only three parameters to generatethe values for the jounce of the position The position and its other derivatives werecalculated from the jounce values The total thrust and the pitch and roll angles toachieve given accelerations were solved from the linear differential equations Thenthe torques were determined by the angular accelerations and angular velocitiescalculated from the angles Finally the required control inputs were solved from thetotal thrust and the torques The simulation results indicated that the quadcopter

could be controlled accurately with the control inputs given by the methodThe proposed heuristic method does not consider unmodelled disturbances suchas wind and thus the PD controller was integrated into the control method Theintegrated PD controller operated well in the example simulation The quadcopterfollowed the given trajectory and began to stabilise after reaching the final destinationHowever the PD controller can perform poorly if the parameter values arenot properly selected and are too small or highThe presented mathematical model only consists of the basic structures of the quadcopterdynamics Several aerodynamical effects were excluded which can lead tounrealiable behaviour Also the electric motors spinning the fours rotors were notmodelled The behaviour of a motor is easily included in the model but would requireestimation of the parameter values of the motor The position and attitudeinformation was assumed to be accurate in the model and the simulations Howeverthe measuring devices in real life are not perfectly accurate as random variationsand errors occur Hence the effects of imprecise information to the flight of thequadcopter should be studied as well Also methods to enhance the accuracy of themeasurements should be researched and implemented to improve all aspects required22for robust quadcopter manoeuvresThe presented model and control methods were tested only with simulations Realexperimental prototype of a quadcopter should be constructed to achieve more realisticand reliable results Even though the construction of a real quadcopter and theestimation of all the model parameters are laborious tasks a real quadcopter wouldbring significant benefits to the research With a real propotype the theoreticalframework and the simulation results could be compared to real-life measurementsThis paper did not include these higlighted matters in the study but presentedthe basics of quadcopter modelling and control This paper can thus be used as a

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

_ =l k (minus22 + 24)l k (minus21 + 23)X4i=1_Mi

(8)in which l is the distance between the rotor and the center of mass of the quadcopterThus the roll movement is acquired by decreasing the 2nd rotor velocityand increasing the 4th rotor velocity Similarly the pitch movement is acquired bydecreasing the 1st rotor velocity and increasing the 3th rotor velocity Yaw movementis acquired by increasing the the angular velocities of two opposite rotors anddecreasing the velocities of the other two421 Newton-Euler equationsThe quadcopter is assumed to be rigid body and thus Newton-Euler equations canbe used to describe its dynamics In the body frame the force required for theacceleration of mass m ˙VB and the centrifugal force _ times (mVB) are equal to thegravity RTG and the total thrust of the rotors TBm ˙VB + _ times (mVB) = RTG + TB (9)In the inertial frame the centrifugal force is nullified Thus only the gravitationalforce and the magnitude and direction of the thrust are contributing in the accelerationof the quadcoptermuml_ = G+ RTBumlxumlyumlz

= minusg001 + TmC S_C_ + S S_S S_C_ minus C S_C_C_ (10)In the body frame the angular acceleration of the inertia I_˙ the centripetal forces_ times (I_) and the gyroscopic forces 1048576 are equal to the external torque _I_˙ + _ times (I_) + 1048576 = _ _˙ = Iminus1minuspqr timesIxx pIyy qIzz r minus Irpqr times00

1 1048576 + _p˙q˙r˙ =(Iyy minus Izz) q rIxx(Izz minus Ixx) p rIyy(Ixx minus Iyy) p qIzz minus IrqIxxminuspIyy0 1048576 +__Ixx__Iyy_ Izz (11)in which 1048576 = 1minus2 +3 minus4 The angular accelerations in the inertial frame arethen attracted from the body frame accelerations with the transformation matrixWminus1_ and its time derivativeuml_ = ddt1048576Wminus1_ __= ddt1048576Wminus1

___ +Wminus1_ _˙=0 ˙_C_T_ + _˙S_C2_ minus˙_S_C_ + _˙C_C2_0 minus˙_S_ minus˙_C_0 ˙_ C_C_ + ˙ _S_T_C_ minus˙_S_C_ + _˙C_T_C_ _ +Wminus1

_ _˙ (12)522 Euler-Lagrange equationsThe Lagrangian L is the sum of the translational Etrans and rotational Erot energiesminus potential energy EpotL (q q˙) = Etrans + Erot minus Epot= (m2) _˙T _˙ + (12) _T I _ minus mgz(13)As shown in [10] the Euler-Lagrange equations with external forces and torques are_f__=ddt_Lq˙_minusLq (14)The linear and angular components do not depend on each other thus they can bestudied separately The linear external force is the total thrust of the rotors Thelinear Euler-Lagrange equations aref = RTB = muml_ + mg0

01 (15)which is equivalent with Equation (10)The Jacobian matrix J (_) from _ to _˙ isJ (_) = J =WT_ IW_=Ixx 0 minusIxxS_0 IyyC2_ + IzzS2_ (Iyy minus Izz)C_S_C_minusIxxS_ (Iyy minus Izz)C_S_C_ IxxS2_ + IyyS2_C2_ + IzzC2_C2_(16)Thus the rotational energy Erot can be expressed in the inertial frame asErot = (12) _T I _ = (12) uml_T J uml_ (17)The external angular force is the torques of the rotors The angular Euler-Lagrangeequations are_ = _B = J uml_ +ddt(J) _˙ minus12_1048576_˙T J _˙_= J _uml + C (_ _˙ ) _˙ (18)in which the matrix C (_ _˙ ) is the Coriolis term containing the gyroscopic andcentripetal terms6The matrix C (_ _˙ ) has the form as shown in [9]C (_ _˙ ) =

C11 C12 C13C21 C22 C23C31 C32 C33 C11 = 0C12 = (Iyy minus Izz)(˙_ C_S_ + ˙ S2_C_) + (Izz minus Iyy) ˙ C2_C_ minus Ixx ˙ C_C13 = (Izz minus Iyy) ˙ C_S_C2_C21 = (Izz minus Iyy)(˙_ C_S_ + ˙ S_C_) + (Iyy minus Izz) ˙ C2_C_ + Ixx ˙ C_C22 = (Izz minus Iyy)˙ _C_S_C23 = minusIxx ˙ S_C_ + Iyy ˙ S2_S_C_ + Izz ˙ C2_S_C_C31 = (Iyy minus Izz) ˙ C2_S_C_ minus Ixx _˙C_C32 = (Izz minus Iyy)(˙_ C_S_S_ + ˙_S2_C_) + (Iyy minus Izz)˙ _C2_C_+Ixx ˙ S_C_ minus Iyy ˙ S2_S_C_ minus Izz ˙ C2_S_C_C33 = (Iyy minus Izz)˙ _C_S_C2_ minus Iyy _˙S2_C_S_ minus Izz ˙_C2_C_S_ + Ixx ˙_C_S_(19)Equation (18) leads to the differential equations for the angular accelerations whichare equivalent with Equations (11) and (12)uml_ = Jminus1 (_B minus C (_ _˙ ) _˙ ) (20)23 Aerodynamical effectsThe preceding model is a simplification of complex dynamic interactions To enforcemore realistical behaviour of the quadcopter drag force generated by the airresistance is included This is devised to Equations (10) and (15) with the diagonalcoefficient matrix associating the linear velocities to the force slowing the movementas in [15]umlxumly

umlz = minusg001 +TmC S_C_ + S S_S S_C_ minus C S_C_C_minus1mAx 0 00 Ay 00 0 Azx˙y˙z˙ (21)in which Ax Ay and Az are the drag force coefficients for velocities in the correspondingdirections of the inertial frameSeveral other aerodynamical effects could be included in the model For exampledependence of thrust on angle of attack blade flapping and airflow distruptions havebeen studied in [1] and [2] The influence of aerodynamical effects are complicatedand the effects are difficult to model Also some of the effects have significant effectonly in high velocities Thus these effects are excluded from the model and thepresented simple model is used

73 SimulationThe mathematical model of the quadcopter is implemented for simulation in Matlab2010 with Matlab programming language Parameter values from [3] are used in thesimulations and are presented in Table 1 The values of the drag force coefficientsAx Ay and Az are selected such as the quadcopter will slow down and stop whenangles _ and _ are stabilised to zero valuesTable 1 Parameter values for simulationParameter Value Unitg 981 ms2m 0468 kgl 0225 mk 2980 10minus6b 1140 10minus7IM 3357 10minus5 kg m2Parameter Value UnitIxx 4856 10minus3 kg m2Iyy 4856 10minus3 kg m2Izz 8801 10minus3 kg m2Ax 025 kgsAy 025 kgsAz 025 kgsThe mathematical model is tested by simulating a quadcopter with an example caseas following The quadcopter is initially in a stable state in which the values of allpositions and angles are zero the body frame of the quadcopter is congruent withthe inertial frame The total thrust is equal to the hover thrust the thrust equal togravity The simulation progresses at 00001 second intervals to total elapsed timeof two seconds The control inputs the angular velocities of the four rotors areshown in Figure 2 the inertial positions x y and z in Figure 3 and the angles _ _and in Figure 4For the first 025 seconds the quadcopter ascended by increasing all of the rotorvelocities from the hover thrust Then the ascend is stopped by decreasing the rotorvelocities significantly for the following 025 seconds Consequently the quadcopterascended 01 meters in the first 05 seconds After the ascend the quadcopter is

stable againNext the quadcopter is put into a roll motion by increasing the velocity of thefourth rotor and decreasing the velocity of the second rotor for 025 seconds Theacceleration of the roll motion is stopped by decreasing the velocity of the fourthand increasing the velocity of the second rotor for 025 seconds Thus after 05seconds in roll motion the roll angle _ had increased approx 25 degrees Becauseof the roll angle the quadcopter accelerated in the direction of the negative y-axisThen similar to the roll motion a pitch motion is created by increasing the velocityof the third rotor and decreasing the velocity of the first The motion is stoppedby decreasing the velocity of the third rotor and increasing the velocity of the firstrotor Due to the pitch movement the pitch angle _ had increased approximately822 degrees The acceleration of the quadcopter in the direction of the positive x-axisis caused by the pitch angleFinally the quadcopter is turned in the direction of the yaw angle by increasingthe velocities of the first and the third rotors and decreasing the velocities of thesecond and the fourth rotors The yaw motion is stopped by decreasing the velocitiesof the first and the third rotors and increasing the velocities of the second and thefourth rotors Consequently the yaw angle increases approximately 10 degreesDuring the whole simulation the total thrust of the rotors had remained close to theinitial total thrust Thus the deviations of the roll and pitch angles from the zerovalues decrease the value of the thrust in the direction of the z-axis Consequentlythe quadcopter accelerates in the direction of the negative z-axis and is descending0 02 04 06 08 1 12 14 16 18 2550575600625650675700Time t (s)Control input i (rads)1234

Figure 2 Control inputs i0 02 04 06 08 1 12 14 16 18 2

minus25minus2minus15minus1minus05005115Time t (s)Position (m)Position xPosition yPosition z

Figure 3 Positions x y and z90 02 04 06 08 1 12 14 16 18 2minus5051015202530Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 4 Angles _ _ and 104 Stabilisation of quadcopterTo stabilise the quadcopter a PID controller is utilised Advantages of the PIDcontroller are the simple structure and easy implementation of the controller Thegeneral form of the PID controller ise(t) = xd(t) minus x(t)u(t) = KP e(t) + KIZ t0e(_ ) d _ + KDd e(t)d t [16](22)in which u(t) is the control input e(t) is the difference between the desired statexd(t) and the present state x(t) and KP KI and KD are the parameters for theproportional integral and derivative elements of the PID controllerIn a quadcopter there are six states positions _ and angles _ but only four controlinputs the angular velocities of the four rotors i The interactions between thestates and the total thrust T and the torques _ created by the rotors are visible fromthe quadcopter dynamics defined by Equations (10) (11) and (12) The total thrustT affects the acceleration in the direction of the z-axis and holds the quadcopter inthe air Torque __ has an affect on the acceleration of angle _ torque __ affects theacceleration of angle _ and torque _ contributes in the acceleration of angle

Hence the PD controller for the quadcopter is chosen as similarly as in [4]T = (g + KzD (z˙d minus z˙) + KzP (zd minus z)) mC_C___ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Ixx__ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Iyy_ =_K D_ ˙d minus ˙ _+ K P ( d minus )_Izz(23)in which also the gravity g and mass m and moments of inertia I of the quadcopterare consideredThe correct angular velocities of rotors i can be calculated from Equations (7) and(8) with values from Equation (23)21 = T4kminus __2klminus_ 4b22 = T

4kminus__2kl+_ 4b23 = T4k+ __2klminus_ 4b24 = T4k+__2kl+_ 4b(24)The performance of the PD controller is tested by simulating the stabilisation ofa quadcopter The PD controller parameters are presented in Table 2 The initialcondition of the quadcopter is for position _ = [0 0 1]T in meters and for angles11_ = [10 10 10]T in degrees The desired position for altitude is zd = 0 The purposeof the stabilisation is stable hovering thus _d = [0 0 0]TTable 2 Parameters of the PD controllerParameter ValueKzD 25K_D 175K_D 175K D 175Parameter ValueKzP 15K_P 6K_P 6K P 6The control inputs i the positions _ and the angles _ during the simulation are

presented in Figures 5 6 and 7 The altitude and the angles are stabilised to zerovalue after 5 seconds However the positions x and y deviated from the zero valuesbecause of the non-zero values of the angles Before the quadcopter is stabilisedto hover it has already moved over 1 meters in the direction of the positive x axisand 05 meters in the direction of the negative y axis This is because the controlmethod of the PD contoller does not consider the accelerations in the directions ofx and y Thus another control method should be constructed to give a control onall of positions and angles of the quadcopter0 1 2 3 4 5 6550560570580590600610620630

Time t (s)Control input i (rads)1234

Figure 5 Control inputs i0 1 2 3 4 5 6minus06minus04minus02002040608112

Time t (s)Position (m)Position xPosition yPosition z

Figure 6 Positions x y and z120 1 2 3 4 5 6minus20246810

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 7 Angles _ _ and 135 Trajectory controlThe purpose of trajectory control is to move the quadcopter from the original locationto the desired location by controlling the rotor velocities of the quadcopterFinding optimal trajectory for a quadcopter is a difficult task because of complexdynamics However a simple control method is able to control the quadcopteradequately Thus a heuristic approach is studied and developed hereThe basis of the development of a control method is the study of the interactions and

dependances between states state derivatives and control inputs These interactionsand dependances are defined by Equations (7) (8) (20) and (21) and presented inFigure 8The given control inputs i define the total thrust T and the torques __ __ and _ The torques affect the angular accelerations depending on the current angles andangular velocities The angles _ can be integrated from the angular velocities _˙ which are integrated from the angular accelerations uml_ The linear accelerations uml_depend on the total thrust T the angles _ and the linear velocities _˙ The linearposition _ is integrated from the linear accelerations uml_ through the linear velocities_˙Hence to find proper control inputs i for given states _ this line of thought has tobe done in reverse___HHHjT_-- _uml - _˙ - _I K_uml - _˙ - _IFigure 8 Interactions between states state derivatives and control inputsOne method is to generate linear accelerations which accomplish the wanted trajectoryaccording to positions x y and z for each time t From Equation (21) threeequations are receivedTB =00T = RT

muml_ +00g +Ax 0 00 Ay 00 0 Az _˙ (25)in which _uml _˙ and are desired trajectory values as well as angles _ and _ and totalthrust T are unknown values to be solvedFrom this equation the required angles _ and _ and the total thrust T for each timet can be calculated as shown in [5]14_ = arcsin dx S minus dy C d2x + d2y + (dz + g)2_ = arctan_dx C + dy S dz + g_T = m(dx (S_C C_ + S S_) + dy (S_S C_ minus C S_)+( dz + g )C_C_) (26)in whichdx = xuml + Axx˙mdy = yuml+ Ayy˙mdz = zuml+ Azz˙m(27)

When the values of the angles _ and _ are known the angular velocities and accelerationscan be calculated from them with simple derivation With the angularvelocities and accelerations the torques _ can be solved from Equation (20) Whenthe torques and thrust are known the control inputs i can be calculated fromEquation (24)51 Heuristic method for trajectory generationThe generation of proper accelerations uml_ is difficult because the composition of thethird and fourth derivatives of the position jerk and jounce has to be reasonableThe influence of the jounce values is visible in the composition of the control inputsi High jounce values will mean high control input values and thus the jounceshave to be considered closely when generating the accelerationsA heuristic method can be used to generate jounce values The method utilises asymmetric structure in jouce function f(t) to control the derivatives One influencialpart of the function is defined by three sine functions as followingf(t) =a sin10485761b _ t_ 0 le t le bminusa sin10485761b _ t minus __ b le t le 3ba sin10485761b _ t minus 3__ 3b le t le 4b(28)The structure of the function is visualised in Figure 9 The sine functions are usedto give a smooth function These three sine functions form a function in whichthe first half increases acceleration to certain value and then the second half of the

function decreases it back to zero This acceleration generates constant velocityMirror image of the function can be used to decelerate the velocity back to zeroThe final position depends on the parameters a and b of the sine functions presented15in Equation (28) and the time c between the accelerating part and the deceleratingpart the mirror image of the jounceaaab2bba sin10485761b _ t_minusa sin1048576 12b _ t minus __a sin10485761b _ t minus 3__Jounce (ms4)Time t (s)Figure 9 Heuristic method for the generation of jounce functionsUnfortunately the method does not give optimal trajectories Thus a dynamicoptimisation model and a suitable algorithm would be needed to calculate optimallythe trajectory of the quadcopter However the method presented is easy to use togenerate proper values of jounce which will achieve the wanted trajectoryThe functionality of the method is studied with an example simulation Jounce ofposition x is created according to Equation (28) with parameters a = 1 b = 05and c = 2 The position x and its derivatives derived from the planned jounce arepresented in Figure 10 The jounce could also be generated simultaneously for y andz However in this example only position x is considered because the relationship

between the jounce of position x and the control inputs 1 and 3 controlling theangle _ is more visible160 1 2 3 4 5 6 7minus1minus08minus06minus04minus020020406081Time t (s)Jounce (ms4)

(a) Jounce0 1 2 3 4 5 6 7minus04minus03minus02minus01001020304

Time t (s)Jerk (ms3)

(b) Jerk0 1 2 3 4 5 6 7minus02minus015minus01minus00500050101502Time t (s)Acceleration (ms2)

(c) Acceleration0 1 2 3 4 5 6 7minus002000200400600801012014016018

Time t (s)Velocity (ms)

(d) Velocity0 1 2 3 4 5 6 7001020304050607

Time t (s)Position (m)

(e) PositionFigure 10 Planned position x and its derivatives with given jounceThe simulation of the example case is performed with previously given accelerationsand velocities of position x The planned value of angle is zero for each time tFirst the required angles _ and _ and thrust T are solved from Equation (26) foreach time t The angular velocities and accelerations are calculated from the solvedangles with derivation Then the torques are solved using the angular velocitiesand accelerations Finally the control inputs are solved Then the simulation isperformed with given control inputsThe calculated control inputs are presented in Figure 11 The simulated positions_ are presented in Figure 12 and the simulated angles _ in Figure 13 Accordingto Figure 12 the simulated position x is the same as the planned position x inFigure 10(e) and the values of the positions y and z stay as zeroes The angle _increases during the acceleration and then stabilises to a constant value to generate

the constant acceleration required to compensate the drag force caused by theplanned constant velocity Finally the angle is changed to the opposite direction todecelerate the quadcopter to a haltThe shape of the calculated control inputs 1 and 3 in Figure 11 are similar toplanned jounce in Figure 10(a) The shape of the simulated angle _ follows theshape of the planned acceleration umlx The shapes of the control inputs and theangles differ from the planned values of the jounce and the acceleration because thedrag force caused by the velocity has to be compensated170 1 2 3 4 5 6 76203620462056206620762086209621

Time t (s)Control input i (rads)1234

Figure 11 Control inputs i0 1 2 3 4 5 6001020304050607

Time t (s)Position (m)Position xPosition yPosition z

Figure 12 Positions x y and z0 1 2 3 4 5 6 7minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 13 Angles _ _ and The method can also be used even if there are unmodeled linear forces wind forexample which affect the linear accelerations and consequently the position of thequadcopter If the trajectory is calculated in shorter distances it is possible tocorrect the trajectory with new calculation from the current but inaccurate locationto the next checkpoint Example of this method is presented in Figure 14 Thearrows with dash lines indicate the planned trajectory in the x y-plane and thesolid arrows indicate the realised trajectory The black squares mark the start and

the finish positions and the white squares mark the checkpoints for the trajectory18The control inputs are calculated from the current location of the quadcopter to thenext checkpoint but because of random and unmodelled forces the realised positionmarked with X differs from the planned If the quadcopter is close enough to thetarget checkpoint the target checkpoint is changed to the next one and new controlinputs are calculated After repeating this and going through all of the checkpointsthe quadcopter reaches the final destinationFigure 14 Example of checkpoint flight pattern with external disturbancesThe biggest weakness in the proposed method is that it works as shown only if thequadcopter starts from a stable attitude the angles _ and _ and their derivativesare zeros and there are no external forces influencing the attitude during the flightSmall deviations in the angles can result into a huge deviation in the trajectory Oneway to solve this problem is to stabilise the quadcopter at each checkpoint with aPD controller proposed earlier or by using the heuristic method to angles Howeverif the angular disturbances are continuous the benefit from temporary stabilisationis only momentary52 Integrated PD controllerAnother method to take into account the possible deviations in the angles is tointegrate a PD controller into the heuristic method This is a simplified version ofthe proposed control method in [5] The required values dx dy and dz in Equation(26) are given by the PD controller considering the deviations between the currentand desired values (subscript d) of the positions _ velocities _˙ and accelerations _umldx = KxP (xd minus x) + KxD (x˙ d minus x˙ ) + KxDD (xumld minus xuml) dy = KyP (yd minus y) + KyD (y˙d minus y˙) + KyDD (yumld minus yuml) dz = KzP (zd minus z) + KzD (z˙d minus z˙) + KzDD (zumld minus zuml) (29)Then the commanded angles _c and _c and thrust T are given by Equation (26)The torques _ are controlled by the PD controller in Equation (30) same as in

19Equation (23) The control inputs can be solved with the calculated thrust andtorques by using Equation (24)__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Ixx__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Iyy_ =_K P ( d minus ) + K D_˙ d minus ˙ __Izz(30)The performance of the PD controller is demonstrated with an example case inwhich for all positions x y and z and their derivatives the values are same as inFigure 10 The simulation is performed with the PD parameters presented in Table3Table 3 Parameters of the PD controllerVariable Parameter valuei KiP KiD KiDDx 185 075 100y 855 075 100z 185 075 100_ 300 075 -_ 300 075 - 300 075 -The results of the simulation are presented Figures 15 - 17 The simulated controlinputs are presented in Figure 15 the simulated positions in Figure 16 and the

simulated angles in Figure 17 The position of the quadcopter is close to the plannedposition after 6 seconds but the position keeps fluctuating close to the planned valuesfor several seconds The angles variate greatly during the simulation to achieve thewanted positions velocities and accelerations The values of the control inputsoscillated during the acceleration but then their behaviour became more stable0 2 4 6 8 10 12 14618619620621622623624625626

Time t (s)Control input i (rads)1234

Figure 15 Control inputs i200 2 4 6 8 10 12 14minus0100102030405060708

Time t (s)Position (m)Position xPosition yPosition z

Figure 16 Positions x y and z0 2 4 6 8 10 12 14minus15minus125minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 17 Angles _ _ and The proposed integrated PD controller performed well in the example case Howeverthe performance of the controller is highly depended on the parameter values If theparameter values are small the controller will not respond quickly enough to followthe planned trajectory If the parameter values are substantial the quadcopter cannot perform the required drastic changes in the angular velocities of the rotor andthe control inputs calculated from Equation (24) can be infeasible with certaintorques Thus the use of equations considering the torques and the control inputsrequires a method to calculate the best feasible torques and from them the bestcontrol inputs Another possible method would be to variate the PD parameters

according to the current positions and angles and their derivatives but it is extremelydifficult216 ConclusionThis paper studied mathematical modelling and control of a quadcopter The mathematicalmodel of quadcopter dynamics was presented and the differential equationswere derived from the Newton-Euler and the Euler-Lagrange equations The modelwas verified by simulating the flight of a quadcopter with Matlab Stabilisation ofattitude of the quadcopter was done by utilising a PD controller A heuristic methodwas developed to control the trajectory of the quadcopter The PD contoller wasintegrated into the heuristic method for better response to disturbances in the flightconditions of the quadcopterThe simulation proved the presented mathematical model to be realistic in modellingthe position and attitude of the quadcopter The simulation results also showedthat the PD controller was efficient in stabilising the quadcopter to the desiredaltitude and attitude However the PD controller did not considered positions xand y Thus the values of x and y variated from their original values during thestabilisation process This was a result of the deviation of the roll and pitch anglesfrom zero valuesAccording to the simulation results the proposed heuristic method produced goodflight trajectories The heuristic method required only three parameters to generatethe values for the jounce of the position The position and its other derivatives werecalculated from the jounce values The total thrust and the pitch and roll angles toachieve given accelerations were solved from the linear differential equations Thenthe torques were determined by the angular accelerations and angular velocitiescalculated from the angles Finally the required control inputs were solved from thetotal thrust and the torques The simulation results indicated that the quadcopter

could be controlled accurately with the control inputs given by the methodThe proposed heuristic method does not consider unmodelled disturbances suchas wind and thus the PD controller was integrated into the control method Theintegrated PD controller operated well in the example simulation The quadcopterfollowed the given trajectory and began to stabilise after reaching the final destinationHowever the PD controller can perform poorly if the parameter values arenot properly selected and are too small or highThe presented mathematical model only consists of the basic structures of the quadcopterdynamics Several aerodynamical effects were excluded which can lead tounrealiable behaviour Also the electric motors spinning the fours rotors were notmodelled The behaviour of a motor is easily included in the model but would requireestimation of the parameter values of the motor The position and attitudeinformation was assumed to be accurate in the model and the simulations Howeverthe measuring devices in real life are not perfectly accurate as random variationsand errors occur Hence the effects of imprecise information to the flight of thequadcopter should be studied as well Also methods to enhance the accuracy of themeasurements should be researched and implemented to improve all aspects required22for robust quadcopter manoeuvresThe presented model and control methods were tested only with simulations Realexperimental prototype of a quadcopter should be constructed to achieve more realisticand reliable results Even though the construction of a real quadcopter and theestimation of all the model parameters are laborious tasks a real quadcopter wouldbring significant benefits to the research With a real propotype the theoreticalframework and the simulation results could be compared to real-life measurementsThis paper did not include these higlighted matters in the study but presentedthe basics of quadcopter modelling and control This paper can thus be used as a

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

= minusg001 + TmC S_C_ + S S_S S_C_ minus C S_C_C_ (10)In the body frame the angular acceleration of the inertia I_˙ the centripetal forces_ times (I_) and the gyroscopic forces 1048576 are equal to the external torque _I_˙ + _ times (I_) + 1048576 = _ _˙ = Iminus1minuspqr timesIxx pIyy qIzz r minus Irpqr times00

1 1048576 + _p˙q˙r˙ =(Iyy minus Izz) q rIxx(Izz minus Ixx) p rIyy(Ixx minus Iyy) p qIzz minus IrqIxxminuspIyy0 1048576 +__Ixx__Iyy_ Izz (11)in which 1048576 = 1minus2 +3 minus4 The angular accelerations in the inertial frame arethen attracted from the body frame accelerations with the transformation matrixWminus1_ and its time derivativeuml_ = ddt1048576Wminus1_ __= ddt1048576Wminus1

___ +Wminus1_ _˙=0 ˙_C_T_ + _˙S_C2_ minus˙_S_C_ + _˙C_C2_0 minus˙_S_ minus˙_C_0 ˙_ C_C_ + ˙ _S_T_C_ minus˙_S_C_ + _˙C_T_C_ _ +Wminus1

_ _˙ (12)522 Euler-Lagrange equationsThe Lagrangian L is the sum of the translational Etrans and rotational Erot energiesminus potential energy EpotL (q q˙) = Etrans + Erot minus Epot= (m2) _˙T _˙ + (12) _T I _ minus mgz(13)As shown in [10] the Euler-Lagrange equations with external forces and torques are_f__=ddt_Lq˙_minusLq (14)The linear and angular components do not depend on each other thus they can bestudied separately The linear external force is the total thrust of the rotors Thelinear Euler-Lagrange equations aref = RTB = muml_ + mg0

01 (15)which is equivalent with Equation (10)The Jacobian matrix J (_) from _ to _˙ isJ (_) = J =WT_ IW_=Ixx 0 minusIxxS_0 IyyC2_ + IzzS2_ (Iyy minus Izz)C_S_C_minusIxxS_ (Iyy minus Izz)C_S_C_ IxxS2_ + IyyS2_C2_ + IzzC2_C2_(16)Thus the rotational energy Erot can be expressed in the inertial frame asErot = (12) _T I _ = (12) uml_T J uml_ (17)The external angular force is the torques of the rotors The angular Euler-Lagrangeequations are_ = _B = J uml_ +ddt(J) _˙ minus12_1048576_˙T J _˙_= J _uml + C (_ _˙ ) _˙ (18)in which the matrix C (_ _˙ ) is the Coriolis term containing the gyroscopic andcentripetal terms6The matrix C (_ _˙ ) has the form as shown in [9]C (_ _˙ ) =

C11 C12 C13C21 C22 C23C31 C32 C33 C11 = 0C12 = (Iyy minus Izz)(˙_ C_S_ + ˙ S2_C_) + (Izz minus Iyy) ˙ C2_C_ minus Ixx ˙ C_C13 = (Izz minus Iyy) ˙ C_S_C2_C21 = (Izz minus Iyy)(˙_ C_S_ + ˙ S_C_) + (Iyy minus Izz) ˙ C2_C_ + Ixx ˙ C_C22 = (Izz minus Iyy)˙ _C_S_C23 = minusIxx ˙ S_C_ + Iyy ˙ S2_S_C_ + Izz ˙ C2_S_C_C31 = (Iyy minus Izz) ˙ C2_S_C_ minus Ixx _˙C_C32 = (Izz minus Iyy)(˙_ C_S_S_ + ˙_S2_C_) + (Iyy minus Izz)˙ _C2_C_+Ixx ˙ S_C_ minus Iyy ˙ S2_S_C_ minus Izz ˙ C2_S_C_C33 = (Iyy minus Izz)˙ _C_S_C2_ minus Iyy _˙S2_C_S_ minus Izz ˙_C2_C_S_ + Ixx ˙_C_S_(19)Equation (18) leads to the differential equations for the angular accelerations whichare equivalent with Equations (11) and (12)uml_ = Jminus1 (_B minus C (_ _˙ ) _˙ ) (20)23 Aerodynamical effectsThe preceding model is a simplification of complex dynamic interactions To enforcemore realistical behaviour of the quadcopter drag force generated by the airresistance is included This is devised to Equations (10) and (15) with the diagonalcoefficient matrix associating the linear velocities to the force slowing the movementas in [15]umlxumly

umlz = minusg001 +TmC S_C_ + S S_S S_C_ minus C S_C_C_minus1mAx 0 00 Ay 00 0 Azx˙y˙z˙ (21)in which Ax Ay and Az are the drag force coefficients for velocities in the correspondingdirections of the inertial frameSeveral other aerodynamical effects could be included in the model For exampledependence of thrust on angle of attack blade flapping and airflow distruptions havebeen studied in [1] and [2] The influence of aerodynamical effects are complicatedand the effects are difficult to model Also some of the effects have significant effectonly in high velocities Thus these effects are excluded from the model and thepresented simple model is used

73 SimulationThe mathematical model of the quadcopter is implemented for simulation in Matlab2010 with Matlab programming language Parameter values from [3] are used in thesimulations and are presented in Table 1 The values of the drag force coefficientsAx Ay and Az are selected such as the quadcopter will slow down and stop whenangles _ and _ are stabilised to zero valuesTable 1 Parameter values for simulationParameter Value Unitg 981 ms2m 0468 kgl 0225 mk 2980 10minus6b 1140 10minus7IM 3357 10minus5 kg m2Parameter Value UnitIxx 4856 10minus3 kg m2Iyy 4856 10minus3 kg m2Izz 8801 10minus3 kg m2Ax 025 kgsAy 025 kgsAz 025 kgsThe mathematical model is tested by simulating a quadcopter with an example caseas following The quadcopter is initially in a stable state in which the values of allpositions and angles are zero the body frame of the quadcopter is congruent withthe inertial frame The total thrust is equal to the hover thrust the thrust equal togravity The simulation progresses at 00001 second intervals to total elapsed timeof two seconds The control inputs the angular velocities of the four rotors areshown in Figure 2 the inertial positions x y and z in Figure 3 and the angles _ _and in Figure 4For the first 025 seconds the quadcopter ascended by increasing all of the rotorvelocities from the hover thrust Then the ascend is stopped by decreasing the rotorvelocities significantly for the following 025 seconds Consequently the quadcopterascended 01 meters in the first 05 seconds After the ascend the quadcopter is

stable againNext the quadcopter is put into a roll motion by increasing the velocity of thefourth rotor and decreasing the velocity of the second rotor for 025 seconds Theacceleration of the roll motion is stopped by decreasing the velocity of the fourthand increasing the velocity of the second rotor for 025 seconds Thus after 05seconds in roll motion the roll angle _ had increased approx 25 degrees Becauseof the roll angle the quadcopter accelerated in the direction of the negative y-axisThen similar to the roll motion a pitch motion is created by increasing the velocityof the third rotor and decreasing the velocity of the first The motion is stoppedby decreasing the velocity of the third rotor and increasing the velocity of the firstrotor Due to the pitch movement the pitch angle _ had increased approximately822 degrees The acceleration of the quadcopter in the direction of the positive x-axisis caused by the pitch angleFinally the quadcopter is turned in the direction of the yaw angle by increasingthe velocities of the first and the third rotors and decreasing the velocities of thesecond and the fourth rotors The yaw motion is stopped by decreasing the velocitiesof the first and the third rotors and increasing the velocities of the second and thefourth rotors Consequently the yaw angle increases approximately 10 degreesDuring the whole simulation the total thrust of the rotors had remained close to theinitial total thrust Thus the deviations of the roll and pitch angles from the zerovalues decrease the value of the thrust in the direction of the z-axis Consequentlythe quadcopter accelerates in the direction of the negative z-axis and is descending0 02 04 06 08 1 12 14 16 18 2550575600625650675700Time t (s)Control input i (rads)1234

Figure 2 Control inputs i0 02 04 06 08 1 12 14 16 18 2

minus25minus2minus15minus1minus05005115Time t (s)Position (m)Position xPosition yPosition z

Figure 3 Positions x y and z90 02 04 06 08 1 12 14 16 18 2minus5051015202530Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 4 Angles _ _ and 104 Stabilisation of quadcopterTo stabilise the quadcopter a PID controller is utilised Advantages of the PIDcontroller are the simple structure and easy implementation of the controller Thegeneral form of the PID controller ise(t) = xd(t) minus x(t)u(t) = KP e(t) + KIZ t0e(_ ) d _ + KDd e(t)d t [16](22)in which u(t) is the control input e(t) is the difference between the desired statexd(t) and the present state x(t) and KP KI and KD are the parameters for theproportional integral and derivative elements of the PID controllerIn a quadcopter there are six states positions _ and angles _ but only four controlinputs the angular velocities of the four rotors i The interactions between thestates and the total thrust T and the torques _ created by the rotors are visible fromthe quadcopter dynamics defined by Equations (10) (11) and (12) The total thrustT affects the acceleration in the direction of the z-axis and holds the quadcopter inthe air Torque __ has an affect on the acceleration of angle _ torque __ affects theacceleration of angle _ and torque _ contributes in the acceleration of angle

Hence the PD controller for the quadcopter is chosen as similarly as in [4]T = (g + KzD (z˙d minus z˙) + KzP (zd minus z)) mC_C___ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Ixx__ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Iyy_ =_K D_ ˙d minus ˙ _+ K P ( d minus )_Izz(23)in which also the gravity g and mass m and moments of inertia I of the quadcopterare consideredThe correct angular velocities of rotors i can be calculated from Equations (7) and(8) with values from Equation (23)21 = T4kminus __2klminus_ 4b22 = T

4kminus__2kl+_ 4b23 = T4k+ __2klminus_ 4b24 = T4k+__2kl+_ 4b(24)The performance of the PD controller is tested by simulating the stabilisation ofa quadcopter The PD controller parameters are presented in Table 2 The initialcondition of the quadcopter is for position _ = [0 0 1]T in meters and for angles11_ = [10 10 10]T in degrees The desired position for altitude is zd = 0 The purposeof the stabilisation is stable hovering thus _d = [0 0 0]TTable 2 Parameters of the PD controllerParameter ValueKzD 25K_D 175K_D 175K D 175Parameter ValueKzP 15K_P 6K_P 6K P 6The control inputs i the positions _ and the angles _ during the simulation are

presented in Figures 5 6 and 7 The altitude and the angles are stabilised to zerovalue after 5 seconds However the positions x and y deviated from the zero valuesbecause of the non-zero values of the angles Before the quadcopter is stabilisedto hover it has already moved over 1 meters in the direction of the positive x axisand 05 meters in the direction of the negative y axis This is because the controlmethod of the PD contoller does not consider the accelerations in the directions ofx and y Thus another control method should be constructed to give a control onall of positions and angles of the quadcopter0 1 2 3 4 5 6550560570580590600610620630

Time t (s)Control input i (rads)1234

Figure 5 Control inputs i0 1 2 3 4 5 6minus06minus04minus02002040608112

Time t (s)Position (m)Position xPosition yPosition z

Figure 6 Positions x y and z120 1 2 3 4 5 6minus20246810

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 7 Angles _ _ and 135 Trajectory controlThe purpose of trajectory control is to move the quadcopter from the original locationto the desired location by controlling the rotor velocities of the quadcopterFinding optimal trajectory for a quadcopter is a difficult task because of complexdynamics However a simple control method is able to control the quadcopteradequately Thus a heuristic approach is studied and developed hereThe basis of the development of a control method is the study of the interactions and

dependances between states state derivatives and control inputs These interactionsand dependances are defined by Equations (7) (8) (20) and (21) and presented inFigure 8The given control inputs i define the total thrust T and the torques __ __ and _ The torques affect the angular accelerations depending on the current angles andangular velocities The angles _ can be integrated from the angular velocities _˙ which are integrated from the angular accelerations uml_ The linear accelerations uml_depend on the total thrust T the angles _ and the linear velocities _˙ The linearposition _ is integrated from the linear accelerations uml_ through the linear velocities_˙Hence to find proper control inputs i for given states _ this line of thought has tobe done in reverse___HHHjT_-- _uml - _˙ - _I K_uml - _˙ - _IFigure 8 Interactions between states state derivatives and control inputsOne method is to generate linear accelerations which accomplish the wanted trajectoryaccording to positions x y and z for each time t From Equation (21) threeequations are receivedTB =00T = RT

muml_ +00g +Ax 0 00 Ay 00 0 Az _˙ (25)in which _uml _˙ and are desired trajectory values as well as angles _ and _ and totalthrust T are unknown values to be solvedFrom this equation the required angles _ and _ and the total thrust T for each timet can be calculated as shown in [5]14_ = arcsin dx S minus dy C d2x + d2y + (dz + g)2_ = arctan_dx C + dy S dz + g_T = m(dx (S_C C_ + S S_) + dy (S_S C_ minus C S_)+( dz + g )C_C_) (26)in whichdx = xuml + Axx˙mdy = yuml+ Ayy˙mdz = zuml+ Azz˙m(27)

When the values of the angles _ and _ are known the angular velocities and accelerationscan be calculated from them with simple derivation With the angularvelocities and accelerations the torques _ can be solved from Equation (20) Whenthe torques and thrust are known the control inputs i can be calculated fromEquation (24)51 Heuristic method for trajectory generationThe generation of proper accelerations uml_ is difficult because the composition of thethird and fourth derivatives of the position jerk and jounce has to be reasonableThe influence of the jounce values is visible in the composition of the control inputsi High jounce values will mean high control input values and thus the jounceshave to be considered closely when generating the accelerationsA heuristic method can be used to generate jounce values The method utilises asymmetric structure in jouce function f(t) to control the derivatives One influencialpart of the function is defined by three sine functions as followingf(t) =a sin10485761b _ t_ 0 le t le bminusa sin10485761b _ t minus __ b le t le 3ba sin10485761b _ t minus 3__ 3b le t le 4b(28)The structure of the function is visualised in Figure 9 The sine functions are usedto give a smooth function These three sine functions form a function in whichthe first half increases acceleration to certain value and then the second half of the

function decreases it back to zero This acceleration generates constant velocityMirror image of the function can be used to decelerate the velocity back to zeroThe final position depends on the parameters a and b of the sine functions presented15in Equation (28) and the time c between the accelerating part and the deceleratingpart the mirror image of the jounceaaab2bba sin10485761b _ t_minusa sin1048576 12b _ t minus __a sin10485761b _ t minus 3__Jounce (ms4)Time t (s)Figure 9 Heuristic method for the generation of jounce functionsUnfortunately the method does not give optimal trajectories Thus a dynamicoptimisation model and a suitable algorithm would be needed to calculate optimallythe trajectory of the quadcopter However the method presented is easy to use togenerate proper values of jounce which will achieve the wanted trajectoryThe functionality of the method is studied with an example simulation Jounce ofposition x is created according to Equation (28) with parameters a = 1 b = 05and c = 2 The position x and its derivatives derived from the planned jounce arepresented in Figure 10 The jounce could also be generated simultaneously for y andz However in this example only position x is considered because the relationship

between the jounce of position x and the control inputs 1 and 3 controlling theangle _ is more visible160 1 2 3 4 5 6 7minus1minus08minus06minus04minus020020406081Time t (s)Jounce (ms4)

(a) Jounce0 1 2 3 4 5 6 7minus04minus03minus02minus01001020304

Time t (s)Jerk (ms3)

(b) Jerk0 1 2 3 4 5 6 7minus02minus015minus01minus00500050101502Time t (s)Acceleration (ms2)

(c) Acceleration0 1 2 3 4 5 6 7minus002000200400600801012014016018

Time t (s)Velocity (ms)

(d) Velocity0 1 2 3 4 5 6 7001020304050607

Time t (s)Position (m)

(e) PositionFigure 10 Planned position x and its derivatives with given jounceThe simulation of the example case is performed with previously given accelerationsand velocities of position x The planned value of angle is zero for each time tFirst the required angles _ and _ and thrust T are solved from Equation (26) foreach time t The angular velocities and accelerations are calculated from the solvedangles with derivation Then the torques are solved using the angular velocitiesand accelerations Finally the control inputs are solved Then the simulation isperformed with given control inputsThe calculated control inputs are presented in Figure 11 The simulated positions_ are presented in Figure 12 and the simulated angles _ in Figure 13 Accordingto Figure 12 the simulated position x is the same as the planned position x inFigure 10(e) and the values of the positions y and z stay as zeroes The angle _increases during the acceleration and then stabilises to a constant value to generate

the constant acceleration required to compensate the drag force caused by theplanned constant velocity Finally the angle is changed to the opposite direction todecelerate the quadcopter to a haltThe shape of the calculated control inputs 1 and 3 in Figure 11 are similar toplanned jounce in Figure 10(a) The shape of the simulated angle _ follows theshape of the planned acceleration umlx The shapes of the control inputs and theangles differ from the planned values of the jounce and the acceleration because thedrag force caused by the velocity has to be compensated170 1 2 3 4 5 6 76203620462056206620762086209621

Time t (s)Control input i (rads)1234

Figure 11 Control inputs i0 1 2 3 4 5 6001020304050607

Time t (s)Position (m)Position xPosition yPosition z

Figure 12 Positions x y and z0 1 2 3 4 5 6 7minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 13 Angles _ _ and The method can also be used even if there are unmodeled linear forces wind forexample which affect the linear accelerations and consequently the position of thequadcopter If the trajectory is calculated in shorter distances it is possible tocorrect the trajectory with new calculation from the current but inaccurate locationto the next checkpoint Example of this method is presented in Figure 14 Thearrows with dash lines indicate the planned trajectory in the x y-plane and thesolid arrows indicate the realised trajectory The black squares mark the start and

the finish positions and the white squares mark the checkpoints for the trajectory18The control inputs are calculated from the current location of the quadcopter to thenext checkpoint but because of random and unmodelled forces the realised positionmarked with X differs from the planned If the quadcopter is close enough to thetarget checkpoint the target checkpoint is changed to the next one and new controlinputs are calculated After repeating this and going through all of the checkpointsthe quadcopter reaches the final destinationFigure 14 Example of checkpoint flight pattern with external disturbancesThe biggest weakness in the proposed method is that it works as shown only if thequadcopter starts from a stable attitude the angles _ and _ and their derivativesare zeros and there are no external forces influencing the attitude during the flightSmall deviations in the angles can result into a huge deviation in the trajectory Oneway to solve this problem is to stabilise the quadcopter at each checkpoint with aPD controller proposed earlier or by using the heuristic method to angles Howeverif the angular disturbances are continuous the benefit from temporary stabilisationis only momentary52 Integrated PD controllerAnother method to take into account the possible deviations in the angles is tointegrate a PD controller into the heuristic method This is a simplified version ofthe proposed control method in [5] The required values dx dy and dz in Equation(26) are given by the PD controller considering the deviations between the currentand desired values (subscript d) of the positions _ velocities _˙ and accelerations _umldx = KxP (xd minus x) + KxD (x˙ d minus x˙ ) + KxDD (xumld minus xuml) dy = KyP (yd minus y) + KyD (y˙d minus y˙) + KyDD (yumld minus yuml) dz = KzP (zd minus z) + KzD (z˙d minus z˙) + KzDD (zumld minus zuml) (29)Then the commanded angles _c and _c and thrust T are given by Equation (26)The torques _ are controlled by the PD controller in Equation (30) same as in

19Equation (23) The control inputs can be solved with the calculated thrust andtorques by using Equation (24)__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Ixx__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Iyy_ =_K P ( d minus ) + K D_˙ d minus ˙ __Izz(30)The performance of the PD controller is demonstrated with an example case inwhich for all positions x y and z and their derivatives the values are same as inFigure 10 The simulation is performed with the PD parameters presented in Table3Table 3 Parameters of the PD controllerVariable Parameter valuei KiP KiD KiDDx 185 075 100y 855 075 100z 185 075 100_ 300 075 -_ 300 075 - 300 075 -The results of the simulation are presented Figures 15 - 17 The simulated controlinputs are presented in Figure 15 the simulated positions in Figure 16 and the

simulated angles in Figure 17 The position of the quadcopter is close to the plannedposition after 6 seconds but the position keeps fluctuating close to the planned valuesfor several seconds The angles variate greatly during the simulation to achieve thewanted positions velocities and accelerations The values of the control inputsoscillated during the acceleration but then their behaviour became more stable0 2 4 6 8 10 12 14618619620621622623624625626

Time t (s)Control input i (rads)1234

Figure 15 Control inputs i200 2 4 6 8 10 12 14minus0100102030405060708

Time t (s)Position (m)Position xPosition yPosition z

Figure 16 Positions x y and z0 2 4 6 8 10 12 14minus15minus125minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 17 Angles _ _ and The proposed integrated PD controller performed well in the example case Howeverthe performance of the controller is highly depended on the parameter values If theparameter values are small the controller will not respond quickly enough to followthe planned trajectory If the parameter values are substantial the quadcopter cannot perform the required drastic changes in the angular velocities of the rotor andthe control inputs calculated from Equation (24) can be infeasible with certaintorques Thus the use of equations considering the torques and the control inputsrequires a method to calculate the best feasible torques and from them the bestcontrol inputs Another possible method would be to variate the PD parameters

according to the current positions and angles and their derivatives but it is extremelydifficult216 ConclusionThis paper studied mathematical modelling and control of a quadcopter The mathematicalmodel of quadcopter dynamics was presented and the differential equationswere derived from the Newton-Euler and the Euler-Lagrange equations The modelwas verified by simulating the flight of a quadcopter with Matlab Stabilisation ofattitude of the quadcopter was done by utilising a PD controller A heuristic methodwas developed to control the trajectory of the quadcopter The PD contoller wasintegrated into the heuristic method for better response to disturbances in the flightconditions of the quadcopterThe simulation proved the presented mathematical model to be realistic in modellingthe position and attitude of the quadcopter The simulation results also showedthat the PD controller was efficient in stabilising the quadcopter to the desiredaltitude and attitude However the PD controller did not considered positions xand y Thus the values of x and y variated from their original values during thestabilisation process This was a result of the deviation of the roll and pitch anglesfrom zero valuesAccording to the simulation results the proposed heuristic method produced goodflight trajectories The heuristic method required only three parameters to generatethe values for the jounce of the position The position and its other derivatives werecalculated from the jounce values The total thrust and the pitch and roll angles toachieve given accelerations were solved from the linear differential equations Thenthe torques were determined by the angular accelerations and angular velocitiescalculated from the angles Finally the required control inputs were solved from thetotal thrust and the torques The simulation results indicated that the quadcopter

could be controlled accurately with the control inputs given by the methodThe proposed heuristic method does not consider unmodelled disturbances suchas wind and thus the PD controller was integrated into the control method Theintegrated PD controller operated well in the example simulation The quadcopterfollowed the given trajectory and began to stabilise after reaching the final destinationHowever the PD controller can perform poorly if the parameter values arenot properly selected and are too small or highThe presented mathematical model only consists of the basic structures of the quadcopterdynamics Several aerodynamical effects were excluded which can lead tounrealiable behaviour Also the electric motors spinning the fours rotors were notmodelled The behaviour of a motor is easily included in the model but would requireestimation of the parameter values of the motor The position and attitudeinformation was assumed to be accurate in the model and the simulations Howeverthe measuring devices in real life are not perfectly accurate as random variationsand errors occur Hence the effects of imprecise information to the flight of thequadcopter should be studied as well Also methods to enhance the accuracy of themeasurements should be researched and implemented to improve all aspects required22for robust quadcopter manoeuvresThe presented model and control methods were tested only with simulations Realexperimental prototype of a quadcopter should be constructed to achieve more realisticand reliable results Even though the construction of a real quadcopter and theestimation of all the model parameters are laborious tasks a real quadcopter wouldbring significant benefits to the research With a real propotype the theoreticalframework and the simulation results could be compared to real-life measurementsThis paper did not include these higlighted matters in the study but presentedthe basics of quadcopter modelling and control This paper can thus be used as a

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

1 1048576 + _p˙q˙r˙ =(Iyy minus Izz) q rIxx(Izz minus Ixx) p rIyy(Ixx minus Iyy) p qIzz minus IrqIxxminuspIyy0 1048576 +__Ixx__Iyy_ Izz (11)in which 1048576 = 1minus2 +3 minus4 The angular accelerations in the inertial frame arethen attracted from the body frame accelerations with the transformation matrixWminus1_ and its time derivativeuml_ = ddt1048576Wminus1_ __= ddt1048576Wminus1

___ +Wminus1_ _˙=0 ˙_C_T_ + _˙S_C2_ minus˙_S_C_ + _˙C_C2_0 minus˙_S_ minus˙_C_0 ˙_ C_C_ + ˙ _S_T_C_ minus˙_S_C_ + _˙C_T_C_ _ +Wminus1

_ _˙ (12)522 Euler-Lagrange equationsThe Lagrangian L is the sum of the translational Etrans and rotational Erot energiesminus potential energy EpotL (q q˙) = Etrans + Erot minus Epot= (m2) _˙T _˙ + (12) _T I _ minus mgz(13)As shown in [10] the Euler-Lagrange equations with external forces and torques are_f__=ddt_Lq˙_minusLq (14)The linear and angular components do not depend on each other thus they can bestudied separately The linear external force is the total thrust of the rotors Thelinear Euler-Lagrange equations aref = RTB = muml_ + mg0

01 (15)which is equivalent with Equation (10)The Jacobian matrix J (_) from _ to _˙ isJ (_) = J =WT_ IW_=Ixx 0 minusIxxS_0 IyyC2_ + IzzS2_ (Iyy minus Izz)C_S_C_minusIxxS_ (Iyy minus Izz)C_S_C_ IxxS2_ + IyyS2_C2_ + IzzC2_C2_(16)Thus the rotational energy Erot can be expressed in the inertial frame asErot = (12) _T I _ = (12) uml_T J uml_ (17)The external angular force is the torques of the rotors The angular Euler-Lagrangeequations are_ = _B = J uml_ +ddt(J) _˙ minus12_1048576_˙T J _˙_= J _uml + C (_ _˙ ) _˙ (18)in which the matrix C (_ _˙ ) is the Coriolis term containing the gyroscopic andcentripetal terms6The matrix C (_ _˙ ) has the form as shown in [9]C (_ _˙ ) =

C11 C12 C13C21 C22 C23C31 C32 C33 C11 = 0C12 = (Iyy minus Izz)(˙_ C_S_ + ˙ S2_C_) + (Izz minus Iyy) ˙ C2_C_ minus Ixx ˙ C_C13 = (Izz minus Iyy) ˙ C_S_C2_C21 = (Izz minus Iyy)(˙_ C_S_ + ˙ S_C_) + (Iyy minus Izz) ˙ C2_C_ + Ixx ˙ C_C22 = (Izz minus Iyy)˙ _C_S_C23 = minusIxx ˙ S_C_ + Iyy ˙ S2_S_C_ + Izz ˙ C2_S_C_C31 = (Iyy minus Izz) ˙ C2_S_C_ minus Ixx _˙C_C32 = (Izz minus Iyy)(˙_ C_S_S_ + ˙_S2_C_) + (Iyy minus Izz)˙ _C2_C_+Ixx ˙ S_C_ minus Iyy ˙ S2_S_C_ minus Izz ˙ C2_S_C_C33 = (Iyy minus Izz)˙ _C_S_C2_ minus Iyy _˙S2_C_S_ minus Izz ˙_C2_C_S_ + Ixx ˙_C_S_(19)Equation (18) leads to the differential equations for the angular accelerations whichare equivalent with Equations (11) and (12)uml_ = Jminus1 (_B minus C (_ _˙ ) _˙ ) (20)23 Aerodynamical effectsThe preceding model is a simplification of complex dynamic interactions To enforcemore realistical behaviour of the quadcopter drag force generated by the airresistance is included This is devised to Equations (10) and (15) with the diagonalcoefficient matrix associating the linear velocities to the force slowing the movementas in [15]umlxumly

umlz = minusg001 +TmC S_C_ + S S_S S_C_ minus C S_C_C_minus1mAx 0 00 Ay 00 0 Azx˙y˙z˙ (21)in which Ax Ay and Az are the drag force coefficients for velocities in the correspondingdirections of the inertial frameSeveral other aerodynamical effects could be included in the model For exampledependence of thrust on angle of attack blade flapping and airflow distruptions havebeen studied in [1] and [2] The influence of aerodynamical effects are complicatedand the effects are difficult to model Also some of the effects have significant effectonly in high velocities Thus these effects are excluded from the model and thepresented simple model is used

73 SimulationThe mathematical model of the quadcopter is implemented for simulation in Matlab2010 with Matlab programming language Parameter values from [3] are used in thesimulations and are presented in Table 1 The values of the drag force coefficientsAx Ay and Az are selected such as the quadcopter will slow down and stop whenangles _ and _ are stabilised to zero valuesTable 1 Parameter values for simulationParameter Value Unitg 981 ms2m 0468 kgl 0225 mk 2980 10minus6b 1140 10minus7IM 3357 10minus5 kg m2Parameter Value UnitIxx 4856 10minus3 kg m2Iyy 4856 10minus3 kg m2Izz 8801 10minus3 kg m2Ax 025 kgsAy 025 kgsAz 025 kgsThe mathematical model is tested by simulating a quadcopter with an example caseas following The quadcopter is initially in a stable state in which the values of allpositions and angles are zero the body frame of the quadcopter is congruent withthe inertial frame The total thrust is equal to the hover thrust the thrust equal togravity The simulation progresses at 00001 second intervals to total elapsed timeof two seconds The control inputs the angular velocities of the four rotors areshown in Figure 2 the inertial positions x y and z in Figure 3 and the angles _ _and in Figure 4For the first 025 seconds the quadcopter ascended by increasing all of the rotorvelocities from the hover thrust Then the ascend is stopped by decreasing the rotorvelocities significantly for the following 025 seconds Consequently the quadcopterascended 01 meters in the first 05 seconds After the ascend the quadcopter is

stable againNext the quadcopter is put into a roll motion by increasing the velocity of thefourth rotor and decreasing the velocity of the second rotor for 025 seconds Theacceleration of the roll motion is stopped by decreasing the velocity of the fourthand increasing the velocity of the second rotor for 025 seconds Thus after 05seconds in roll motion the roll angle _ had increased approx 25 degrees Becauseof the roll angle the quadcopter accelerated in the direction of the negative y-axisThen similar to the roll motion a pitch motion is created by increasing the velocityof the third rotor and decreasing the velocity of the first The motion is stoppedby decreasing the velocity of the third rotor and increasing the velocity of the firstrotor Due to the pitch movement the pitch angle _ had increased approximately822 degrees The acceleration of the quadcopter in the direction of the positive x-axisis caused by the pitch angleFinally the quadcopter is turned in the direction of the yaw angle by increasingthe velocities of the first and the third rotors and decreasing the velocities of thesecond and the fourth rotors The yaw motion is stopped by decreasing the velocitiesof the first and the third rotors and increasing the velocities of the second and thefourth rotors Consequently the yaw angle increases approximately 10 degreesDuring the whole simulation the total thrust of the rotors had remained close to theinitial total thrust Thus the deviations of the roll and pitch angles from the zerovalues decrease the value of the thrust in the direction of the z-axis Consequentlythe quadcopter accelerates in the direction of the negative z-axis and is descending0 02 04 06 08 1 12 14 16 18 2550575600625650675700Time t (s)Control input i (rads)1234

Figure 2 Control inputs i0 02 04 06 08 1 12 14 16 18 2

minus25minus2minus15minus1minus05005115Time t (s)Position (m)Position xPosition yPosition z

Figure 3 Positions x y and z90 02 04 06 08 1 12 14 16 18 2minus5051015202530Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 4 Angles _ _ and 104 Stabilisation of quadcopterTo stabilise the quadcopter a PID controller is utilised Advantages of the PIDcontroller are the simple structure and easy implementation of the controller Thegeneral form of the PID controller ise(t) = xd(t) minus x(t)u(t) = KP e(t) + KIZ t0e(_ ) d _ + KDd e(t)d t [16](22)in which u(t) is the control input e(t) is the difference between the desired statexd(t) and the present state x(t) and KP KI and KD are the parameters for theproportional integral and derivative elements of the PID controllerIn a quadcopter there are six states positions _ and angles _ but only four controlinputs the angular velocities of the four rotors i The interactions between thestates and the total thrust T and the torques _ created by the rotors are visible fromthe quadcopter dynamics defined by Equations (10) (11) and (12) The total thrustT affects the acceleration in the direction of the z-axis and holds the quadcopter inthe air Torque __ has an affect on the acceleration of angle _ torque __ affects theacceleration of angle _ and torque _ contributes in the acceleration of angle

Hence the PD controller for the quadcopter is chosen as similarly as in [4]T = (g + KzD (z˙d minus z˙) + KzP (zd minus z)) mC_C___ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Ixx__ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Iyy_ =_K D_ ˙d minus ˙ _+ K P ( d minus )_Izz(23)in which also the gravity g and mass m and moments of inertia I of the quadcopterare consideredThe correct angular velocities of rotors i can be calculated from Equations (7) and(8) with values from Equation (23)21 = T4kminus __2klminus_ 4b22 = T

4kminus__2kl+_ 4b23 = T4k+ __2klminus_ 4b24 = T4k+__2kl+_ 4b(24)The performance of the PD controller is tested by simulating the stabilisation ofa quadcopter The PD controller parameters are presented in Table 2 The initialcondition of the quadcopter is for position _ = [0 0 1]T in meters and for angles11_ = [10 10 10]T in degrees The desired position for altitude is zd = 0 The purposeof the stabilisation is stable hovering thus _d = [0 0 0]TTable 2 Parameters of the PD controllerParameter ValueKzD 25K_D 175K_D 175K D 175Parameter ValueKzP 15K_P 6K_P 6K P 6The control inputs i the positions _ and the angles _ during the simulation are

presented in Figures 5 6 and 7 The altitude and the angles are stabilised to zerovalue after 5 seconds However the positions x and y deviated from the zero valuesbecause of the non-zero values of the angles Before the quadcopter is stabilisedto hover it has already moved over 1 meters in the direction of the positive x axisand 05 meters in the direction of the negative y axis This is because the controlmethod of the PD contoller does not consider the accelerations in the directions ofx and y Thus another control method should be constructed to give a control onall of positions and angles of the quadcopter0 1 2 3 4 5 6550560570580590600610620630

Time t (s)Control input i (rads)1234

Figure 5 Control inputs i0 1 2 3 4 5 6minus06minus04minus02002040608112

Time t (s)Position (m)Position xPosition yPosition z

Figure 6 Positions x y and z120 1 2 3 4 5 6minus20246810

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 7 Angles _ _ and 135 Trajectory controlThe purpose of trajectory control is to move the quadcopter from the original locationto the desired location by controlling the rotor velocities of the quadcopterFinding optimal trajectory for a quadcopter is a difficult task because of complexdynamics However a simple control method is able to control the quadcopteradequately Thus a heuristic approach is studied and developed hereThe basis of the development of a control method is the study of the interactions and

dependances between states state derivatives and control inputs These interactionsand dependances are defined by Equations (7) (8) (20) and (21) and presented inFigure 8The given control inputs i define the total thrust T and the torques __ __ and _ The torques affect the angular accelerations depending on the current angles andangular velocities The angles _ can be integrated from the angular velocities _˙ which are integrated from the angular accelerations uml_ The linear accelerations uml_depend on the total thrust T the angles _ and the linear velocities _˙ The linearposition _ is integrated from the linear accelerations uml_ through the linear velocities_˙Hence to find proper control inputs i for given states _ this line of thought has tobe done in reverse___HHHjT_-- _uml - _˙ - _I K_uml - _˙ - _IFigure 8 Interactions between states state derivatives and control inputsOne method is to generate linear accelerations which accomplish the wanted trajectoryaccording to positions x y and z for each time t From Equation (21) threeequations are receivedTB =00T = RT

muml_ +00g +Ax 0 00 Ay 00 0 Az _˙ (25)in which _uml _˙ and are desired trajectory values as well as angles _ and _ and totalthrust T are unknown values to be solvedFrom this equation the required angles _ and _ and the total thrust T for each timet can be calculated as shown in [5]14_ = arcsin dx S minus dy C d2x + d2y + (dz + g)2_ = arctan_dx C + dy S dz + g_T = m(dx (S_C C_ + S S_) + dy (S_S C_ minus C S_)+( dz + g )C_C_) (26)in whichdx = xuml + Axx˙mdy = yuml+ Ayy˙mdz = zuml+ Azz˙m(27)

When the values of the angles _ and _ are known the angular velocities and accelerationscan be calculated from them with simple derivation With the angularvelocities and accelerations the torques _ can be solved from Equation (20) Whenthe torques and thrust are known the control inputs i can be calculated fromEquation (24)51 Heuristic method for trajectory generationThe generation of proper accelerations uml_ is difficult because the composition of thethird and fourth derivatives of the position jerk and jounce has to be reasonableThe influence of the jounce values is visible in the composition of the control inputsi High jounce values will mean high control input values and thus the jounceshave to be considered closely when generating the accelerationsA heuristic method can be used to generate jounce values The method utilises asymmetric structure in jouce function f(t) to control the derivatives One influencialpart of the function is defined by three sine functions as followingf(t) =a sin10485761b _ t_ 0 le t le bminusa sin10485761b _ t minus __ b le t le 3ba sin10485761b _ t minus 3__ 3b le t le 4b(28)The structure of the function is visualised in Figure 9 The sine functions are usedto give a smooth function These three sine functions form a function in whichthe first half increases acceleration to certain value and then the second half of the

function decreases it back to zero This acceleration generates constant velocityMirror image of the function can be used to decelerate the velocity back to zeroThe final position depends on the parameters a and b of the sine functions presented15in Equation (28) and the time c between the accelerating part and the deceleratingpart the mirror image of the jounceaaab2bba sin10485761b _ t_minusa sin1048576 12b _ t minus __a sin10485761b _ t minus 3__Jounce (ms4)Time t (s)Figure 9 Heuristic method for the generation of jounce functionsUnfortunately the method does not give optimal trajectories Thus a dynamicoptimisation model and a suitable algorithm would be needed to calculate optimallythe trajectory of the quadcopter However the method presented is easy to use togenerate proper values of jounce which will achieve the wanted trajectoryThe functionality of the method is studied with an example simulation Jounce ofposition x is created according to Equation (28) with parameters a = 1 b = 05and c = 2 The position x and its derivatives derived from the planned jounce arepresented in Figure 10 The jounce could also be generated simultaneously for y andz However in this example only position x is considered because the relationship

between the jounce of position x and the control inputs 1 and 3 controlling theangle _ is more visible160 1 2 3 4 5 6 7minus1minus08minus06minus04minus020020406081Time t (s)Jounce (ms4)

(a) Jounce0 1 2 3 4 5 6 7minus04minus03minus02minus01001020304

Time t (s)Jerk (ms3)

(b) Jerk0 1 2 3 4 5 6 7minus02minus015minus01minus00500050101502Time t (s)Acceleration (ms2)

(c) Acceleration0 1 2 3 4 5 6 7minus002000200400600801012014016018

Time t (s)Velocity (ms)

(d) Velocity0 1 2 3 4 5 6 7001020304050607

Time t (s)Position (m)

(e) PositionFigure 10 Planned position x and its derivatives with given jounceThe simulation of the example case is performed with previously given accelerationsand velocities of position x The planned value of angle is zero for each time tFirst the required angles _ and _ and thrust T are solved from Equation (26) foreach time t The angular velocities and accelerations are calculated from the solvedangles with derivation Then the torques are solved using the angular velocitiesand accelerations Finally the control inputs are solved Then the simulation isperformed with given control inputsThe calculated control inputs are presented in Figure 11 The simulated positions_ are presented in Figure 12 and the simulated angles _ in Figure 13 Accordingto Figure 12 the simulated position x is the same as the planned position x inFigure 10(e) and the values of the positions y and z stay as zeroes The angle _increases during the acceleration and then stabilises to a constant value to generate

the constant acceleration required to compensate the drag force caused by theplanned constant velocity Finally the angle is changed to the opposite direction todecelerate the quadcopter to a haltThe shape of the calculated control inputs 1 and 3 in Figure 11 are similar toplanned jounce in Figure 10(a) The shape of the simulated angle _ follows theshape of the planned acceleration umlx The shapes of the control inputs and theangles differ from the planned values of the jounce and the acceleration because thedrag force caused by the velocity has to be compensated170 1 2 3 4 5 6 76203620462056206620762086209621

Time t (s)Control input i (rads)1234

Figure 11 Control inputs i0 1 2 3 4 5 6001020304050607

Time t (s)Position (m)Position xPosition yPosition z

Figure 12 Positions x y and z0 1 2 3 4 5 6 7minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 13 Angles _ _ and The method can also be used even if there are unmodeled linear forces wind forexample which affect the linear accelerations and consequently the position of thequadcopter If the trajectory is calculated in shorter distances it is possible tocorrect the trajectory with new calculation from the current but inaccurate locationto the next checkpoint Example of this method is presented in Figure 14 Thearrows with dash lines indicate the planned trajectory in the x y-plane and thesolid arrows indicate the realised trajectory The black squares mark the start and

the finish positions and the white squares mark the checkpoints for the trajectory18The control inputs are calculated from the current location of the quadcopter to thenext checkpoint but because of random and unmodelled forces the realised positionmarked with X differs from the planned If the quadcopter is close enough to thetarget checkpoint the target checkpoint is changed to the next one and new controlinputs are calculated After repeating this and going through all of the checkpointsthe quadcopter reaches the final destinationFigure 14 Example of checkpoint flight pattern with external disturbancesThe biggest weakness in the proposed method is that it works as shown only if thequadcopter starts from a stable attitude the angles _ and _ and their derivativesare zeros and there are no external forces influencing the attitude during the flightSmall deviations in the angles can result into a huge deviation in the trajectory Oneway to solve this problem is to stabilise the quadcopter at each checkpoint with aPD controller proposed earlier or by using the heuristic method to angles Howeverif the angular disturbances are continuous the benefit from temporary stabilisationis only momentary52 Integrated PD controllerAnother method to take into account the possible deviations in the angles is tointegrate a PD controller into the heuristic method This is a simplified version ofthe proposed control method in [5] The required values dx dy and dz in Equation(26) are given by the PD controller considering the deviations between the currentand desired values (subscript d) of the positions _ velocities _˙ and accelerations _umldx = KxP (xd minus x) + KxD (x˙ d minus x˙ ) + KxDD (xumld minus xuml) dy = KyP (yd minus y) + KyD (y˙d minus y˙) + KyDD (yumld minus yuml) dz = KzP (zd minus z) + KzD (z˙d minus z˙) + KzDD (zumld minus zuml) (29)Then the commanded angles _c and _c and thrust T are given by Equation (26)The torques _ are controlled by the PD controller in Equation (30) same as in

19Equation (23) The control inputs can be solved with the calculated thrust andtorques by using Equation (24)__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Ixx__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Iyy_ =_K P ( d minus ) + K D_˙ d minus ˙ __Izz(30)The performance of the PD controller is demonstrated with an example case inwhich for all positions x y and z and their derivatives the values are same as inFigure 10 The simulation is performed with the PD parameters presented in Table3Table 3 Parameters of the PD controllerVariable Parameter valuei KiP KiD KiDDx 185 075 100y 855 075 100z 185 075 100_ 300 075 -_ 300 075 - 300 075 -The results of the simulation are presented Figures 15 - 17 The simulated controlinputs are presented in Figure 15 the simulated positions in Figure 16 and the

simulated angles in Figure 17 The position of the quadcopter is close to the plannedposition after 6 seconds but the position keeps fluctuating close to the planned valuesfor several seconds The angles variate greatly during the simulation to achieve thewanted positions velocities and accelerations The values of the control inputsoscillated during the acceleration but then their behaviour became more stable0 2 4 6 8 10 12 14618619620621622623624625626

Time t (s)Control input i (rads)1234

Figure 15 Control inputs i200 2 4 6 8 10 12 14minus0100102030405060708

Time t (s)Position (m)Position xPosition yPosition z

Figure 16 Positions x y and z0 2 4 6 8 10 12 14minus15minus125minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 17 Angles _ _ and The proposed integrated PD controller performed well in the example case Howeverthe performance of the controller is highly depended on the parameter values If theparameter values are small the controller will not respond quickly enough to followthe planned trajectory If the parameter values are substantial the quadcopter cannot perform the required drastic changes in the angular velocities of the rotor andthe control inputs calculated from Equation (24) can be infeasible with certaintorques Thus the use of equations considering the torques and the control inputsrequires a method to calculate the best feasible torques and from them the bestcontrol inputs Another possible method would be to variate the PD parameters

according to the current positions and angles and their derivatives but it is extremelydifficult216 ConclusionThis paper studied mathematical modelling and control of a quadcopter The mathematicalmodel of quadcopter dynamics was presented and the differential equationswere derived from the Newton-Euler and the Euler-Lagrange equations The modelwas verified by simulating the flight of a quadcopter with Matlab Stabilisation ofattitude of the quadcopter was done by utilising a PD controller A heuristic methodwas developed to control the trajectory of the quadcopter The PD contoller wasintegrated into the heuristic method for better response to disturbances in the flightconditions of the quadcopterThe simulation proved the presented mathematical model to be realistic in modellingthe position and attitude of the quadcopter The simulation results also showedthat the PD controller was efficient in stabilising the quadcopter to the desiredaltitude and attitude However the PD controller did not considered positions xand y Thus the values of x and y variated from their original values during thestabilisation process This was a result of the deviation of the roll and pitch anglesfrom zero valuesAccording to the simulation results the proposed heuristic method produced goodflight trajectories The heuristic method required only three parameters to generatethe values for the jounce of the position The position and its other derivatives werecalculated from the jounce values The total thrust and the pitch and roll angles toachieve given accelerations were solved from the linear differential equations Thenthe torques were determined by the angular accelerations and angular velocitiescalculated from the angles Finally the required control inputs were solved from thetotal thrust and the torques The simulation results indicated that the quadcopter

could be controlled accurately with the control inputs given by the methodThe proposed heuristic method does not consider unmodelled disturbances suchas wind and thus the PD controller was integrated into the control method Theintegrated PD controller operated well in the example simulation The quadcopterfollowed the given trajectory and began to stabilise after reaching the final destinationHowever the PD controller can perform poorly if the parameter values arenot properly selected and are too small or highThe presented mathematical model only consists of the basic structures of the quadcopterdynamics Several aerodynamical effects were excluded which can lead tounrealiable behaviour Also the electric motors spinning the fours rotors were notmodelled The behaviour of a motor is easily included in the model but would requireestimation of the parameter values of the motor The position and attitudeinformation was assumed to be accurate in the model and the simulations Howeverthe measuring devices in real life are not perfectly accurate as random variationsand errors occur Hence the effects of imprecise information to the flight of thequadcopter should be studied as well Also methods to enhance the accuracy of themeasurements should be researched and implemented to improve all aspects required22for robust quadcopter manoeuvresThe presented model and control methods were tested only with simulations Realexperimental prototype of a quadcopter should be constructed to achieve more realisticand reliable results Even though the construction of a real quadcopter and theestimation of all the model parameters are laborious tasks a real quadcopter wouldbring significant benefits to the research With a real propotype the theoreticalframework and the simulation results could be compared to real-life measurementsThis paper did not include these higlighted matters in the study but presentedthe basics of quadcopter modelling and control This paper can thus be used as a

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

___ +Wminus1_ _˙=0 ˙_C_T_ + _˙S_C2_ minus˙_S_C_ + _˙C_C2_0 minus˙_S_ minus˙_C_0 ˙_ C_C_ + ˙ _S_T_C_ minus˙_S_C_ + _˙C_T_C_ _ +Wminus1

_ _˙ (12)522 Euler-Lagrange equationsThe Lagrangian L is the sum of the translational Etrans and rotational Erot energiesminus potential energy EpotL (q q˙) = Etrans + Erot minus Epot= (m2) _˙T _˙ + (12) _T I _ minus mgz(13)As shown in [10] the Euler-Lagrange equations with external forces and torques are_f__=ddt_Lq˙_minusLq (14)The linear and angular components do not depend on each other thus they can bestudied separately The linear external force is the total thrust of the rotors Thelinear Euler-Lagrange equations aref = RTB = muml_ + mg0

01 (15)which is equivalent with Equation (10)The Jacobian matrix J (_) from _ to _˙ isJ (_) = J =WT_ IW_=Ixx 0 minusIxxS_0 IyyC2_ + IzzS2_ (Iyy minus Izz)C_S_C_minusIxxS_ (Iyy minus Izz)C_S_C_ IxxS2_ + IyyS2_C2_ + IzzC2_C2_(16)Thus the rotational energy Erot can be expressed in the inertial frame asErot = (12) _T I _ = (12) uml_T J uml_ (17)The external angular force is the torques of the rotors The angular Euler-Lagrangeequations are_ = _B = J uml_ +ddt(J) _˙ minus12_1048576_˙T J _˙_= J _uml + C (_ _˙ ) _˙ (18)in which the matrix C (_ _˙ ) is the Coriolis term containing the gyroscopic andcentripetal terms6The matrix C (_ _˙ ) has the form as shown in [9]C (_ _˙ ) =

C11 C12 C13C21 C22 C23C31 C32 C33 C11 = 0C12 = (Iyy minus Izz)(˙_ C_S_ + ˙ S2_C_) + (Izz minus Iyy) ˙ C2_C_ minus Ixx ˙ C_C13 = (Izz minus Iyy) ˙ C_S_C2_C21 = (Izz minus Iyy)(˙_ C_S_ + ˙ S_C_) + (Iyy minus Izz) ˙ C2_C_ + Ixx ˙ C_C22 = (Izz minus Iyy)˙ _C_S_C23 = minusIxx ˙ S_C_ + Iyy ˙ S2_S_C_ + Izz ˙ C2_S_C_C31 = (Iyy minus Izz) ˙ C2_S_C_ minus Ixx _˙C_C32 = (Izz minus Iyy)(˙_ C_S_S_ + ˙_S2_C_) + (Iyy minus Izz)˙ _C2_C_+Ixx ˙ S_C_ minus Iyy ˙ S2_S_C_ minus Izz ˙ C2_S_C_C33 = (Iyy minus Izz)˙ _C_S_C2_ minus Iyy _˙S2_C_S_ minus Izz ˙_C2_C_S_ + Ixx ˙_C_S_(19)Equation (18) leads to the differential equations for the angular accelerations whichare equivalent with Equations (11) and (12)uml_ = Jminus1 (_B minus C (_ _˙ ) _˙ ) (20)23 Aerodynamical effectsThe preceding model is a simplification of complex dynamic interactions To enforcemore realistical behaviour of the quadcopter drag force generated by the airresistance is included This is devised to Equations (10) and (15) with the diagonalcoefficient matrix associating the linear velocities to the force slowing the movementas in [15]umlxumly

umlz = minusg001 +TmC S_C_ + S S_S S_C_ minus C S_C_C_minus1mAx 0 00 Ay 00 0 Azx˙y˙z˙ (21)in which Ax Ay and Az are the drag force coefficients for velocities in the correspondingdirections of the inertial frameSeveral other aerodynamical effects could be included in the model For exampledependence of thrust on angle of attack blade flapping and airflow distruptions havebeen studied in [1] and [2] The influence of aerodynamical effects are complicatedand the effects are difficult to model Also some of the effects have significant effectonly in high velocities Thus these effects are excluded from the model and thepresented simple model is used

73 SimulationThe mathematical model of the quadcopter is implemented for simulation in Matlab2010 with Matlab programming language Parameter values from [3] are used in thesimulations and are presented in Table 1 The values of the drag force coefficientsAx Ay and Az are selected such as the quadcopter will slow down and stop whenangles _ and _ are stabilised to zero valuesTable 1 Parameter values for simulationParameter Value Unitg 981 ms2m 0468 kgl 0225 mk 2980 10minus6b 1140 10minus7IM 3357 10minus5 kg m2Parameter Value UnitIxx 4856 10minus3 kg m2Iyy 4856 10minus3 kg m2Izz 8801 10minus3 kg m2Ax 025 kgsAy 025 kgsAz 025 kgsThe mathematical model is tested by simulating a quadcopter with an example caseas following The quadcopter is initially in a stable state in which the values of allpositions and angles are zero the body frame of the quadcopter is congruent withthe inertial frame The total thrust is equal to the hover thrust the thrust equal togravity The simulation progresses at 00001 second intervals to total elapsed timeof two seconds The control inputs the angular velocities of the four rotors areshown in Figure 2 the inertial positions x y and z in Figure 3 and the angles _ _and in Figure 4For the first 025 seconds the quadcopter ascended by increasing all of the rotorvelocities from the hover thrust Then the ascend is stopped by decreasing the rotorvelocities significantly for the following 025 seconds Consequently the quadcopterascended 01 meters in the first 05 seconds After the ascend the quadcopter is

stable againNext the quadcopter is put into a roll motion by increasing the velocity of thefourth rotor and decreasing the velocity of the second rotor for 025 seconds Theacceleration of the roll motion is stopped by decreasing the velocity of the fourthand increasing the velocity of the second rotor for 025 seconds Thus after 05seconds in roll motion the roll angle _ had increased approx 25 degrees Becauseof the roll angle the quadcopter accelerated in the direction of the negative y-axisThen similar to the roll motion a pitch motion is created by increasing the velocityof the third rotor and decreasing the velocity of the first The motion is stoppedby decreasing the velocity of the third rotor and increasing the velocity of the firstrotor Due to the pitch movement the pitch angle _ had increased approximately822 degrees The acceleration of the quadcopter in the direction of the positive x-axisis caused by the pitch angleFinally the quadcopter is turned in the direction of the yaw angle by increasingthe velocities of the first and the third rotors and decreasing the velocities of thesecond and the fourth rotors The yaw motion is stopped by decreasing the velocitiesof the first and the third rotors and increasing the velocities of the second and thefourth rotors Consequently the yaw angle increases approximately 10 degreesDuring the whole simulation the total thrust of the rotors had remained close to theinitial total thrust Thus the deviations of the roll and pitch angles from the zerovalues decrease the value of the thrust in the direction of the z-axis Consequentlythe quadcopter accelerates in the direction of the negative z-axis and is descending0 02 04 06 08 1 12 14 16 18 2550575600625650675700Time t (s)Control input i (rads)1234

Figure 2 Control inputs i0 02 04 06 08 1 12 14 16 18 2

minus25minus2minus15minus1minus05005115Time t (s)Position (m)Position xPosition yPosition z

Figure 3 Positions x y and z90 02 04 06 08 1 12 14 16 18 2minus5051015202530Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 4 Angles _ _ and 104 Stabilisation of quadcopterTo stabilise the quadcopter a PID controller is utilised Advantages of the PIDcontroller are the simple structure and easy implementation of the controller Thegeneral form of the PID controller ise(t) = xd(t) minus x(t)u(t) = KP e(t) + KIZ t0e(_ ) d _ + KDd e(t)d t [16](22)in which u(t) is the control input e(t) is the difference between the desired statexd(t) and the present state x(t) and KP KI and KD are the parameters for theproportional integral and derivative elements of the PID controllerIn a quadcopter there are six states positions _ and angles _ but only four controlinputs the angular velocities of the four rotors i The interactions between thestates and the total thrust T and the torques _ created by the rotors are visible fromthe quadcopter dynamics defined by Equations (10) (11) and (12) The total thrustT affects the acceleration in the direction of the z-axis and holds the quadcopter inthe air Torque __ has an affect on the acceleration of angle _ torque __ affects theacceleration of angle _ and torque _ contributes in the acceleration of angle

Hence the PD controller for the quadcopter is chosen as similarly as in [4]T = (g + KzD (z˙d minus z˙) + KzP (zd minus z)) mC_C___ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Ixx__ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Iyy_ =_K D_ ˙d minus ˙ _+ K P ( d minus )_Izz(23)in which also the gravity g and mass m and moments of inertia I of the quadcopterare consideredThe correct angular velocities of rotors i can be calculated from Equations (7) and(8) with values from Equation (23)21 = T4kminus __2klminus_ 4b22 = T

4kminus__2kl+_ 4b23 = T4k+ __2klminus_ 4b24 = T4k+__2kl+_ 4b(24)The performance of the PD controller is tested by simulating the stabilisation ofa quadcopter The PD controller parameters are presented in Table 2 The initialcondition of the quadcopter is for position _ = [0 0 1]T in meters and for angles11_ = [10 10 10]T in degrees The desired position for altitude is zd = 0 The purposeof the stabilisation is stable hovering thus _d = [0 0 0]TTable 2 Parameters of the PD controllerParameter ValueKzD 25K_D 175K_D 175K D 175Parameter ValueKzP 15K_P 6K_P 6K P 6The control inputs i the positions _ and the angles _ during the simulation are

presented in Figures 5 6 and 7 The altitude and the angles are stabilised to zerovalue after 5 seconds However the positions x and y deviated from the zero valuesbecause of the non-zero values of the angles Before the quadcopter is stabilisedto hover it has already moved over 1 meters in the direction of the positive x axisand 05 meters in the direction of the negative y axis This is because the controlmethod of the PD contoller does not consider the accelerations in the directions ofx and y Thus another control method should be constructed to give a control onall of positions and angles of the quadcopter0 1 2 3 4 5 6550560570580590600610620630

Time t (s)Control input i (rads)1234

Figure 5 Control inputs i0 1 2 3 4 5 6minus06minus04minus02002040608112

Time t (s)Position (m)Position xPosition yPosition z

Figure 6 Positions x y and z120 1 2 3 4 5 6minus20246810

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 7 Angles _ _ and 135 Trajectory controlThe purpose of trajectory control is to move the quadcopter from the original locationto the desired location by controlling the rotor velocities of the quadcopterFinding optimal trajectory for a quadcopter is a difficult task because of complexdynamics However a simple control method is able to control the quadcopteradequately Thus a heuristic approach is studied and developed hereThe basis of the development of a control method is the study of the interactions and

dependances between states state derivatives and control inputs These interactionsand dependances are defined by Equations (7) (8) (20) and (21) and presented inFigure 8The given control inputs i define the total thrust T and the torques __ __ and _ The torques affect the angular accelerations depending on the current angles andangular velocities The angles _ can be integrated from the angular velocities _˙ which are integrated from the angular accelerations uml_ The linear accelerations uml_depend on the total thrust T the angles _ and the linear velocities _˙ The linearposition _ is integrated from the linear accelerations uml_ through the linear velocities_˙Hence to find proper control inputs i for given states _ this line of thought has tobe done in reverse___HHHjT_-- _uml - _˙ - _I K_uml - _˙ - _IFigure 8 Interactions between states state derivatives and control inputsOne method is to generate linear accelerations which accomplish the wanted trajectoryaccording to positions x y and z for each time t From Equation (21) threeequations are receivedTB =00T = RT

muml_ +00g +Ax 0 00 Ay 00 0 Az _˙ (25)in which _uml _˙ and are desired trajectory values as well as angles _ and _ and totalthrust T are unknown values to be solvedFrom this equation the required angles _ and _ and the total thrust T for each timet can be calculated as shown in [5]14_ = arcsin dx S minus dy C d2x + d2y + (dz + g)2_ = arctan_dx C + dy S dz + g_T = m(dx (S_C C_ + S S_) + dy (S_S C_ minus C S_)+( dz + g )C_C_) (26)in whichdx = xuml + Axx˙mdy = yuml+ Ayy˙mdz = zuml+ Azz˙m(27)

When the values of the angles _ and _ are known the angular velocities and accelerationscan be calculated from them with simple derivation With the angularvelocities and accelerations the torques _ can be solved from Equation (20) Whenthe torques and thrust are known the control inputs i can be calculated fromEquation (24)51 Heuristic method for trajectory generationThe generation of proper accelerations uml_ is difficult because the composition of thethird and fourth derivatives of the position jerk and jounce has to be reasonableThe influence of the jounce values is visible in the composition of the control inputsi High jounce values will mean high control input values and thus the jounceshave to be considered closely when generating the accelerationsA heuristic method can be used to generate jounce values The method utilises asymmetric structure in jouce function f(t) to control the derivatives One influencialpart of the function is defined by three sine functions as followingf(t) =a sin10485761b _ t_ 0 le t le bminusa sin10485761b _ t minus __ b le t le 3ba sin10485761b _ t minus 3__ 3b le t le 4b(28)The structure of the function is visualised in Figure 9 The sine functions are usedto give a smooth function These three sine functions form a function in whichthe first half increases acceleration to certain value and then the second half of the

function decreases it back to zero This acceleration generates constant velocityMirror image of the function can be used to decelerate the velocity back to zeroThe final position depends on the parameters a and b of the sine functions presented15in Equation (28) and the time c between the accelerating part and the deceleratingpart the mirror image of the jounceaaab2bba sin10485761b _ t_minusa sin1048576 12b _ t minus __a sin10485761b _ t minus 3__Jounce (ms4)Time t (s)Figure 9 Heuristic method for the generation of jounce functionsUnfortunately the method does not give optimal trajectories Thus a dynamicoptimisation model and a suitable algorithm would be needed to calculate optimallythe trajectory of the quadcopter However the method presented is easy to use togenerate proper values of jounce which will achieve the wanted trajectoryThe functionality of the method is studied with an example simulation Jounce ofposition x is created according to Equation (28) with parameters a = 1 b = 05and c = 2 The position x and its derivatives derived from the planned jounce arepresented in Figure 10 The jounce could also be generated simultaneously for y andz However in this example only position x is considered because the relationship

between the jounce of position x and the control inputs 1 and 3 controlling theangle _ is more visible160 1 2 3 4 5 6 7minus1minus08minus06minus04minus020020406081Time t (s)Jounce (ms4)

(a) Jounce0 1 2 3 4 5 6 7minus04minus03minus02minus01001020304

Time t (s)Jerk (ms3)

(b) Jerk0 1 2 3 4 5 6 7minus02minus015minus01minus00500050101502Time t (s)Acceleration (ms2)

(c) Acceleration0 1 2 3 4 5 6 7minus002000200400600801012014016018

Time t (s)Velocity (ms)

(d) Velocity0 1 2 3 4 5 6 7001020304050607

Time t (s)Position (m)

(e) PositionFigure 10 Planned position x and its derivatives with given jounceThe simulation of the example case is performed with previously given accelerationsand velocities of position x The planned value of angle is zero for each time tFirst the required angles _ and _ and thrust T are solved from Equation (26) foreach time t The angular velocities and accelerations are calculated from the solvedangles with derivation Then the torques are solved using the angular velocitiesand accelerations Finally the control inputs are solved Then the simulation isperformed with given control inputsThe calculated control inputs are presented in Figure 11 The simulated positions_ are presented in Figure 12 and the simulated angles _ in Figure 13 Accordingto Figure 12 the simulated position x is the same as the planned position x inFigure 10(e) and the values of the positions y and z stay as zeroes The angle _increases during the acceleration and then stabilises to a constant value to generate

the constant acceleration required to compensate the drag force caused by theplanned constant velocity Finally the angle is changed to the opposite direction todecelerate the quadcopter to a haltThe shape of the calculated control inputs 1 and 3 in Figure 11 are similar toplanned jounce in Figure 10(a) The shape of the simulated angle _ follows theshape of the planned acceleration umlx The shapes of the control inputs and theangles differ from the planned values of the jounce and the acceleration because thedrag force caused by the velocity has to be compensated170 1 2 3 4 5 6 76203620462056206620762086209621

Time t (s)Control input i (rads)1234

Figure 11 Control inputs i0 1 2 3 4 5 6001020304050607

Time t (s)Position (m)Position xPosition yPosition z

Figure 12 Positions x y and z0 1 2 3 4 5 6 7minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 13 Angles _ _ and The method can also be used even if there are unmodeled linear forces wind forexample which affect the linear accelerations and consequently the position of thequadcopter If the trajectory is calculated in shorter distances it is possible tocorrect the trajectory with new calculation from the current but inaccurate locationto the next checkpoint Example of this method is presented in Figure 14 Thearrows with dash lines indicate the planned trajectory in the x y-plane and thesolid arrows indicate the realised trajectory The black squares mark the start and

the finish positions and the white squares mark the checkpoints for the trajectory18The control inputs are calculated from the current location of the quadcopter to thenext checkpoint but because of random and unmodelled forces the realised positionmarked with X differs from the planned If the quadcopter is close enough to thetarget checkpoint the target checkpoint is changed to the next one and new controlinputs are calculated After repeating this and going through all of the checkpointsthe quadcopter reaches the final destinationFigure 14 Example of checkpoint flight pattern with external disturbancesThe biggest weakness in the proposed method is that it works as shown only if thequadcopter starts from a stable attitude the angles _ and _ and their derivativesare zeros and there are no external forces influencing the attitude during the flightSmall deviations in the angles can result into a huge deviation in the trajectory Oneway to solve this problem is to stabilise the quadcopter at each checkpoint with aPD controller proposed earlier or by using the heuristic method to angles Howeverif the angular disturbances are continuous the benefit from temporary stabilisationis only momentary52 Integrated PD controllerAnother method to take into account the possible deviations in the angles is tointegrate a PD controller into the heuristic method This is a simplified version ofthe proposed control method in [5] The required values dx dy and dz in Equation(26) are given by the PD controller considering the deviations between the currentand desired values (subscript d) of the positions _ velocities _˙ and accelerations _umldx = KxP (xd minus x) + KxD (x˙ d minus x˙ ) + KxDD (xumld minus xuml) dy = KyP (yd minus y) + KyD (y˙d minus y˙) + KyDD (yumld minus yuml) dz = KzP (zd minus z) + KzD (z˙d minus z˙) + KzDD (zumld minus zuml) (29)Then the commanded angles _c and _c and thrust T are given by Equation (26)The torques _ are controlled by the PD controller in Equation (30) same as in

19Equation (23) The control inputs can be solved with the calculated thrust andtorques by using Equation (24)__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Ixx__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Iyy_ =_K P ( d minus ) + K D_˙ d minus ˙ __Izz(30)The performance of the PD controller is demonstrated with an example case inwhich for all positions x y and z and their derivatives the values are same as inFigure 10 The simulation is performed with the PD parameters presented in Table3Table 3 Parameters of the PD controllerVariable Parameter valuei KiP KiD KiDDx 185 075 100y 855 075 100z 185 075 100_ 300 075 -_ 300 075 - 300 075 -The results of the simulation are presented Figures 15 - 17 The simulated controlinputs are presented in Figure 15 the simulated positions in Figure 16 and the

simulated angles in Figure 17 The position of the quadcopter is close to the plannedposition after 6 seconds but the position keeps fluctuating close to the planned valuesfor several seconds The angles variate greatly during the simulation to achieve thewanted positions velocities and accelerations The values of the control inputsoscillated during the acceleration but then their behaviour became more stable0 2 4 6 8 10 12 14618619620621622623624625626

Time t (s)Control input i (rads)1234

Figure 15 Control inputs i200 2 4 6 8 10 12 14minus0100102030405060708

Time t (s)Position (m)Position xPosition yPosition z

Figure 16 Positions x y and z0 2 4 6 8 10 12 14minus15minus125minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 17 Angles _ _ and The proposed integrated PD controller performed well in the example case Howeverthe performance of the controller is highly depended on the parameter values If theparameter values are small the controller will not respond quickly enough to followthe planned trajectory If the parameter values are substantial the quadcopter cannot perform the required drastic changes in the angular velocities of the rotor andthe control inputs calculated from Equation (24) can be infeasible with certaintorques Thus the use of equations considering the torques and the control inputsrequires a method to calculate the best feasible torques and from them the bestcontrol inputs Another possible method would be to variate the PD parameters

according to the current positions and angles and their derivatives but it is extremelydifficult216 ConclusionThis paper studied mathematical modelling and control of a quadcopter The mathematicalmodel of quadcopter dynamics was presented and the differential equationswere derived from the Newton-Euler and the Euler-Lagrange equations The modelwas verified by simulating the flight of a quadcopter with Matlab Stabilisation ofattitude of the quadcopter was done by utilising a PD controller A heuristic methodwas developed to control the trajectory of the quadcopter The PD contoller wasintegrated into the heuristic method for better response to disturbances in the flightconditions of the quadcopterThe simulation proved the presented mathematical model to be realistic in modellingthe position and attitude of the quadcopter The simulation results also showedthat the PD controller was efficient in stabilising the quadcopter to the desiredaltitude and attitude However the PD controller did not considered positions xand y Thus the values of x and y variated from their original values during thestabilisation process This was a result of the deviation of the roll and pitch anglesfrom zero valuesAccording to the simulation results the proposed heuristic method produced goodflight trajectories The heuristic method required only three parameters to generatethe values for the jounce of the position The position and its other derivatives werecalculated from the jounce values The total thrust and the pitch and roll angles toachieve given accelerations were solved from the linear differential equations Thenthe torques were determined by the angular accelerations and angular velocitiescalculated from the angles Finally the required control inputs were solved from thetotal thrust and the torques The simulation results indicated that the quadcopter

could be controlled accurately with the control inputs given by the methodThe proposed heuristic method does not consider unmodelled disturbances suchas wind and thus the PD controller was integrated into the control method Theintegrated PD controller operated well in the example simulation The quadcopterfollowed the given trajectory and began to stabilise after reaching the final destinationHowever the PD controller can perform poorly if the parameter values arenot properly selected and are too small or highThe presented mathematical model only consists of the basic structures of the quadcopterdynamics Several aerodynamical effects were excluded which can lead tounrealiable behaviour Also the electric motors spinning the fours rotors were notmodelled The behaviour of a motor is easily included in the model but would requireestimation of the parameter values of the motor The position and attitudeinformation was assumed to be accurate in the model and the simulations Howeverthe measuring devices in real life are not perfectly accurate as random variationsand errors occur Hence the effects of imprecise information to the flight of thequadcopter should be studied as well Also methods to enhance the accuracy of themeasurements should be researched and implemented to improve all aspects required22for robust quadcopter manoeuvresThe presented model and control methods were tested only with simulations Realexperimental prototype of a quadcopter should be constructed to achieve more realisticand reliable results Even though the construction of a real quadcopter and theestimation of all the model parameters are laborious tasks a real quadcopter wouldbring significant benefits to the research With a real propotype the theoreticalframework and the simulation results could be compared to real-life measurementsThis paper did not include these higlighted matters in the study but presentedthe basics of quadcopter modelling and control This paper can thus be used as a

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

01 (15)which is equivalent with Equation (10)The Jacobian matrix J (_) from _ to _˙ isJ (_) = J =WT_ IW_=Ixx 0 minusIxxS_0 IyyC2_ + IzzS2_ (Iyy minus Izz)C_S_C_minusIxxS_ (Iyy minus Izz)C_S_C_ IxxS2_ + IyyS2_C2_ + IzzC2_C2_(16)Thus the rotational energy Erot can be expressed in the inertial frame asErot = (12) _T I _ = (12) uml_T J uml_ (17)The external angular force is the torques of the rotors The angular Euler-Lagrangeequations are_ = _B = J uml_ +ddt(J) _˙ minus12_1048576_˙T J _˙_= J _uml + C (_ _˙ ) _˙ (18)in which the matrix C (_ _˙ ) is the Coriolis term containing the gyroscopic andcentripetal terms6The matrix C (_ _˙ ) has the form as shown in [9]C (_ _˙ ) =

C11 C12 C13C21 C22 C23C31 C32 C33 C11 = 0C12 = (Iyy minus Izz)(˙_ C_S_ + ˙ S2_C_) + (Izz minus Iyy) ˙ C2_C_ minus Ixx ˙ C_C13 = (Izz minus Iyy) ˙ C_S_C2_C21 = (Izz minus Iyy)(˙_ C_S_ + ˙ S_C_) + (Iyy minus Izz) ˙ C2_C_ + Ixx ˙ C_C22 = (Izz minus Iyy)˙ _C_S_C23 = minusIxx ˙ S_C_ + Iyy ˙ S2_S_C_ + Izz ˙ C2_S_C_C31 = (Iyy minus Izz) ˙ C2_S_C_ minus Ixx _˙C_C32 = (Izz minus Iyy)(˙_ C_S_S_ + ˙_S2_C_) + (Iyy minus Izz)˙ _C2_C_+Ixx ˙ S_C_ minus Iyy ˙ S2_S_C_ minus Izz ˙ C2_S_C_C33 = (Iyy minus Izz)˙ _C_S_C2_ minus Iyy _˙S2_C_S_ minus Izz ˙_C2_C_S_ + Ixx ˙_C_S_(19)Equation (18) leads to the differential equations for the angular accelerations whichare equivalent with Equations (11) and (12)uml_ = Jminus1 (_B minus C (_ _˙ ) _˙ ) (20)23 Aerodynamical effectsThe preceding model is a simplification of complex dynamic interactions To enforcemore realistical behaviour of the quadcopter drag force generated by the airresistance is included This is devised to Equations (10) and (15) with the diagonalcoefficient matrix associating the linear velocities to the force slowing the movementas in [15]umlxumly

umlz = minusg001 +TmC S_C_ + S S_S S_C_ minus C S_C_C_minus1mAx 0 00 Ay 00 0 Azx˙y˙z˙ (21)in which Ax Ay and Az are the drag force coefficients for velocities in the correspondingdirections of the inertial frameSeveral other aerodynamical effects could be included in the model For exampledependence of thrust on angle of attack blade flapping and airflow distruptions havebeen studied in [1] and [2] The influence of aerodynamical effects are complicatedand the effects are difficult to model Also some of the effects have significant effectonly in high velocities Thus these effects are excluded from the model and thepresented simple model is used

73 SimulationThe mathematical model of the quadcopter is implemented for simulation in Matlab2010 with Matlab programming language Parameter values from [3] are used in thesimulations and are presented in Table 1 The values of the drag force coefficientsAx Ay and Az are selected such as the quadcopter will slow down and stop whenangles _ and _ are stabilised to zero valuesTable 1 Parameter values for simulationParameter Value Unitg 981 ms2m 0468 kgl 0225 mk 2980 10minus6b 1140 10minus7IM 3357 10minus5 kg m2Parameter Value UnitIxx 4856 10minus3 kg m2Iyy 4856 10minus3 kg m2Izz 8801 10minus3 kg m2Ax 025 kgsAy 025 kgsAz 025 kgsThe mathematical model is tested by simulating a quadcopter with an example caseas following The quadcopter is initially in a stable state in which the values of allpositions and angles are zero the body frame of the quadcopter is congruent withthe inertial frame The total thrust is equal to the hover thrust the thrust equal togravity The simulation progresses at 00001 second intervals to total elapsed timeof two seconds The control inputs the angular velocities of the four rotors areshown in Figure 2 the inertial positions x y and z in Figure 3 and the angles _ _and in Figure 4For the first 025 seconds the quadcopter ascended by increasing all of the rotorvelocities from the hover thrust Then the ascend is stopped by decreasing the rotorvelocities significantly for the following 025 seconds Consequently the quadcopterascended 01 meters in the first 05 seconds After the ascend the quadcopter is

stable againNext the quadcopter is put into a roll motion by increasing the velocity of thefourth rotor and decreasing the velocity of the second rotor for 025 seconds Theacceleration of the roll motion is stopped by decreasing the velocity of the fourthand increasing the velocity of the second rotor for 025 seconds Thus after 05seconds in roll motion the roll angle _ had increased approx 25 degrees Becauseof the roll angle the quadcopter accelerated in the direction of the negative y-axisThen similar to the roll motion a pitch motion is created by increasing the velocityof the third rotor and decreasing the velocity of the first The motion is stoppedby decreasing the velocity of the third rotor and increasing the velocity of the firstrotor Due to the pitch movement the pitch angle _ had increased approximately822 degrees The acceleration of the quadcopter in the direction of the positive x-axisis caused by the pitch angleFinally the quadcopter is turned in the direction of the yaw angle by increasingthe velocities of the first and the third rotors and decreasing the velocities of thesecond and the fourth rotors The yaw motion is stopped by decreasing the velocitiesof the first and the third rotors and increasing the velocities of the second and thefourth rotors Consequently the yaw angle increases approximately 10 degreesDuring the whole simulation the total thrust of the rotors had remained close to theinitial total thrust Thus the deviations of the roll and pitch angles from the zerovalues decrease the value of the thrust in the direction of the z-axis Consequentlythe quadcopter accelerates in the direction of the negative z-axis and is descending0 02 04 06 08 1 12 14 16 18 2550575600625650675700Time t (s)Control input i (rads)1234

Figure 2 Control inputs i0 02 04 06 08 1 12 14 16 18 2

minus25minus2minus15minus1minus05005115Time t (s)Position (m)Position xPosition yPosition z

Figure 3 Positions x y and z90 02 04 06 08 1 12 14 16 18 2minus5051015202530Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 4 Angles _ _ and 104 Stabilisation of quadcopterTo stabilise the quadcopter a PID controller is utilised Advantages of the PIDcontroller are the simple structure and easy implementation of the controller Thegeneral form of the PID controller ise(t) = xd(t) minus x(t)u(t) = KP e(t) + KIZ t0e(_ ) d _ + KDd e(t)d t [16](22)in which u(t) is the control input e(t) is the difference between the desired statexd(t) and the present state x(t) and KP KI and KD are the parameters for theproportional integral and derivative elements of the PID controllerIn a quadcopter there are six states positions _ and angles _ but only four controlinputs the angular velocities of the four rotors i The interactions between thestates and the total thrust T and the torques _ created by the rotors are visible fromthe quadcopter dynamics defined by Equations (10) (11) and (12) The total thrustT affects the acceleration in the direction of the z-axis and holds the quadcopter inthe air Torque __ has an affect on the acceleration of angle _ torque __ affects theacceleration of angle _ and torque _ contributes in the acceleration of angle

Hence the PD controller for the quadcopter is chosen as similarly as in [4]T = (g + KzD (z˙d minus z˙) + KzP (zd minus z)) mC_C___ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Ixx__ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Iyy_ =_K D_ ˙d minus ˙ _+ K P ( d minus )_Izz(23)in which also the gravity g and mass m and moments of inertia I of the quadcopterare consideredThe correct angular velocities of rotors i can be calculated from Equations (7) and(8) with values from Equation (23)21 = T4kminus __2klminus_ 4b22 = T

4kminus__2kl+_ 4b23 = T4k+ __2klminus_ 4b24 = T4k+__2kl+_ 4b(24)The performance of the PD controller is tested by simulating the stabilisation ofa quadcopter The PD controller parameters are presented in Table 2 The initialcondition of the quadcopter is for position _ = [0 0 1]T in meters and for angles11_ = [10 10 10]T in degrees The desired position for altitude is zd = 0 The purposeof the stabilisation is stable hovering thus _d = [0 0 0]TTable 2 Parameters of the PD controllerParameter ValueKzD 25K_D 175K_D 175K D 175Parameter ValueKzP 15K_P 6K_P 6K P 6The control inputs i the positions _ and the angles _ during the simulation are

presented in Figures 5 6 and 7 The altitude and the angles are stabilised to zerovalue after 5 seconds However the positions x and y deviated from the zero valuesbecause of the non-zero values of the angles Before the quadcopter is stabilisedto hover it has already moved over 1 meters in the direction of the positive x axisand 05 meters in the direction of the negative y axis This is because the controlmethod of the PD contoller does not consider the accelerations in the directions ofx and y Thus another control method should be constructed to give a control onall of positions and angles of the quadcopter0 1 2 3 4 5 6550560570580590600610620630

Time t (s)Control input i (rads)1234

Figure 5 Control inputs i0 1 2 3 4 5 6minus06minus04minus02002040608112

Time t (s)Position (m)Position xPosition yPosition z

Figure 6 Positions x y and z120 1 2 3 4 5 6minus20246810

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 7 Angles _ _ and 135 Trajectory controlThe purpose of trajectory control is to move the quadcopter from the original locationto the desired location by controlling the rotor velocities of the quadcopterFinding optimal trajectory for a quadcopter is a difficult task because of complexdynamics However a simple control method is able to control the quadcopteradequately Thus a heuristic approach is studied and developed hereThe basis of the development of a control method is the study of the interactions and

dependances between states state derivatives and control inputs These interactionsand dependances are defined by Equations (7) (8) (20) and (21) and presented inFigure 8The given control inputs i define the total thrust T and the torques __ __ and _ The torques affect the angular accelerations depending on the current angles andangular velocities The angles _ can be integrated from the angular velocities _˙ which are integrated from the angular accelerations uml_ The linear accelerations uml_depend on the total thrust T the angles _ and the linear velocities _˙ The linearposition _ is integrated from the linear accelerations uml_ through the linear velocities_˙Hence to find proper control inputs i for given states _ this line of thought has tobe done in reverse___HHHjT_-- _uml - _˙ - _I K_uml - _˙ - _IFigure 8 Interactions between states state derivatives and control inputsOne method is to generate linear accelerations which accomplish the wanted trajectoryaccording to positions x y and z for each time t From Equation (21) threeequations are receivedTB =00T = RT

muml_ +00g +Ax 0 00 Ay 00 0 Az _˙ (25)in which _uml _˙ and are desired trajectory values as well as angles _ and _ and totalthrust T are unknown values to be solvedFrom this equation the required angles _ and _ and the total thrust T for each timet can be calculated as shown in [5]14_ = arcsin dx S minus dy C d2x + d2y + (dz + g)2_ = arctan_dx C + dy S dz + g_T = m(dx (S_C C_ + S S_) + dy (S_S C_ minus C S_)+( dz + g )C_C_) (26)in whichdx = xuml + Axx˙mdy = yuml+ Ayy˙mdz = zuml+ Azz˙m(27)

When the values of the angles _ and _ are known the angular velocities and accelerationscan be calculated from them with simple derivation With the angularvelocities and accelerations the torques _ can be solved from Equation (20) Whenthe torques and thrust are known the control inputs i can be calculated fromEquation (24)51 Heuristic method for trajectory generationThe generation of proper accelerations uml_ is difficult because the composition of thethird and fourth derivatives of the position jerk and jounce has to be reasonableThe influence of the jounce values is visible in the composition of the control inputsi High jounce values will mean high control input values and thus the jounceshave to be considered closely when generating the accelerationsA heuristic method can be used to generate jounce values The method utilises asymmetric structure in jouce function f(t) to control the derivatives One influencialpart of the function is defined by three sine functions as followingf(t) =a sin10485761b _ t_ 0 le t le bminusa sin10485761b _ t minus __ b le t le 3ba sin10485761b _ t minus 3__ 3b le t le 4b(28)The structure of the function is visualised in Figure 9 The sine functions are usedto give a smooth function These three sine functions form a function in whichthe first half increases acceleration to certain value and then the second half of the

function decreases it back to zero This acceleration generates constant velocityMirror image of the function can be used to decelerate the velocity back to zeroThe final position depends on the parameters a and b of the sine functions presented15in Equation (28) and the time c between the accelerating part and the deceleratingpart the mirror image of the jounceaaab2bba sin10485761b _ t_minusa sin1048576 12b _ t minus __a sin10485761b _ t minus 3__Jounce (ms4)Time t (s)Figure 9 Heuristic method for the generation of jounce functionsUnfortunately the method does not give optimal trajectories Thus a dynamicoptimisation model and a suitable algorithm would be needed to calculate optimallythe trajectory of the quadcopter However the method presented is easy to use togenerate proper values of jounce which will achieve the wanted trajectoryThe functionality of the method is studied with an example simulation Jounce ofposition x is created according to Equation (28) with parameters a = 1 b = 05and c = 2 The position x and its derivatives derived from the planned jounce arepresented in Figure 10 The jounce could also be generated simultaneously for y andz However in this example only position x is considered because the relationship

between the jounce of position x and the control inputs 1 and 3 controlling theangle _ is more visible160 1 2 3 4 5 6 7minus1minus08minus06minus04minus020020406081Time t (s)Jounce (ms4)

(a) Jounce0 1 2 3 4 5 6 7minus04minus03minus02minus01001020304

Time t (s)Jerk (ms3)

(b) Jerk0 1 2 3 4 5 6 7minus02minus015minus01minus00500050101502Time t (s)Acceleration (ms2)

(c) Acceleration0 1 2 3 4 5 6 7minus002000200400600801012014016018

Time t (s)Velocity (ms)

(d) Velocity0 1 2 3 4 5 6 7001020304050607

Time t (s)Position (m)

(e) PositionFigure 10 Planned position x and its derivatives with given jounceThe simulation of the example case is performed with previously given accelerationsand velocities of position x The planned value of angle is zero for each time tFirst the required angles _ and _ and thrust T are solved from Equation (26) foreach time t The angular velocities and accelerations are calculated from the solvedangles with derivation Then the torques are solved using the angular velocitiesand accelerations Finally the control inputs are solved Then the simulation isperformed with given control inputsThe calculated control inputs are presented in Figure 11 The simulated positions_ are presented in Figure 12 and the simulated angles _ in Figure 13 Accordingto Figure 12 the simulated position x is the same as the planned position x inFigure 10(e) and the values of the positions y and z stay as zeroes The angle _increases during the acceleration and then stabilises to a constant value to generate

the constant acceleration required to compensate the drag force caused by theplanned constant velocity Finally the angle is changed to the opposite direction todecelerate the quadcopter to a haltThe shape of the calculated control inputs 1 and 3 in Figure 11 are similar toplanned jounce in Figure 10(a) The shape of the simulated angle _ follows theshape of the planned acceleration umlx The shapes of the control inputs and theangles differ from the planned values of the jounce and the acceleration because thedrag force caused by the velocity has to be compensated170 1 2 3 4 5 6 76203620462056206620762086209621

Time t (s)Control input i (rads)1234

Figure 11 Control inputs i0 1 2 3 4 5 6001020304050607

Time t (s)Position (m)Position xPosition yPosition z

Figure 12 Positions x y and z0 1 2 3 4 5 6 7minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 13 Angles _ _ and The method can also be used even if there are unmodeled linear forces wind forexample which affect the linear accelerations and consequently the position of thequadcopter If the trajectory is calculated in shorter distances it is possible tocorrect the trajectory with new calculation from the current but inaccurate locationto the next checkpoint Example of this method is presented in Figure 14 Thearrows with dash lines indicate the planned trajectory in the x y-plane and thesolid arrows indicate the realised trajectory The black squares mark the start and

the finish positions and the white squares mark the checkpoints for the trajectory18The control inputs are calculated from the current location of the quadcopter to thenext checkpoint but because of random and unmodelled forces the realised positionmarked with X differs from the planned If the quadcopter is close enough to thetarget checkpoint the target checkpoint is changed to the next one and new controlinputs are calculated After repeating this and going through all of the checkpointsthe quadcopter reaches the final destinationFigure 14 Example of checkpoint flight pattern with external disturbancesThe biggest weakness in the proposed method is that it works as shown only if thequadcopter starts from a stable attitude the angles _ and _ and their derivativesare zeros and there are no external forces influencing the attitude during the flightSmall deviations in the angles can result into a huge deviation in the trajectory Oneway to solve this problem is to stabilise the quadcopter at each checkpoint with aPD controller proposed earlier or by using the heuristic method to angles Howeverif the angular disturbances are continuous the benefit from temporary stabilisationis only momentary52 Integrated PD controllerAnother method to take into account the possible deviations in the angles is tointegrate a PD controller into the heuristic method This is a simplified version ofthe proposed control method in [5] The required values dx dy and dz in Equation(26) are given by the PD controller considering the deviations between the currentand desired values (subscript d) of the positions _ velocities _˙ and accelerations _umldx = KxP (xd minus x) + KxD (x˙ d minus x˙ ) + KxDD (xumld minus xuml) dy = KyP (yd minus y) + KyD (y˙d minus y˙) + KyDD (yumld minus yuml) dz = KzP (zd minus z) + KzD (z˙d minus z˙) + KzDD (zumld minus zuml) (29)Then the commanded angles _c and _c and thrust T are given by Equation (26)The torques _ are controlled by the PD controller in Equation (30) same as in

19Equation (23) The control inputs can be solved with the calculated thrust andtorques by using Equation (24)__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Ixx__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Iyy_ =_K P ( d minus ) + K D_˙ d minus ˙ __Izz(30)The performance of the PD controller is demonstrated with an example case inwhich for all positions x y and z and their derivatives the values are same as inFigure 10 The simulation is performed with the PD parameters presented in Table3Table 3 Parameters of the PD controllerVariable Parameter valuei KiP KiD KiDDx 185 075 100y 855 075 100z 185 075 100_ 300 075 -_ 300 075 - 300 075 -The results of the simulation are presented Figures 15 - 17 The simulated controlinputs are presented in Figure 15 the simulated positions in Figure 16 and the

simulated angles in Figure 17 The position of the quadcopter is close to the plannedposition after 6 seconds but the position keeps fluctuating close to the planned valuesfor several seconds The angles variate greatly during the simulation to achieve thewanted positions velocities and accelerations The values of the control inputsoscillated during the acceleration but then their behaviour became more stable0 2 4 6 8 10 12 14618619620621622623624625626

Time t (s)Control input i (rads)1234

Figure 15 Control inputs i200 2 4 6 8 10 12 14minus0100102030405060708

Time t (s)Position (m)Position xPosition yPosition z

Figure 16 Positions x y and z0 2 4 6 8 10 12 14minus15minus125minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 17 Angles _ _ and The proposed integrated PD controller performed well in the example case Howeverthe performance of the controller is highly depended on the parameter values If theparameter values are small the controller will not respond quickly enough to followthe planned trajectory If the parameter values are substantial the quadcopter cannot perform the required drastic changes in the angular velocities of the rotor andthe control inputs calculated from Equation (24) can be infeasible with certaintorques Thus the use of equations considering the torques and the control inputsrequires a method to calculate the best feasible torques and from them the bestcontrol inputs Another possible method would be to variate the PD parameters

according to the current positions and angles and their derivatives but it is extremelydifficult216 ConclusionThis paper studied mathematical modelling and control of a quadcopter The mathematicalmodel of quadcopter dynamics was presented and the differential equationswere derived from the Newton-Euler and the Euler-Lagrange equations The modelwas verified by simulating the flight of a quadcopter with Matlab Stabilisation ofattitude of the quadcopter was done by utilising a PD controller A heuristic methodwas developed to control the trajectory of the quadcopter The PD contoller wasintegrated into the heuristic method for better response to disturbances in the flightconditions of the quadcopterThe simulation proved the presented mathematical model to be realistic in modellingthe position and attitude of the quadcopter The simulation results also showedthat the PD controller was efficient in stabilising the quadcopter to the desiredaltitude and attitude However the PD controller did not considered positions xand y Thus the values of x and y variated from their original values during thestabilisation process This was a result of the deviation of the roll and pitch anglesfrom zero valuesAccording to the simulation results the proposed heuristic method produced goodflight trajectories The heuristic method required only three parameters to generatethe values for the jounce of the position The position and its other derivatives werecalculated from the jounce values The total thrust and the pitch and roll angles toachieve given accelerations were solved from the linear differential equations Thenthe torques were determined by the angular accelerations and angular velocitiescalculated from the angles Finally the required control inputs were solved from thetotal thrust and the torques The simulation results indicated that the quadcopter

could be controlled accurately with the control inputs given by the methodThe proposed heuristic method does not consider unmodelled disturbances suchas wind and thus the PD controller was integrated into the control method Theintegrated PD controller operated well in the example simulation The quadcopterfollowed the given trajectory and began to stabilise after reaching the final destinationHowever the PD controller can perform poorly if the parameter values arenot properly selected and are too small or highThe presented mathematical model only consists of the basic structures of the quadcopterdynamics Several aerodynamical effects were excluded which can lead tounrealiable behaviour Also the electric motors spinning the fours rotors were notmodelled The behaviour of a motor is easily included in the model but would requireestimation of the parameter values of the motor The position and attitudeinformation was assumed to be accurate in the model and the simulations Howeverthe measuring devices in real life are not perfectly accurate as random variationsand errors occur Hence the effects of imprecise information to the flight of thequadcopter should be studied as well Also methods to enhance the accuracy of themeasurements should be researched and implemented to improve all aspects required22for robust quadcopter manoeuvresThe presented model and control methods were tested only with simulations Realexperimental prototype of a quadcopter should be constructed to achieve more realisticand reliable results Even though the construction of a real quadcopter and theestimation of all the model parameters are laborious tasks a real quadcopter wouldbring significant benefits to the research With a real propotype the theoreticalframework and the simulation results could be compared to real-life measurementsThis paper did not include these higlighted matters in the study but presentedthe basics of quadcopter modelling and control This paper can thus be used as a

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

C11 C12 C13C21 C22 C23C31 C32 C33 C11 = 0C12 = (Iyy minus Izz)(˙_ C_S_ + ˙ S2_C_) + (Izz minus Iyy) ˙ C2_C_ minus Ixx ˙ C_C13 = (Izz minus Iyy) ˙ C_S_C2_C21 = (Izz minus Iyy)(˙_ C_S_ + ˙ S_C_) + (Iyy minus Izz) ˙ C2_C_ + Ixx ˙ C_C22 = (Izz minus Iyy)˙ _C_S_C23 = minusIxx ˙ S_C_ + Iyy ˙ S2_S_C_ + Izz ˙ C2_S_C_C31 = (Iyy minus Izz) ˙ C2_S_C_ minus Ixx _˙C_C32 = (Izz minus Iyy)(˙_ C_S_S_ + ˙_S2_C_) + (Iyy minus Izz)˙ _C2_C_+Ixx ˙ S_C_ minus Iyy ˙ S2_S_C_ minus Izz ˙ C2_S_C_C33 = (Iyy minus Izz)˙ _C_S_C2_ minus Iyy _˙S2_C_S_ minus Izz ˙_C2_C_S_ + Ixx ˙_C_S_(19)Equation (18) leads to the differential equations for the angular accelerations whichare equivalent with Equations (11) and (12)uml_ = Jminus1 (_B minus C (_ _˙ ) _˙ ) (20)23 Aerodynamical effectsThe preceding model is a simplification of complex dynamic interactions To enforcemore realistical behaviour of the quadcopter drag force generated by the airresistance is included This is devised to Equations (10) and (15) with the diagonalcoefficient matrix associating the linear velocities to the force slowing the movementas in [15]umlxumly

umlz = minusg001 +TmC S_C_ + S S_S S_C_ minus C S_C_C_minus1mAx 0 00 Ay 00 0 Azx˙y˙z˙ (21)in which Ax Ay and Az are the drag force coefficients for velocities in the correspondingdirections of the inertial frameSeveral other aerodynamical effects could be included in the model For exampledependence of thrust on angle of attack blade flapping and airflow distruptions havebeen studied in [1] and [2] The influence of aerodynamical effects are complicatedand the effects are difficult to model Also some of the effects have significant effectonly in high velocities Thus these effects are excluded from the model and thepresented simple model is used

73 SimulationThe mathematical model of the quadcopter is implemented for simulation in Matlab2010 with Matlab programming language Parameter values from [3] are used in thesimulations and are presented in Table 1 The values of the drag force coefficientsAx Ay and Az are selected such as the quadcopter will slow down and stop whenangles _ and _ are stabilised to zero valuesTable 1 Parameter values for simulationParameter Value Unitg 981 ms2m 0468 kgl 0225 mk 2980 10minus6b 1140 10minus7IM 3357 10minus5 kg m2Parameter Value UnitIxx 4856 10minus3 kg m2Iyy 4856 10minus3 kg m2Izz 8801 10minus3 kg m2Ax 025 kgsAy 025 kgsAz 025 kgsThe mathematical model is tested by simulating a quadcopter with an example caseas following The quadcopter is initially in a stable state in which the values of allpositions and angles are zero the body frame of the quadcopter is congruent withthe inertial frame The total thrust is equal to the hover thrust the thrust equal togravity The simulation progresses at 00001 second intervals to total elapsed timeof two seconds The control inputs the angular velocities of the four rotors areshown in Figure 2 the inertial positions x y and z in Figure 3 and the angles _ _and in Figure 4For the first 025 seconds the quadcopter ascended by increasing all of the rotorvelocities from the hover thrust Then the ascend is stopped by decreasing the rotorvelocities significantly for the following 025 seconds Consequently the quadcopterascended 01 meters in the first 05 seconds After the ascend the quadcopter is

stable againNext the quadcopter is put into a roll motion by increasing the velocity of thefourth rotor and decreasing the velocity of the second rotor for 025 seconds Theacceleration of the roll motion is stopped by decreasing the velocity of the fourthand increasing the velocity of the second rotor for 025 seconds Thus after 05seconds in roll motion the roll angle _ had increased approx 25 degrees Becauseof the roll angle the quadcopter accelerated in the direction of the negative y-axisThen similar to the roll motion a pitch motion is created by increasing the velocityof the third rotor and decreasing the velocity of the first The motion is stoppedby decreasing the velocity of the third rotor and increasing the velocity of the firstrotor Due to the pitch movement the pitch angle _ had increased approximately822 degrees The acceleration of the quadcopter in the direction of the positive x-axisis caused by the pitch angleFinally the quadcopter is turned in the direction of the yaw angle by increasingthe velocities of the first and the third rotors and decreasing the velocities of thesecond and the fourth rotors The yaw motion is stopped by decreasing the velocitiesof the first and the third rotors and increasing the velocities of the second and thefourth rotors Consequently the yaw angle increases approximately 10 degreesDuring the whole simulation the total thrust of the rotors had remained close to theinitial total thrust Thus the deviations of the roll and pitch angles from the zerovalues decrease the value of the thrust in the direction of the z-axis Consequentlythe quadcopter accelerates in the direction of the negative z-axis and is descending0 02 04 06 08 1 12 14 16 18 2550575600625650675700Time t (s)Control input i (rads)1234

Figure 2 Control inputs i0 02 04 06 08 1 12 14 16 18 2

minus25minus2minus15minus1minus05005115Time t (s)Position (m)Position xPosition yPosition z

Figure 3 Positions x y and z90 02 04 06 08 1 12 14 16 18 2minus5051015202530Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 4 Angles _ _ and 104 Stabilisation of quadcopterTo stabilise the quadcopter a PID controller is utilised Advantages of the PIDcontroller are the simple structure and easy implementation of the controller Thegeneral form of the PID controller ise(t) = xd(t) minus x(t)u(t) = KP e(t) + KIZ t0e(_ ) d _ + KDd e(t)d t [16](22)in which u(t) is the control input e(t) is the difference between the desired statexd(t) and the present state x(t) and KP KI and KD are the parameters for theproportional integral and derivative elements of the PID controllerIn a quadcopter there are six states positions _ and angles _ but only four controlinputs the angular velocities of the four rotors i The interactions between thestates and the total thrust T and the torques _ created by the rotors are visible fromthe quadcopter dynamics defined by Equations (10) (11) and (12) The total thrustT affects the acceleration in the direction of the z-axis and holds the quadcopter inthe air Torque __ has an affect on the acceleration of angle _ torque __ affects theacceleration of angle _ and torque _ contributes in the acceleration of angle

Hence the PD controller for the quadcopter is chosen as similarly as in [4]T = (g + KzD (z˙d minus z˙) + KzP (zd minus z)) mC_C___ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Ixx__ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Iyy_ =_K D_ ˙d minus ˙ _+ K P ( d minus )_Izz(23)in which also the gravity g and mass m and moments of inertia I of the quadcopterare consideredThe correct angular velocities of rotors i can be calculated from Equations (7) and(8) with values from Equation (23)21 = T4kminus __2klminus_ 4b22 = T

4kminus__2kl+_ 4b23 = T4k+ __2klminus_ 4b24 = T4k+__2kl+_ 4b(24)The performance of the PD controller is tested by simulating the stabilisation ofa quadcopter The PD controller parameters are presented in Table 2 The initialcondition of the quadcopter is for position _ = [0 0 1]T in meters and for angles11_ = [10 10 10]T in degrees The desired position for altitude is zd = 0 The purposeof the stabilisation is stable hovering thus _d = [0 0 0]TTable 2 Parameters of the PD controllerParameter ValueKzD 25K_D 175K_D 175K D 175Parameter ValueKzP 15K_P 6K_P 6K P 6The control inputs i the positions _ and the angles _ during the simulation are

presented in Figures 5 6 and 7 The altitude and the angles are stabilised to zerovalue after 5 seconds However the positions x and y deviated from the zero valuesbecause of the non-zero values of the angles Before the quadcopter is stabilisedto hover it has already moved over 1 meters in the direction of the positive x axisand 05 meters in the direction of the negative y axis This is because the controlmethod of the PD contoller does not consider the accelerations in the directions ofx and y Thus another control method should be constructed to give a control onall of positions and angles of the quadcopter0 1 2 3 4 5 6550560570580590600610620630

Time t (s)Control input i (rads)1234

Figure 5 Control inputs i0 1 2 3 4 5 6minus06minus04minus02002040608112

Time t (s)Position (m)Position xPosition yPosition z

Figure 6 Positions x y and z120 1 2 3 4 5 6minus20246810

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 7 Angles _ _ and 135 Trajectory controlThe purpose of trajectory control is to move the quadcopter from the original locationto the desired location by controlling the rotor velocities of the quadcopterFinding optimal trajectory for a quadcopter is a difficult task because of complexdynamics However a simple control method is able to control the quadcopteradequately Thus a heuristic approach is studied and developed hereThe basis of the development of a control method is the study of the interactions and

dependances between states state derivatives and control inputs These interactionsand dependances are defined by Equations (7) (8) (20) and (21) and presented inFigure 8The given control inputs i define the total thrust T and the torques __ __ and _ The torques affect the angular accelerations depending on the current angles andangular velocities The angles _ can be integrated from the angular velocities _˙ which are integrated from the angular accelerations uml_ The linear accelerations uml_depend on the total thrust T the angles _ and the linear velocities _˙ The linearposition _ is integrated from the linear accelerations uml_ through the linear velocities_˙Hence to find proper control inputs i for given states _ this line of thought has tobe done in reverse___HHHjT_-- _uml - _˙ - _I K_uml - _˙ - _IFigure 8 Interactions between states state derivatives and control inputsOne method is to generate linear accelerations which accomplish the wanted trajectoryaccording to positions x y and z for each time t From Equation (21) threeequations are receivedTB =00T = RT

muml_ +00g +Ax 0 00 Ay 00 0 Az _˙ (25)in which _uml _˙ and are desired trajectory values as well as angles _ and _ and totalthrust T are unknown values to be solvedFrom this equation the required angles _ and _ and the total thrust T for each timet can be calculated as shown in [5]14_ = arcsin dx S minus dy C d2x + d2y + (dz + g)2_ = arctan_dx C + dy S dz + g_T = m(dx (S_C C_ + S S_) + dy (S_S C_ minus C S_)+( dz + g )C_C_) (26)in whichdx = xuml + Axx˙mdy = yuml+ Ayy˙mdz = zuml+ Azz˙m(27)

When the values of the angles _ and _ are known the angular velocities and accelerationscan be calculated from them with simple derivation With the angularvelocities and accelerations the torques _ can be solved from Equation (20) Whenthe torques and thrust are known the control inputs i can be calculated fromEquation (24)51 Heuristic method for trajectory generationThe generation of proper accelerations uml_ is difficult because the composition of thethird and fourth derivatives of the position jerk and jounce has to be reasonableThe influence of the jounce values is visible in the composition of the control inputsi High jounce values will mean high control input values and thus the jounceshave to be considered closely when generating the accelerationsA heuristic method can be used to generate jounce values The method utilises asymmetric structure in jouce function f(t) to control the derivatives One influencialpart of the function is defined by three sine functions as followingf(t) =a sin10485761b _ t_ 0 le t le bminusa sin10485761b _ t minus __ b le t le 3ba sin10485761b _ t minus 3__ 3b le t le 4b(28)The structure of the function is visualised in Figure 9 The sine functions are usedto give a smooth function These three sine functions form a function in whichthe first half increases acceleration to certain value and then the second half of the

function decreases it back to zero This acceleration generates constant velocityMirror image of the function can be used to decelerate the velocity back to zeroThe final position depends on the parameters a and b of the sine functions presented15in Equation (28) and the time c between the accelerating part and the deceleratingpart the mirror image of the jounceaaab2bba sin10485761b _ t_minusa sin1048576 12b _ t minus __a sin10485761b _ t minus 3__Jounce (ms4)Time t (s)Figure 9 Heuristic method for the generation of jounce functionsUnfortunately the method does not give optimal trajectories Thus a dynamicoptimisation model and a suitable algorithm would be needed to calculate optimallythe trajectory of the quadcopter However the method presented is easy to use togenerate proper values of jounce which will achieve the wanted trajectoryThe functionality of the method is studied with an example simulation Jounce ofposition x is created according to Equation (28) with parameters a = 1 b = 05and c = 2 The position x and its derivatives derived from the planned jounce arepresented in Figure 10 The jounce could also be generated simultaneously for y andz However in this example only position x is considered because the relationship

between the jounce of position x and the control inputs 1 and 3 controlling theangle _ is more visible160 1 2 3 4 5 6 7minus1minus08minus06minus04minus020020406081Time t (s)Jounce (ms4)

(a) Jounce0 1 2 3 4 5 6 7minus04minus03minus02minus01001020304

Time t (s)Jerk (ms3)

(b) Jerk0 1 2 3 4 5 6 7minus02minus015minus01minus00500050101502Time t (s)Acceleration (ms2)

(c) Acceleration0 1 2 3 4 5 6 7minus002000200400600801012014016018

Time t (s)Velocity (ms)

(d) Velocity0 1 2 3 4 5 6 7001020304050607

Time t (s)Position (m)

(e) PositionFigure 10 Planned position x and its derivatives with given jounceThe simulation of the example case is performed with previously given accelerationsand velocities of position x The planned value of angle is zero for each time tFirst the required angles _ and _ and thrust T are solved from Equation (26) foreach time t The angular velocities and accelerations are calculated from the solvedangles with derivation Then the torques are solved using the angular velocitiesand accelerations Finally the control inputs are solved Then the simulation isperformed with given control inputsThe calculated control inputs are presented in Figure 11 The simulated positions_ are presented in Figure 12 and the simulated angles _ in Figure 13 Accordingto Figure 12 the simulated position x is the same as the planned position x inFigure 10(e) and the values of the positions y and z stay as zeroes The angle _increases during the acceleration and then stabilises to a constant value to generate

the constant acceleration required to compensate the drag force caused by theplanned constant velocity Finally the angle is changed to the opposite direction todecelerate the quadcopter to a haltThe shape of the calculated control inputs 1 and 3 in Figure 11 are similar toplanned jounce in Figure 10(a) The shape of the simulated angle _ follows theshape of the planned acceleration umlx The shapes of the control inputs and theangles differ from the planned values of the jounce and the acceleration because thedrag force caused by the velocity has to be compensated170 1 2 3 4 5 6 76203620462056206620762086209621

Time t (s)Control input i (rads)1234

Figure 11 Control inputs i0 1 2 3 4 5 6001020304050607

Time t (s)Position (m)Position xPosition yPosition z

Figure 12 Positions x y and z0 1 2 3 4 5 6 7minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 13 Angles _ _ and The method can also be used even if there are unmodeled linear forces wind forexample which affect the linear accelerations and consequently the position of thequadcopter If the trajectory is calculated in shorter distances it is possible tocorrect the trajectory with new calculation from the current but inaccurate locationto the next checkpoint Example of this method is presented in Figure 14 Thearrows with dash lines indicate the planned trajectory in the x y-plane and thesolid arrows indicate the realised trajectory The black squares mark the start and

the finish positions and the white squares mark the checkpoints for the trajectory18The control inputs are calculated from the current location of the quadcopter to thenext checkpoint but because of random and unmodelled forces the realised positionmarked with X differs from the planned If the quadcopter is close enough to thetarget checkpoint the target checkpoint is changed to the next one and new controlinputs are calculated After repeating this and going through all of the checkpointsthe quadcopter reaches the final destinationFigure 14 Example of checkpoint flight pattern with external disturbancesThe biggest weakness in the proposed method is that it works as shown only if thequadcopter starts from a stable attitude the angles _ and _ and their derivativesare zeros and there are no external forces influencing the attitude during the flightSmall deviations in the angles can result into a huge deviation in the trajectory Oneway to solve this problem is to stabilise the quadcopter at each checkpoint with aPD controller proposed earlier or by using the heuristic method to angles Howeverif the angular disturbances are continuous the benefit from temporary stabilisationis only momentary52 Integrated PD controllerAnother method to take into account the possible deviations in the angles is tointegrate a PD controller into the heuristic method This is a simplified version ofthe proposed control method in [5] The required values dx dy and dz in Equation(26) are given by the PD controller considering the deviations between the currentand desired values (subscript d) of the positions _ velocities _˙ and accelerations _umldx = KxP (xd minus x) + KxD (x˙ d minus x˙ ) + KxDD (xumld minus xuml) dy = KyP (yd minus y) + KyD (y˙d minus y˙) + KyDD (yumld minus yuml) dz = KzP (zd minus z) + KzD (z˙d minus z˙) + KzDD (zumld minus zuml) (29)Then the commanded angles _c and _c and thrust T are given by Equation (26)The torques _ are controlled by the PD controller in Equation (30) same as in

19Equation (23) The control inputs can be solved with the calculated thrust andtorques by using Equation (24)__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Ixx__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Iyy_ =_K P ( d minus ) + K D_˙ d minus ˙ __Izz(30)The performance of the PD controller is demonstrated with an example case inwhich for all positions x y and z and their derivatives the values are same as inFigure 10 The simulation is performed with the PD parameters presented in Table3Table 3 Parameters of the PD controllerVariable Parameter valuei KiP KiD KiDDx 185 075 100y 855 075 100z 185 075 100_ 300 075 -_ 300 075 - 300 075 -The results of the simulation are presented Figures 15 - 17 The simulated controlinputs are presented in Figure 15 the simulated positions in Figure 16 and the

simulated angles in Figure 17 The position of the quadcopter is close to the plannedposition after 6 seconds but the position keeps fluctuating close to the planned valuesfor several seconds The angles variate greatly during the simulation to achieve thewanted positions velocities and accelerations The values of the control inputsoscillated during the acceleration but then their behaviour became more stable0 2 4 6 8 10 12 14618619620621622623624625626

Time t (s)Control input i (rads)1234

Figure 15 Control inputs i200 2 4 6 8 10 12 14minus0100102030405060708

Time t (s)Position (m)Position xPosition yPosition z

Figure 16 Positions x y and z0 2 4 6 8 10 12 14minus15minus125minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 17 Angles _ _ and The proposed integrated PD controller performed well in the example case Howeverthe performance of the controller is highly depended on the parameter values If theparameter values are small the controller will not respond quickly enough to followthe planned trajectory If the parameter values are substantial the quadcopter cannot perform the required drastic changes in the angular velocities of the rotor andthe control inputs calculated from Equation (24) can be infeasible with certaintorques Thus the use of equations considering the torques and the control inputsrequires a method to calculate the best feasible torques and from them the bestcontrol inputs Another possible method would be to variate the PD parameters

according to the current positions and angles and their derivatives but it is extremelydifficult216 ConclusionThis paper studied mathematical modelling and control of a quadcopter The mathematicalmodel of quadcopter dynamics was presented and the differential equationswere derived from the Newton-Euler and the Euler-Lagrange equations The modelwas verified by simulating the flight of a quadcopter with Matlab Stabilisation ofattitude of the quadcopter was done by utilising a PD controller A heuristic methodwas developed to control the trajectory of the quadcopter The PD contoller wasintegrated into the heuristic method for better response to disturbances in the flightconditions of the quadcopterThe simulation proved the presented mathematical model to be realistic in modellingthe position and attitude of the quadcopter The simulation results also showedthat the PD controller was efficient in stabilising the quadcopter to the desiredaltitude and attitude However the PD controller did not considered positions xand y Thus the values of x and y variated from their original values during thestabilisation process This was a result of the deviation of the roll and pitch anglesfrom zero valuesAccording to the simulation results the proposed heuristic method produced goodflight trajectories The heuristic method required only three parameters to generatethe values for the jounce of the position The position and its other derivatives werecalculated from the jounce values The total thrust and the pitch and roll angles toachieve given accelerations were solved from the linear differential equations Thenthe torques were determined by the angular accelerations and angular velocitiescalculated from the angles Finally the required control inputs were solved from thetotal thrust and the torques The simulation results indicated that the quadcopter

could be controlled accurately with the control inputs given by the methodThe proposed heuristic method does not consider unmodelled disturbances suchas wind and thus the PD controller was integrated into the control method Theintegrated PD controller operated well in the example simulation The quadcopterfollowed the given trajectory and began to stabilise after reaching the final destinationHowever the PD controller can perform poorly if the parameter values arenot properly selected and are too small or highThe presented mathematical model only consists of the basic structures of the quadcopterdynamics Several aerodynamical effects were excluded which can lead tounrealiable behaviour Also the electric motors spinning the fours rotors were notmodelled The behaviour of a motor is easily included in the model but would requireestimation of the parameter values of the motor The position and attitudeinformation was assumed to be accurate in the model and the simulations Howeverthe measuring devices in real life are not perfectly accurate as random variationsand errors occur Hence the effects of imprecise information to the flight of thequadcopter should be studied as well Also methods to enhance the accuracy of themeasurements should be researched and implemented to improve all aspects required22for robust quadcopter manoeuvresThe presented model and control methods were tested only with simulations Realexperimental prototype of a quadcopter should be constructed to achieve more realisticand reliable results Even though the construction of a real quadcopter and theestimation of all the model parameters are laborious tasks a real quadcopter wouldbring significant benefits to the research With a real propotype the theoreticalframework and the simulation results could be compared to real-life measurementsThis paper did not include these higlighted matters in the study but presentedthe basics of quadcopter modelling and control This paper can thus be used as a

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

umlz = minusg001 +TmC S_C_ + S S_S S_C_ minus C S_C_C_minus1mAx 0 00 Ay 00 0 Azx˙y˙z˙ (21)in which Ax Ay and Az are the drag force coefficients for velocities in the correspondingdirections of the inertial frameSeveral other aerodynamical effects could be included in the model For exampledependence of thrust on angle of attack blade flapping and airflow distruptions havebeen studied in [1] and [2] The influence of aerodynamical effects are complicatedand the effects are difficult to model Also some of the effects have significant effectonly in high velocities Thus these effects are excluded from the model and thepresented simple model is used

73 SimulationThe mathematical model of the quadcopter is implemented for simulation in Matlab2010 with Matlab programming language Parameter values from [3] are used in thesimulations and are presented in Table 1 The values of the drag force coefficientsAx Ay and Az are selected such as the quadcopter will slow down and stop whenangles _ and _ are stabilised to zero valuesTable 1 Parameter values for simulationParameter Value Unitg 981 ms2m 0468 kgl 0225 mk 2980 10minus6b 1140 10minus7IM 3357 10minus5 kg m2Parameter Value UnitIxx 4856 10minus3 kg m2Iyy 4856 10minus3 kg m2Izz 8801 10minus3 kg m2Ax 025 kgsAy 025 kgsAz 025 kgsThe mathematical model is tested by simulating a quadcopter with an example caseas following The quadcopter is initially in a stable state in which the values of allpositions and angles are zero the body frame of the quadcopter is congruent withthe inertial frame The total thrust is equal to the hover thrust the thrust equal togravity The simulation progresses at 00001 second intervals to total elapsed timeof two seconds The control inputs the angular velocities of the four rotors areshown in Figure 2 the inertial positions x y and z in Figure 3 and the angles _ _and in Figure 4For the first 025 seconds the quadcopter ascended by increasing all of the rotorvelocities from the hover thrust Then the ascend is stopped by decreasing the rotorvelocities significantly for the following 025 seconds Consequently the quadcopterascended 01 meters in the first 05 seconds After the ascend the quadcopter is

stable againNext the quadcopter is put into a roll motion by increasing the velocity of thefourth rotor and decreasing the velocity of the second rotor for 025 seconds Theacceleration of the roll motion is stopped by decreasing the velocity of the fourthand increasing the velocity of the second rotor for 025 seconds Thus after 05seconds in roll motion the roll angle _ had increased approx 25 degrees Becauseof the roll angle the quadcopter accelerated in the direction of the negative y-axisThen similar to the roll motion a pitch motion is created by increasing the velocityof the third rotor and decreasing the velocity of the first The motion is stoppedby decreasing the velocity of the third rotor and increasing the velocity of the firstrotor Due to the pitch movement the pitch angle _ had increased approximately822 degrees The acceleration of the quadcopter in the direction of the positive x-axisis caused by the pitch angleFinally the quadcopter is turned in the direction of the yaw angle by increasingthe velocities of the first and the third rotors and decreasing the velocities of thesecond and the fourth rotors The yaw motion is stopped by decreasing the velocitiesof the first and the third rotors and increasing the velocities of the second and thefourth rotors Consequently the yaw angle increases approximately 10 degreesDuring the whole simulation the total thrust of the rotors had remained close to theinitial total thrust Thus the deviations of the roll and pitch angles from the zerovalues decrease the value of the thrust in the direction of the z-axis Consequentlythe quadcopter accelerates in the direction of the negative z-axis and is descending0 02 04 06 08 1 12 14 16 18 2550575600625650675700Time t (s)Control input i (rads)1234

Figure 2 Control inputs i0 02 04 06 08 1 12 14 16 18 2

minus25minus2minus15minus1minus05005115Time t (s)Position (m)Position xPosition yPosition z

Figure 3 Positions x y and z90 02 04 06 08 1 12 14 16 18 2minus5051015202530Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 4 Angles _ _ and 104 Stabilisation of quadcopterTo stabilise the quadcopter a PID controller is utilised Advantages of the PIDcontroller are the simple structure and easy implementation of the controller Thegeneral form of the PID controller ise(t) = xd(t) minus x(t)u(t) = KP e(t) + KIZ t0e(_ ) d _ + KDd e(t)d t [16](22)in which u(t) is the control input e(t) is the difference between the desired statexd(t) and the present state x(t) and KP KI and KD are the parameters for theproportional integral and derivative elements of the PID controllerIn a quadcopter there are six states positions _ and angles _ but only four controlinputs the angular velocities of the four rotors i The interactions between thestates and the total thrust T and the torques _ created by the rotors are visible fromthe quadcopter dynamics defined by Equations (10) (11) and (12) The total thrustT affects the acceleration in the direction of the z-axis and holds the quadcopter inthe air Torque __ has an affect on the acceleration of angle _ torque __ affects theacceleration of angle _ and torque _ contributes in the acceleration of angle

Hence the PD controller for the quadcopter is chosen as similarly as in [4]T = (g + KzD (z˙d minus z˙) + KzP (zd minus z)) mC_C___ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Ixx__ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Iyy_ =_K D_ ˙d minus ˙ _+ K P ( d minus )_Izz(23)in which also the gravity g and mass m and moments of inertia I of the quadcopterare consideredThe correct angular velocities of rotors i can be calculated from Equations (7) and(8) with values from Equation (23)21 = T4kminus __2klminus_ 4b22 = T

4kminus__2kl+_ 4b23 = T4k+ __2klminus_ 4b24 = T4k+__2kl+_ 4b(24)The performance of the PD controller is tested by simulating the stabilisation ofa quadcopter The PD controller parameters are presented in Table 2 The initialcondition of the quadcopter is for position _ = [0 0 1]T in meters and for angles11_ = [10 10 10]T in degrees The desired position for altitude is zd = 0 The purposeof the stabilisation is stable hovering thus _d = [0 0 0]TTable 2 Parameters of the PD controllerParameter ValueKzD 25K_D 175K_D 175K D 175Parameter ValueKzP 15K_P 6K_P 6K P 6The control inputs i the positions _ and the angles _ during the simulation are

presented in Figures 5 6 and 7 The altitude and the angles are stabilised to zerovalue after 5 seconds However the positions x and y deviated from the zero valuesbecause of the non-zero values of the angles Before the quadcopter is stabilisedto hover it has already moved over 1 meters in the direction of the positive x axisand 05 meters in the direction of the negative y axis This is because the controlmethod of the PD contoller does not consider the accelerations in the directions ofx and y Thus another control method should be constructed to give a control onall of positions and angles of the quadcopter0 1 2 3 4 5 6550560570580590600610620630

Time t (s)Control input i (rads)1234

Figure 5 Control inputs i0 1 2 3 4 5 6minus06minus04minus02002040608112

Time t (s)Position (m)Position xPosition yPosition z

Figure 6 Positions x y and z120 1 2 3 4 5 6minus20246810

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 7 Angles _ _ and 135 Trajectory controlThe purpose of trajectory control is to move the quadcopter from the original locationto the desired location by controlling the rotor velocities of the quadcopterFinding optimal trajectory for a quadcopter is a difficult task because of complexdynamics However a simple control method is able to control the quadcopteradequately Thus a heuristic approach is studied and developed hereThe basis of the development of a control method is the study of the interactions and

dependances between states state derivatives and control inputs These interactionsand dependances are defined by Equations (7) (8) (20) and (21) and presented inFigure 8The given control inputs i define the total thrust T and the torques __ __ and _ The torques affect the angular accelerations depending on the current angles andangular velocities The angles _ can be integrated from the angular velocities _˙ which are integrated from the angular accelerations uml_ The linear accelerations uml_depend on the total thrust T the angles _ and the linear velocities _˙ The linearposition _ is integrated from the linear accelerations uml_ through the linear velocities_˙Hence to find proper control inputs i for given states _ this line of thought has tobe done in reverse___HHHjT_-- _uml - _˙ - _I K_uml - _˙ - _IFigure 8 Interactions between states state derivatives and control inputsOne method is to generate linear accelerations which accomplish the wanted trajectoryaccording to positions x y and z for each time t From Equation (21) threeequations are receivedTB =00T = RT

muml_ +00g +Ax 0 00 Ay 00 0 Az _˙ (25)in which _uml _˙ and are desired trajectory values as well as angles _ and _ and totalthrust T are unknown values to be solvedFrom this equation the required angles _ and _ and the total thrust T for each timet can be calculated as shown in [5]14_ = arcsin dx S minus dy C d2x + d2y + (dz + g)2_ = arctan_dx C + dy S dz + g_T = m(dx (S_C C_ + S S_) + dy (S_S C_ minus C S_)+( dz + g )C_C_) (26)in whichdx = xuml + Axx˙mdy = yuml+ Ayy˙mdz = zuml+ Azz˙m(27)

When the values of the angles _ and _ are known the angular velocities and accelerationscan be calculated from them with simple derivation With the angularvelocities and accelerations the torques _ can be solved from Equation (20) Whenthe torques and thrust are known the control inputs i can be calculated fromEquation (24)51 Heuristic method for trajectory generationThe generation of proper accelerations uml_ is difficult because the composition of thethird and fourth derivatives of the position jerk and jounce has to be reasonableThe influence of the jounce values is visible in the composition of the control inputsi High jounce values will mean high control input values and thus the jounceshave to be considered closely when generating the accelerationsA heuristic method can be used to generate jounce values The method utilises asymmetric structure in jouce function f(t) to control the derivatives One influencialpart of the function is defined by three sine functions as followingf(t) =a sin10485761b _ t_ 0 le t le bminusa sin10485761b _ t minus __ b le t le 3ba sin10485761b _ t minus 3__ 3b le t le 4b(28)The structure of the function is visualised in Figure 9 The sine functions are usedto give a smooth function These three sine functions form a function in whichthe first half increases acceleration to certain value and then the second half of the

function decreases it back to zero This acceleration generates constant velocityMirror image of the function can be used to decelerate the velocity back to zeroThe final position depends on the parameters a and b of the sine functions presented15in Equation (28) and the time c between the accelerating part and the deceleratingpart the mirror image of the jounceaaab2bba sin10485761b _ t_minusa sin1048576 12b _ t minus __a sin10485761b _ t minus 3__Jounce (ms4)Time t (s)Figure 9 Heuristic method for the generation of jounce functionsUnfortunately the method does not give optimal trajectories Thus a dynamicoptimisation model and a suitable algorithm would be needed to calculate optimallythe trajectory of the quadcopter However the method presented is easy to use togenerate proper values of jounce which will achieve the wanted trajectoryThe functionality of the method is studied with an example simulation Jounce ofposition x is created according to Equation (28) with parameters a = 1 b = 05and c = 2 The position x and its derivatives derived from the planned jounce arepresented in Figure 10 The jounce could also be generated simultaneously for y andz However in this example only position x is considered because the relationship

between the jounce of position x and the control inputs 1 and 3 controlling theangle _ is more visible160 1 2 3 4 5 6 7minus1minus08minus06minus04minus020020406081Time t (s)Jounce (ms4)

(a) Jounce0 1 2 3 4 5 6 7minus04minus03minus02minus01001020304

Time t (s)Jerk (ms3)

(b) Jerk0 1 2 3 4 5 6 7minus02minus015minus01minus00500050101502Time t (s)Acceleration (ms2)

(c) Acceleration0 1 2 3 4 5 6 7minus002000200400600801012014016018

Time t (s)Velocity (ms)

(d) Velocity0 1 2 3 4 5 6 7001020304050607

Time t (s)Position (m)

(e) PositionFigure 10 Planned position x and its derivatives with given jounceThe simulation of the example case is performed with previously given accelerationsand velocities of position x The planned value of angle is zero for each time tFirst the required angles _ and _ and thrust T are solved from Equation (26) foreach time t The angular velocities and accelerations are calculated from the solvedangles with derivation Then the torques are solved using the angular velocitiesand accelerations Finally the control inputs are solved Then the simulation isperformed with given control inputsThe calculated control inputs are presented in Figure 11 The simulated positions_ are presented in Figure 12 and the simulated angles _ in Figure 13 Accordingto Figure 12 the simulated position x is the same as the planned position x inFigure 10(e) and the values of the positions y and z stay as zeroes The angle _increases during the acceleration and then stabilises to a constant value to generate

the constant acceleration required to compensate the drag force caused by theplanned constant velocity Finally the angle is changed to the opposite direction todecelerate the quadcopter to a haltThe shape of the calculated control inputs 1 and 3 in Figure 11 are similar toplanned jounce in Figure 10(a) The shape of the simulated angle _ follows theshape of the planned acceleration umlx The shapes of the control inputs and theangles differ from the planned values of the jounce and the acceleration because thedrag force caused by the velocity has to be compensated170 1 2 3 4 5 6 76203620462056206620762086209621

Time t (s)Control input i (rads)1234

Figure 11 Control inputs i0 1 2 3 4 5 6001020304050607

Time t (s)Position (m)Position xPosition yPosition z

Figure 12 Positions x y and z0 1 2 3 4 5 6 7minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 13 Angles _ _ and The method can also be used even if there are unmodeled linear forces wind forexample which affect the linear accelerations and consequently the position of thequadcopter If the trajectory is calculated in shorter distances it is possible tocorrect the trajectory with new calculation from the current but inaccurate locationto the next checkpoint Example of this method is presented in Figure 14 Thearrows with dash lines indicate the planned trajectory in the x y-plane and thesolid arrows indicate the realised trajectory The black squares mark the start and

the finish positions and the white squares mark the checkpoints for the trajectory18The control inputs are calculated from the current location of the quadcopter to thenext checkpoint but because of random and unmodelled forces the realised positionmarked with X differs from the planned If the quadcopter is close enough to thetarget checkpoint the target checkpoint is changed to the next one and new controlinputs are calculated After repeating this and going through all of the checkpointsthe quadcopter reaches the final destinationFigure 14 Example of checkpoint flight pattern with external disturbancesThe biggest weakness in the proposed method is that it works as shown only if thequadcopter starts from a stable attitude the angles _ and _ and their derivativesare zeros and there are no external forces influencing the attitude during the flightSmall deviations in the angles can result into a huge deviation in the trajectory Oneway to solve this problem is to stabilise the quadcopter at each checkpoint with aPD controller proposed earlier or by using the heuristic method to angles Howeverif the angular disturbances are continuous the benefit from temporary stabilisationis only momentary52 Integrated PD controllerAnother method to take into account the possible deviations in the angles is tointegrate a PD controller into the heuristic method This is a simplified version ofthe proposed control method in [5] The required values dx dy and dz in Equation(26) are given by the PD controller considering the deviations between the currentand desired values (subscript d) of the positions _ velocities _˙ and accelerations _umldx = KxP (xd minus x) + KxD (x˙ d minus x˙ ) + KxDD (xumld minus xuml) dy = KyP (yd minus y) + KyD (y˙d minus y˙) + KyDD (yumld minus yuml) dz = KzP (zd minus z) + KzD (z˙d minus z˙) + KzDD (zumld minus zuml) (29)Then the commanded angles _c and _c and thrust T are given by Equation (26)The torques _ are controlled by the PD controller in Equation (30) same as in

19Equation (23) The control inputs can be solved with the calculated thrust andtorques by using Equation (24)__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Ixx__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Iyy_ =_K P ( d minus ) + K D_˙ d minus ˙ __Izz(30)The performance of the PD controller is demonstrated with an example case inwhich for all positions x y and z and their derivatives the values are same as inFigure 10 The simulation is performed with the PD parameters presented in Table3Table 3 Parameters of the PD controllerVariable Parameter valuei KiP KiD KiDDx 185 075 100y 855 075 100z 185 075 100_ 300 075 -_ 300 075 - 300 075 -The results of the simulation are presented Figures 15 - 17 The simulated controlinputs are presented in Figure 15 the simulated positions in Figure 16 and the

simulated angles in Figure 17 The position of the quadcopter is close to the plannedposition after 6 seconds but the position keeps fluctuating close to the planned valuesfor several seconds The angles variate greatly during the simulation to achieve thewanted positions velocities and accelerations The values of the control inputsoscillated during the acceleration but then their behaviour became more stable0 2 4 6 8 10 12 14618619620621622623624625626

Time t (s)Control input i (rads)1234

Figure 15 Control inputs i200 2 4 6 8 10 12 14minus0100102030405060708

Time t (s)Position (m)Position xPosition yPosition z

Figure 16 Positions x y and z0 2 4 6 8 10 12 14minus15minus125minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 17 Angles _ _ and The proposed integrated PD controller performed well in the example case Howeverthe performance of the controller is highly depended on the parameter values If theparameter values are small the controller will not respond quickly enough to followthe planned trajectory If the parameter values are substantial the quadcopter cannot perform the required drastic changes in the angular velocities of the rotor andthe control inputs calculated from Equation (24) can be infeasible with certaintorques Thus the use of equations considering the torques and the control inputsrequires a method to calculate the best feasible torques and from them the bestcontrol inputs Another possible method would be to variate the PD parameters

according to the current positions and angles and their derivatives but it is extremelydifficult216 ConclusionThis paper studied mathematical modelling and control of a quadcopter The mathematicalmodel of quadcopter dynamics was presented and the differential equationswere derived from the Newton-Euler and the Euler-Lagrange equations The modelwas verified by simulating the flight of a quadcopter with Matlab Stabilisation ofattitude of the quadcopter was done by utilising a PD controller A heuristic methodwas developed to control the trajectory of the quadcopter The PD contoller wasintegrated into the heuristic method for better response to disturbances in the flightconditions of the quadcopterThe simulation proved the presented mathematical model to be realistic in modellingthe position and attitude of the quadcopter The simulation results also showedthat the PD controller was efficient in stabilising the quadcopter to the desiredaltitude and attitude However the PD controller did not considered positions xand y Thus the values of x and y variated from their original values during thestabilisation process This was a result of the deviation of the roll and pitch anglesfrom zero valuesAccording to the simulation results the proposed heuristic method produced goodflight trajectories The heuristic method required only three parameters to generatethe values for the jounce of the position The position and its other derivatives werecalculated from the jounce values The total thrust and the pitch and roll angles toachieve given accelerations were solved from the linear differential equations Thenthe torques were determined by the angular accelerations and angular velocitiescalculated from the angles Finally the required control inputs were solved from thetotal thrust and the torques The simulation results indicated that the quadcopter

could be controlled accurately with the control inputs given by the methodThe proposed heuristic method does not consider unmodelled disturbances suchas wind and thus the PD controller was integrated into the control method Theintegrated PD controller operated well in the example simulation The quadcopterfollowed the given trajectory and began to stabilise after reaching the final destinationHowever the PD controller can perform poorly if the parameter values arenot properly selected and are too small or highThe presented mathematical model only consists of the basic structures of the quadcopterdynamics Several aerodynamical effects were excluded which can lead tounrealiable behaviour Also the electric motors spinning the fours rotors were notmodelled The behaviour of a motor is easily included in the model but would requireestimation of the parameter values of the motor The position and attitudeinformation was assumed to be accurate in the model and the simulations Howeverthe measuring devices in real life are not perfectly accurate as random variationsand errors occur Hence the effects of imprecise information to the flight of thequadcopter should be studied as well Also methods to enhance the accuracy of themeasurements should be researched and implemented to improve all aspects required22for robust quadcopter manoeuvresThe presented model and control methods were tested only with simulations Realexperimental prototype of a quadcopter should be constructed to achieve more realisticand reliable results Even though the construction of a real quadcopter and theestimation of all the model parameters are laborious tasks a real quadcopter wouldbring significant benefits to the research With a real propotype the theoreticalframework and the simulation results could be compared to real-life measurementsThis paper did not include these higlighted matters in the study but presentedthe basics of quadcopter modelling and control This paper can thus be used as a

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

73 SimulationThe mathematical model of the quadcopter is implemented for simulation in Matlab2010 with Matlab programming language Parameter values from [3] are used in thesimulations and are presented in Table 1 The values of the drag force coefficientsAx Ay and Az are selected such as the quadcopter will slow down and stop whenangles _ and _ are stabilised to zero valuesTable 1 Parameter values for simulationParameter Value Unitg 981 ms2m 0468 kgl 0225 mk 2980 10minus6b 1140 10minus7IM 3357 10minus5 kg m2Parameter Value UnitIxx 4856 10minus3 kg m2Iyy 4856 10minus3 kg m2Izz 8801 10minus3 kg m2Ax 025 kgsAy 025 kgsAz 025 kgsThe mathematical model is tested by simulating a quadcopter with an example caseas following The quadcopter is initially in a stable state in which the values of allpositions and angles are zero the body frame of the quadcopter is congruent withthe inertial frame The total thrust is equal to the hover thrust the thrust equal togravity The simulation progresses at 00001 second intervals to total elapsed timeof two seconds The control inputs the angular velocities of the four rotors areshown in Figure 2 the inertial positions x y and z in Figure 3 and the angles _ _and in Figure 4For the first 025 seconds the quadcopter ascended by increasing all of the rotorvelocities from the hover thrust Then the ascend is stopped by decreasing the rotorvelocities significantly for the following 025 seconds Consequently the quadcopterascended 01 meters in the first 05 seconds After the ascend the quadcopter is

stable againNext the quadcopter is put into a roll motion by increasing the velocity of thefourth rotor and decreasing the velocity of the second rotor for 025 seconds Theacceleration of the roll motion is stopped by decreasing the velocity of the fourthand increasing the velocity of the second rotor for 025 seconds Thus after 05seconds in roll motion the roll angle _ had increased approx 25 degrees Becauseof the roll angle the quadcopter accelerated in the direction of the negative y-axisThen similar to the roll motion a pitch motion is created by increasing the velocityof the third rotor and decreasing the velocity of the first The motion is stoppedby decreasing the velocity of the third rotor and increasing the velocity of the firstrotor Due to the pitch movement the pitch angle _ had increased approximately822 degrees The acceleration of the quadcopter in the direction of the positive x-axisis caused by the pitch angleFinally the quadcopter is turned in the direction of the yaw angle by increasingthe velocities of the first and the third rotors and decreasing the velocities of thesecond and the fourth rotors The yaw motion is stopped by decreasing the velocitiesof the first and the third rotors and increasing the velocities of the second and thefourth rotors Consequently the yaw angle increases approximately 10 degreesDuring the whole simulation the total thrust of the rotors had remained close to theinitial total thrust Thus the deviations of the roll and pitch angles from the zerovalues decrease the value of the thrust in the direction of the z-axis Consequentlythe quadcopter accelerates in the direction of the negative z-axis and is descending0 02 04 06 08 1 12 14 16 18 2550575600625650675700Time t (s)Control input i (rads)1234

Figure 2 Control inputs i0 02 04 06 08 1 12 14 16 18 2

minus25minus2minus15minus1minus05005115Time t (s)Position (m)Position xPosition yPosition z

Figure 3 Positions x y and z90 02 04 06 08 1 12 14 16 18 2minus5051015202530Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 4 Angles _ _ and 104 Stabilisation of quadcopterTo stabilise the quadcopter a PID controller is utilised Advantages of the PIDcontroller are the simple structure and easy implementation of the controller Thegeneral form of the PID controller ise(t) = xd(t) minus x(t)u(t) = KP e(t) + KIZ t0e(_ ) d _ + KDd e(t)d t [16](22)in which u(t) is the control input e(t) is the difference between the desired statexd(t) and the present state x(t) and KP KI and KD are the parameters for theproportional integral and derivative elements of the PID controllerIn a quadcopter there are six states positions _ and angles _ but only four controlinputs the angular velocities of the four rotors i The interactions between thestates and the total thrust T and the torques _ created by the rotors are visible fromthe quadcopter dynamics defined by Equations (10) (11) and (12) The total thrustT affects the acceleration in the direction of the z-axis and holds the quadcopter inthe air Torque __ has an affect on the acceleration of angle _ torque __ affects theacceleration of angle _ and torque _ contributes in the acceleration of angle

Hence the PD controller for the quadcopter is chosen as similarly as in [4]T = (g + KzD (z˙d minus z˙) + KzP (zd minus z)) mC_C___ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Ixx__ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Iyy_ =_K D_ ˙d minus ˙ _+ K P ( d minus )_Izz(23)in which also the gravity g and mass m and moments of inertia I of the quadcopterare consideredThe correct angular velocities of rotors i can be calculated from Equations (7) and(8) with values from Equation (23)21 = T4kminus __2klminus_ 4b22 = T

4kminus__2kl+_ 4b23 = T4k+ __2klminus_ 4b24 = T4k+__2kl+_ 4b(24)The performance of the PD controller is tested by simulating the stabilisation ofa quadcopter The PD controller parameters are presented in Table 2 The initialcondition of the quadcopter is for position _ = [0 0 1]T in meters and for angles11_ = [10 10 10]T in degrees The desired position for altitude is zd = 0 The purposeof the stabilisation is stable hovering thus _d = [0 0 0]TTable 2 Parameters of the PD controllerParameter ValueKzD 25K_D 175K_D 175K D 175Parameter ValueKzP 15K_P 6K_P 6K P 6The control inputs i the positions _ and the angles _ during the simulation are

presented in Figures 5 6 and 7 The altitude and the angles are stabilised to zerovalue after 5 seconds However the positions x and y deviated from the zero valuesbecause of the non-zero values of the angles Before the quadcopter is stabilisedto hover it has already moved over 1 meters in the direction of the positive x axisand 05 meters in the direction of the negative y axis This is because the controlmethod of the PD contoller does not consider the accelerations in the directions ofx and y Thus another control method should be constructed to give a control onall of positions and angles of the quadcopter0 1 2 3 4 5 6550560570580590600610620630

Time t (s)Control input i (rads)1234

Figure 5 Control inputs i0 1 2 3 4 5 6minus06minus04minus02002040608112

Time t (s)Position (m)Position xPosition yPosition z

Figure 6 Positions x y and z120 1 2 3 4 5 6minus20246810

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 7 Angles _ _ and 135 Trajectory controlThe purpose of trajectory control is to move the quadcopter from the original locationto the desired location by controlling the rotor velocities of the quadcopterFinding optimal trajectory for a quadcopter is a difficult task because of complexdynamics However a simple control method is able to control the quadcopteradequately Thus a heuristic approach is studied and developed hereThe basis of the development of a control method is the study of the interactions and

dependances between states state derivatives and control inputs These interactionsand dependances are defined by Equations (7) (8) (20) and (21) and presented inFigure 8The given control inputs i define the total thrust T and the torques __ __ and _ The torques affect the angular accelerations depending on the current angles andangular velocities The angles _ can be integrated from the angular velocities _˙ which are integrated from the angular accelerations uml_ The linear accelerations uml_depend on the total thrust T the angles _ and the linear velocities _˙ The linearposition _ is integrated from the linear accelerations uml_ through the linear velocities_˙Hence to find proper control inputs i for given states _ this line of thought has tobe done in reverse___HHHjT_-- _uml - _˙ - _I K_uml - _˙ - _IFigure 8 Interactions between states state derivatives and control inputsOne method is to generate linear accelerations which accomplish the wanted trajectoryaccording to positions x y and z for each time t From Equation (21) threeequations are receivedTB =00T = RT

muml_ +00g +Ax 0 00 Ay 00 0 Az _˙ (25)in which _uml _˙ and are desired trajectory values as well as angles _ and _ and totalthrust T are unknown values to be solvedFrom this equation the required angles _ and _ and the total thrust T for each timet can be calculated as shown in [5]14_ = arcsin dx S minus dy C d2x + d2y + (dz + g)2_ = arctan_dx C + dy S dz + g_T = m(dx (S_C C_ + S S_) + dy (S_S C_ minus C S_)+( dz + g )C_C_) (26)in whichdx = xuml + Axx˙mdy = yuml+ Ayy˙mdz = zuml+ Azz˙m(27)

When the values of the angles _ and _ are known the angular velocities and accelerationscan be calculated from them with simple derivation With the angularvelocities and accelerations the torques _ can be solved from Equation (20) Whenthe torques and thrust are known the control inputs i can be calculated fromEquation (24)51 Heuristic method for trajectory generationThe generation of proper accelerations uml_ is difficult because the composition of thethird and fourth derivatives of the position jerk and jounce has to be reasonableThe influence of the jounce values is visible in the composition of the control inputsi High jounce values will mean high control input values and thus the jounceshave to be considered closely when generating the accelerationsA heuristic method can be used to generate jounce values The method utilises asymmetric structure in jouce function f(t) to control the derivatives One influencialpart of the function is defined by three sine functions as followingf(t) =a sin10485761b _ t_ 0 le t le bminusa sin10485761b _ t minus __ b le t le 3ba sin10485761b _ t minus 3__ 3b le t le 4b(28)The structure of the function is visualised in Figure 9 The sine functions are usedto give a smooth function These three sine functions form a function in whichthe first half increases acceleration to certain value and then the second half of the

function decreases it back to zero This acceleration generates constant velocityMirror image of the function can be used to decelerate the velocity back to zeroThe final position depends on the parameters a and b of the sine functions presented15in Equation (28) and the time c between the accelerating part and the deceleratingpart the mirror image of the jounceaaab2bba sin10485761b _ t_minusa sin1048576 12b _ t minus __a sin10485761b _ t minus 3__Jounce (ms4)Time t (s)Figure 9 Heuristic method for the generation of jounce functionsUnfortunately the method does not give optimal trajectories Thus a dynamicoptimisation model and a suitable algorithm would be needed to calculate optimallythe trajectory of the quadcopter However the method presented is easy to use togenerate proper values of jounce which will achieve the wanted trajectoryThe functionality of the method is studied with an example simulation Jounce ofposition x is created according to Equation (28) with parameters a = 1 b = 05and c = 2 The position x and its derivatives derived from the planned jounce arepresented in Figure 10 The jounce could also be generated simultaneously for y andz However in this example only position x is considered because the relationship

between the jounce of position x and the control inputs 1 and 3 controlling theangle _ is more visible160 1 2 3 4 5 6 7minus1minus08minus06minus04minus020020406081Time t (s)Jounce (ms4)

(a) Jounce0 1 2 3 4 5 6 7minus04minus03minus02minus01001020304

Time t (s)Jerk (ms3)

(b) Jerk0 1 2 3 4 5 6 7minus02minus015minus01minus00500050101502Time t (s)Acceleration (ms2)

(c) Acceleration0 1 2 3 4 5 6 7minus002000200400600801012014016018

Time t (s)Velocity (ms)

(d) Velocity0 1 2 3 4 5 6 7001020304050607

Time t (s)Position (m)

(e) PositionFigure 10 Planned position x and its derivatives with given jounceThe simulation of the example case is performed with previously given accelerationsand velocities of position x The planned value of angle is zero for each time tFirst the required angles _ and _ and thrust T are solved from Equation (26) foreach time t The angular velocities and accelerations are calculated from the solvedangles with derivation Then the torques are solved using the angular velocitiesand accelerations Finally the control inputs are solved Then the simulation isperformed with given control inputsThe calculated control inputs are presented in Figure 11 The simulated positions_ are presented in Figure 12 and the simulated angles _ in Figure 13 Accordingto Figure 12 the simulated position x is the same as the planned position x inFigure 10(e) and the values of the positions y and z stay as zeroes The angle _increases during the acceleration and then stabilises to a constant value to generate

the constant acceleration required to compensate the drag force caused by theplanned constant velocity Finally the angle is changed to the opposite direction todecelerate the quadcopter to a haltThe shape of the calculated control inputs 1 and 3 in Figure 11 are similar toplanned jounce in Figure 10(a) The shape of the simulated angle _ follows theshape of the planned acceleration umlx The shapes of the control inputs and theangles differ from the planned values of the jounce and the acceleration because thedrag force caused by the velocity has to be compensated170 1 2 3 4 5 6 76203620462056206620762086209621

Time t (s)Control input i (rads)1234

Figure 11 Control inputs i0 1 2 3 4 5 6001020304050607

Time t (s)Position (m)Position xPosition yPosition z

Figure 12 Positions x y and z0 1 2 3 4 5 6 7minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 13 Angles _ _ and The method can also be used even if there are unmodeled linear forces wind forexample which affect the linear accelerations and consequently the position of thequadcopter If the trajectory is calculated in shorter distances it is possible tocorrect the trajectory with new calculation from the current but inaccurate locationto the next checkpoint Example of this method is presented in Figure 14 Thearrows with dash lines indicate the planned trajectory in the x y-plane and thesolid arrows indicate the realised trajectory The black squares mark the start and

the finish positions and the white squares mark the checkpoints for the trajectory18The control inputs are calculated from the current location of the quadcopter to thenext checkpoint but because of random and unmodelled forces the realised positionmarked with X differs from the planned If the quadcopter is close enough to thetarget checkpoint the target checkpoint is changed to the next one and new controlinputs are calculated After repeating this and going through all of the checkpointsthe quadcopter reaches the final destinationFigure 14 Example of checkpoint flight pattern with external disturbancesThe biggest weakness in the proposed method is that it works as shown only if thequadcopter starts from a stable attitude the angles _ and _ and their derivativesare zeros and there are no external forces influencing the attitude during the flightSmall deviations in the angles can result into a huge deviation in the trajectory Oneway to solve this problem is to stabilise the quadcopter at each checkpoint with aPD controller proposed earlier or by using the heuristic method to angles Howeverif the angular disturbances are continuous the benefit from temporary stabilisationis only momentary52 Integrated PD controllerAnother method to take into account the possible deviations in the angles is tointegrate a PD controller into the heuristic method This is a simplified version ofthe proposed control method in [5] The required values dx dy and dz in Equation(26) are given by the PD controller considering the deviations between the currentand desired values (subscript d) of the positions _ velocities _˙ and accelerations _umldx = KxP (xd minus x) + KxD (x˙ d minus x˙ ) + KxDD (xumld minus xuml) dy = KyP (yd minus y) + KyD (y˙d minus y˙) + KyDD (yumld minus yuml) dz = KzP (zd minus z) + KzD (z˙d minus z˙) + KzDD (zumld minus zuml) (29)Then the commanded angles _c and _c and thrust T are given by Equation (26)The torques _ are controlled by the PD controller in Equation (30) same as in

19Equation (23) The control inputs can be solved with the calculated thrust andtorques by using Equation (24)__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Ixx__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Iyy_ =_K P ( d minus ) + K D_˙ d minus ˙ __Izz(30)The performance of the PD controller is demonstrated with an example case inwhich for all positions x y and z and their derivatives the values are same as inFigure 10 The simulation is performed with the PD parameters presented in Table3Table 3 Parameters of the PD controllerVariable Parameter valuei KiP KiD KiDDx 185 075 100y 855 075 100z 185 075 100_ 300 075 -_ 300 075 - 300 075 -The results of the simulation are presented Figures 15 - 17 The simulated controlinputs are presented in Figure 15 the simulated positions in Figure 16 and the

simulated angles in Figure 17 The position of the quadcopter is close to the plannedposition after 6 seconds but the position keeps fluctuating close to the planned valuesfor several seconds The angles variate greatly during the simulation to achieve thewanted positions velocities and accelerations The values of the control inputsoscillated during the acceleration but then their behaviour became more stable0 2 4 6 8 10 12 14618619620621622623624625626

Time t (s)Control input i (rads)1234

Figure 15 Control inputs i200 2 4 6 8 10 12 14minus0100102030405060708

Time t (s)Position (m)Position xPosition yPosition z

Figure 16 Positions x y and z0 2 4 6 8 10 12 14minus15minus125minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 17 Angles _ _ and The proposed integrated PD controller performed well in the example case Howeverthe performance of the controller is highly depended on the parameter values If theparameter values are small the controller will not respond quickly enough to followthe planned trajectory If the parameter values are substantial the quadcopter cannot perform the required drastic changes in the angular velocities of the rotor andthe control inputs calculated from Equation (24) can be infeasible with certaintorques Thus the use of equations considering the torques and the control inputsrequires a method to calculate the best feasible torques and from them the bestcontrol inputs Another possible method would be to variate the PD parameters

according to the current positions and angles and their derivatives but it is extremelydifficult216 ConclusionThis paper studied mathematical modelling and control of a quadcopter The mathematicalmodel of quadcopter dynamics was presented and the differential equationswere derived from the Newton-Euler and the Euler-Lagrange equations The modelwas verified by simulating the flight of a quadcopter with Matlab Stabilisation ofattitude of the quadcopter was done by utilising a PD controller A heuristic methodwas developed to control the trajectory of the quadcopter The PD contoller wasintegrated into the heuristic method for better response to disturbances in the flightconditions of the quadcopterThe simulation proved the presented mathematical model to be realistic in modellingthe position and attitude of the quadcopter The simulation results also showedthat the PD controller was efficient in stabilising the quadcopter to the desiredaltitude and attitude However the PD controller did not considered positions xand y Thus the values of x and y variated from their original values during thestabilisation process This was a result of the deviation of the roll and pitch anglesfrom zero valuesAccording to the simulation results the proposed heuristic method produced goodflight trajectories The heuristic method required only three parameters to generatethe values for the jounce of the position The position and its other derivatives werecalculated from the jounce values The total thrust and the pitch and roll angles toachieve given accelerations were solved from the linear differential equations Thenthe torques were determined by the angular accelerations and angular velocitiescalculated from the angles Finally the required control inputs were solved from thetotal thrust and the torques The simulation results indicated that the quadcopter

could be controlled accurately with the control inputs given by the methodThe proposed heuristic method does not consider unmodelled disturbances suchas wind and thus the PD controller was integrated into the control method Theintegrated PD controller operated well in the example simulation The quadcopterfollowed the given trajectory and began to stabilise after reaching the final destinationHowever the PD controller can perform poorly if the parameter values arenot properly selected and are too small or highThe presented mathematical model only consists of the basic structures of the quadcopterdynamics Several aerodynamical effects were excluded which can lead tounrealiable behaviour Also the electric motors spinning the fours rotors were notmodelled The behaviour of a motor is easily included in the model but would requireestimation of the parameter values of the motor The position and attitudeinformation was assumed to be accurate in the model and the simulations Howeverthe measuring devices in real life are not perfectly accurate as random variationsand errors occur Hence the effects of imprecise information to the flight of thequadcopter should be studied as well Also methods to enhance the accuracy of themeasurements should be researched and implemented to improve all aspects required22for robust quadcopter manoeuvresThe presented model and control methods were tested only with simulations Realexperimental prototype of a quadcopter should be constructed to achieve more realisticand reliable results Even though the construction of a real quadcopter and theestimation of all the model parameters are laborious tasks a real quadcopter wouldbring significant benefits to the research With a real propotype the theoreticalframework and the simulation results could be compared to real-life measurementsThis paper did not include these higlighted matters in the study but presentedthe basics of quadcopter modelling and control This paper can thus be used as a

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

stable againNext the quadcopter is put into a roll motion by increasing the velocity of thefourth rotor and decreasing the velocity of the second rotor for 025 seconds Theacceleration of the roll motion is stopped by decreasing the velocity of the fourthand increasing the velocity of the second rotor for 025 seconds Thus after 05seconds in roll motion the roll angle _ had increased approx 25 degrees Becauseof the roll angle the quadcopter accelerated in the direction of the negative y-axisThen similar to the roll motion a pitch motion is created by increasing the velocityof the third rotor and decreasing the velocity of the first The motion is stoppedby decreasing the velocity of the third rotor and increasing the velocity of the firstrotor Due to the pitch movement the pitch angle _ had increased approximately822 degrees The acceleration of the quadcopter in the direction of the positive x-axisis caused by the pitch angleFinally the quadcopter is turned in the direction of the yaw angle by increasingthe velocities of the first and the third rotors and decreasing the velocities of thesecond and the fourth rotors The yaw motion is stopped by decreasing the velocitiesof the first and the third rotors and increasing the velocities of the second and thefourth rotors Consequently the yaw angle increases approximately 10 degreesDuring the whole simulation the total thrust of the rotors had remained close to theinitial total thrust Thus the deviations of the roll and pitch angles from the zerovalues decrease the value of the thrust in the direction of the z-axis Consequentlythe quadcopter accelerates in the direction of the negative z-axis and is descending0 02 04 06 08 1 12 14 16 18 2550575600625650675700Time t (s)Control input i (rads)1234

Figure 2 Control inputs i0 02 04 06 08 1 12 14 16 18 2

minus25minus2minus15minus1minus05005115Time t (s)Position (m)Position xPosition yPosition z

Figure 3 Positions x y and z90 02 04 06 08 1 12 14 16 18 2minus5051015202530Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 4 Angles _ _ and 104 Stabilisation of quadcopterTo stabilise the quadcopter a PID controller is utilised Advantages of the PIDcontroller are the simple structure and easy implementation of the controller Thegeneral form of the PID controller ise(t) = xd(t) minus x(t)u(t) = KP e(t) + KIZ t0e(_ ) d _ + KDd e(t)d t [16](22)in which u(t) is the control input e(t) is the difference between the desired statexd(t) and the present state x(t) and KP KI and KD are the parameters for theproportional integral and derivative elements of the PID controllerIn a quadcopter there are six states positions _ and angles _ but only four controlinputs the angular velocities of the four rotors i The interactions between thestates and the total thrust T and the torques _ created by the rotors are visible fromthe quadcopter dynamics defined by Equations (10) (11) and (12) The total thrustT affects the acceleration in the direction of the z-axis and holds the quadcopter inthe air Torque __ has an affect on the acceleration of angle _ torque __ affects theacceleration of angle _ and torque _ contributes in the acceleration of angle

Hence the PD controller for the quadcopter is chosen as similarly as in [4]T = (g + KzD (z˙d minus z˙) + KzP (zd minus z)) mC_C___ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Ixx__ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Iyy_ =_K D_ ˙d minus ˙ _+ K P ( d minus )_Izz(23)in which also the gravity g and mass m and moments of inertia I of the quadcopterare consideredThe correct angular velocities of rotors i can be calculated from Equations (7) and(8) with values from Equation (23)21 = T4kminus __2klminus_ 4b22 = T

4kminus__2kl+_ 4b23 = T4k+ __2klminus_ 4b24 = T4k+__2kl+_ 4b(24)The performance of the PD controller is tested by simulating the stabilisation ofa quadcopter The PD controller parameters are presented in Table 2 The initialcondition of the quadcopter is for position _ = [0 0 1]T in meters and for angles11_ = [10 10 10]T in degrees The desired position for altitude is zd = 0 The purposeof the stabilisation is stable hovering thus _d = [0 0 0]TTable 2 Parameters of the PD controllerParameter ValueKzD 25K_D 175K_D 175K D 175Parameter ValueKzP 15K_P 6K_P 6K P 6The control inputs i the positions _ and the angles _ during the simulation are

presented in Figures 5 6 and 7 The altitude and the angles are stabilised to zerovalue after 5 seconds However the positions x and y deviated from the zero valuesbecause of the non-zero values of the angles Before the quadcopter is stabilisedto hover it has already moved over 1 meters in the direction of the positive x axisand 05 meters in the direction of the negative y axis This is because the controlmethod of the PD contoller does not consider the accelerations in the directions ofx and y Thus another control method should be constructed to give a control onall of positions and angles of the quadcopter0 1 2 3 4 5 6550560570580590600610620630

Time t (s)Control input i (rads)1234

Figure 5 Control inputs i0 1 2 3 4 5 6minus06minus04minus02002040608112

Time t (s)Position (m)Position xPosition yPosition z

Figure 6 Positions x y and z120 1 2 3 4 5 6minus20246810

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 7 Angles _ _ and 135 Trajectory controlThe purpose of trajectory control is to move the quadcopter from the original locationto the desired location by controlling the rotor velocities of the quadcopterFinding optimal trajectory for a quadcopter is a difficult task because of complexdynamics However a simple control method is able to control the quadcopteradequately Thus a heuristic approach is studied and developed hereThe basis of the development of a control method is the study of the interactions and

dependances between states state derivatives and control inputs These interactionsand dependances are defined by Equations (7) (8) (20) and (21) and presented inFigure 8The given control inputs i define the total thrust T and the torques __ __ and _ The torques affect the angular accelerations depending on the current angles andangular velocities The angles _ can be integrated from the angular velocities _˙ which are integrated from the angular accelerations uml_ The linear accelerations uml_depend on the total thrust T the angles _ and the linear velocities _˙ The linearposition _ is integrated from the linear accelerations uml_ through the linear velocities_˙Hence to find proper control inputs i for given states _ this line of thought has tobe done in reverse___HHHjT_-- _uml - _˙ - _I K_uml - _˙ - _IFigure 8 Interactions between states state derivatives and control inputsOne method is to generate linear accelerations which accomplish the wanted trajectoryaccording to positions x y and z for each time t From Equation (21) threeequations are receivedTB =00T = RT

muml_ +00g +Ax 0 00 Ay 00 0 Az _˙ (25)in which _uml _˙ and are desired trajectory values as well as angles _ and _ and totalthrust T are unknown values to be solvedFrom this equation the required angles _ and _ and the total thrust T for each timet can be calculated as shown in [5]14_ = arcsin dx S minus dy C d2x + d2y + (dz + g)2_ = arctan_dx C + dy S dz + g_T = m(dx (S_C C_ + S S_) + dy (S_S C_ minus C S_)+( dz + g )C_C_) (26)in whichdx = xuml + Axx˙mdy = yuml+ Ayy˙mdz = zuml+ Azz˙m(27)

When the values of the angles _ and _ are known the angular velocities and accelerationscan be calculated from them with simple derivation With the angularvelocities and accelerations the torques _ can be solved from Equation (20) Whenthe torques and thrust are known the control inputs i can be calculated fromEquation (24)51 Heuristic method for trajectory generationThe generation of proper accelerations uml_ is difficult because the composition of thethird and fourth derivatives of the position jerk and jounce has to be reasonableThe influence of the jounce values is visible in the composition of the control inputsi High jounce values will mean high control input values and thus the jounceshave to be considered closely when generating the accelerationsA heuristic method can be used to generate jounce values The method utilises asymmetric structure in jouce function f(t) to control the derivatives One influencialpart of the function is defined by three sine functions as followingf(t) =a sin10485761b _ t_ 0 le t le bminusa sin10485761b _ t minus __ b le t le 3ba sin10485761b _ t minus 3__ 3b le t le 4b(28)The structure of the function is visualised in Figure 9 The sine functions are usedto give a smooth function These three sine functions form a function in whichthe first half increases acceleration to certain value and then the second half of the

function decreases it back to zero This acceleration generates constant velocityMirror image of the function can be used to decelerate the velocity back to zeroThe final position depends on the parameters a and b of the sine functions presented15in Equation (28) and the time c between the accelerating part and the deceleratingpart the mirror image of the jounceaaab2bba sin10485761b _ t_minusa sin1048576 12b _ t minus __a sin10485761b _ t minus 3__Jounce (ms4)Time t (s)Figure 9 Heuristic method for the generation of jounce functionsUnfortunately the method does not give optimal trajectories Thus a dynamicoptimisation model and a suitable algorithm would be needed to calculate optimallythe trajectory of the quadcopter However the method presented is easy to use togenerate proper values of jounce which will achieve the wanted trajectoryThe functionality of the method is studied with an example simulation Jounce ofposition x is created according to Equation (28) with parameters a = 1 b = 05and c = 2 The position x and its derivatives derived from the planned jounce arepresented in Figure 10 The jounce could also be generated simultaneously for y andz However in this example only position x is considered because the relationship

between the jounce of position x and the control inputs 1 and 3 controlling theangle _ is more visible160 1 2 3 4 5 6 7minus1minus08minus06minus04minus020020406081Time t (s)Jounce (ms4)

(a) Jounce0 1 2 3 4 5 6 7minus04minus03minus02minus01001020304

Time t (s)Jerk (ms3)

(b) Jerk0 1 2 3 4 5 6 7minus02minus015minus01minus00500050101502Time t (s)Acceleration (ms2)

(c) Acceleration0 1 2 3 4 5 6 7minus002000200400600801012014016018

Time t (s)Velocity (ms)

(d) Velocity0 1 2 3 4 5 6 7001020304050607

Time t (s)Position (m)

(e) PositionFigure 10 Planned position x and its derivatives with given jounceThe simulation of the example case is performed with previously given accelerationsand velocities of position x The planned value of angle is zero for each time tFirst the required angles _ and _ and thrust T are solved from Equation (26) foreach time t The angular velocities and accelerations are calculated from the solvedangles with derivation Then the torques are solved using the angular velocitiesand accelerations Finally the control inputs are solved Then the simulation isperformed with given control inputsThe calculated control inputs are presented in Figure 11 The simulated positions_ are presented in Figure 12 and the simulated angles _ in Figure 13 Accordingto Figure 12 the simulated position x is the same as the planned position x inFigure 10(e) and the values of the positions y and z stay as zeroes The angle _increases during the acceleration and then stabilises to a constant value to generate

the constant acceleration required to compensate the drag force caused by theplanned constant velocity Finally the angle is changed to the opposite direction todecelerate the quadcopter to a haltThe shape of the calculated control inputs 1 and 3 in Figure 11 are similar toplanned jounce in Figure 10(a) The shape of the simulated angle _ follows theshape of the planned acceleration umlx The shapes of the control inputs and theangles differ from the planned values of the jounce and the acceleration because thedrag force caused by the velocity has to be compensated170 1 2 3 4 5 6 76203620462056206620762086209621

Time t (s)Control input i (rads)1234

Figure 11 Control inputs i0 1 2 3 4 5 6001020304050607

Time t (s)Position (m)Position xPosition yPosition z

Figure 12 Positions x y and z0 1 2 3 4 5 6 7minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 13 Angles _ _ and The method can also be used even if there are unmodeled linear forces wind forexample which affect the linear accelerations and consequently the position of thequadcopter If the trajectory is calculated in shorter distances it is possible tocorrect the trajectory with new calculation from the current but inaccurate locationto the next checkpoint Example of this method is presented in Figure 14 Thearrows with dash lines indicate the planned trajectory in the x y-plane and thesolid arrows indicate the realised trajectory The black squares mark the start and

the finish positions and the white squares mark the checkpoints for the trajectory18The control inputs are calculated from the current location of the quadcopter to thenext checkpoint but because of random and unmodelled forces the realised positionmarked with X differs from the planned If the quadcopter is close enough to thetarget checkpoint the target checkpoint is changed to the next one and new controlinputs are calculated After repeating this and going through all of the checkpointsthe quadcopter reaches the final destinationFigure 14 Example of checkpoint flight pattern with external disturbancesThe biggest weakness in the proposed method is that it works as shown only if thequadcopter starts from a stable attitude the angles _ and _ and their derivativesare zeros and there are no external forces influencing the attitude during the flightSmall deviations in the angles can result into a huge deviation in the trajectory Oneway to solve this problem is to stabilise the quadcopter at each checkpoint with aPD controller proposed earlier or by using the heuristic method to angles Howeverif the angular disturbances are continuous the benefit from temporary stabilisationis only momentary52 Integrated PD controllerAnother method to take into account the possible deviations in the angles is tointegrate a PD controller into the heuristic method This is a simplified version ofthe proposed control method in [5] The required values dx dy and dz in Equation(26) are given by the PD controller considering the deviations between the currentand desired values (subscript d) of the positions _ velocities _˙ and accelerations _umldx = KxP (xd minus x) + KxD (x˙ d minus x˙ ) + KxDD (xumld minus xuml) dy = KyP (yd minus y) + KyD (y˙d minus y˙) + KyDD (yumld minus yuml) dz = KzP (zd minus z) + KzD (z˙d minus z˙) + KzDD (zumld minus zuml) (29)Then the commanded angles _c and _c and thrust T are given by Equation (26)The torques _ are controlled by the PD controller in Equation (30) same as in

19Equation (23) The control inputs can be solved with the calculated thrust andtorques by using Equation (24)__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Ixx__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Iyy_ =_K P ( d minus ) + K D_˙ d minus ˙ __Izz(30)The performance of the PD controller is demonstrated with an example case inwhich for all positions x y and z and their derivatives the values are same as inFigure 10 The simulation is performed with the PD parameters presented in Table3Table 3 Parameters of the PD controllerVariable Parameter valuei KiP KiD KiDDx 185 075 100y 855 075 100z 185 075 100_ 300 075 -_ 300 075 - 300 075 -The results of the simulation are presented Figures 15 - 17 The simulated controlinputs are presented in Figure 15 the simulated positions in Figure 16 and the

simulated angles in Figure 17 The position of the quadcopter is close to the plannedposition after 6 seconds but the position keeps fluctuating close to the planned valuesfor several seconds The angles variate greatly during the simulation to achieve thewanted positions velocities and accelerations The values of the control inputsoscillated during the acceleration but then their behaviour became more stable0 2 4 6 8 10 12 14618619620621622623624625626

Time t (s)Control input i (rads)1234

Figure 15 Control inputs i200 2 4 6 8 10 12 14minus0100102030405060708

Time t (s)Position (m)Position xPosition yPosition z

Figure 16 Positions x y and z0 2 4 6 8 10 12 14minus15minus125minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 17 Angles _ _ and The proposed integrated PD controller performed well in the example case Howeverthe performance of the controller is highly depended on the parameter values If theparameter values are small the controller will not respond quickly enough to followthe planned trajectory If the parameter values are substantial the quadcopter cannot perform the required drastic changes in the angular velocities of the rotor andthe control inputs calculated from Equation (24) can be infeasible with certaintorques Thus the use of equations considering the torques and the control inputsrequires a method to calculate the best feasible torques and from them the bestcontrol inputs Another possible method would be to variate the PD parameters

according to the current positions and angles and their derivatives but it is extremelydifficult216 ConclusionThis paper studied mathematical modelling and control of a quadcopter The mathematicalmodel of quadcopter dynamics was presented and the differential equationswere derived from the Newton-Euler and the Euler-Lagrange equations The modelwas verified by simulating the flight of a quadcopter with Matlab Stabilisation ofattitude of the quadcopter was done by utilising a PD controller A heuristic methodwas developed to control the trajectory of the quadcopter The PD contoller wasintegrated into the heuristic method for better response to disturbances in the flightconditions of the quadcopterThe simulation proved the presented mathematical model to be realistic in modellingthe position and attitude of the quadcopter The simulation results also showedthat the PD controller was efficient in stabilising the quadcopter to the desiredaltitude and attitude However the PD controller did not considered positions xand y Thus the values of x and y variated from their original values during thestabilisation process This was a result of the deviation of the roll and pitch anglesfrom zero valuesAccording to the simulation results the proposed heuristic method produced goodflight trajectories The heuristic method required only three parameters to generatethe values for the jounce of the position The position and its other derivatives werecalculated from the jounce values The total thrust and the pitch and roll angles toachieve given accelerations were solved from the linear differential equations Thenthe torques were determined by the angular accelerations and angular velocitiescalculated from the angles Finally the required control inputs were solved from thetotal thrust and the torques The simulation results indicated that the quadcopter

could be controlled accurately with the control inputs given by the methodThe proposed heuristic method does not consider unmodelled disturbances suchas wind and thus the PD controller was integrated into the control method Theintegrated PD controller operated well in the example simulation The quadcopterfollowed the given trajectory and began to stabilise after reaching the final destinationHowever the PD controller can perform poorly if the parameter values arenot properly selected and are too small or highThe presented mathematical model only consists of the basic structures of the quadcopterdynamics Several aerodynamical effects were excluded which can lead tounrealiable behaviour Also the electric motors spinning the fours rotors were notmodelled The behaviour of a motor is easily included in the model but would requireestimation of the parameter values of the motor The position and attitudeinformation was assumed to be accurate in the model and the simulations Howeverthe measuring devices in real life are not perfectly accurate as random variationsand errors occur Hence the effects of imprecise information to the flight of thequadcopter should be studied as well Also methods to enhance the accuracy of themeasurements should be researched and implemented to improve all aspects required22for robust quadcopter manoeuvresThe presented model and control methods were tested only with simulations Realexperimental prototype of a quadcopter should be constructed to achieve more realisticand reliable results Even though the construction of a real quadcopter and theestimation of all the model parameters are laborious tasks a real quadcopter wouldbring significant benefits to the research With a real propotype the theoreticalframework and the simulation results could be compared to real-life measurementsThis paper did not include these higlighted matters in the study but presentedthe basics of quadcopter modelling and control This paper can thus be used as a

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

minus25minus2minus15minus1minus05005115Time t (s)Position (m)Position xPosition yPosition z

Figure 3 Positions x y and z90 02 04 06 08 1 12 14 16 18 2minus5051015202530Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 4 Angles _ _ and 104 Stabilisation of quadcopterTo stabilise the quadcopter a PID controller is utilised Advantages of the PIDcontroller are the simple structure and easy implementation of the controller Thegeneral form of the PID controller ise(t) = xd(t) minus x(t)u(t) = KP e(t) + KIZ t0e(_ ) d _ + KDd e(t)d t [16](22)in which u(t) is the control input e(t) is the difference between the desired statexd(t) and the present state x(t) and KP KI and KD are the parameters for theproportional integral and derivative elements of the PID controllerIn a quadcopter there are six states positions _ and angles _ but only four controlinputs the angular velocities of the four rotors i The interactions between thestates and the total thrust T and the torques _ created by the rotors are visible fromthe quadcopter dynamics defined by Equations (10) (11) and (12) The total thrustT affects the acceleration in the direction of the z-axis and holds the quadcopter inthe air Torque __ has an affect on the acceleration of angle _ torque __ affects theacceleration of angle _ and torque _ contributes in the acceleration of angle

Hence the PD controller for the quadcopter is chosen as similarly as in [4]T = (g + KzD (z˙d minus z˙) + KzP (zd minus z)) mC_C___ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Ixx__ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Iyy_ =_K D_ ˙d minus ˙ _+ K P ( d minus )_Izz(23)in which also the gravity g and mass m and moments of inertia I of the quadcopterare consideredThe correct angular velocities of rotors i can be calculated from Equations (7) and(8) with values from Equation (23)21 = T4kminus __2klminus_ 4b22 = T

4kminus__2kl+_ 4b23 = T4k+ __2klminus_ 4b24 = T4k+__2kl+_ 4b(24)The performance of the PD controller is tested by simulating the stabilisation ofa quadcopter The PD controller parameters are presented in Table 2 The initialcondition of the quadcopter is for position _ = [0 0 1]T in meters and for angles11_ = [10 10 10]T in degrees The desired position for altitude is zd = 0 The purposeof the stabilisation is stable hovering thus _d = [0 0 0]TTable 2 Parameters of the PD controllerParameter ValueKzD 25K_D 175K_D 175K D 175Parameter ValueKzP 15K_P 6K_P 6K P 6The control inputs i the positions _ and the angles _ during the simulation are

presented in Figures 5 6 and 7 The altitude and the angles are stabilised to zerovalue after 5 seconds However the positions x and y deviated from the zero valuesbecause of the non-zero values of the angles Before the quadcopter is stabilisedto hover it has already moved over 1 meters in the direction of the positive x axisand 05 meters in the direction of the negative y axis This is because the controlmethod of the PD contoller does not consider the accelerations in the directions ofx and y Thus another control method should be constructed to give a control onall of positions and angles of the quadcopter0 1 2 3 4 5 6550560570580590600610620630

Time t (s)Control input i (rads)1234

Figure 5 Control inputs i0 1 2 3 4 5 6minus06minus04minus02002040608112

Time t (s)Position (m)Position xPosition yPosition z

Figure 6 Positions x y and z120 1 2 3 4 5 6minus20246810

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 7 Angles _ _ and 135 Trajectory controlThe purpose of trajectory control is to move the quadcopter from the original locationto the desired location by controlling the rotor velocities of the quadcopterFinding optimal trajectory for a quadcopter is a difficult task because of complexdynamics However a simple control method is able to control the quadcopteradequately Thus a heuristic approach is studied and developed hereThe basis of the development of a control method is the study of the interactions and

dependances between states state derivatives and control inputs These interactionsand dependances are defined by Equations (7) (8) (20) and (21) and presented inFigure 8The given control inputs i define the total thrust T and the torques __ __ and _ The torques affect the angular accelerations depending on the current angles andangular velocities The angles _ can be integrated from the angular velocities _˙ which are integrated from the angular accelerations uml_ The linear accelerations uml_depend on the total thrust T the angles _ and the linear velocities _˙ The linearposition _ is integrated from the linear accelerations uml_ through the linear velocities_˙Hence to find proper control inputs i for given states _ this line of thought has tobe done in reverse___HHHjT_-- _uml - _˙ - _I K_uml - _˙ - _IFigure 8 Interactions between states state derivatives and control inputsOne method is to generate linear accelerations which accomplish the wanted trajectoryaccording to positions x y and z for each time t From Equation (21) threeequations are receivedTB =00T = RT

muml_ +00g +Ax 0 00 Ay 00 0 Az _˙ (25)in which _uml _˙ and are desired trajectory values as well as angles _ and _ and totalthrust T are unknown values to be solvedFrom this equation the required angles _ and _ and the total thrust T for each timet can be calculated as shown in [5]14_ = arcsin dx S minus dy C d2x + d2y + (dz + g)2_ = arctan_dx C + dy S dz + g_T = m(dx (S_C C_ + S S_) + dy (S_S C_ minus C S_)+( dz + g )C_C_) (26)in whichdx = xuml + Axx˙mdy = yuml+ Ayy˙mdz = zuml+ Azz˙m(27)

When the values of the angles _ and _ are known the angular velocities and accelerationscan be calculated from them with simple derivation With the angularvelocities and accelerations the torques _ can be solved from Equation (20) Whenthe torques and thrust are known the control inputs i can be calculated fromEquation (24)51 Heuristic method for trajectory generationThe generation of proper accelerations uml_ is difficult because the composition of thethird and fourth derivatives of the position jerk and jounce has to be reasonableThe influence of the jounce values is visible in the composition of the control inputsi High jounce values will mean high control input values and thus the jounceshave to be considered closely when generating the accelerationsA heuristic method can be used to generate jounce values The method utilises asymmetric structure in jouce function f(t) to control the derivatives One influencialpart of the function is defined by three sine functions as followingf(t) =a sin10485761b _ t_ 0 le t le bminusa sin10485761b _ t minus __ b le t le 3ba sin10485761b _ t minus 3__ 3b le t le 4b(28)The structure of the function is visualised in Figure 9 The sine functions are usedto give a smooth function These three sine functions form a function in whichthe first half increases acceleration to certain value and then the second half of the

function decreases it back to zero This acceleration generates constant velocityMirror image of the function can be used to decelerate the velocity back to zeroThe final position depends on the parameters a and b of the sine functions presented15in Equation (28) and the time c between the accelerating part and the deceleratingpart the mirror image of the jounceaaab2bba sin10485761b _ t_minusa sin1048576 12b _ t minus __a sin10485761b _ t minus 3__Jounce (ms4)Time t (s)Figure 9 Heuristic method for the generation of jounce functionsUnfortunately the method does not give optimal trajectories Thus a dynamicoptimisation model and a suitable algorithm would be needed to calculate optimallythe trajectory of the quadcopter However the method presented is easy to use togenerate proper values of jounce which will achieve the wanted trajectoryThe functionality of the method is studied with an example simulation Jounce ofposition x is created according to Equation (28) with parameters a = 1 b = 05and c = 2 The position x and its derivatives derived from the planned jounce arepresented in Figure 10 The jounce could also be generated simultaneously for y andz However in this example only position x is considered because the relationship

between the jounce of position x and the control inputs 1 and 3 controlling theangle _ is more visible160 1 2 3 4 5 6 7minus1minus08minus06minus04minus020020406081Time t (s)Jounce (ms4)

(a) Jounce0 1 2 3 4 5 6 7minus04minus03minus02minus01001020304

Time t (s)Jerk (ms3)

(b) Jerk0 1 2 3 4 5 6 7minus02minus015minus01minus00500050101502Time t (s)Acceleration (ms2)

(c) Acceleration0 1 2 3 4 5 6 7minus002000200400600801012014016018

Time t (s)Velocity (ms)

(d) Velocity0 1 2 3 4 5 6 7001020304050607

Time t (s)Position (m)

(e) PositionFigure 10 Planned position x and its derivatives with given jounceThe simulation of the example case is performed with previously given accelerationsand velocities of position x The planned value of angle is zero for each time tFirst the required angles _ and _ and thrust T are solved from Equation (26) foreach time t The angular velocities and accelerations are calculated from the solvedangles with derivation Then the torques are solved using the angular velocitiesand accelerations Finally the control inputs are solved Then the simulation isperformed with given control inputsThe calculated control inputs are presented in Figure 11 The simulated positions_ are presented in Figure 12 and the simulated angles _ in Figure 13 Accordingto Figure 12 the simulated position x is the same as the planned position x inFigure 10(e) and the values of the positions y and z stay as zeroes The angle _increases during the acceleration and then stabilises to a constant value to generate

the constant acceleration required to compensate the drag force caused by theplanned constant velocity Finally the angle is changed to the opposite direction todecelerate the quadcopter to a haltThe shape of the calculated control inputs 1 and 3 in Figure 11 are similar toplanned jounce in Figure 10(a) The shape of the simulated angle _ follows theshape of the planned acceleration umlx The shapes of the control inputs and theangles differ from the planned values of the jounce and the acceleration because thedrag force caused by the velocity has to be compensated170 1 2 3 4 5 6 76203620462056206620762086209621

Time t (s)Control input i (rads)1234

Figure 11 Control inputs i0 1 2 3 4 5 6001020304050607

Time t (s)Position (m)Position xPosition yPosition z

Figure 12 Positions x y and z0 1 2 3 4 5 6 7minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 13 Angles _ _ and The method can also be used even if there are unmodeled linear forces wind forexample which affect the linear accelerations and consequently the position of thequadcopter If the trajectory is calculated in shorter distances it is possible tocorrect the trajectory with new calculation from the current but inaccurate locationto the next checkpoint Example of this method is presented in Figure 14 Thearrows with dash lines indicate the planned trajectory in the x y-plane and thesolid arrows indicate the realised trajectory The black squares mark the start and

the finish positions and the white squares mark the checkpoints for the trajectory18The control inputs are calculated from the current location of the quadcopter to thenext checkpoint but because of random and unmodelled forces the realised positionmarked with X differs from the planned If the quadcopter is close enough to thetarget checkpoint the target checkpoint is changed to the next one and new controlinputs are calculated After repeating this and going through all of the checkpointsthe quadcopter reaches the final destinationFigure 14 Example of checkpoint flight pattern with external disturbancesThe biggest weakness in the proposed method is that it works as shown only if thequadcopter starts from a stable attitude the angles _ and _ and their derivativesare zeros and there are no external forces influencing the attitude during the flightSmall deviations in the angles can result into a huge deviation in the trajectory Oneway to solve this problem is to stabilise the quadcopter at each checkpoint with aPD controller proposed earlier or by using the heuristic method to angles Howeverif the angular disturbances are continuous the benefit from temporary stabilisationis only momentary52 Integrated PD controllerAnother method to take into account the possible deviations in the angles is tointegrate a PD controller into the heuristic method This is a simplified version ofthe proposed control method in [5] The required values dx dy and dz in Equation(26) are given by the PD controller considering the deviations between the currentand desired values (subscript d) of the positions _ velocities _˙ and accelerations _umldx = KxP (xd minus x) + KxD (x˙ d minus x˙ ) + KxDD (xumld minus xuml) dy = KyP (yd minus y) + KyD (y˙d minus y˙) + KyDD (yumld minus yuml) dz = KzP (zd minus z) + KzD (z˙d minus z˙) + KzDD (zumld minus zuml) (29)Then the commanded angles _c and _c and thrust T are given by Equation (26)The torques _ are controlled by the PD controller in Equation (30) same as in

19Equation (23) The control inputs can be solved with the calculated thrust andtorques by using Equation (24)__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Ixx__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Iyy_ =_K P ( d minus ) + K D_˙ d minus ˙ __Izz(30)The performance of the PD controller is demonstrated with an example case inwhich for all positions x y and z and their derivatives the values are same as inFigure 10 The simulation is performed with the PD parameters presented in Table3Table 3 Parameters of the PD controllerVariable Parameter valuei KiP KiD KiDDx 185 075 100y 855 075 100z 185 075 100_ 300 075 -_ 300 075 - 300 075 -The results of the simulation are presented Figures 15 - 17 The simulated controlinputs are presented in Figure 15 the simulated positions in Figure 16 and the

simulated angles in Figure 17 The position of the quadcopter is close to the plannedposition after 6 seconds but the position keeps fluctuating close to the planned valuesfor several seconds The angles variate greatly during the simulation to achieve thewanted positions velocities and accelerations The values of the control inputsoscillated during the acceleration but then their behaviour became more stable0 2 4 6 8 10 12 14618619620621622623624625626

Time t (s)Control input i (rads)1234

Figure 15 Control inputs i200 2 4 6 8 10 12 14minus0100102030405060708

Time t (s)Position (m)Position xPosition yPosition z

Figure 16 Positions x y and z0 2 4 6 8 10 12 14minus15minus125minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 17 Angles _ _ and The proposed integrated PD controller performed well in the example case Howeverthe performance of the controller is highly depended on the parameter values If theparameter values are small the controller will not respond quickly enough to followthe planned trajectory If the parameter values are substantial the quadcopter cannot perform the required drastic changes in the angular velocities of the rotor andthe control inputs calculated from Equation (24) can be infeasible with certaintorques Thus the use of equations considering the torques and the control inputsrequires a method to calculate the best feasible torques and from them the bestcontrol inputs Another possible method would be to variate the PD parameters

according to the current positions and angles and their derivatives but it is extremelydifficult216 ConclusionThis paper studied mathematical modelling and control of a quadcopter The mathematicalmodel of quadcopter dynamics was presented and the differential equationswere derived from the Newton-Euler and the Euler-Lagrange equations The modelwas verified by simulating the flight of a quadcopter with Matlab Stabilisation ofattitude of the quadcopter was done by utilising a PD controller A heuristic methodwas developed to control the trajectory of the quadcopter The PD contoller wasintegrated into the heuristic method for better response to disturbances in the flightconditions of the quadcopterThe simulation proved the presented mathematical model to be realistic in modellingthe position and attitude of the quadcopter The simulation results also showedthat the PD controller was efficient in stabilising the quadcopter to the desiredaltitude and attitude However the PD controller did not considered positions xand y Thus the values of x and y variated from their original values during thestabilisation process This was a result of the deviation of the roll and pitch anglesfrom zero valuesAccording to the simulation results the proposed heuristic method produced goodflight trajectories The heuristic method required only three parameters to generatethe values for the jounce of the position The position and its other derivatives werecalculated from the jounce values The total thrust and the pitch and roll angles toachieve given accelerations were solved from the linear differential equations Thenthe torques were determined by the angular accelerations and angular velocitiescalculated from the angles Finally the required control inputs were solved from thetotal thrust and the torques The simulation results indicated that the quadcopter

could be controlled accurately with the control inputs given by the methodThe proposed heuristic method does not consider unmodelled disturbances suchas wind and thus the PD controller was integrated into the control method Theintegrated PD controller operated well in the example simulation The quadcopterfollowed the given trajectory and began to stabilise after reaching the final destinationHowever the PD controller can perform poorly if the parameter values arenot properly selected and are too small or highThe presented mathematical model only consists of the basic structures of the quadcopterdynamics Several aerodynamical effects were excluded which can lead tounrealiable behaviour Also the electric motors spinning the fours rotors were notmodelled The behaviour of a motor is easily included in the model but would requireestimation of the parameter values of the motor The position and attitudeinformation was assumed to be accurate in the model and the simulations Howeverthe measuring devices in real life are not perfectly accurate as random variationsand errors occur Hence the effects of imprecise information to the flight of thequadcopter should be studied as well Also methods to enhance the accuracy of themeasurements should be researched and implemented to improve all aspects required22for robust quadcopter manoeuvresThe presented model and control methods were tested only with simulations Realexperimental prototype of a quadcopter should be constructed to achieve more realisticand reliable results Even though the construction of a real quadcopter and theestimation of all the model parameters are laborious tasks a real quadcopter wouldbring significant benefits to the research With a real propotype the theoreticalframework and the simulation results could be compared to real-life measurementsThis paper did not include these higlighted matters in the study but presentedthe basics of quadcopter modelling and control This paper can thus be used as a

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

Hence the PD controller for the quadcopter is chosen as similarly as in [4]T = (g + KzD (z˙d minus z˙) + KzP (zd minus z)) mC_C___ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Ixx__ =_K_D_˙ _d minus ˙__+ K_P (_d minus _)_Iyy_ =_K D_ ˙d minus ˙ _+ K P ( d minus )_Izz(23)in which also the gravity g and mass m and moments of inertia I of the quadcopterare consideredThe correct angular velocities of rotors i can be calculated from Equations (7) and(8) with values from Equation (23)21 = T4kminus __2klminus_ 4b22 = T

4kminus__2kl+_ 4b23 = T4k+ __2klminus_ 4b24 = T4k+__2kl+_ 4b(24)The performance of the PD controller is tested by simulating the stabilisation ofa quadcopter The PD controller parameters are presented in Table 2 The initialcondition of the quadcopter is for position _ = [0 0 1]T in meters and for angles11_ = [10 10 10]T in degrees The desired position for altitude is zd = 0 The purposeof the stabilisation is stable hovering thus _d = [0 0 0]TTable 2 Parameters of the PD controllerParameter ValueKzD 25K_D 175K_D 175K D 175Parameter ValueKzP 15K_P 6K_P 6K P 6The control inputs i the positions _ and the angles _ during the simulation are

presented in Figures 5 6 and 7 The altitude and the angles are stabilised to zerovalue after 5 seconds However the positions x and y deviated from the zero valuesbecause of the non-zero values of the angles Before the quadcopter is stabilisedto hover it has already moved over 1 meters in the direction of the positive x axisand 05 meters in the direction of the negative y axis This is because the controlmethod of the PD contoller does not consider the accelerations in the directions ofx and y Thus another control method should be constructed to give a control onall of positions and angles of the quadcopter0 1 2 3 4 5 6550560570580590600610620630

Time t (s)Control input i (rads)1234

Figure 5 Control inputs i0 1 2 3 4 5 6minus06minus04minus02002040608112

Time t (s)Position (m)Position xPosition yPosition z

Figure 6 Positions x y and z120 1 2 3 4 5 6minus20246810

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 7 Angles _ _ and 135 Trajectory controlThe purpose of trajectory control is to move the quadcopter from the original locationto the desired location by controlling the rotor velocities of the quadcopterFinding optimal trajectory for a quadcopter is a difficult task because of complexdynamics However a simple control method is able to control the quadcopteradequately Thus a heuristic approach is studied and developed hereThe basis of the development of a control method is the study of the interactions and

dependances between states state derivatives and control inputs These interactionsand dependances are defined by Equations (7) (8) (20) and (21) and presented inFigure 8The given control inputs i define the total thrust T and the torques __ __ and _ The torques affect the angular accelerations depending on the current angles andangular velocities The angles _ can be integrated from the angular velocities _˙ which are integrated from the angular accelerations uml_ The linear accelerations uml_depend on the total thrust T the angles _ and the linear velocities _˙ The linearposition _ is integrated from the linear accelerations uml_ through the linear velocities_˙Hence to find proper control inputs i for given states _ this line of thought has tobe done in reverse___HHHjT_-- _uml - _˙ - _I K_uml - _˙ - _IFigure 8 Interactions between states state derivatives and control inputsOne method is to generate linear accelerations which accomplish the wanted trajectoryaccording to positions x y and z for each time t From Equation (21) threeequations are receivedTB =00T = RT

muml_ +00g +Ax 0 00 Ay 00 0 Az _˙ (25)in which _uml _˙ and are desired trajectory values as well as angles _ and _ and totalthrust T are unknown values to be solvedFrom this equation the required angles _ and _ and the total thrust T for each timet can be calculated as shown in [5]14_ = arcsin dx S minus dy C d2x + d2y + (dz + g)2_ = arctan_dx C + dy S dz + g_T = m(dx (S_C C_ + S S_) + dy (S_S C_ minus C S_)+( dz + g )C_C_) (26)in whichdx = xuml + Axx˙mdy = yuml+ Ayy˙mdz = zuml+ Azz˙m(27)

When the values of the angles _ and _ are known the angular velocities and accelerationscan be calculated from them with simple derivation With the angularvelocities and accelerations the torques _ can be solved from Equation (20) Whenthe torques and thrust are known the control inputs i can be calculated fromEquation (24)51 Heuristic method for trajectory generationThe generation of proper accelerations uml_ is difficult because the composition of thethird and fourth derivatives of the position jerk and jounce has to be reasonableThe influence of the jounce values is visible in the composition of the control inputsi High jounce values will mean high control input values and thus the jounceshave to be considered closely when generating the accelerationsA heuristic method can be used to generate jounce values The method utilises asymmetric structure in jouce function f(t) to control the derivatives One influencialpart of the function is defined by three sine functions as followingf(t) =a sin10485761b _ t_ 0 le t le bminusa sin10485761b _ t minus __ b le t le 3ba sin10485761b _ t minus 3__ 3b le t le 4b(28)The structure of the function is visualised in Figure 9 The sine functions are usedto give a smooth function These three sine functions form a function in whichthe first half increases acceleration to certain value and then the second half of the

function decreases it back to zero This acceleration generates constant velocityMirror image of the function can be used to decelerate the velocity back to zeroThe final position depends on the parameters a and b of the sine functions presented15in Equation (28) and the time c between the accelerating part and the deceleratingpart the mirror image of the jounceaaab2bba sin10485761b _ t_minusa sin1048576 12b _ t minus __a sin10485761b _ t minus 3__Jounce (ms4)Time t (s)Figure 9 Heuristic method for the generation of jounce functionsUnfortunately the method does not give optimal trajectories Thus a dynamicoptimisation model and a suitable algorithm would be needed to calculate optimallythe trajectory of the quadcopter However the method presented is easy to use togenerate proper values of jounce which will achieve the wanted trajectoryThe functionality of the method is studied with an example simulation Jounce ofposition x is created according to Equation (28) with parameters a = 1 b = 05and c = 2 The position x and its derivatives derived from the planned jounce arepresented in Figure 10 The jounce could also be generated simultaneously for y andz However in this example only position x is considered because the relationship

between the jounce of position x and the control inputs 1 and 3 controlling theangle _ is more visible160 1 2 3 4 5 6 7minus1minus08minus06minus04minus020020406081Time t (s)Jounce (ms4)

(a) Jounce0 1 2 3 4 5 6 7minus04minus03minus02minus01001020304

Time t (s)Jerk (ms3)

(b) Jerk0 1 2 3 4 5 6 7minus02minus015minus01minus00500050101502Time t (s)Acceleration (ms2)

(c) Acceleration0 1 2 3 4 5 6 7minus002000200400600801012014016018

Time t (s)Velocity (ms)

(d) Velocity0 1 2 3 4 5 6 7001020304050607

Time t (s)Position (m)

(e) PositionFigure 10 Planned position x and its derivatives with given jounceThe simulation of the example case is performed with previously given accelerationsand velocities of position x The planned value of angle is zero for each time tFirst the required angles _ and _ and thrust T are solved from Equation (26) foreach time t The angular velocities and accelerations are calculated from the solvedangles with derivation Then the torques are solved using the angular velocitiesand accelerations Finally the control inputs are solved Then the simulation isperformed with given control inputsThe calculated control inputs are presented in Figure 11 The simulated positions_ are presented in Figure 12 and the simulated angles _ in Figure 13 Accordingto Figure 12 the simulated position x is the same as the planned position x inFigure 10(e) and the values of the positions y and z stay as zeroes The angle _increases during the acceleration and then stabilises to a constant value to generate

the constant acceleration required to compensate the drag force caused by theplanned constant velocity Finally the angle is changed to the opposite direction todecelerate the quadcopter to a haltThe shape of the calculated control inputs 1 and 3 in Figure 11 are similar toplanned jounce in Figure 10(a) The shape of the simulated angle _ follows theshape of the planned acceleration umlx The shapes of the control inputs and theangles differ from the planned values of the jounce and the acceleration because thedrag force caused by the velocity has to be compensated170 1 2 3 4 5 6 76203620462056206620762086209621

Time t (s)Control input i (rads)1234

Figure 11 Control inputs i0 1 2 3 4 5 6001020304050607

Time t (s)Position (m)Position xPosition yPosition z

Figure 12 Positions x y and z0 1 2 3 4 5 6 7minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 13 Angles _ _ and The method can also be used even if there are unmodeled linear forces wind forexample which affect the linear accelerations and consequently the position of thequadcopter If the trajectory is calculated in shorter distances it is possible tocorrect the trajectory with new calculation from the current but inaccurate locationto the next checkpoint Example of this method is presented in Figure 14 Thearrows with dash lines indicate the planned trajectory in the x y-plane and thesolid arrows indicate the realised trajectory The black squares mark the start and

the finish positions and the white squares mark the checkpoints for the trajectory18The control inputs are calculated from the current location of the quadcopter to thenext checkpoint but because of random and unmodelled forces the realised positionmarked with X differs from the planned If the quadcopter is close enough to thetarget checkpoint the target checkpoint is changed to the next one and new controlinputs are calculated After repeating this and going through all of the checkpointsthe quadcopter reaches the final destinationFigure 14 Example of checkpoint flight pattern with external disturbancesThe biggest weakness in the proposed method is that it works as shown only if thequadcopter starts from a stable attitude the angles _ and _ and their derivativesare zeros and there are no external forces influencing the attitude during the flightSmall deviations in the angles can result into a huge deviation in the trajectory Oneway to solve this problem is to stabilise the quadcopter at each checkpoint with aPD controller proposed earlier or by using the heuristic method to angles Howeverif the angular disturbances are continuous the benefit from temporary stabilisationis only momentary52 Integrated PD controllerAnother method to take into account the possible deviations in the angles is tointegrate a PD controller into the heuristic method This is a simplified version ofthe proposed control method in [5] The required values dx dy and dz in Equation(26) are given by the PD controller considering the deviations between the currentand desired values (subscript d) of the positions _ velocities _˙ and accelerations _umldx = KxP (xd minus x) + KxD (x˙ d minus x˙ ) + KxDD (xumld minus xuml) dy = KyP (yd minus y) + KyD (y˙d minus y˙) + KyDD (yumld minus yuml) dz = KzP (zd minus z) + KzD (z˙d minus z˙) + KzDD (zumld minus zuml) (29)Then the commanded angles _c and _c and thrust T are given by Equation (26)The torques _ are controlled by the PD controller in Equation (30) same as in

19Equation (23) The control inputs can be solved with the calculated thrust andtorques by using Equation (24)__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Ixx__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Iyy_ =_K P ( d minus ) + K D_˙ d minus ˙ __Izz(30)The performance of the PD controller is demonstrated with an example case inwhich for all positions x y and z and their derivatives the values are same as inFigure 10 The simulation is performed with the PD parameters presented in Table3Table 3 Parameters of the PD controllerVariable Parameter valuei KiP KiD KiDDx 185 075 100y 855 075 100z 185 075 100_ 300 075 -_ 300 075 - 300 075 -The results of the simulation are presented Figures 15 - 17 The simulated controlinputs are presented in Figure 15 the simulated positions in Figure 16 and the

simulated angles in Figure 17 The position of the quadcopter is close to the plannedposition after 6 seconds but the position keeps fluctuating close to the planned valuesfor several seconds The angles variate greatly during the simulation to achieve thewanted positions velocities and accelerations The values of the control inputsoscillated during the acceleration but then their behaviour became more stable0 2 4 6 8 10 12 14618619620621622623624625626

Time t (s)Control input i (rads)1234

Figure 15 Control inputs i200 2 4 6 8 10 12 14minus0100102030405060708

Time t (s)Position (m)Position xPosition yPosition z

Figure 16 Positions x y and z0 2 4 6 8 10 12 14minus15minus125minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 17 Angles _ _ and The proposed integrated PD controller performed well in the example case Howeverthe performance of the controller is highly depended on the parameter values If theparameter values are small the controller will not respond quickly enough to followthe planned trajectory If the parameter values are substantial the quadcopter cannot perform the required drastic changes in the angular velocities of the rotor andthe control inputs calculated from Equation (24) can be infeasible with certaintorques Thus the use of equations considering the torques and the control inputsrequires a method to calculate the best feasible torques and from them the bestcontrol inputs Another possible method would be to variate the PD parameters

according to the current positions and angles and their derivatives but it is extremelydifficult216 ConclusionThis paper studied mathematical modelling and control of a quadcopter The mathematicalmodel of quadcopter dynamics was presented and the differential equationswere derived from the Newton-Euler and the Euler-Lagrange equations The modelwas verified by simulating the flight of a quadcopter with Matlab Stabilisation ofattitude of the quadcopter was done by utilising a PD controller A heuristic methodwas developed to control the trajectory of the quadcopter The PD contoller wasintegrated into the heuristic method for better response to disturbances in the flightconditions of the quadcopterThe simulation proved the presented mathematical model to be realistic in modellingthe position and attitude of the quadcopter The simulation results also showedthat the PD controller was efficient in stabilising the quadcopter to the desiredaltitude and attitude However the PD controller did not considered positions xand y Thus the values of x and y variated from their original values during thestabilisation process This was a result of the deviation of the roll and pitch anglesfrom zero valuesAccording to the simulation results the proposed heuristic method produced goodflight trajectories The heuristic method required only three parameters to generatethe values for the jounce of the position The position and its other derivatives werecalculated from the jounce values The total thrust and the pitch and roll angles toachieve given accelerations were solved from the linear differential equations Thenthe torques were determined by the angular accelerations and angular velocitiescalculated from the angles Finally the required control inputs were solved from thetotal thrust and the torques The simulation results indicated that the quadcopter

could be controlled accurately with the control inputs given by the methodThe proposed heuristic method does not consider unmodelled disturbances suchas wind and thus the PD controller was integrated into the control method Theintegrated PD controller operated well in the example simulation The quadcopterfollowed the given trajectory and began to stabilise after reaching the final destinationHowever the PD controller can perform poorly if the parameter values arenot properly selected and are too small or highThe presented mathematical model only consists of the basic structures of the quadcopterdynamics Several aerodynamical effects were excluded which can lead tounrealiable behaviour Also the electric motors spinning the fours rotors were notmodelled The behaviour of a motor is easily included in the model but would requireestimation of the parameter values of the motor The position and attitudeinformation was assumed to be accurate in the model and the simulations Howeverthe measuring devices in real life are not perfectly accurate as random variationsand errors occur Hence the effects of imprecise information to the flight of thequadcopter should be studied as well Also methods to enhance the accuracy of themeasurements should be researched and implemented to improve all aspects required22for robust quadcopter manoeuvresThe presented model and control methods were tested only with simulations Realexperimental prototype of a quadcopter should be constructed to achieve more realisticand reliable results Even though the construction of a real quadcopter and theestimation of all the model parameters are laborious tasks a real quadcopter wouldbring significant benefits to the research With a real propotype the theoreticalframework and the simulation results could be compared to real-life measurementsThis paper did not include these higlighted matters in the study but presentedthe basics of quadcopter modelling and control This paper can thus be used as a

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

4kminus__2kl+_ 4b23 = T4k+ __2klminus_ 4b24 = T4k+__2kl+_ 4b(24)The performance of the PD controller is tested by simulating the stabilisation ofa quadcopter The PD controller parameters are presented in Table 2 The initialcondition of the quadcopter is for position _ = [0 0 1]T in meters and for angles11_ = [10 10 10]T in degrees The desired position for altitude is zd = 0 The purposeof the stabilisation is stable hovering thus _d = [0 0 0]TTable 2 Parameters of the PD controllerParameter ValueKzD 25K_D 175K_D 175K D 175Parameter ValueKzP 15K_P 6K_P 6K P 6The control inputs i the positions _ and the angles _ during the simulation are

presented in Figures 5 6 and 7 The altitude and the angles are stabilised to zerovalue after 5 seconds However the positions x and y deviated from the zero valuesbecause of the non-zero values of the angles Before the quadcopter is stabilisedto hover it has already moved over 1 meters in the direction of the positive x axisand 05 meters in the direction of the negative y axis This is because the controlmethod of the PD contoller does not consider the accelerations in the directions ofx and y Thus another control method should be constructed to give a control onall of positions and angles of the quadcopter0 1 2 3 4 5 6550560570580590600610620630

Time t (s)Control input i (rads)1234

Figure 5 Control inputs i0 1 2 3 4 5 6minus06minus04minus02002040608112

Time t (s)Position (m)Position xPosition yPosition z

Figure 6 Positions x y and z120 1 2 3 4 5 6minus20246810

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 7 Angles _ _ and 135 Trajectory controlThe purpose of trajectory control is to move the quadcopter from the original locationto the desired location by controlling the rotor velocities of the quadcopterFinding optimal trajectory for a quadcopter is a difficult task because of complexdynamics However a simple control method is able to control the quadcopteradequately Thus a heuristic approach is studied and developed hereThe basis of the development of a control method is the study of the interactions and

dependances between states state derivatives and control inputs These interactionsand dependances are defined by Equations (7) (8) (20) and (21) and presented inFigure 8The given control inputs i define the total thrust T and the torques __ __ and _ The torques affect the angular accelerations depending on the current angles andangular velocities The angles _ can be integrated from the angular velocities _˙ which are integrated from the angular accelerations uml_ The linear accelerations uml_depend on the total thrust T the angles _ and the linear velocities _˙ The linearposition _ is integrated from the linear accelerations uml_ through the linear velocities_˙Hence to find proper control inputs i for given states _ this line of thought has tobe done in reverse___HHHjT_-- _uml - _˙ - _I K_uml - _˙ - _IFigure 8 Interactions between states state derivatives and control inputsOne method is to generate linear accelerations which accomplish the wanted trajectoryaccording to positions x y and z for each time t From Equation (21) threeequations are receivedTB =00T = RT

muml_ +00g +Ax 0 00 Ay 00 0 Az _˙ (25)in which _uml _˙ and are desired trajectory values as well as angles _ and _ and totalthrust T are unknown values to be solvedFrom this equation the required angles _ and _ and the total thrust T for each timet can be calculated as shown in [5]14_ = arcsin dx S minus dy C d2x + d2y + (dz + g)2_ = arctan_dx C + dy S dz + g_T = m(dx (S_C C_ + S S_) + dy (S_S C_ minus C S_)+( dz + g )C_C_) (26)in whichdx = xuml + Axx˙mdy = yuml+ Ayy˙mdz = zuml+ Azz˙m(27)

When the values of the angles _ and _ are known the angular velocities and accelerationscan be calculated from them with simple derivation With the angularvelocities and accelerations the torques _ can be solved from Equation (20) Whenthe torques and thrust are known the control inputs i can be calculated fromEquation (24)51 Heuristic method for trajectory generationThe generation of proper accelerations uml_ is difficult because the composition of thethird and fourth derivatives of the position jerk and jounce has to be reasonableThe influence of the jounce values is visible in the composition of the control inputsi High jounce values will mean high control input values and thus the jounceshave to be considered closely when generating the accelerationsA heuristic method can be used to generate jounce values The method utilises asymmetric structure in jouce function f(t) to control the derivatives One influencialpart of the function is defined by three sine functions as followingf(t) =a sin10485761b _ t_ 0 le t le bminusa sin10485761b _ t minus __ b le t le 3ba sin10485761b _ t minus 3__ 3b le t le 4b(28)The structure of the function is visualised in Figure 9 The sine functions are usedto give a smooth function These three sine functions form a function in whichthe first half increases acceleration to certain value and then the second half of the

function decreases it back to zero This acceleration generates constant velocityMirror image of the function can be used to decelerate the velocity back to zeroThe final position depends on the parameters a and b of the sine functions presented15in Equation (28) and the time c between the accelerating part and the deceleratingpart the mirror image of the jounceaaab2bba sin10485761b _ t_minusa sin1048576 12b _ t minus __a sin10485761b _ t minus 3__Jounce (ms4)Time t (s)Figure 9 Heuristic method for the generation of jounce functionsUnfortunately the method does not give optimal trajectories Thus a dynamicoptimisation model and a suitable algorithm would be needed to calculate optimallythe trajectory of the quadcopter However the method presented is easy to use togenerate proper values of jounce which will achieve the wanted trajectoryThe functionality of the method is studied with an example simulation Jounce ofposition x is created according to Equation (28) with parameters a = 1 b = 05and c = 2 The position x and its derivatives derived from the planned jounce arepresented in Figure 10 The jounce could also be generated simultaneously for y andz However in this example only position x is considered because the relationship

between the jounce of position x and the control inputs 1 and 3 controlling theangle _ is more visible160 1 2 3 4 5 6 7minus1minus08minus06minus04minus020020406081Time t (s)Jounce (ms4)

(a) Jounce0 1 2 3 4 5 6 7minus04minus03minus02minus01001020304

Time t (s)Jerk (ms3)

(b) Jerk0 1 2 3 4 5 6 7minus02minus015minus01minus00500050101502Time t (s)Acceleration (ms2)

(c) Acceleration0 1 2 3 4 5 6 7minus002000200400600801012014016018

Time t (s)Velocity (ms)

(d) Velocity0 1 2 3 4 5 6 7001020304050607

Time t (s)Position (m)

(e) PositionFigure 10 Planned position x and its derivatives with given jounceThe simulation of the example case is performed with previously given accelerationsand velocities of position x The planned value of angle is zero for each time tFirst the required angles _ and _ and thrust T are solved from Equation (26) foreach time t The angular velocities and accelerations are calculated from the solvedangles with derivation Then the torques are solved using the angular velocitiesand accelerations Finally the control inputs are solved Then the simulation isperformed with given control inputsThe calculated control inputs are presented in Figure 11 The simulated positions_ are presented in Figure 12 and the simulated angles _ in Figure 13 Accordingto Figure 12 the simulated position x is the same as the planned position x inFigure 10(e) and the values of the positions y and z stay as zeroes The angle _increases during the acceleration and then stabilises to a constant value to generate

the constant acceleration required to compensate the drag force caused by theplanned constant velocity Finally the angle is changed to the opposite direction todecelerate the quadcopter to a haltThe shape of the calculated control inputs 1 and 3 in Figure 11 are similar toplanned jounce in Figure 10(a) The shape of the simulated angle _ follows theshape of the planned acceleration umlx The shapes of the control inputs and theangles differ from the planned values of the jounce and the acceleration because thedrag force caused by the velocity has to be compensated170 1 2 3 4 5 6 76203620462056206620762086209621

Time t (s)Control input i (rads)1234

Figure 11 Control inputs i0 1 2 3 4 5 6001020304050607

Time t (s)Position (m)Position xPosition yPosition z

Figure 12 Positions x y and z0 1 2 3 4 5 6 7minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 13 Angles _ _ and The method can also be used even if there are unmodeled linear forces wind forexample which affect the linear accelerations and consequently the position of thequadcopter If the trajectory is calculated in shorter distances it is possible tocorrect the trajectory with new calculation from the current but inaccurate locationto the next checkpoint Example of this method is presented in Figure 14 Thearrows with dash lines indicate the planned trajectory in the x y-plane and thesolid arrows indicate the realised trajectory The black squares mark the start and

the finish positions and the white squares mark the checkpoints for the trajectory18The control inputs are calculated from the current location of the quadcopter to thenext checkpoint but because of random and unmodelled forces the realised positionmarked with X differs from the planned If the quadcopter is close enough to thetarget checkpoint the target checkpoint is changed to the next one and new controlinputs are calculated After repeating this and going through all of the checkpointsthe quadcopter reaches the final destinationFigure 14 Example of checkpoint flight pattern with external disturbancesThe biggest weakness in the proposed method is that it works as shown only if thequadcopter starts from a stable attitude the angles _ and _ and their derivativesare zeros and there are no external forces influencing the attitude during the flightSmall deviations in the angles can result into a huge deviation in the trajectory Oneway to solve this problem is to stabilise the quadcopter at each checkpoint with aPD controller proposed earlier or by using the heuristic method to angles Howeverif the angular disturbances are continuous the benefit from temporary stabilisationis only momentary52 Integrated PD controllerAnother method to take into account the possible deviations in the angles is tointegrate a PD controller into the heuristic method This is a simplified version ofthe proposed control method in [5] The required values dx dy and dz in Equation(26) are given by the PD controller considering the deviations between the currentand desired values (subscript d) of the positions _ velocities _˙ and accelerations _umldx = KxP (xd minus x) + KxD (x˙ d minus x˙ ) + KxDD (xumld minus xuml) dy = KyP (yd minus y) + KyD (y˙d minus y˙) + KyDD (yumld minus yuml) dz = KzP (zd minus z) + KzD (z˙d minus z˙) + KzDD (zumld minus zuml) (29)Then the commanded angles _c and _c and thrust T are given by Equation (26)The torques _ are controlled by the PD controller in Equation (30) same as in

19Equation (23) The control inputs can be solved with the calculated thrust andtorques by using Equation (24)__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Ixx__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Iyy_ =_K P ( d minus ) + K D_˙ d minus ˙ __Izz(30)The performance of the PD controller is demonstrated with an example case inwhich for all positions x y and z and their derivatives the values are same as inFigure 10 The simulation is performed with the PD parameters presented in Table3Table 3 Parameters of the PD controllerVariable Parameter valuei KiP KiD KiDDx 185 075 100y 855 075 100z 185 075 100_ 300 075 -_ 300 075 - 300 075 -The results of the simulation are presented Figures 15 - 17 The simulated controlinputs are presented in Figure 15 the simulated positions in Figure 16 and the

simulated angles in Figure 17 The position of the quadcopter is close to the plannedposition after 6 seconds but the position keeps fluctuating close to the planned valuesfor several seconds The angles variate greatly during the simulation to achieve thewanted positions velocities and accelerations The values of the control inputsoscillated during the acceleration but then their behaviour became more stable0 2 4 6 8 10 12 14618619620621622623624625626

Time t (s)Control input i (rads)1234

Figure 15 Control inputs i200 2 4 6 8 10 12 14minus0100102030405060708

Time t (s)Position (m)Position xPosition yPosition z

Figure 16 Positions x y and z0 2 4 6 8 10 12 14minus15minus125minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 17 Angles _ _ and The proposed integrated PD controller performed well in the example case Howeverthe performance of the controller is highly depended on the parameter values If theparameter values are small the controller will not respond quickly enough to followthe planned trajectory If the parameter values are substantial the quadcopter cannot perform the required drastic changes in the angular velocities of the rotor andthe control inputs calculated from Equation (24) can be infeasible with certaintorques Thus the use of equations considering the torques and the control inputsrequires a method to calculate the best feasible torques and from them the bestcontrol inputs Another possible method would be to variate the PD parameters

according to the current positions and angles and their derivatives but it is extremelydifficult216 ConclusionThis paper studied mathematical modelling and control of a quadcopter The mathematicalmodel of quadcopter dynamics was presented and the differential equationswere derived from the Newton-Euler and the Euler-Lagrange equations The modelwas verified by simulating the flight of a quadcopter with Matlab Stabilisation ofattitude of the quadcopter was done by utilising a PD controller A heuristic methodwas developed to control the trajectory of the quadcopter The PD contoller wasintegrated into the heuristic method for better response to disturbances in the flightconditions of the quadcopterThe simulation proved the presented mathematical model to be realistic in modellingthe position and attitude of the quadcopter The simulation results also showedthat the PD controller was efficient in stabilising the quadcopter to the desiredaltitude and attitude However the PD controller did not considered positions xand y Thus the values of x and y variated from their original values during thestabilisation process This was a result of the deviation of the roll and pitch anglesfrom zero valuesAccording to the simulation results the proposed heuristic method produced goodflight trajectories The heuristic method required only three parameters to generatethe values for the jounce of the position The position and its other derivatives werecalculated from the jounce values The total thrust and the pitch and roll angles toachieve given accelerations were solved from the linear differential equations Thenthe torques were determined by the angular accelerations and angular velocitiescalculated from the angles Finally the required control inputs were solved from thetotal thrust and the torques The simulation results indicated that the quadcopter

could be controlled accurately with the control inputs given by the methodThe proposed heuristic method does not consider unmodelled disturbances suchas wind and thus the PD controller was integrated into the control method Theintegrated PD controller operated well in the example simulation The quadcopterfollowed the given trajectory and began to stabilise after reaching the final destinationHowever the PD controller can perform poorly if the parameter values arenot properly selected and are too small or highThe presented mathematical model only consists of the basic structures of the quadcopterdynamics Several aerodynamical effects were excluded which can lead tounrealiable behaviour Also the electric motors spinning the fours rotors were notmodelled The behaviour of a motor is easily included in the model but would requireestimation of the parameter values of the motor The position and attitudeinformation was assumed to be accurate in the model and the simulations Howeverthe measuring devices in real life are not perfectly accurate as random variationsand errors occur Hence the effects of imprecise information to the flight of thequadcopter should be studied as well Also methods to enhance the accuracy of themeasurements should be researched and implemented to improve all aspects required22for robust quadcopter manoeuvresThe presented model and control methods were tested only with simulations Realexperimental prototype of a quadcopter should be constructed to achieve more realisticand reliable results Even though the construction of a real quadcopter and theestimation of all the model parameters are laborious tasks a real quadcopter wouldbring significant benefits to the research With a real propotype the theoreticalframework and the simulation results could be compared to real-life measurementsThis paper did not include these higlighted matters in the study but presentedthe basics of quadcopter modelling and control This paper can thus be used as a

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

presented in Figures 5 6 and 7 The altitude and the angles are stabilised to zerovalue after 5 seconds However the positions x and y deviated from the zero valuesbecause of the non-zero values of the angles Before the quadcopter is stabilisedto hover it has already moved over 1 meters in the direction of the positive x axisand 05 meters in the direction of the negative y axis This is because the controlmethod of the PD contoller does not consider the accelerations in the directions ofx and y Thus another control method should be constructed to give a control onall of positions and angles of the quadcopter0 1 2 3 4 5 6550560570580590600610620630

Time t (s)Control input i (rads)1234

Figure 5 Control inputs i0 1 2 3 4 5 6minus06minus04minus02002040608112

Time t (s)Position (m)Position xPosition yPosition z

Figure 6 Positions x y and z120 1 2 3 4 5 6minus20246810

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 7 Angles _ _ and 135 Trajectory controlThe purpose of trajectory control is to move the quadcopter from the original locationto the desired location by controlling the rotor velocities of the quadcopterFinding optimal trajectory for a quadcopter is a difficult task because of complexdynamics However a simple control method is able to control the quadcopteradequately Thus a heuristic approach is studied and developed hereThe basis of the development of a control method is the study of the interactions and

dependances between states state derivatives and control inputs These interactionsand dependances are defined by Equations (7) (8) (20) and (21) and presented inFigure 8The given control inputs i define the total thrust T and the torques __ __ and _ The torques affect the angular accelerations depending on the current angles andangular velocities The angles _ can be integrated from the angular velocities _˙ which are integrated from the angular accelerations uml_ The linear accelerations uml_depend on the total thrust T the angles _ and the linear velocities _˙ The linearposition _ is integrated from the linear accelerations uml_ through the linear velocities_˙Hence to find proper control inputs i for given states _ this line of thought has tobe done in reverse___HHHjT_-- _uml - _˙ - _I K_uml - _˙ - _IFigure 8 Interactions between states state derivatives and control inputsOne method is to generate linear accelerations which accomplish the wanted trajectoryaccording to positions x y and z for each time t From Equation (21) threeequations are receivedTB =00T = RT

muml_ +00g +Ax 0 00 Ay 00 0 Az _˙ (25)in which _uml _˙ and are desired trajectory values as well as angles _ and _ and totalthrust T are unknown values to be solvedFrom this equation the required angles _ and _ and the total thrust T for each timet can be calculated as shown in [5]14_ = arcsin dx S minus dy C d2x + d2y + (dz + g)2_ = arctan_dx C + dy S dz + g_T = m(dx (S_C C_ + S S_) + dy (S_S C_ minus C S_)+( dz + g )C_C_) (26)in whichdx = xuml + Axx˙mdy = yuml+ Ayy˙mdz = zuml+ Azz˙m(27)

When the values of the angles _ and _ are known the angular velocities and accelerationscan be calculated from them with simple derivation With the angularvelocities and accelerations the torques _ can be solved from Equation (20) Whenthe torques and thrust are known the control inputs i can be calculated fromEquation (24)51 Heuristic method for trajectory generationThe generation of proper accelerations uml_ is difficult because the composition of thethird and fourth derivatives of the position jerk and jounce has to be reasonableThe influence of the jounce values is visible in the composition of the control inputsi High jounce values will mean high control input values and thus the jounceshave to be considered closely when generating the accelerationsA heuristic method can be used to generate jounce values The method utilises asymmetric structure in jouce function f(t) to control the derivatives One influencialpart of the function is defined by three sine functions as followingf(t) =a sin10485761b _ t_ 0 le t le bminusa sin10485761b _ t minus __ b le t le 3ba sin10485761b _ t minus 3__ 3b le t le 4b(28)The structure of the function is visualised in Figure 9 The sine functions are usedto give a smooth function These three sine functions form a function in whichthe first half increases acceleration to certain value and then the second half of the

function decreases it back to zero This acceleration generates constant velocityMirror image of the function can be used to decelerate the velocity back to zeroThe final position depends on the parameters a and b of the sine functions presented15in Equation (28) and the time c between the accelerating part and the deceleratingpart the mirror image of the jounceaaab2bba sin10485761b _ t_minusa sin1048576 12b _ t minus __a sin10485761b _ t minus 3__Jounce (ms4)Time t (s)Figure 9 Heuristic method for the generation of jounce functionsUnfortunately the method does not give optimal trajectories Thus a dynamicoptimisation model and a suitable algorithm would be needed to calculate optimallythe trajectory of the quadcopter However the method presented is easy to use togenerate proper values of jounce which will achieve the wanted trajectoryThe functionality of the method is studied with an example simulation Jounce ofposition x is created according to Equation (28) with parameters a = 1 b = 05and c = 2 The position x and its derivatives derived from the planned jounce arepresented in Figure 10 The jounce could also be generated simultaneously for y andz However in this example only position x is considered because the relationship

between the jounce of position x and the control inputs 1 and 3 controlling theangle _ is more visible160 1 2 3 4 5 6 7minus1minus08minus06minus04minus020020406081Time t (s)Jounce (ms4)

(a) Jounce0 1 2 3 4 5 6 7minus04minus03minus02minus01001020304

Time t (s)Jerk (ms3)

(b) Jerk0 1 2 3 4 5 6 7minus02minus015minus01minus00500050101502Time t (s)Acceleration (ms2)

(c) Acceleration0 1 2 3 4 5 6 7minus002000200400600801012014016018

Time t (s)Velocity (ms)

(d) Velocity0 1 2 3 4 5 6 7001020304050607

Time t (s)Position (m)

(e) PositionFigure 10 Planned position x and its derivatives with given jounceThe simulation of the example case is performed with previously given accelerationsand velocities of position x The planned value of angle is zero for each time tFirst the required angles _ and _ and thrust T are solved from Equation (26) foreach time t The angular velocities and accelerations are calculated from the solvedangles with derivation Then the torques are solved using the angular velocitiesand accelerations Finally the control inputs are solved Then the simulation isperformed with given control inputsThe calculated control inputs are presented in Figure 11 The simulated positions_ are presented in Figure 12 and the simulated angles _ in Figure 13 Accordingto Figure 12 the simulated position x is the same as the planned position x inFigure 10(e) and the values of the positions y and z stay as zeroes The angle _increases during the acceleration and then stabilises to a constant value to generate

the constant acceleration required to compensate the drag force caused by theplanned constant velocity Finally the angle is changed to the opposite direction todecelerate the quadcopter to a haltThe shape of the calculated control inputs 1 and 3 in Figure 11 are similar toplanned jounce in Figure 10(a) The shape of the simulated angle _ follows theshape of the planned acceleration umlx The shapes of the control inputs and theangles differ from the planned values of the jounce and the acceleration because thedrag force caused by the velocity has to be compensated170 1 2 3 4 5 6 76203620462056206620762086209621

Time t (s)Control input i (rads)1234

Figure 11 Control inputs i0 1 2 3 4 5 6001020304050607

Time t (s)Position (m)Position xPosition yPosition z

Figure 12 Positions x y and z0 1 2 3 4 5 6 7minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 13 Angles _ _ and The method can also be used even if there are unmodeled linear forces wind forexample which affect the linear accelerations and consequently the position of thequadcopter If the trajectory is calculated in shorter distances it is possible tocorrect the trajectory with new calculation from the current but inaccurate locationto the next checkpoint Example of this method is presented in Figure 14 Thearrows with dash lines indicate the planned trajectory in the x y-plane and thesolid arrows indicate the realised trajectory The black squares mark the start and

the finish positions and the white squares mark the checkpoints for the trajectory18The control inputs are calculated from the current location of the quadcopter to thenext checkpoint but because of random and unmodelled forces the realised positionmarked with X differs from the planned If the quadcopter is close enough to thetarget checkpoint the target checkpoint is changed to the next one and new controlinputs are calculated After repeating this and going through all of the checkpointsthe quadcopter reaches the final destinationFigure 14 Example of checkpoint flight pattern with external disturbancesThe biggest weakness in the proposed method is that it works as shown only if thequadcopter starts from a stable attitude the angles _ and _ and their derivativesare zeros and there are no external forces influencing the attitude during the flightSmall deviations in the angles can result into a huge deviation in the trajectory Oneway to solve this problem is to stabilise the quadcopter at each checkpoint with aPD controller proposed earlier or by using the heuristic method to angles Howeverif the angular disturbances are continuous the benefit from temporary stabilisationis only momentary52 Integrated PD controllerAnother method to take into account the possible deviations in the angles is tointegrate a PD controller into the heuristic method This is a simplified version ofthe proposed control method in [5] The required values dx dy and dz in Equation(26) are given by the PD controller considering the deviations between the currentand desired values (subscript d) of the positions _ velocities _˙ and accelerations _umldx = KxP (xd minus x) + KxD (x˙ d minus x˙ ) + KxDD (xumld minus xuml) dy = KyP (yd minus y) + KyD (y˙d minus y˙) + KyDD (yumld minus yuml) dz = KzP (zd minus z) + KzD (z˙d minus z˙) + KzDD (zumld minus zuml) (29)Then the commanded angles _c and _c and thrust T are given by Equation (26)The torques _ are controlled by the PD controller in Equation (30) same as in

19Equation (23) The control inputs can be solved with the calculated thrust andtorques by using Equation (24)__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Ixx__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Iyy_ =_K P ( d minus ) + K D_˙ d minus ˙ __Izz(30)The performance of the PD controller is demonstrated with an example case inwhich for all positions x y and z and their derivatives the values are same as inFigure 10 The simulation is performed with the PD parameters presented in Table3Table 3 Parameters of the PD controllerVariable Parameter valuei KiP KiD KiDDx 185 075 100y 855 075 100z 185 075 100_ 300 075 -_ 300 075 - 300 075 -The results of the simulation are presented Figures 15 - 17 The simulated controlinputs are presented in Figure 15 the simulated positions in Figure 16 and the

simulated angles in Figure 17 The position of the quadcopter is close to the plannedposition after 6 seconds but the position keeps fluctuating close to the planned valuesfor several seconds The angles variate greatly during the simulation to achieve thewanted positions velocities and accelerations The values of the control inputsoscillated during the acceleration but then their behaviour became more stable0 2 4 6 8 10 12 14618619620621622623624625626

Time t (s)Control input i (rads)1234

Figure 15 Control inputs i200 2 4 6 8 10 12 14minus0100102030405060708

Time t (s)Position (m)Position xPosition yPosition z

Figure 16 Positions x y and z0 2 4 6 8 10 12 14minus15minus125minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 17 Angles _ _ and The proposed integrated PD controller performed well in the example case Howeverthe performance of the controller is highly depended on the parameter values If theparameter values are small the controller will not respond quickly enough to followthe planned trajectory If the parameter values are substantial the quadcopter cannot perform the required drastic changes in the angular velocities of the rotor andthe control inputs calculated from Equation (24) can be infeasible with certaintorques Thus the use of equations considering the torques and the control inputsrequires a method to calculate the best feasible torques and from them the bestcontrol inputs Another possible method would be to variate the PD parameters

according to the current positions and angles and their derivatives but it is extremelydifficult216 ConclusionThis paper studied mathematical modelling and control of a quadcopter The mathematicalmodel of quadcopter dynamics was presented and the differential equationswere derived from the Newton-Euler and the Euler-Lagrange equations The modelwas verified by simulating the flight of a quadcopter with Matlab Stabilisation ofattitude of the quadcopter was done by utilising a PD controller A heuristic methodwas developed to control the trajectory of the quadcopter The PD contoller wasintegrated into the heuristic method for better response to disturbances in the flightconditions of the quadcopterThe simulation proved the presented mathematical model to be realistic in modellingthe position and attitude of the quadcopter The simulation results also showedthat the PD controller was efficient in stabilising the quadcopter to the desiredaltitude and attitude However the PD controller did not considered positions xand y Thus the values of x and y variated from their original values during thestabilisation process This was a result of the deviation of the roll and pitch anglesfrom zero valuesAccording to the simulation results the proposed heuristic method produced goodflight trajectories The heuristic method required only three parameters to generatethe values for the jounce of the position The position and its other derivatives werecalculated from the jounce values The total thrust and the pitch and roll angles toachieve given accelerations were solved from the linear differential equations Thenthe torques were determined by the angular accelerations and angular velocitiescalculated from the angles Finally the required control inputs were solved from thetotal thrust and the torques The simulation results indicated that the quadcopter

could be controlled accurately with the control inputs given by the methodThe proposed heuristic method does not consider unmodelled disturbances suchas wind and thus the PD controller was integrated into the control method Theintegrated PD controller operated well in the example simulation The quadcopterfollowed the given trajectory and began to stabilise after reaching the final destinationHowever the PD controller can perform poorly if the parameter values arenot properly selected and are too small or highThe presented mathematical model only consists of the basic structures of the quadcopterdynamics Several aerodynamical effects were excluded which can lead tounrealiable behaviour Also the electric motors spinning the fours rotors were notmodelled The behaviour of a motor is easily included in the model but would requireestimation of the parameter values of the motor The position and attitudeinformation was assumed to be accurate in the model and the simulations Howeverthe measuring devices in real life are not perfectly accurate as random variationsand errors occur Hence the effects of imprecise information to the flight of thequadcopter should be studied as well Also methods to enhance the accuracy of themeasurements should be researched and implemented to improve all aspects required22for robust quadcopter manoeuvresThe presented model and control methods were tested only with simulations Realexperimental prototype of a quadcopter should be constructed to achieve more realisticand reliable results Even though the construction of a real quadcopter and theestimation of all the model parameters are laborious tasks a real quadcopter wouldbring significant benefits to the research With a real propotype the theoreticalframework and the simulation results could be compared to real-life measurementsThis paper did not include these higlighted matters in the study but presentedthe basics of quadcopter modelling and control This paper can thus be used as a

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

dependances between states state derivatives and control inputs These interactionsand dependances are defined by Equations (7) (8) (20) and (21) and presented inFigure 8The given control inputs i define the total thrust T and the torques __ __ and _ The torques affect the angular accelerations depending on the current angles andangular velocities The angles _ can be integrated from the angular velocities _˙ which are integrated from the angular accelerations uml_ The linear accelerations uml_depend on the total thrust T the angles _ and the linear velocities _˙ The linearposition _ is integrated from the linear accelerations uml_ through the linear velocities_˙Hence to find proper control inputs i for given states _ this line of thought has tobe done in reverse___HHHjT_-- _uml - _˙ - _I K_uml - _˙ - _IFigure 8 Interactions between states state derivatives and control inputsOne method is to generate linear accelerations which accomplish the wanted trajectoryaccording to positions x y and z for each time t From Equation (21) threeequations are receivedTB =00T = RT

muml_ +00g +Ax 0 00 Ay 00 0 Az _˙ (25)in which _uml _˙ and are desired trajectory values as well as angles _ and _ and totalthrust T are unknown values to be solvedFrom this equation the required angles _ and _ and the total thrust T for each timet can be calculated as shown in [5]14_ = arcsin dx S minus dy C d2x + d2y + (dz + g)2_ = arctan_dx C + dy S dz + g_T = m(dx (S_C C_ + S S_) + dy (S_S C_ minus C S_)+( dz + g )C_C_) (26)in whichdx = xuml + Axx˙mdy = yuml+ Ayy˙mdz = zuml+ Azz˙m(27)

When the values of the angles _ and _ are known the angular velocities and accelerationscan be calculated from them with simple derivation With the angularvelocities and accelerations the torques _ can be solved from Equation (20) Whenthe torques and thrust are known the control inputs i can be calculated fromEquation (24)51 Heuristic method for trajectory generationThe generation of proper accelerations uml_ is difficult because the composition of thethird and fourth derivatives of the position jerk and jounce has to be reasonableThe influence of the jounce values is visible in the composition of the control inputsi High jounce values will mean high control input values and thus the jounceshave to be considered closely when generating the accelerationsA heuristic method can be used to generate jounce values The method utilises asymmetric structure in jouce function f(t) to control the derivatives One influencialpart of the function is defined by three sine functions as followingf(t) =a sin10485761b _ t_ 0 le t le bminusa sin10485761b _ t minus __ b le t le 3ba sin10485761b _ t minus 3__ 3b le t le 4b(28)The structure of the function is visualised in Figure 9 The sine functions are usedto give a smooth function These three sine functions form a function in whichthe first half increases acceleration to certain value and then the second half of the

function decreases it back to zero This acceleration generates constant velocityMirror image of the function can be used to decelerate the velocity back to zeroThe final position depends on the parameters a and b of the sine functions presented15in Equation (28) and the time c between the accelerating part and the deceleratingpart the mirror image of the jounceaaab2bba sin10485761b _ t_minusa sin1048576 12b _ t minus __a sin10485761b _ t minus 3__Jounce (ms4)Time t (s)Figure 9 Heuristic method for the generation of jounce functionsUnfortunately the method does not give optimal trajectories Thus a dynamicoptimisation model and a suitable algorithm would be needed to calculate optimallythe trajectory of the quadcopter However the method presented is easy to use togenerate proper values of jounce which will achieve the wanted trajectoryThe functionality of the method is studied with an example simulation Jounce ofposition x is created according to Equation (28) with parameters a = 1 b = 05and c = 2 The position x and its derivatives derived from the planned jounce arepresented in Figure 10 The jounce could also be generated simultaneously for y andz However in this example only position x is considered because the relationship

between the jounce of position x and the control inputs 1 and 3 controlling theangle _ is more visible160 1 2 3 4 5 6 7minus1minus08minus06minus04minus020020406081Time t (s)Jounce (ms4)

(a) Jounce0 1 2 3 4 5 6 7minus04minus03minus02minus01001020304

Time t (s)Jerk (ms3)

(b) Jerk0 1 2 3 4 5 6 7minus02minus015minus01minus00500050101502Time t (s)Acceleration (ms2)

(c) Acceleration0 1 2 3 4 5 6 7minus002000200400600801012014016018

Time t (s)Velocity (ms)

(d) Velocity0 1 2 3 4 5 6 7001020304050607

Time t (s)Position (m)

(e) PositionFigure 10 Planned position x and its derivatives with given jounceThe simulation of the example case is performed with previously given accelerationsand velocities of position x The planned value of angle is zero for each time tFirst the required angles _ and _ and thrust T are solved from Equation (26) foreach time t The angular velocities and accelerations are calculated from the solvedangles with derivation Then the torques are solved using the angular velocitiesand accelerations Finally the control inputs are solved Then the simulation isperformed with given control inputsThe calculated control inputs are presented in Figure 11 The simulated positions_ are presented in Figure 12 and the simulated angles _ in Figure 13 Accordingto Figure 12 the simulated position x is the same as the planned position x inFigure 10(e) and the values of the positions y and z stay as zeroes The angle _increases during the acceleration and then stabilises to a constant value to generate

the constant acceleration required to compensate the drag force caused by theplanned constant velocity Finally the angle is changed to the opposite direction todecelerate the quadcopter to a haltThe shape of the calculated control inputs 1 and 3 in Figure 11 are similar toplanned jounce in Figure 10(a) The shape of the simulated angle _ follows theshape of the planned acceleration umlx The shapes of the control inputs and theangles differ from the planned values of the jounce and the acceleration because thedrag force caused by the velocity has to be compensated170 1 2 3 4 5 6 76203620462056206620762086209621

Time t (s)Control input i (rads)1234

Figure 11 Control inputs i0 1 2 3 4 5 6001020304050607

Time t (s)Position (m)Position xPosition yPosition z

Figure 12 Positions x y and z0 1 2 3 4 5 6 7minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 13 Angles _ _ and The method can also be used even if there are unmodeled linear forces wind forexample which affect the linear accelerations and consequently the position of thequadcopter If the trajectory is calculated in shorter distances it is possible tocorrect the trajectory with new calculation from the current but inaccurate locationto the next checkpoint Example of this method is presented in Figure 14 Thearrows with dash lines indicate the planned trajectory in the x y-plane and thesolid arrows indicate the realised trajectory The black squares mark the start and

the finish positions and the white squares mark the checkpoints for the trajectory18The control inputs are calculated from the current location of the quadcopter to thenext checkpoint but because of random and unmodelled forces the realised positionmarked with X differs from the planned If the quadcopter is close enough to thetarget checkpoint the target checkpoint is changed to the next one and new controlinputs are calculated After repeating this and going through all of the checkpointsthe quadcopter reaches the final destinationFigure 14 Example of checkpoint flight pattern with external disturbancesThe biggest weakness in the proposed method is that it works as shown only if thequadcopter starts from a stable attitude the angles _ and _ and their derivativesare zeros and there are no external forces influencing the attitude during the flightSmall deviations in the angles can result into a huge deviation in the trajectory Oneway to solve this problem is to stabilise the quadcopter at each checkpoint with aPD controller proposed earlier or by using the heuristic method to angles Howeverif the angular disturbances are continuous the benefit from temporary stabilisationis only momentary52 Integrated PD controllerAnother method to take into account the possible deviations in the angles is tointegrate a PD controller into the heuristic method This is a simplified version ofthe proposed control method in [5] The required values dx dy and dz in Equation(26) are given by the PD controller considering the deviations between the currentand desired values (subscript d) of the positions _ velocities _˙ and accelerations _umldx = KxP (xd minus x) + KxD (x˙ d minus x˙ ) + KxDD (xumld minus xuml) dy = KyP (yd minus y) + KyD (y˙d minus y˙) + KyDD (yumld minus yuml) dz = KzP (zd minus z) + KzD (z˙d minus z˙) + KzDD (zumld minus zuml) (29)Then the commanded angles _c and _c and thrust T are given by Equation (26)The torques _ are controlled by the PD controller in Equation (30) same as in

19Equation (23) The control inputs can be solved with the calculated thrust andtorques by using Equation (24)__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Ixx__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Iyy_ =_K P ( d minus ) + K D_˙ d minus ˙ __Izz(30)The performance of the PD controller is demonstrated with an example case inwhich for all positions x y and z and their derivatives the values are same as inFigure 10 The simulation is performed with the PD parameters presented in Table3Table 3 Parameters of the PD controllerVariable Parameter valuei KiP KiD KiDDx 185 075 100y 855 075 100z 185 075 100_ 300 075 -_ 300 075 - 300 075 -The results of the simulation are presented Figures 15 - 17 The simulated controlinputs are presented in Figure 15 the simulated positions in Figure 16 and the

simulated angles in Figure 17 The position of the quadcopter is close to the plannedposition after 6 seconds but the position keeps fluctuating close to the planned valuesfor several seconds The angles variate greatly during the simulation to achieve thewanted positions velocities and accelerations The values of the control inputsoscillated during the acceleration but then their behaviour became more stable0 2 4 6 8 10 12 14618619620621622623624625626

Time t (s)Control input i (rads)1234

Figure 15 Control inputs i200 2 4 6 8 10 12 14minus0100102030405060708

Time t (s)Position (m)Position xPosition yPosition z

Figure 16 Positions x y and z0 2 4 6 8 10 12 14minus15minus125minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 17 Angles _ _ and The proposed integrated PD controller performed well in the example case Howeverthe performance of the controller is highly depended on the parameter values If theparameter values are small the controller will not respond quickly enough to followthe planned trajectory If the parameter values are substantial the quadcopter cannot perform the required drastic changes in the angular velocities of the rotor andthe control inputs calculated from Equation (24) can be infeasible with certaintorques Thus the use of equations considering the torques and the control inputsrequires a method to calculate the best feasible torques and from them the bestcontrol inputs Another possible method would be to variate the PD parameters

according to the current positions and angles and their derivatives but it is extremelydifficult216 ConclusionThis paper studied mathematical modelling and control of a quadcopter The mathematicalmodel of quadcopter dynamics was presented and the differential equationswere derived from the Newton-Euler and the Euler-Lagrange equations The modelwas verified by simulating the flight of a quadcopter with Matlab Stabilisation ofattitude of the quadcopter was done by utilising a PD controller A heuristic methodwas developed to control the trajectory of the quadcopter The PD contoller wasintegrated into the heuristic method for better response to disturbances in the flightconditions of the quadcopterThe simulation proved the presented mathematical model to be realistic in modellingthe position and attitude of the quadcopter The simulation results also showedthat the PD controller was efficient in stabilising the quadcopter to the desiredaltitude and attitude However the PD controller did not considered positions xand y Thus the values of x and y variated from their original values during thestabilisation process This was a result of the deviation of the roll and pitch anglesfrom zero valuesAccording to the simulation results the proposed heuristic method produced goodflight trajectories The heuristic method required only three parameters to generatethe values for the jounce of the position The position and its other derivatives werecalculated from the jounce values The total thrust and the pitch and roll angles toachieve given accelerations were solved from the linear differential equations Thenthe torques were determined by the angular accelerations and angular velocitiescalculated from the angles Finally the required control inputs were solved from thetotal thrust and the torques The simulation results indicated that the quadcopter

could be controlled accurately with the control inputs given by the methodThe proposed heuristic method does not consider unmodelled disturbances suchas wind and thus the PD controller was integrated into the control method Theintegrated PD controller operated well in the example simulation The quadcopterfollowed the given trajectory and began to stabilise after reaching the final destinationHowever the PD controller can perform poorly if the parameter values arenot properly selected and are too small or highThe presented mathematical model only consists of the basic structures of the quadcopterdynamics Several aerodynamical effects were excluded which can lead tounrealiable behaviour Also the electric motors spinning the fours rotors were notmodelled The behaviour of a motor is easily included in the model but would requireestimation of the parameter values of the motor The position and attitudeinformation was assumed to be accurate in the model and the simulations Howeverthe measuring devices in real life are not perfectly accurate as random variationsand errors occur Hence the effects of imprecise information to the flight of thequadcopter should be studied as well Also methods to enhance the accuracy of themeasurements should be researched and implemented to improve all aspects required22for robust quadcopter manoeuvresThe presented model and control methods were tested only with simulations Realexperimental prototype of a quadcopter should be constructed to achieve more realisticand reliable results Even though the construction of a real quadcopter and theestimation of all the model parameters are laborious tasks a real quadcopter wouldbring significant benefits to the research With a real propotype the theoreticalframework and the simulation results could be compared to real-life measurementsThis paper did not include these higlighted matters in the study but presentedthe basics of quadcopter modelling and control This paper can thus be used as a

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

muml_ +00g +Ax 0 00 Ay 00 0 Az _˙ (25)in which _uml _˙ and are desired trajectory values as well as angles _ and _ and totalthrust T are unknown values to be solvedFrom this equation the required angles _ and _ and the total thrust T for each timet can be calculated as shown in [5]14_ = arcsin dx S minus dy C d2x + d2y + (dz + g)2_ = arctan_dx C + dy S dz + g_T = m(dx (S_C C_ + S S_) + dy (S_S C_ minus C S_)+( dz + g )C_C_) (26)in whichdx = xuml + Axx˙mdy = yuml+ Ayy˙mdz = zuml+ Azz˙m(27)

When the values of the angles _ and _ are known the angular velocities and accelerationscan be calculated from them with simple derivation With the angularvelocities and accelerations the torques _ can be solved from Equation (20) Whenthe torques and thrust are known the control inputs i can be calculated fromEquation (24)51 Heuristic method for trajectory generationThe generation of proper accelerations uml_ is difficult because the composition of thethird and fourth derivatives of the position jerk and jounce has to be reasonableThe influence of the jounce values is visible in the composition of the control inputsi High jounce values will mean high control input values and thus the jounceshave to be considered closely when generating the accelerationsA heuristic method can be used to generate jounce values The method utilises asymmetric structure in jouce function f(t) to control the derivatives One influencialpart of the function is defined by three sine functions as followingf(t) =a sin10485761b _ t_ 0 le t le bminusa sin10485761b _ t minus __ b le t le 3ba sin10485761b _ t minus 3__ 3b le t le 4b(28)The structure of the function is visualised in Figure 9 The sine functions are usedto give a smooth function These three sine functions form a function in whichthe first half increases acceleration to certain value and then the second half of the

function decreases it back to zero This acceleration generates constant velocityMirror image of the function can be used to decelerate the velocity back to zeroThe final position depends on the parameters a and b of the sine functions presented15in Equation (28) and the time c between the accelerating part and the deceleratingpart the mirror image of the jounceaaab2bba sin10485761b _ t_minusa sin1048576 12b _ t minus __a sin10485761b _ t minus 3__Jounce (ms4)Time t (s)Figure 9 Heuristic method for the generation of jounce functionsUnfortunately the method does not give optimal trajectories Thus a dynamicoptimisation model and a suitable algorithm would be needed to calculate optimallythe trajectory of the quadcopter However the method presented is easy to use togenerate proper values of jounce which will achieve the wanted trajectoryThe functionality of the method is studied with an example simulation Jounce ofposition x is created according to Equation (28) with parameters a = 1 b = 05and c = 2 The position x and its derivatives derived from the planned jounce arepresented in Figure 10 The jounce could also be generated simultaneously for y andz However in this example only position x is considered because the relationship

between the jounce of position x and the control inputs 1 and 3 controlling theangle _ is more visible160 1 2 3 4 5 6 7minus1minus08minus06minus04minus020020406081Time t (s)Jounce (ms4)

(a) Jounce0 1 2 3 4 5 6 7minus04minus03minus02minus01001020304

Time t (s)Jerk (ms3)

(b) Jerk0 1 2 3 4 5 6 7minus02minus015minus01minus00500050101502Time t (s)Acceleration (ms2)

(c) Acceleration0 1 2 3 4 5 6 7minus002000200400600801012014016018

Time t (s)Velocity (ms)

(d) Velocity0 1 2 3 4 5 6 7001020304050607

Time t (s)Position (m)

(e) PositionFigure 10 Planned position x and its derivatives with given jounceThe simulation of the example case is performed with previously given accelerationsand velocities of position x The planned value of angle is zero for each time tFirst the required angles _ and _ and thrust T are solved from Equation (26) foreach time t The angular velocities and accelerations are calculated from the solvedangles with derivation Then the torques are solved using the angular velocitiesand accelerations Finally the control inputs are solved Then the simulation isperformed with given control inputsThe calculated control inputs are presented in Figure 11 The simulated positions_ are presented in Figure 12 and the simulated angles _ in Figure 13 Accordingto Figure 12 the simulated position x is the same as the planned position x inFigure 10(e) and the values of the positions y and z stay as zeroes The angle _increases during the acceleration and then stabilises to a constant value to generate

the constant acceleration required to compensate the drag force caused by theplanned constant velocity Finally the angle is changed to the opposite direction todecelerate the quadcopter to a haltThe shape of the calculated control inputs 1 and 3 in Figure 11 are similar toplanned jounce in Figure 10(a) The shape of the simulated angle _ follows theshape of the planned acceleration umlx The shapes of the control inputs and theangles differ from the planned values of the jounce and the acceleration because thedrag force caused by the velocity has to be compensated170 1 2 3 4 5 6 76203620462056206620762086209621

Time t (s)Control input i (rads)1234

Figure 11 Control inputs i0 1 2 3 4 5 6001020304050607

Time t (s)Position (m)Position xPosition yPosition z

Figure 12 Positions x y and z0 1 2 3 4 5 6 7minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 13 Angles _ _ and The method can also be used even if there are unmodeled linear forces wind forexample which affect the linear accelerations and consequently the position of thequadcopter If the trajectory is calculated in shorter distances it is possible tocorrect the trajectory with new calculation from the current but inaccurate locationto the next checkpoint Example of this method is presented in Figure 14 Thearrows with dash lines indicate the planned trajectory in the x y-plane and thesolid arrows indicate the realised trajectory The black squares mark the start and

the finish positions and the white squares mark the checkpoints for the trajectory18The control inputs are calculated from the current location of the quadcopter to thenext checkpoint but because of random and unmodelled forces the realised positionmarked with X differs from the planned If the quadcopter is close enough to thetarget checkpoint the target checkpoint is changed to the next one and new controlinputs are calculated After repeating this and going through all of the checkpointsthe quadcopter reaches the final destinationFigure 14 Example of checkpoint flight pattern with external disturbancesThe biggest weakness in the proposed method is that it works as shown only if thequadcopter starts from a stable attitude the angles _ and _ and their derivativesare zeros and there are no external forces influencing the attitude during the flightSmall deviations in the angles can result into a huge deviation in the trajectory Oneway to solve this problem is to stabilise the quadcopter at each checkpoint with aPD controller proposed earlier or by using the heuristic method to angles Howeverif the angular disturbances are continuous the benefit from temporary stabilisationis only momentary52 Integrated PD controllerAnother method to take into account the possible deviations in the angles is tointegrate a PD controller into the heuristic method This is a simplified version ofthe proposed control method in [5] The required values dx dy and dz in Equation(26) are given by the PD controller considering the deviations between the currentand desired values (subscript d) of the positions _ velocities _˙ and accelerations _umldx = KxP (xd minus x) + KxD (x˙ d minus x˙ ) + KxDD (xumld minus xuml) dy = KyP (yd minus y) + KyD (y˙d minus y˙) + KyDD (yumld minus yuml) dz = KzP (zd minus z) + KzD (z˙d minus z˙) + KzDD (zumld minus zuml) (29)Then the commanded angles _c and _c and thrust T are given by Equation (26)The torques _ are controlled by the PD controller in Equation (30) same as in

19Equation (23) The control inputs can be solved with the calculated thrust andtorques by using Equation (24)__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Ixx__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Iyy_ =_K P ( d minus ) + K D_˙ d minus ˙ __Izz(30)The performance of the PD controller is demonstrated with an example case inwhich for all positions x y and z and their derivatives the values are same as inFigure 10 The simulation is performed with the PD parameters presented in Table3Table 3 Parameters of the PD controllerVariable Parameter valuei KiP KiD KiDDx 185 075 100y 855 075 100z 185 075 100_ 300 075 -_ 300 075 - 300 075 -The results of the simulation are presented Figures 15 - 17 The simulated controlinputs are presented in Figure 15 the simulated positions in Figure 16 and the

simulated angles in Figure 17 The position of the quadcopter is close to the plannedposition after 6 seconds but the position keeps fluctuating close to the planned valuesfor several seconds The angles variate greatly during the simulation to achieve thewanted positions velocities and accelerations The values of the control inputsoscillated during the acceleration but then their behaviour became more stable0 2 4 6 8 10 12 14618619620621622623624625626

Time t (s)Control input i (rads)1234

Figure 15 Control inputs i200 2 4 6 8 10 12 14minus0100102030405060708

Time t (s)Position (m)Position xPosition yPosition z

Figure 16 Positions x y and z0 2 4 6 8 10 12 14minus15minus125minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 17 Angles _ _ and The proposed integrated PD controller performed well in the example case Howeverthe performance of the controller is highly depended on the parameter values If theparameter values are small the controller will not respond quickly enough to followthe planned trajectory If the parameter values are substantial the quadcopter cannot perform the required drastic changes in the angular velocities of the rotor andthe control inputs calculated from Equation (24) can be infeasible with certaintorques Thus the use of equations considering the torques and the control inputsrequires a method to calculate the best feasible torques and from them the bestcontrol inputs Another possible method would be to variate the PD parameters

according to the current positions and angles and their derivatives but it is extremelydifficult216 ConclusionThis paper studied mathematical modelling and control of a quadcopter The mathematicalmodel of quadcopter dynamics was presented and the differential equationswere derived from the Newton-Euler and the Euler-Lagrange equations The modelwas verified by simulating the flight of a quadcopter with Matlab Stabilisation ofattitude of the quadcopter was done by utilising a PD controller A heuristic methodwas developed to control the trajectory of the quadcopter The PD contoller wasintegrated into the heuristic method for better response to disturbances in the flightconditions of the quadcopterThe simulation proved the presented mathematical model to be realistic in modellingthe position and attitude of the quadcopter The simulation results also showedthat the PD controller was efficient in stabilising the quadcopter to the desiredaltitude and attitude However the PD controller did not considered positions xand y Thus the values of x and y variated from their original values during thestabilisation process This was a result of the deviation of the roll and pitch anglesfrom zero valuesAccording to the simulation results the proposed heuristic method produced goodflight trajectories The heuristic method required only three parameters to generatethe values for the jounce of the position The position and its other derivatives werecalculated from the jounce values The total thrust and the pitch and roll angles toachieve given accelerations were solved from the linear differential equations Thenthe torques were determined by the angular accelerations and angular velocitiescalculated from the angles Finally the required control inputs were solved from thetotal thrust and the torques The simulation results indicated that the quadcopter

could be controlled accurately with the control inputs given by the methodThe proposed heuristic method does not consider unmodelled disturbances suchas wind and thus the PD controller was integrated into the control method Theintegrated PD controller operated well in the example simulation The quadcopterfollowed the given trajectory and began to stabilise after reaching the final destinationHowever the PD controller can perform poorly if the parameter values arenot properly selected and are too small or highThe presented mathematical model only consists of the basic structures of the quadcopterdynamics Several aerodynamical effects were excluded which can lead tounrealiable behaviour Also the electric motors spinning the fours rotors were notmodelled The behaviour of a motor is easily included in the model but would requireestimation of the parameter values of the motor The position and attitudeinformation was assumed to be accurate in the model and the simulations Howeverthe measuring devices in real life are not perfectly accurate as random variationsand errors occur Hence the effects of imprecise information to the flight of thequadcopter should be studied as well Also methods to enhance the accuracy of themeasurements should be researched and implemented to improve all aspects required22for robust quadcopter manoeuvresThe presented model and control methods were tested only with simulations Realexperimental prototype of a quadcopter should be constructed to achieve more realisticand reliable results Even though the construction of a real quadcopter and theestimation of all the model parameters are laborious tasks a real quadcopter wouldbring significant benefits to the research With a real propotype the theoreticalframework and the simulation results could be compared to real-life measurementsThis paper did not include these higlighted matters in the study but presentedthe basics of quadcopter modelling and control This paper can thus be used as a

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

When the values of the angles _ and _ are known the angular velocities and accelerationscan be calculated from them with simple derivation With the angularvelocities and accelerations the torques _ can be solved from Equation (20) Whenthe torques and thrust are known the control inputs i can be calculated fromEquation (24)51 Heuristic method for trajectory generationThe generation of proper accelerations uml_ is difficult because the composition of thethird and fourth derivatives of the position jerk and jounce has to be reasonableThe influence of the jounce values is visible in the composition of the control inputsi High jounce values will mean high control input values and thus the jounceshave to be considered closely when generating the accelerationsA heuristic method can be used to generate jounce values The method utilises asymmetric structure in jouce function f(t) to control the derivatives One influencialpart of the function is defined by three sine functions as followingf(t) =a sin10485761b _ t_ 0 le t le bminusa sin10485761b _ t minus __ b le t le 3ba sin10485761b _ t minus 3__ 3b le t le 4b(28)The structure of the function is visualised in Figure 9 The sine functions are usedto give a smooth function These three sine functions form a function in whichthe first half increases acceleration to certain value and then the second half of the

function decreases it back to zero This acceleration generates constant velocityMirror image of the function can be used to decelerate the velocity back to zeroThe final position depends on the parameters a and b of the sine functions presented15in Equation (28) and the time c between the accelerating part and the deceleratingpart the mirror image of the jounceaaab2bba sin10485761b _ t_minusa sin1048576 12b _ t minus __a sin10485761b _ t minus 3__Jounce (ms4)Time t (s)Figure 9 Heuristic method for the generation of jounce functionsUnfortunately the method does not give optimal trajectories Thus a dynamicoptimisation model and a suitable algorithm would be needed to calculate optimallythe trajectory of the quadcopter However the method presented is easy to use togenerate proper values of jounce which will achieve the wanted trajectoryThe functionality of the method is studied with an example simulation Jounce ofposition x is created according to Equation (28) with parameters a = 1 b = 05and c = 2 The position x and its derivatives derived from the planned jounce arepresented in Figure 10 The jounce could also be generated simultaneously for y andz However in this example only position x is considered because the relationship

between the jounce of position x and the control inputs 1 and 3 controlling theangle _ is more visible160 1 2 3 4 5 6 7minus1minus08minus06minus04minus020020406081Time t (s)Jounce (ms4)

(a) Jounce0 1 2 3 4 5 6 7minus04minus03minus02minus01001020304

Time t (s)Jerk (ms3)

(b) Jerk0 1 2 3 4 5 6 7minus02minus015minus01minus00500050101502Time t (s)Acceleration (ms2)

(c) Acceleration0 1 2 3 4 5 6 7minus002000200400600801012014016018

Time t (s)Velocity (ms)

(d) Velocity0 1 2 3 4 5 6 7001020304050607

Time t (s)Position (m)

(e) PositionFigure 10 Planned position x and its derivatives with given jounceThe simulation of the example case is performed with previously given accelerationsand velocities of position x The planned value of angle is zero for each time tFirst the required angles _ and _ and thrust T are solved from Equation (26) foreach time t The angular velocities and accelerations are calculated from the solvedangles with derivation Then the torques are solved using the angular velocitiesand accelerations Finally the control inputs are solved Then the simulation isperformed with given control inputsThe calculated control inputs are presented in Figure 11 The simulated positions_ are presented in Figure 12 and the simulated angles _ in Figure 13 Accordingto Figure 12 the simulated position x is the same as the planned position x inFigure 10(e) and the values of the positions y and z stay as zeroes The angle _increases during the acceleration and then stabilises to a constant value to generate

the constant acceleration required to compensate the drag force caused by theplanned constant velocity Finally the angle is changed to the opposite direction todecelerate the quadcopter to a haltThe shape of the calculated control inputs 1 and 3 in Figure 11 are similar toplanned jounce in Figure 10(a) The shape of the simulated angle _ follows theshape of the planned acceleration umlx The shapes of the control inputs and theangles differ from the planned values of the jounce and the acceleration because thedrag force caused by the velocity has to be compensated170 1 2 3 4 5 6 76203620462056206620762086209621

Time t (s)Control input i (rads)1234

Figure 11 Control inputs i0 1 2 3 4 5 6001020304050607

Time t (s)Position (m)Position xPosition yPosition z

Figure 12 Positions x y and z0 1 2 3 4 5 6 7minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 13 Angles _ _ and The method can also be used even if there are unmodeled linear forces wind forexample which affect the linear accelerations and consequently the position of thequadcopter If the trajectory is calculated in shorter distances it is possible tocorrect the trajectory with new calculation from the current but inaccurate locationto the next checkpoint Example of this method is presented in Figure 14 Thearrows with dash lines indicate the planned trajectory in the x y-plane and thesolid arrows indicate the realised trajectory The black squares mark the start and

the finish positions and the white squares mark the checkpoints for the trajectory18The control inputs are calculated from the current location of the quadcopter to thenext checkpoint but because of random and unmodelled forces the realised positionmarked with X differs from the planned If the quadcopter is close enough to thetarget checkpoint the target checkpoint is changed to the next one and new controlinputs are calculated After repeating this and going through all of the checkpointsthe quadcopter reaches the final destinationFigure 14 Example of checkpoint flight pattern with external disturbancesThe biggest weakness in the proposed method is that it works as shown only if thequadcopter starts from a stable attitude the angles _ and _ and their derivativesare zeros and there are no external forces influencing the attitude during the flightSmall deviations in the angles can result into a huge deviation in the trajectory Oneway to solve this problem is to stabilise the quadcopter at each checkpoint with aPD controller proposed earlier or by using the heuristic method to angles Howeverif the angular disturbances are continuous the benefit from temporary stabilisationis only momentary52 Integrated PD controllerAnother method to take into account the possible deviations in the angles is tointegrate a PD controller into the heuristic method This is a simplified version ofthe proposed control method in [5] The required values dx dy and dz in Equation(26) are given by the PD controller considering the deviations between the currentand desired values (subscript d) of the positions _ velocities _˙ and accelerations _umldx = KxP (xd minus x) + KxD (x˙ d minus x˙ ) + KxDD (xumld minus xuml) dy = KyP (yd minus y) + KyD (y˙d minus y˙) + KyDD (yumld minus yuml) dz = KzP (zd minus z) + KzD (z˙d minus z˙) + KzDD (zumld minus zuml) (29)Then the commanded angles _c and _c and thrust T are given by Equation (26)The torques _ are controlled by the PD controller in Equation (30) same as in

19Equation (23) The control inputs can be solved with the calculated thrust andtorques by using Equation (24)__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Ixx__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Iyy_ =_K P ( d minus ) + K D_˙ d minus ˙ __Izz(30)The performance of the PD controller is demonstrated with an example case inwhich for all positions x y and z and their derivatives the values are same as inFigure 10 The simulation is performed with the PD parameters presented in Table3Table 3 Parameters of the PD controllerVariable Parameter valuei KiP KiD KiDDx 185 075 100y 855 075 100z 185 075 100_ 300 075 -_ 300 075 - 300 075 -The results of the simulation are presented Figures 15 - 17 The simulated controlinputs are presented in Figure 15 the simulated positions in Figure 16 and the

simulated angles in Figure 17 The position of the quadcopter is close to the plannedposition after 6 seconds but the position keeps fluctuating close to the planned valuesfor several seconds The angles variate greatly during the simulation to achieve thewanted positions velocities and accelerations The values of the control inputsoscillated during the acceleration but then their behaviour became more stable0 2 4 6 8 10 12 14618619620621622623624625626

Time t (s)Control input i (rads)1234

Figure 15 Control inputs i200 2 4 6 8 10 12 14minus0100102030405060708

Time t (s)Position (m)Position xPosition yPosition z

Figure 16 Positions x y and z0 2 4 6 8 10 12 14minus15minus125minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 17 Angles _ _ and The proposed integrated PD controller performed well in the example case Howeverthe performance of the controller is highly depended on the parameter values If theparameter values are small the controller will not respond quickly enough to followthe planned trajectory If the parameter values are substantial the quadcopter cannot perform the required drastic changes in the angular velocities of the rotor andthe control inputs calculated from Equation (24) can be infeasible with certaintorques Thus the use of equations considering the torques and the control inputsrequires a method to calculate the best feasible torques and from them the bestcontrol inputs Another possible method would be to variate the PD parameters

according to the current positions and angles and their derivatives but it is extremelydifficult216 ConclusionThis paper studied mathematical modelling and control of a quadcopter The mathematicalmodel of quadcopter dynamics was presented and the differential equationswere derived from the Newton-Euler and the Euler-Lagrange equations The modelwas verified by simulating the flight of a quadcopter with Matlab Stabilisation ofattitude of the quadcopter was done by utilising a PD controller A heuristic methodwas developed to control the trajectory of the quadcopter The PD contoller wasintegrated into the heuristic method for better response to disturbances in the flightconditions of the quadcopterThe simulation proved the presented mathematical model to be realistic in modellingthe position and attitude of the quadcopter The simulation results also showedthat the PD controller was efficient in stabilising the quadcopter to the desiredaltitude and attitude However the PD controller did not considered positions xand y Thus the values of x and y variated from their original values during thestabilisation process This was a result of the deviation of the roll and pitch anglesfrom zero valuesAccording to the simulation results the proposed heuristic method produced goodflight trajectories The heuristic method required only three parameters to generatethe values for the jounce of the position The position and its other derivatives werecalculated from the jounce values The total thrust and the pitch and roll angles toachieve given accelerations were solved from the linear differential equations Thenthe torques were determined by the angular accelerations and angular velocitiescalculated from the angles Finally the required control inputs were solved from thetotal thrust and the torques The simulation results indicated that the quadcopter

could be controlled accurately with the control inputs given by the methodThe proposed heuristic method does not consider unmodelled disturbances suchas wind and thus the PD controller was integrated into the control method Theintegrated PD controller operated well in the example simulation The quadcopterfollowed the given trajectory and began to stabilise after reaching the final destinationHowever the PD controller can perform poorly if the parameter values arenot properly selected and are too small or highThe presented mathematical model only consists of the basic structures of the quadcopterdynamics Several aerodynamical effects were excluded which can lead tounrealiable behaviour Also the electric motors spinning the fours rotors were notmodelled The behaviour of a motor is easily included in the model but would requireestimation of the parameter values of the motor The position and attitudeinformation was assumed to be accurate in the model and the simulations Howeverthe measuring devices in real life are not perfectly accurate as random variationsand errors occur Hence the effects of imprecise information to the flight of thequadcopter should be studied as well Also methods to enhance the accuracy of themeasurements should be researched and implemented to improve all aspects required22for robust quadcopter manoeuvresThe presented model and control methods were tested only with simulations Realexperimental prototype of a quadcopter should be constructed to achieve more realisticand reliable results Even though the construction of a real quadcopter and theestimation of all the model parameters are laborious tasks a real quadcopter wouldbring significant benefits to the research With a real propotype the theoreticalframework and the simulation results could be compared to real-life measurementsThis paper did not include these higlighted matters in the study but presentedthe basics of quadcopter modelling and control This paper can thus be used as a

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

function decreases it back to zero This acceleration generates constant velocityMirror image of the function can be used to decelerate the velocity back to zeroThe final position depends on the parameters a and b of the sine functions presented15in Equation (28) and the time c between the accelerating part and the deceleratingpart the mirror image of the jounceaaab2bba sin10485761b _ t_minusa sin1048576 12b _ t minus __a sin10485761b _ t minus 3__Jounce (ms4)Time t (s)Figure 9 Heuristic method for the generation of jounce functionsUnfortunately the method does not give optimal trajectories Thus a dynamicoptimisation model and a suitable algorithm would be needed to calculate optimallythe trajectory of the quadcopter However the method presented is easy to use togenerate proper values of jounce which will achieve the wanted trajectoryThe functionality of the method is studied with an example simulation Jounce ofposition x is created according to Equation (28) with parameters a = 1 b = 05and c = 2 The position x and its derivatives derived from the planned jounce arepresented in Figure 10 The jounce could also be generated simultaneously for y andz However in this example only position x is considered because the relationship

between the jounce of position x and the control inputs 1 and 3 controlling theangle _ is more visible160 1 2 3 4 5 6 7minus1minus08minus06minus04minus020020406081Time t (s)Jounce (ms4)

(a) Jounce0 1 2 3 4 5 6 7minus04minus03minus02minus01001020304

Time t (s)Jerk (ms3)

(b) Jerk0 1 2 3 4 5 6 7minus02minus015minus01minus00500050101502Time t (s)Acceleration (ms2)

(c) Acceleration0 1 2 3 4 5 6 7minus002000200400600801012014016018

Time t (s)Velocity (ms)

(d) Velocity0 1 2 3 4 5 6 7001020304050607

Time t (s)Position (m)

(e) PositionFigure 10 Planned position x and its derivatives with given jounceThe simulation of the example case is performed with previously given accelerationsand velocities of position x The planned value of angle is zero for each time tFirst the required angles _ and _ and thrust T are solved from Equation (26) foreach time t The angular velocities and accelerations are calculated from the solvedangles with derivation Then the torques are solved using the angular velocitiesand accelerations Finally the control inputs are solved Then the simulation isperformed with given control inputsThe calculated control inputs are presented in Figure 11 The simulated positions_ are presented in Figure 12 and the simulated angles _ in Figure 13 Accordingto Figure 12 the simulated position x is the same as the planned position x inFigure 10(e) and the values of the positions y and z stay as zeroes The angle _increases during the acceleration and then stabilises to a constant value to generate

the constant acceleration required to compensate the drag force caused by theplanned constant velocity Finally the angle is changed to the opposite direction todecelerate the quadcopter to a haltThe shape of the calculated control inputs 1 and 3 in Figure 11 are similar toplanned jounce in Figure 10(a) The shape of the simulated angle _ follows theshape of the planned acceleration umlx The shapes of the control inputs and theangles differ from the planned values of the jounce and the acceleration because thedrag force caused by the velocity has to be compensated170 1 2 3 4 5 6 76203620462056206620762086209621

Time t (s)Control input i (rads)1234

Figure 11 Control inputs i0 1 2 3 4 5 6001020304050607

Time t (s)Position (m)Position xPosition yPosition z

Figure 12 Positions x y and z0 1 2 3 4 5 6 7minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 13 Angles _ _ and The method can also be used even if there are unmodeled linear forces wind forexample which affect the linear accelerations and consequently the position of thequadcopter If the trajectory is calculated in shorter distances it is possible tocorrect the trajectory with new calculation from the current but inaccurate locationto the next checkpoint Example of this method is presented in Figure 14 Thearrows with dash lines indicate the planned trajectory in the x y-plane and thesolid arrows indicate the realised trajectory The black squares mark the start and

the finish positions and the white squares mark the checkpoints for the trajectory18The control inputs are calculated from the current location of the quadcopter to thenext checkpoint but because of random and unmodelled forces the realised positionmarked with X differs from the planned If the quadcopter is close enough to thetarget checkpoint the target checkpoint is changed to the next one and new controlinputs are calculated After repeating this and going through all of the checkpointsthe quadcopter reaches the final destinationFigure 14 Example of checkpoint flight pattern with external disturbancesThe biggest weakness in the proposed method is that it works as shown only if thequadcopter starts from a stable attitude the angles _ and _ and their derivativesare zeros and there are no external forces influencing the attitude during the flightSmall deviations in the angles can result into a huge deviation in the trajectory Oneway to solve this problem is to stabilise the quadcopter at each checkpoint with aPD controller proposed earlier or by using the heuristic method to angles Howeverif the angular disturbances are continuous the benefit from temporary stabilisationis only momentary52 Integrated PD controllerAnother method to take into account the possible deviations in the angles is tointegrate a PD controller into the heuristic method This is a simplified version ofthe proposed control method in [5] The required values dx dy and dz in Equation(26) are given by the PD controller considering the deviations between the currentand desired values (subscript d) of the positions _ velocities _˙ and accelerations _umldx = KxP (xd minus x) + KxD (x˙ d minus x˙ ) + KxDD (xumld minus xuml) dy = KyP (yd minus y) + KyD (y˙d minus y˙) + KyDD (yumld minus yuml) dz = KzP (zd minus z) + KzD (z˙d minus z˙) + KzDD (zumld minus zuml) (29)Then the commanded angles _c and _c and thrust T are given by Equation (26)The torques _ are controlled by the PD controller in Equation (30) same as in

19Equation (23) The control inputs can be solved with the calculated thrust andtorques by using Equation (24)__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Ixx__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Iyy_ =_K P ( d minus ) + K D_˙ d minus ˙ __Izz(30)The performance of the PD controller is demonstrated with an example case inwhich for all positions x y and z and their derivatives the values are same as inFigure 10 The simulation is performed with the PD parameters presented in Table3Table 3 Parameters of the PD controllerVariable Parameter valuei KiP KiD KiDDx 185 075 100y 855 075 100z 185 075 100_ 300 075 -_ 300 075 - 300 075 -The results of the simulation are presented Figures 15 - 17 The simulated controlinputs are presented in Figure 15 the simulated positions in Figure 16 and the

simulated angles in Figure 17 The position of the quadcopter is close to the plannedposition after 6 seconds but the position keeps fluctuating close to the planned valuesfor several seconds The angles variate greatly during the simulation to achieve thewanted positions velocities and accelerations The values of the control inputsoscillated during the acceleration but then their behaviour became more stable0 2 4 6 8 10 12 14618619620621622623624625626

Time t (s)Control input i (rads)1234

Figure 15 Control inputs i200 2 4 6 8 10 12 14minus0100102030405060708

Time t (s)Position (m)Position xPosition yPosition z

Figure 16 Positions x y and z0 2 4 6 8 10 12 14minus15minus125minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 17 Angles _ _ and The proposed integrated PD controller performed well in the example case Howeverthe performance of the controller is highly depended on the parameter values If theparameter values are small the controller will not respond quickly enough to followthe planned trajectory If the parameter values are substantial the quadcopter cannot perform the required drastic changes in the angular velocities of the rotor andthe control inputs calculated from Equation (24) can be infeasible with certaintorques Thus the use of equations considering the torques and the control inputsrequires a method to calculate the best feasible torques and from them the bestcontrol inputs Another possible method would be to variate the PD parameters

according to the current positions and angles and their derivatives but it is extremelydifficult216 ConclusionThis paper studied mathematical modelling and control of a quadcopter The mathematicalmodel of quadcopter dynamics was presented and the differential equationswere derived from the Newton-Euler and the Euler-Lagrange equations The modelwas verified by simulating the flight of a quadcopter with Matlab Stabilisation ofattitude of the quadcopter was done by utilising a PD controller A heuristic methodwas developed to control the trajectory of the quadcopter The PD contoller wasintegrated into the heuristic method for better response to disturbances in the flightconditions of the quadcopterThe simulation proved the presented mathematical model to be realistic in modellingthe position and attitude of the quadcopter The simulation results also showedthat the PD controller was efficient in stabilising the quadcopter to the desiredaltitude and attitude However the PD controller did not considered positions xand y Thus the values of x and y variated from their original values during thestabilisation process This was a result of the deviation of the roll and pitch anglesfrom zero valuesAccording to the simulation results the proposed heuristic method produced goodflight trajectories The heuristic method required only three parameters to generatethe values for the jounce of the position The position and its other derivatives werecalculated from the jounce values The total thrust and the pitch and roll angles toachieve given accelerations were solved from the linear differential equations Thenthe torques were determined by the angular accelerations and angular velocitiescalculated from the angles Finally the required control inputs were solved from thetotal thrust and the torques The simulation results indicated that the quadcopter

could be controlled accurately with the control inputs given by the methodThe proposed heuristic method does not consider unmodelled disturbances suchas wind and thus the PD controller was integrated into the control method Theintegrated PD controller operated well in the example simulation The quadcopterfollowed the given trajectory and began to stabilise after reaching the final destinationHowever the PD controller can perform poorly if the parameter values arenot properly selected and are too small or highThe presented mathematical model only consists of the basic structures of the quadcopterdynamics Several aerodynamical effects were excluded which can lead tounrealiable behaviour Also the electric motors spinning the fours rotors were notmodelled The behaviour of a motor is easily included in the model but would requireestimation of the parameter values of the motor The position and attitudeinformation was assumed to be accurate in the model and the simulations Howeverthe measuring devices in real life are not perfectly accurate as random variationsand errors occur Hence the effects of imprecise information to the flight of thequadcopter should be studied as well Also methods to enhance the accuracy of themeasurements should be researched and implemented to improve all aspects required22for robust quadcopter manoeuvresThe presented model and control methods were tested only with simulations Realexperimental prototype of a quadcopter should be constructed to achieve more realisticand reliable results Even though the construction of a real quadcopter and theestimation of all the model parameters are laborious tasks a real quadcopter wouldbring significant benefits to the research With a real propotype the theoreticalframework and the simulation results could be compared to real-life measurementsThis paper did not include these higlighted matters in the study but presentedthe basics of quadcopter modelling and control This paper can thus be used as a

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

between the jounce of position x and the control inputs 1 and 3 controlling theangle _ is more visible160 1 2 3 4 5 6 7minus1minus08minus06minus04minus020020406081Time t (s)Jounce (ms4)

(a) Jounce0 1 2 3 4 5 6 7minus04minus03minus02minus01001020304

Time t (s)Jerk (ms3)

(b) Jerk0 1 2 3 4 5 6 7minus02minus015minus01minus00500050101502Time t (s)Acceleration (ms2)

(c) Acceleration0 1 2 3 4 5 6 7minus002000200400600801012014016018

Time t (s)Velocity (ms)

(d) Velocity0 1 2 3 4 5 6 7001020304050607

Time t (s)Position (m)

(e) PositionFigure 10 Planned position x and its derivatives with given jounceThe simulation of the example case is performed with previously given accelerationsand velocities of position x The planned value of angle is zero for each time tFirst the required angles _ and _ and thrust T are solved from Equation (26) foreach time t The angular velocities and accelerations are calculated from the solvedangles with derivation Then the torques are solved using the angular velocitiesand accelerations Finally the control inputs are solved Then the simulation isperformed with given control inputsThe calculated control inputs are presented in Figure 11 The simulated positions_ are presented in Figure 12 and the simulated angles _ in Figure 13 Accordingto Figure 12 the simulated position x is the same as the planned position x inFigure 10(e) and the values of the positions y and z stay as zeroes The angle _increases during the acceleration and then stabilises to a constant value to generate

the constant acceleration required to compensate the drag force caused by theplanned constant velocity Finally the angle is changed to the opposite direction todecelerate the quadcopter to a haltThe shape of the calculated control inputs 1 and 3 in Figure 11 are similar toplanned jounce in Figure 10(a) The shape of the simulated angle _ follows theshape of the planned acceleration umlx The shapes of the control inputs and theangles differ from the planned values of the jounce and the acceleration because thedrag force caused by the velocity has to be compensated170 1 2 3 4 5 6 76203620462056206620762086209621

Time t (s)Control input i (rads)1234

Figure 11 Control inputs i0 1 2 3 4 5 6001020304050607

Time t (s)Position (m)Position xPosition yPosition z

Figure 12 Positions x y and z0 1 2 3 4 5 6 7minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 13 Angles _ _ and The method can also be used even if there are unmodeled linear forces wind forexample which affect the linear accelerations and consequently the position of thequadcopter If the trajectory is calculated in shorter distances it is possible tocorrect the trajectory with new calculation from the current but inaccurate locationto the next checkpoint Example of this method is presented in Figure 14 Thearrows with dash lines indicate the planned trajectory in the x y-plane and thesolid arrows indicate the realised trajectory The black squares mark the start and

the finish positions and the white squares mark the checkpoints for the trajectory18The control inputs are calculated from the current location of the quadcopter to thenext checkpoint but because of random and unmodelled forces the realised positionmarked with X differs from the planned If the quadcopter is close enough to thetarget checkpoint the target checkpoint is changed to the next one and new controlinputs are calculated After repeating this and going through all of the checkpointsthe quadcopter reaches the final destinationFigure 14 Example of checkpoint flight pattern with external disturbancesThe biggest weakness in the proposed method is that it works as shown only if thequadcopter starts from a stable attitude the angles _ and _ and their derivativesare zeros and there are no external forces influencing the attitude during the flightSmall deviations in the angles can result into a huge deviation in the trajectory Oneway to solve this problem is to stabilise the quadcopter at each checkpoint with aPD controller proposed earlier or by using the heuristic method to angles Howeverif the angular disturbances are continuous the benefit from temporary stabilisationis only momentary52 Integrated PD controllerAnother method to take into account the possible deviations in the angles is tointegrate a PD controller into the heuristic method This is a simplified version ofthe proposed control method in [5] The required values dx dy and dz in Equation(26) are given by the PD controller considering the deviations between the currentand desired values (subscript d) of the positions _ velocities _˙ and accelerations _umldx = KxP (xd minus x) + KxD (x˙ d minus x˙ ) + KxDD (xumld minus xuml) dy = KyP (yd minus y) + KyD (y˙d minus y˙) + KyDD (yumld minus yuml) dz = KzP (zd minus z) + KzD (z˙d minus z˙) + KzDD (zumld minus zuml) (29)Then the commanded angles _c and _c and thrust T are given by Equation (26)The torques _ are controlled by the PD controller in Equation (30) same as in

19Equation (23) The control inputs can be solved with the calculated thrust andtorques by using Equation (24)__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Ixx__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Iyy_ =_K P ( d minus ) + K D_˙ d minus ˙ __Izz(30)The performance of the PD controller is demonstrated with an example case inwhich for all positions x y and z and their derivatives the values are same as inFigure 10 The simulation is performed with the PD parameters presented in Table3Table 3 Parameters of the PD controllerVariable Parameter valuei KiP KiD KiDDx 185 075 100y 855 075 100z 185 075 100_ 300 075 -_ 300 075 - 300 075 -The results of the simulation are presented Figures 15 - 17 The simulated controlinputs are presented in Figure 15 the simulated positions in Figure 16 and the

simulated angles in Figure 17 The position of the quadcopter is close to the plannedposition after 6 seconds but the position keeps fluctuating close to the planned valuesfor several seconds The angles variate greatly during the simulation to achieve thewanted positions velocities and accelerations The values of the control inputsoscillated during the acceleration but then their behaviour became more stable0 2 4 6 8 10 12 14618619620621622623624625626

Time t (s)Control input i (rads)1234

Figure 15 Control inputs i200 2 4 6 8 10 12 14minus0100102030405060708

Time t (s)Position (m)Position xPosition yPosition z

Figure 16 Positions x y and z0 2 4 6 8 10 12 14minus15minus125minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 17 Angles _ _ and The proposed integrated PD controller performed well in the example case Howeverthe performance of the controller is highly depended on the parameter values If theparameter values are small the controller will not respond quickly enough to followthe planned trajectory If the parameter values are substantial the quadcopter cannot perform the required drastic changes in the angular velocities of the rotor andthe control inputs calculated from Equation (24) can be infeasible with certaintorques Thus the use of equations considering the torques and the control inputsrequires a method to calculate the best feasible torques and from them the bestcontrol inputs Another possible method would be to variate the PD parameters

according to the current positions and angles and their derivatives but it is extremelydifficult216 ConclusionThis paper studied mathematical modelling and control of a quadcopter The mathematicalmodel of quadcopter dynamics was presented and the differential equationswere derived from the Newton-Euler and the Euler-Lagrange equations The modelwas verified by simulating the flight of a quadcopter with Matlab Stabilisation ofattitude of the quadcopter was done by utilising a PD controller A heuristic methodwas developed to control the trajectory of the quadcopter The PD contoller wasintegrated into the heuristic method for better response to disturbances in the flightconditions of the quadcopterThe simulation proved the presented mathematical model to be realistic in modellingthe position and attitude of the quadcopter The simulation results also showedthat the PD controller was efficient in stabilising the quadcopter to the desiredaltitude and attitude However the PD controller did not considered positions xand y Thus the values of x and y variated from their original values during thestabilisation process This was a result of the deviation of the roll and pitch anglesfrom zero valuesAccording to the simulation results the proposed heuristic method produced goodflight trajectories The heuristic method required only three parameters to generatethe values for the jounce of the position The position and its other derivatives werecalculated from the jounce values The total thrust and the pitch and roll angles toachieve given accelerations were solved from the linear differential equations Thenthe torques were determined by the angular accelerations and angular velocitiescalculated from the angles Finally the required control inputs were solved from thetotal thrust and the torques The simulation results indicated that the quadcopter

could be controlled accurately with the control inputs given by the methodThe proposed heuristic method does not consider unmodelled disturbances suchas wind and thus the PD controller was integrated into the control method Theintegrated PD controller operated well in the example simulation The quadcopterfollowed the given trajectory and began to stabilise after reaching the final destinationHowever the PD controller can perform poorly if the parameter values arenot properly selected and are too small or highThe presented mathematical model only consists of the basic structures of the quadcopterdynamics Several aerodynamical effects were excluded which can lead tounrealiable behaviour Also the electric motors spinning the fours rotors were notmodelled The behaviour of a motor is easily included in the model but would requireestimation of the parameter values of the motor The position and attitudeinformation was assumed to be accurate in the model and the simulations Howeverthe measuring devices in real life are not perfectly accurate as random variationsand errors occur Hence the effects of imprecise information to the flight of thequadcopter should be studied as well Also methods to enhance the accuracy of themeasurements should be researched and implemented to improve all aspects required22for robust quadcopter manoeuvresThe presented model and control methods were tested only with simulations Realexperimental prototype of a quadcopter should be constructed to achieve more realisticand reliable results Even though the construction of a real quadcopter and theestimation of all the model parameters are laborious tasks a real quadcopter wouldbring significant benefits to the research With a real propotype the theoreticalframework and the simulation results could be compared to real-life measurementsThis paper did not include these higlighted matters in the study but presentedthe basics of quadcopter modelling and control This paper can thus be used as a

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

the constant acceleration required to compensate the drag force caused by theplanned constant velocity Finally the angle is changed to the opposite direction todecelerate the quadcopter to a haltThe shape of the calculated control inputs 1 and 3 in Figure 11 are similar toplanned jounce in Figure 10(a) The shape of the simulated angle _ follows theshape of the planned acceleration umlx The shapes of the control inputs and theangles differ from the planned values of the jounce and the acceleration because thedrag force caused by the velocity has to be compensated170 1 2 3 4 5 6 76203620462056206620762086209621

Time t (s)Control input i (rads)1234

Figure 11 Control inputs i0 1 2 3 4 5 6001020304050607

Time t (s)Position (m)Position xPosition yPosition z

Figure 12 Positions x y and z0 1 2 3 4 5 6 7minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 13 Angles _ _ and The method can also be used even if there are unmodeled linear forces wind forexample which affect the linear accelerations and consequently the position of thequadcopter If the trajectory is calculated in shorter distances it is possible tocorrect the trajectory with new calculation from the current but inaccurate locationto the next checkpoint Example of this method is presented in Figure 14 Thearrows with dash lines indicate the planned trajectory in the x y-plane and thesolid arrows indicate the realised trajectory The black squares mark the start and

the finish positions and the white squares mark the checkpoints for the trajectory18The control inputs are calculated from the current location of the quadcopter to thenext checkpoint but because of random and unmodelled forces the realised positionmarked with X differs from the planned If the quadcopter is close enough to thetarget checkpoint the target checkpoint is changed to the next one and new controlinputs are calculated After repeating this and going through all of the checkpointsthe quadcopter reaches the final destinationFigure 14 Example of checkpoint flight pattern with external disturbancesThe biggest weakness in the proposed method is that it works as shown only if thequadcopter starts from a stable attitude the angles _ and _ and their derivativesare zeros and there are no external forces influencing the attitude during the flightSmall deviations in the angles can result into a huge deviation in the trajectory Oneway to solve this problem is to stabilise the quadcopter at each checkpoint with aPD controller proposed earlier or by using the heuristic method to angles Howeverif the angular disturbances are continuous the benefit from temporary stabilisationis only momentary52 Integrated PD controllerAnother method to take into account the possible deviations in the angles is tointegrate a PD controller into the heuristic method This is a simplified version ofthe proposed control method in [5] The required values dx dy and dz in Equation(26) are given by the PD controller considering the deviations between the currentand desired values (subscript d) of the positions _ velocities _˙ and accelerations _umldx = KxP (xd minus x) + KxD (x˙ d minus x˙ ) + KxDD (xumld minus xuml) dy = KyP (yd minus y) + KyD (y˙d minus y˙) + KyDD (yumld minus yuml) dz = KzP (zd minus z) + KzD (z˙d minus z˙) + KzDD (zumld minus zuml) (29)Then the commanded angles _c and _c and thrust T are given by Equation (26)The torques _ are controlled by the PD controller in Equation (30) same as in

19Equation (23) The control inputs can be solved with the calculated thrust andtorques by using Equation (24)__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Ixx__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Iyy_ =_K P ( d minus ) + K D_˙ d minus ˙ __Izz(30)The performance of the PD controller is demonstrated with an example case inwhich for all positions x y and z and their derivatives the values are same as inFigure 10 The simulation is performed with the PD parameters presented in Table3Table 3 Parameters of the PD controllerVariable Parameter valuei KiP KiD KiDDx 185 075 100y 855 075 100z 185 075 100_ 300 075 -_ 300 075 - 300 075 -The results of the simulation are presented Figures 15 - 17 The simulated controlinputs are presented in Figure 15 the simulated positions in Figure 16 and the

simulated angles in Figure 17 The position of the quadcopter is close to the plannedposition after 6 seconds but the position keeps fluctuating close to the planned valuesfor several seconds The angles variate greatly during the simulation to achieve thewanted positions velocities and accelerations The values of the control inputsoscillated during the acceleration but then their behaviour became more stable0 2 4 6 8 10 12 14618619620621622623624625626

Time t (s)Control input i (rads)1234

Figure 15 Control inputs i200 2 4 6 8 10 12 14minus0100102030405060708

Time t (s)Position (m)Position xPosition yPosition z

Figure 16 Positions x y and z0 2 4 6 8 10 12 14minus15minus125minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 17 Angles _ _ and The proposed integrated PD controller performed well in the example case Howeverthe performance of the controller is highly depended on the parameter values If theparameter values are small the controller will not respond quickly enough to followthe planned trajectory If the parameter values are substantial the quadcopter cannot perform the required drastic changes in the angular velocities of the rotor andthe control inputs calculated from Equation (24) can be infeasible with certaintorques Thus the use of equations considering the torques and the control inputsrequires a method to calculate the best feasible torques and from them the bestcontrol inputs Another possible method would be to variate the PD parameters

according to the current positions and angles and their derivatives but it is extremelydifficult216 ConclusionThis paper studied mathematical modelling and control of a quadcopter The mathematicalmodel of quadcopter dynamics was presented and the differential equationswere derived from the Newton-Euler and the Euler-Lagrange equations The modelwas verified by simulating the flight of a quadcopter with Matlab Stabilisation ofattitude of the quadcopter was done by utilising a PD controller A heuristic methodwas developed to control the trajectory of the quadcopter The PD contoller wasintegrated into the heuristic method for better response to disturbances in the flightconditions of the quadcopterThe simulation proved the presented mathematical model to be realistic in modellingthe position and attitude of the quadcopter The simulation results also showedthat the PD controller was efficient in stabilising the quadcopter to the desiredaltitude and attitude However the PD controller did not considered positions xand y Thus the values of x and y variated from their original values during thestabilisation process This was a result of the deviation of the roll and pitch anglesfrom zero valuesAccording to the simulation results the proposed heuristic method produced goodflight trajectories The heuristic method required only three parameters to generatethe values for the jounce of the position The position and its other derivatives werecalculated from the jounce values The total thrust and the pitch and roll angles toachieve given accelerations were solved from the linear differential equations Thenthe torques were determined by the angular accelerations and angular velocitiescalculated from the angles Finally the required control inputs were solved from thetotal thrust and the torques The simulation results indicated that the quadcopter

could be controlled accurately with the control inputs given by the methodThe proposed heuristic method does not consider unmodelled disturbances suchas wind and thus the PD controller was integrated into the control method Theintegrated PD controller operated well in the example simulation The quadcopterfollowed the given trajectory and began to stabilise after reaching the final destinationHowever the PD controller can perform poorly if the parameter values arenot properly selected and are too small or highThe presented mathematical model only consists of the basic structures of the quadcopterdynamics Several aerodynamical effects were excluded which can lead tounrealiable behaviour Also the electric motors spinning the fours rotors were notmodelled The behaviour of a motor is easily included in the model but would requireestimation of the parameter values of the motor The position and attitudeinformation was assumed to be accurate in the model and the simulations Howeverthe measuring devices in real life are not perfectly accurate as random variationsand errors occur Hence the effects of imprecise information to the flight of thequadcopter should be studied as well Also methods to enhance the accuracy of themeasurements should be researched and implemented to improve all aspects required22for robust quadcopter manoeuvresThe presented model and control methods were tested only with simulations Realexperimental prototype of a quadcopter should be constructed to achieve more realisticand reliable results Even though the construction of a real quadcopter and theestimation of all the model parameters are laborious tasks a real quadcopter wouldbring significant benefits to the research With a real propotype the theoreticalframework and the simulation results could be compared to real-life measurementsThis paper did not include these higlighted matters in the study but presentedthe basics of quadcopter modelling and control This paper can thus be used as a

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

the finish positions and the white squares mark the checkpoints for the trajectory18The control inputs are calculated from the current location of the quadcopter to thenext checkpoint but because of random and unmodelled forces the realised positionmarked with X differs from the planned If the quadcopter is close enough to thetarget checkpoint the target checkpoint is changed to the next one and new controlinputs are calculated After repeating this and going through all of the checkpointsthe quadcopter reaches the final destinationFigure 14 Example of checkpoint flight pattern with external disturbancesThe biggest weakness in the proposed method is that it works as shown only if thequadcopter starts from a stable attitude the angles _ and _ and their derivativesare zeros and there are no external forces influencing the attitude during the flightSmall deviations in the angles can result into a huge deviation in the trajectory Oneway to solve this problem is to stabilise the quadcopter at each checkpoint with aPD controller proposed earlier or by using the heuristic method to angles Howeverif the angular disturbances are continuous the benefit from temporary stabilisationis only momentary52 Integrated PD controllerAnother method to take into account the possible deviations in the angles is tointegrate a PD controller into the heuristic method This is a simplified version ofthe proposed control method in [5] The required values dx dy and dz in Equation(26) are given by the PD controller considering the deviations between the currentand desired values (subscript d) of the positions _ velocities _˙ and accelerations _umldx = KxP (xd minus x) + KxD (x˙ d minus x˙ ) + KxDD (xumld minus xuml) dy = KyP (yd minus y) + KyD (y˙d minus y˙) + KyDD (yumld minus yuml) dz = KzP (zd minus z) + KzD (z˙d minus z˙) + KzDD (zumld minus zuml) (29)Then the commanded angles _c and _c and thrust T are given by Equation (26)The torques _ are controlled by the PD controller in Equation (30) same as in

19Equation (23) The control inputs can be solved with the calculated thrust andtorques by using Equation (24)__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Ixx__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Iyy_ =_K P ( d minus ) + K D_˙ d minus ˙ __Izz(30)The performance of the PD controller is demonstrated with an example case inwhich for all positions x y and z and their derivatives the values are same as inFigure 10 The simulation is performed with the PD parameters presented in Table3Table 3 Parameters of the PD controllerVariable Parameter valuei KiP KiD KiDDx 185 075 100y 855 075 100z 185 075 100_ 300 075 -_ 300 075 - 300 075 -The results of the simulation are presented Figures 15 - 17 The simulated controlinputs are presented in Figure 15 the simulated positions in Figure 16 and the

simulated angles in Figure 17 The position of the quadcopter is close to the plannedposition after 6 seconds but the position keeps fluctuating close to the planned valuesfor several seconds The angles variate greatly during the simulation to achieve thewanted positions velocities and accelerations The values of the control inputsoscillated during the acceleration but then their behaviour became more stable0 2 4 6 8 10 12 14618619620621622623624625626

Time t (s)Control input i (rads)1234

Figure 15 Control inputs i200 2 4 6 8 10 12 14minus0100102030405060708

Time t (s)Position (m)Position xPosition yPosition z

Figure 16 Positions x y and z0 2 4 6 8 10 12 14minus15minus125minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 17 Angles _ _ and The proposed integrated PD controller performed well in the example case Howeverthe performance of the controller is highly depended on the parameter values If theparameter values are small the controller will not respond quickly enough to followthe planned trajectory If the parameter values are substantial the quadcopter cannot perform the required drastic changes in the angular velocities of the rotor andthe control inputs calculated from Equation (24) can be infeasible with certaintorques Thus the use of equations considering the torques and the control inputsrequires a method to calculate the best feasible torques and from them the bestcontrol inputs Another possible method would be to variate the PD parameters

according to the current positions and angles and their derivatives but it is extremelydifficult216 ConclusionThis paper studied mathematical modelling and control of a quadcopter The mathematicalmodel of quadcopter dynamics was presented and the differential equationswere derived from the Newton-Euler and the Euler-Lagrange equations The modelwas verified by simulating the flight of a quadcopter with Matlab Stabilisation ofattitude of the quadcopter was done by utilising a PD controller A heuristic methodwas developed to control the trajectory of the quadcopter The PD contoller wasintegrated into the heuristic method for better response to disturbances in the flightconditions of the quadcopterThe simulation proved the presented mathematical model to be realistic in modellingthe position and attitude of the quadcopter The simulation results also showedthat the PD controller was efficient in stabilising the quadcopter to the desiredaltitude and attitude However the PD controller did not considered positions xand y Thus the values of x and y variated from their original values during thestabilisation process This was a result of the deviation of the roll and pitch anglesfrom zero valuesAccording to the simulation results the proposed heuristic method produced goodflight trajectories The heuristic method required only three parameters to generatethe values for the jounce of the position The position and its other derivatives werecalculated from the jounce values The total thrust and the pitch and roll angles toachieve given accelerations were solved from the linear differential equations Thenthe torques were determined by the angular accelerations and angular velocitiescalculated from the angles Finally the required control inputs were solved from thetotal thrust and the torques The simulation results indicated that the quadcopter

could be controlled accurately with the control inputs given by the methodThe proposed heuristic method does not consider unmodelled disturbances suchas wind and thus the PD controller was integrated into the control method Theintegrated PD controller operated well in the example simulation The quadcopterfollowed the given trajectory and began to stabilise after reaching the final destinationHowever the PD controller can perform poorly if the parameter values arenot properly selected and are too small or highThe presented mathematical model only consists of the basic structures of the quadcopterdynamics Several aerodynamical effects were excluded which can lead tounrealiable behaviour Also the electric motors spinning the fours rotors were notmodelled The behaviour of a motor is easily included in the model but would requireestimation of the parameter values of the motor The position and attitudeinformation was assumed to be accurate in the model and the simulations Howeverthe measuring devices in real life are not perfectly accurate as random variationsand errors occur Hence the effects of imprecise information to the flight of thequadcopter should be studied as well Also methods to enhance the accuracy of themeasurements should be researched and implemented to improve all aspects required22for robust quadcopter manoeuvresThe presented model and control methods were tested only with simulations Realexperimental prototype of a quadcopter should be constructed to achieve more realisticand reliable results Even though the construction of a real quadcopter and theestimation of all the model parameters are laborious tasks a real quadcopter wouldbring significant benefits to the research With a real propotype the theoreticalframework and the simulation results could be compared to real-life measurementsThis paper did not include these higlighted matters in the study but presentedthe basics of quadcopter modelling and control This paper can thus be used as a

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

19Equation (23) The control inputs can be solved with the calculated thrust andtorques by using Equation (24)__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Ixx__ =_K_P (_c minus _) + K_D_˙_c minus ˙___Iyy_ =_K P ( d minus ) + K D_˙ d minus ˙ __Izz(30)The performance of the PD controller is demonstrated with an example case inwhich for all positions x y and z and their derivatives the values are same as inFigure 10 The simulation is performed with the PD parameters presented in Table3Table 3 Parameters of the PD controllerVariable Parameter valuei KiP KiD KiDDx 185 075 100y 855 075 100z 185 075 100_ 300 075 -_ 300 075 - 300 075 -The results of the simulation are presented Figures 15 - 17 The simulated controlinputs are presented in Figure 15 the simulated positions in Figure 16 and the

simulated angles in Figure 17 The position of the quadcopter is close to the plannedposition after 6 seconds but the position keeps fluctuating close to the planned valuesfor several seconds The angles variate greatly during the simulation to achieve thewanted positions velocities and accelerations The values of the control inputsoscillated during the acceleration but then their behaviour became more stable0 2 4 6 8 10 12 14618619620621622623624625626

Time t (s)Control input i (rads)1234

Figure 15 Control inputs i200 2 4 6 8 10 12 14minus0100102030405060708

Time t (s)Position (m)Position xPosition yPosition z

Figure 16 Positions x y and z0 2 4 6 8 10 12 14minus15minus125minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 17 Angles _ _ and The proposed integrated PD controller performed well in the example case Howeverthe performance of the controller is highly depended on the parameter values If theparameter values are small the controller will not respond quickly enough to followthe planned trajectory If the parameter values are substantial the quadcopter cannot perform the required drastic changes in the angular velocities of the rotor andthe control inputs calculated from Equation (24) can be infeasible with certaintorques Thus the use of equations considering the torques and the control inputsrequires a method to calculate the best feasible torques and from them the bestcontrol inputs Another possible method would be to variate the PD parameters

according to the current positions and angles and their derivatives but it is extremelydifficult216 ConclusionThis paper studied mathematical modelling and control of a quadcopter The mathematicalmodel of quadcopter dynamics was presented and the differential equationswere derived from the Newton-Euler and the Euler-Lagrange equations The modelwas verified by simulating the flight of a quadcopter with Matlab Stabilisation ofattitude of the quadcopter was done by utilising a PD controller A heuristic methodwas developed to control the trajectory of the quadcopter The PD contoller wasintegrated into the heuristic method for better response to disturbances in the flightconditions of the quadcopterThe simulation proved the presented mathematical model to be realistic in modellingthe position and attitude of the quadcopter The simulation results also showedthat the PD controller was efficient in stabilising the quadcopter to the desiredaltitude and attitude However the PD controller did not considered positions xand y Thus the values of x and y variated from their original values during thestabilisation process This was a result of the deviation of the roll and pitch anglesfrom zero valuesAccording to the simulation results the proposed heuristic method produced goodflight trajectories The heuristic method required only three parameters to generatethe values for the jounce of the position The position and its other derivatives werecalculated from the jounce values The total thrust and the pitch and roll angles toachieve given accelerations were solved from the linear differential equations Thenthe torques were determined by the angular accelerations and angular velocitiescalculated from the angles Finally the required control inputs were solved from thetotal thrust and the torques The simulation results indicated that the quadcopter

could be controlled accurately with the control inputs given by the methodThe proposed heuristic method does not consider unmodelled disturbances suchas wind and thus the PD controller was integrated into the control method Theintegrated PD controller operated well in the example simulation The quadcopterfollowed the given trajectory and began to stabilise after reaching the final destinationHowever the PD controller can perform poorly if the parameter values arenot properly selected and are too small or highThe presented mathematical model only consists of the basic structures of the quadcopterdynamics Several aerodynamical effects were excluded which can lead tounrealiable behaviour Also the electric motors spinning the fours rotors were notmodelled The behaviour of a motor is easily included in the model but would requireestimation of the parameter values of the motor The position and attitudeinformation was assumed to be accurate in the model and the simulations Howeverthe measuring devices in real life are not perfectly accurate as random variationsand errors occur Hence the effects of imprecise information to the flight of thequadcopter should be studied as well Also methods to enhance the accuracy of themeasurements should be researched and implemented to improve all aspects required22for robust quadcopter manoeuvresThe presented model and control methods were tested only with simulations Realexperimental prototype of a quadcopter should be constructed to achieve more realisticand reliable results Even though the construction of a real quadcopter and theestimation of all the model parameters are laborious tasks a real quadcopter wouldbring significant benefits to the research With a real propotype the theoreticalframework and the simulation results could be compared to real-life measurementsThis paper did not include these higlighted matters in the study but presentedthe basics of quadcopter modelling and control This paper can thus be used as a

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

simulated angles in Figure 17 The position of the quadcopter is close to the plannedposition after 6 seconds but the position keeps fluctuating close to the planned valuesfor several seconds The angles variate greatly during the simulation to achieve thewanted positions velocities and accelerations The values of the control inputsoscillated during the acceleration but then their behaviour became more stable0 2 4 6 8 10 12 14618619620621622623624625626

Time t (s)Control input i (rads)1234

Figure 15 Control inputs i200 2 4 6 8 10 12 14minus0100102030405060708

Time t (s)Position (m)Position xPosition yPosition z

Figure 16 Positions x y and z0 2 4 6 8 10 12 14minus15minus125minus1minus075minus05minus025002505075112515

Time t (s)Angle (deg)Angle AacuteAngle microAngle

Figure 17 Angles _ _ and The proposed integrated PD controller performed well in the example case Howeverthe performance of the controller is highly depended on the parameter values If theparameter values are small the controller will not respond quickly enough to followthe planned trajectory If the parameter values are substantial the quadcopter cannot perform the required drastic changes in the angular velocities of the rotor andthe control inputs calculated from Equation (24) can be infeasible with certaintorques Thus the use of equations considering the torques and the control inputsrequires a method to calculate the best feasible torques and from them the bestcontrol inputs Another possible method would be to variate the PD parameters

according to the current positions and angles and their derivatives but it is extremelydifficult216 ConclusionThis paper studied mathematical modelling and control of a quadcopter The mathematicalmodel of quadcopter dynamics was presented and the differential equationswere derived from the Newton-Euler and the Euler-Lagrange equations The modelwas verified by simulating the flight of a quadcopter with Matlab Stabilisation ofattitude of the quadcopter was done by utilising a PD controller A heuristic methodwas developed to control the trajectory of the quadcopter The PD contoller wasintegrated into the heuristic method for better response to disturbances in the flightconditions of the quadcopterThe simulation proved the presented mathematical model to be realistic in modellingthe position and attitude of the quadcopter The simulation results also showedthat the PD controller was efficient in stabilising the quadcopter to the desiredaltitude and attitude However the PD controller did not considered positions xand y Thus the values of x and y variated from their original values during thestabilisation process This was a result of the deviation of the roll and pitch anglesfrom zero valuesAccording to the simulation results the proposed heuristic method produced goodflight trajectories The heuristic method required only three parameters to generatethe values for the jounce of the position The position and its other derivatives werecalculated from the jounce values The total thrust and the pitch and roll angles toachieve given accelerations were solved from the linear differential equations Thenthe torques were determined by the angular accelerations and angular velocitiescalculated from the angles Finally the required control inputs were solved from thetotal thrust and the torques The simulation results indicated that the quadcopter

could be controlled accurately with the control inputs given by the methodThe proposed heuristic method does not consider unmodelled disturbances suchas wind and thus the PD controller was integrated into the control method Theintegrated PD controller operated well in the example simulation The quadcopterfollowed the given trajectory and began to stabilise after reaching the final destinationHowever the PD controller can perform poorly if the parameter values arenot properly selected and are too small or highThe presented mathematical model only consists of the basic structures of the quadcopterdynamics Several aerodynamical effects were excluded which can lead tounrealiable behaviour Also the electric motors spinning the fours rotors were notmodelled The behaviour of a motor is easily included in the model but would requireestimation of the parameter values of the motor The position and attitudeinformation was assumed to be accurate in the model and the simulations Howeverthe measuring devices in real life are not perfectly accurate as random variationsand errors occur Hence the effects of imprecise information to the flight of thequadcopter should be studied as well Also methods to enhance the accuracy of themeasurements should be researched and implemented to improve all aspects required22for robust quadcopter manoeuvresThe presented model and control methods were tested only with simulations Realexperimental prototype of a quadcopter should be constructed to achieve more realisticand reliable results Even though the construction of a real quadcopter and theestimation of all the model parameters are laborious tasks a real quadcopter wouldbring significant benefits to the research With a real propotype the theoreticalframework and the simulation results could be compared to real-life measurementsThis paper did not include these higlighted matters in the study but presentedthe basics of quadcopter modelling and control This paper can thus be used as a

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

according to the current positions and angles and their derivatives but it is extremelydifficult216 ConclusionThis paper studied mathematical modelling and control of a quadcopter The mathematicalmodel of quadcopter dynamics was presented and the differential equationswere derived from the Newton-Euler and the Euler-Lagrange equations The modelwas verified by simulating the flight of a quadcopter with Matlab Stabilisation ofattitude of the quadcopter was done by utilising a PD controller A heuristic methodwas developed to control the trajectory of the quadcopter The PD contoller wasintegrated into the heuristic method for better response to disturbances in the flightconditions of the quadcopterThe simulation proved the presented mathematical model to be realistic in modellingthe position and attitude of the quadcopter The simulation results also showedthat the PD controller was efficient in stabilising the quadcopter to the desiredaltitude and attitude However the PD controller did not considered positions xand y Thus the values of x and y variated from their original values during thestabilisation process This was a result of the deviation of the roll and pitch anglesfrom zero valuesAccording to the simulation results the proposed heuristic method produced goodflight trajectories The heuristic method required only three parameters to generatethe values for the jounce of the position The position and its other derivatives werecalculated from the jounce values The total thrust and the pitch and roll angles toachieve given accelerations were solved from the linear differential equations Thenthe torques were determined by the angular accelerations and angular velocitiescalculated from the angles Finally the required control inputs were solved from thetotal thrust and the torques The simulation results indicated that the quadcopter

could be controlled accurately with the control inputs given by the methodThe proposed heuristic method does not consider unmodelled disturbances suchas wind and thus the PD controller was integrated into the control method Theintegrated PD controller operated well in the example simulation The quadcopterfollowed the given trajectory and began to stabilise after reaching the final destinationHowever the PD controller can perform poorly if the parameter values arenot properly selected and are too small or highThe presented mathematical model only consists of the basic structures of the quadcopterdynamics Several aerodynamical effects were excluded which can lead tounrealiable behaviour Also the electric motors spinning the fours rotors were notmodelled The behaviour of a motor is easily included in the model but would requireestimation of the parameter values of the motor The position and attitudeinformation was assumed to be accurate in the model and the simulations Howeverthe measuring devices in real life are not perfectly accurate as random variationsand errors occur Hence the effects of imprecise information to the flight of thequadcopter should be studied as well Also methods to enhance the accuracy of themeasurements should be researched and implemented to improve all aspects required22for robust quadcopter manoeuvresThe presented model and control methods were tested only with simulations Realexperimental prototype of a quadcopter should be constructed to achieve more realisticand reliable results Even though the construction of a real quadcopter and theestimation of all the model parameters are laborious tasks a real quadcopter wouldbring significant benefits to the research With a real propotype the theoreticalframework and the simulation results could be compared to real-life measurementsThis paper did not include these higlighted matters in the study but presentedthe basics of quadcopter modelling and control This paper can thus be used as a

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

could be controlled accurately with the control inputs given by the methodThe proposed heuristic method does not consider unmodelled disturbances suchas wind and thus the PD controller was integrated into the control method Theintegrated PD controller operated well in the example simulation The quadcopterfollowed the given trajectory and began to stabilise after reaching the final destinationHowever the PD controller can perform poorly if the parameter values arenot properly selected and are too small or highThe presented mathematical model only consists of the basic structures of the quadcopterdynamics Several aerodynamical effects were excluded which can lead tounrealiable behaviour Also the electric motors spinning the fours rotors were notmodelled The behaviour of a motor is easily included in the model but would requireestimation of the parameter values of the motor The position and attitudeinformation was assumed to be accurate in the model and the simulations Howeverthe measuring devices in real life are not perfectly accurate as random variationsand errors occur Hence the effects of imprecise information to the flight of thequadcopter should be studied as well Also methods to enhance the accuracy of themeasurements should be researched and implemented to improve all aspects required22for robust quadcopter manoeuvresThe presented model and control methods were tested only with simulations Realexperimental prototype of a quadcopter should be constructed to achieve more realisticand reliable results Even though the construction of a real quadcopter and theestimation of all the model parameters are laborious tasks a real quadcopter wouldbring significant benefits to the research With a real propotype the theoreticalframework and the simulation results could be compared to real-life measurementsThis paper did not include these higlighted matters in the study but presentedthe basics of quadcopter modelling and control This paper can thus be used as a

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

stepping-stone for future research in more complex modelling of the quadcopter23References[1] G M Hoffmann H Huang S L Waslander and C J Tomlin ldquoQuadrotorhelicopter flight dynamics and control Theory and experimentrdquo Proceedingsof the AIAA Guidance Navigation and Control Conference and Exhibit Aug2007[2] H Huang G M Hoffmann S L Waslander and C J Tomlin ldquoAerodynamicsand control of autonomous quadrotor helicopters in aggressive maneuveringrdquoIEEE International Conference on Robotics and Automation pp 3277ndash3282May 2009[3] A Tayebi and S McGilvray ldquoAttitude stabilization of a four-rotor aerialrobotrdquo 43rd IEEE Conference on Decision and Control vol 2 pp 1216ndash12212004[4] ˙ I C Dikmen A Arısoy and H Temeltacedils ldquoAttitude control of a quadrotorrdquo 4thInternational Conference on Recent Advances in Space Technologies pp 722ndash727 2009[5] Z Zuo ldquoTrajectory tracking control design with command-filtered compensationfor a quadrotorrdquo IET Control Theory Appl vol 4 no 11 pp 2343ndash23552010[6] S Bouabdallah A Noth and R Siegwart ldquoPID vs LQ control techniquesapplied to an indoor micro quadrotorrdquo IEEERSJ International Conferenceon Intelligent Robots and Systems vol 3 pp 2451ndash2456 2004[7] T Madani and A Benallegue ldquoBackstepping control for a quadrotor helicopterrdquoIEEERSJ International Conference on Intelligent Robots and Systemspp 3255ndash3260 2006[8] K M Zemalache L Beji and H Marref ldquoControl of an under-actuated systemApplication to a four rotors rotorcraftrdquo IEEE International Conference onRobotic and Biomimetics pp 404ndash409 2005[9] G V Raffo M G Ortega and F R Rubio ldquoAn integral predictivenonlinearH1 control structure for a quadrotor helicopterrdquo Automatica vol 46 no 1pp 29ndash39 2010[10] P Castillo R Lozano and A Dzul ldquoStabilisation of a mini rotorcraft with

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006

four rotorsrdquo IEEE Control Systems Magazine pp 45ndash55 Dec 2005[11] J Escare˜no C Salazar-Cruz and R Lozano ldquoEmbedded control of a four-rotorUAVrdquo American Control Conference vol 4 no 11 pp 3936ndash3941 2006[12] P Martin and E Salaumlun ldquoThe true role of acceleromter feedback in quadrotorcontrolrdquo IEEE International Conference on Robotics and Automationpp 1623ndash1629 May 201024[13] R He S Prentice and N Roy ldquoPlanning in information space for a quadrotorhelicopter in a GPS-denied environmentrdquo IEEE International Conference onRobotics and Automation pp 1814ndash1820 2008[14] T S Alderete ldquoSimulator aero model implementationrdquo NASA Ames ResearchCenter Moffett Field California httpwwwaviationsystemsdivisionarcnasagovpublicationshitlrtsimTomspdf[15] H Bouadi and M Tadjine ldquoNonlinear observer design and sliding mode controlof four rotors helicopterrdquo Proceedings of World Academy of Science Engineeringand Technology vol 25 pp 225ndash230 2007[16] K J degAstrumlom and T Humlagglund Advanced PID Control ISA - InstrumentationSystems and Automation Society 2006