 Open Access
 Total Downloads : 1019
 Authors : M. Mahfouz, M. Ashry, G. Elnashar
 Paper ID : IJERTV2IS120278
 Volume & Issue : Volume 02, Issue 12 (December 2013)
 Published (First Online): 09122013
 ISSN (Online) : 22780181
 Publisher Name : IJERT
 License: This work is licensed under a Creative Commons Attribution 4.0 International License
Design and Control of QuadRotor Helicopters Based on Adaptive NeuroFuzzy Inference System
M. Mahfouz, M. Ashry, G. Elnashar
M.T.C., Cairo, Egypt
Abstract
In this paper, Adaptive Neuro Fuzzy Inference System (ANFIS) is developed for an unmanned quadrotor air vehicle. The quadrotor is modelled as a nonlinear system. PID controller is designed first for the nonlinear system. Simplex algorithm is used as a fast optimal tuning technique for the PID controller parameters. Genetic Algorithm (GA) is then used as a fine tunning technique for PID parameters. Input output data of the PID controlled system are collected along the whole range of operation. These data are used as learning and checking data for the ANFIS design. The results obtained using ANFIS, as a nonlinear controller, are compared with the PID controller results obtained at the different operating points along the whole range of operation. These results confirm the effectiveness of the ANFIS as a nonlinear controller for the quadrotor.
1. Introduction
Unmanned air vehicles (UAV), especially a four rotors vertical takeoff and landing (VTOL) aircraft known as the quadrotor, have drawn great attention in recent years because of their manoeuvrability, ease of design and control. The quadrotor is a four bladed craft which has advantages over traditional aircrafts. The significant runway requirements imposed by traditional aircrafts are considered as a draw back. Conventional aircrafts must operate between runways and do not provide the flexibility of VTOL aircrafts. VTOL aircrafts have the advantage of being able to access congested areas and can land practically anywhere that has an opening equivalent to the vehicle footprint. There are many situations where this ability would be required such as evacuations of elevated areas and transport of goods to areas where road access is not available. VTOL craft also offer direct access to buildings or areas making them a very fast form of
transport between areas, especially those which are elevated or have limited access.
The quadrotor has also advantages over helicopters. The quadrotor design is one which reduces the mechanical complexity inherent in helicopter and other VTOL aircraft. Directional control is produced by individually altering the speed of the four motors. This greatly reduces the mechanical complexity. A quadrotor consists of two fixed pitch clockwise spinning rotors and two counterclockwise spinning rotors which diagonally oppose each other as shown in Figure 1. This results in the reactive force of each propeller being effectively cancelled out by the diagonally opposite rotors reactive component. This eliminates the need for a helicopter tail rotor.
Figure 1: Free body diagram of a quadrotor helicopter.
The quadrotor has also an advantage of manoeuvrability due to its inherent nature. It is an underactuated system with four inputs (roll, pitch, yaw and throttle). The parameters that determine the
characteristics of a flying machine are the flying principle and propulsion mode [1]. The manoeuvrability and stability of quadrotor crafts are advantageous even at a small scale. Interest has been shown in using quadrotor craft for video surveillance tasks with prototype craft currently in use by the
direction [3]. Thus, for the body to earth transformation, the following direction cosine matrix is considered as given in (5), where:
, , : roll, pitch, and yaw angles respectively; S=Sin,
C=Cos.
s ss c c ss c c s s c
Liverpool police [2]. These tasks range from taking
R
cs
c c
s
(5)
footage of sporting events to surveying infrastructure with limited access for maintenance purposes.
This paper is organized as follows:
Section 2 gives a brief description of the quadrotor and represents its mathematical model. The quadrotor assembly and the experimental results to find out the system parameters are described in section 3. Section 4 introduces the PID controller design. The ANFIS based controller design is described in section 5. Comparison between the two different controllers is held in section
6. Finally, conclusion is introduced is section7.

Quadrotor system model
The basic quadrotor has a symmetrical design. It consists of four complete rotors attached at equal distance from the central hub. All the rotors are located
within the same plane and oriented to generate thrust
zxy
c s s s c c sc s s c c
The development of a suitable attitude controller for the quadrotor prototype required an accurate dynamic model to be developed. A Newtonian modelling method was chosen to define the quadrotor dynamics for control purposes. The Newtonian method is the most popular choice for modelling rigid bodies in six degrees of freedom and has been used extensively for the modelling of traditional helicopters [4][5]. As a result, the Newtonian based equations used to represent a rigid body in six degrees of freedom are well defined and can be found in many texts [5][6][7]. The dynamics of a rigid body under external forces applied to the centre of mass and expressed in the body fixed frame are in NewtonEuler formalism given in (6) [8]:
mvb b mvb Fb
and torque. Each rotor of the quadrotor helicopter produces both thrust and torque. Given that the front
I b b Ib b
(6)
and rear motors both rotate counterclockwise (make clockwise torque) and the other two rotate clockwise to balance the total torque of the system. The quadrotor is
controlled by separately adjusting the speed of the four
Let us consider an earthfixed frame E and a body
fixed frame B as seen in Figure 2. Using Euler angles parameterization, the airframe orientation in space is given by a rotation R from B to E, where RSO3 is the
rotors. Let i
and i
be the thrust and torque for
ith
rotation matrix. The frame system (Figure 2) is in
rotor respectively, where i = 1,2,3,4. These values are normalized with the moment of inertia and the mass, respectively. Denoting the distance of the rotor from
conformity with the N, E, D (North, East, Down) standard.
the centre of mass by l, a set of four control inputs ui
can be introduced as function of normalized individual thrusts and torques as in the following equations. The total thrust, the rolling moment, the pitching moment, and the yawing moment are given in (1), (2), (3), and
(4) respectively.
u1 1 2 3 4
u2 l(3 4 )
(1)
(2)
Figure 2: Quadrotor configuration, frame
u l( )
system with a body fixed frame B and the
3 1 2
u4 1 2 3 4
(3)
(4)
inertial frame E.
The equations can be summarised in (7) where:
The way of modelling the quadrotor differs from the one used for fixed wing vehicle in the fact that the rotational transformations are not made in the same order to go from the earth to body axes. Indeed, the most practical way is to carry out the final rotation of the earth to body transformation along the thrust
, , : roll, pitch, and yaw angles respectively;
Ixx , I yy , Izz : body moment of inertia;
r : rotor speed;
Jr : rotor moment of inertia.
4 i 1 4
control signal cable from Arduino Mega 2560 is
I xx I yy I zz J rr l T 2 T 4 h H yi 1
Rmxi
assigned to each one of the speed controllers. A
i 1
4
i 1 4
i 1
lithium polymer high discharge rate battery is acting as
I yy I zz I xx J rr l T1 T3 h H xi 1
Rmyi
a DC power supply to the craft. Flight control
i 1
i 4
i 1
directions and commands coming from handheld RC
I zz I xx I yy J r r 1 Qi l H x 2 H x 4 l H y 1 H y 3
i 1
4
transmitter are bypassed to the flight controller via a directly attached receiver module.
mz mg cc Ti
i 1
4 4
The speed controllers utilized were constructed based upon a fan controller circuit [9]. An opamp
mx c sc s s Ti H xi 1 C x Ac x x
i 1
4 4
4 4
2
i 1
based triangular oscillator is set to produce a wave
2
2
my s sc c s Ti H yi 1 C y Ac y y
between 0 and 5V. This wave is compared with the
output of the Arduino Mega 2560 to produce a Pulse
i 1 i 1
(7)
Width Modulated (PWM) signal of controllable duty cycle. This PWM signal is then used to drive the motor.

Quadrotor assembly and parameters calculations
The actual prototype is assembled as shown in Figure 3. It consists of two sets of counterrotating blades driven by Brushless DC motors. Arduino Mega 2560 module was chosen as the hardware controller. Arduino IDE was used to program the Arduino Mega 2560 module with the control laws. Directional cosine matrix is implemented in this environment to observe the craft attitude. Arduino IDE software was also able to configure the required inputs and outputs of the system.
Figure 3: The complete quadrotor assembly.
To reduce system wiring and sensor alignments a custom designed Arduino Mega 2560 module is fixed at the centre of the craft. Arduino Mega 2560 module contains nine degree of freedom IMU chip with tri axial accelerometer, triaxial gyroscopes, and triaxial
The IMU system is an Ienvensense MPU 6000 chip containing a digital motion processor and uses I2C serial bus.
A major challenge of the current quadrotor prototype is the motor control system. The motor controllers are not linear across the entire range of operation and caused erroneous motor speeds. The dynamic response of the motors also has a large impact on the controllability of the system. This has been proven by dealing as in system identification to identify experimentally the relation between the input and the output of the black box system. The Motor driving circuit (Electronic Speed Controller), the motor, and the rotors are considered as a black box in this case. The input to this black box is voltage to the motor driving circuit and the output is the thrust produced out of the rotor. It was found experimentally that the relation between the input voltage to the motor driving circuit and the motor output speed measured in Revolution Per Minute (RPM) is linear with time delay involved. The relation between the motor speed and the thrust is deduced through a flight test. The procedure of flight test in this paper is typically started by taking the Remote Controller to a hovering condition after taking off gradually and measure experimentally the relation between the thrust force and the motor speed in RPM. The experimental set up can be seen in Figure 4. From the experiment, the relation between the thrust and the motor speed in RPM is obtained as in Figure 5. The quadratic approximation used is shown also in the same figure.
The total thrust force imparted on the body attached frame can be defined mathematically from the experimental results to be as in (8), where:
T: is the total thrust of the quadrotor, Fi: is the force produced by rotor i, i: is the motor speed in RPM.
magnetometer. DC power cables are running from a
T 4 F b4 2
(8)
power distribution board to each one of the four speed controllers that attached to the four brushless motors. A
i1 i
i1 i
where
KP is proportional gain, KI
is integral gain,
KD is derivative gain, and e(t) is the difference
between the desired value and the actual controlled variable value. The quadrotor controller will be targeted at forcing the attitude angles to desired set points. As a result e(t) can be defined as in (10).
eRoll (t) set point measured roll
ePitch
(t) set point measured Pitch
(10)
Figure 4: Motor test setup for thrust calculation.
Experimental data Approximate quadratic 
Experimental data Approximate quadratic 
16
14
12
eYaw (t) set point measured yaw
The proportional component of the controller can be implemented once e(t) is defined. The integral and derivative components are normally need more computations. By utilizing the craft angular velocity estimate the derivative control component can be simply and efficiently calculated. The craft angular velocity can be considered to be the derivative of the attitude angle measurement and the control set point can be considered as a constant value. This can be described in (11).
Thrust [N]
Thrust [N]
10 de(t)
d (set pointAttitudeangle)
8
8
dt dt
d
6 dt
(Const.) craft angular velocity
(11)
4
2
0
2000 3000 4000 5000 6000 7000 8000
RPM
Figure 5: Experimental and approximate relations between thrust and motor speed.
4. PID controller design
A PID controller is selected to provide attitude control of the quadrotor craft. The implementation of the controller deviated from normal PID controller implementation due to the feedback information available.
Proportional compensation was provided for the Euler based attitude estimate with a derivative term being used to provide compensation for the angular velocities. The use of the actual angles of roll, pitch and yaw as feedback into the controller allowed for attitude set points to be used to enable the craft to be manoeuvred.
As the angular velocity of the craft is calculated using onboard gyroscopes the derivative term of the controller is available in realtime and does not have to be calculated based on previous attitude samples. This changes the traditional PID controller implementation slightly. For the traditional implementation the output of the controller y(t) can be defined as in (9).
craft angular velocity
A PID controller is designed for each channel of the system. As the four channels are coupled, the tuning of the four PID controller parameters need to be optimized. The optimization algorithm should minimize the coupling effect and the error signal between the desired and actual measured values in each channel.
Simplex algorithm is used at extreme condition of flight as a fast optimizer. The extreme conditions were

rad for roll, pitch, and yaw angles at 2m altitude. PID control parameters obtained from simplex fast algorithm is used as initial acceptable parameters for genetic algorithm. Fine tuning of PID parameters is obtained using gnetic algorithm. The PID parameters obtained, using genetic algorithm, are used to study the robustness of the PID controller at different operating points.
The Quadrotor Prototype was able to achieve stable flight under the influence of the Arduino Mega 2560 controller. The prototype was also able to maintain desired angles of pitch and roll under different conditions. The results obtained from the flight experiments show that the designed PID controller is capable of controlling the prototype quadrotor aircraft both for level and attitude setpoints.
t
y(t) KPe(t) KI e( )d KD
0
de(t)
dt
(9)
5. Adaptive Neurofuzzy Inference System (ANFIS) based controller
The architecture and learning procedure underlying ANFIS implemented in the framework of adaptive networks. By using a hybrid learning procedure, the proposed ANFIS can construct an inputoutput mapping based on both human knowledge in the form of fuzzy ifthen rules, and inputoutput data pairs. In the simulation, the ANFIS architecture is employed to model nonlinear functions, identify nonlinear components online in a control system, and predict a chaotic time series, all yielding remarkable results [10].
In this paper, as the system is nonlinear ANFIS can be used as a nonlinear controller. The input output data of the PID controlled system at different operating points are used as training and checking data sets for ANFIS. Half of these data are used as a training data and the other half as a checking data. Training the FIS is started using hybrid optimization method after generating the initial FIS structure. In the case studied, a sixty training Epochs with zero tolerance error are used in the system training. Validation of the model obtained is performed then the generated FIS is successfully used as a controller of the system in the Simulink model.
The ANFIS model structure is the same in all channels and can be seen in Figure 6. The surface viewer of the FIS that relates the inputs and the output of roll, pitch, yaw, and altitude channels can be seen in Figure 7, 8, 9, 10 respectively.
The checking data and the FIS output can be seen for roll, pitch, yaw, and altitude channels in Figure 11, 12, 13, 14 respectively. These figures show the validation of the ANFIS based controller. The two groups of data in each figure are approximately identical. This confirms acceptable controller design.
Figure 6: The ANFIS model structure for all channels
Figure 7: The FIS surface viewer of the roll channel
Figure 8: The FIS surface viewer of the pitch channel
Figure 9: The FIS surface viewer of the yaw channel
Figure 10: The FIS surface viewer of the altitude channel
Figure 11: Checking data and FIS output for the roll channel
Figure 12: Checking data and FIS output for the pitch channel
Figure 13: Checking data and FIS output for the yaw channel
because of the feedback noise and motors time delay/response time. Figure 15, 16, 17, 18 show the output response using both controllers in each channel. In these figures, roll, pitch, and yaw of the system are set initially to 0.3 rad each. The altitude is set initially to 2 m. It is required in this experiment to maintain the same altitude (2 m) and change the roll, pitch, and yaw angles to zero rad (from 0.3 rad).
The simulation results show a stable flight is achieved for both controllers although this manoeuvre is severe. The two controllers show approximately identical output responses in roll, pitch, and yaw angles. The altitude output responses in Figure 18 are slightly different. The overshoot in case of ANFIS is better than the PID. Also, the steady state error in case of ANFIS is zero, while the steady state error in case of PID controller in not zero.
From robust stability point of view, the two controllers are robust. From robust performance point of view, ANFIS is better than the PID controller.
ANFIS
PID
ANFIS
PID
0.3
0.25
Roll [rad]
Roll [rad]
0.2
0.15
0.1
0.05
0
0.05
0 5 10 15 20 25
Time [s]
Figure 15: Output responses of ANFIS and PID for the roll channel
Figure 14: Checking data and FIS output for the altitude channel
0.35
0.3
0.25
Pitch [rad]
Pitch [rad]
0.2
0.15
0.1
ANFIS
PID

Comparison between the PID and ANFIS controllers
The theoretical model of the quadrotor does not include all the motor dynamics, the mechanical frictions, and the aerodynamics of the rotors. Therefore the controller which is designed virtually by employing the mathematical model of the system using Simulink and Matlab cannot be applied on the experimental setup directly in order to achieve a robust and successful implementation of the control on the real system.
Experimental works have shown that a controller with slower responses is better than a faster one
0.05
0
0.05
0.1
0 5 10 15 20 25
Time [s]
Figure 16: Output responses of ANFIS and PID for the pitch channel
0.035
0.04
8.5 9 9.5 10 10.5 11 11.5
ANFIS PID
0.045
0.05
0.055
0.06
0.065
0.07
0.075
0.035
0.04
8.5 9 9.5 10 10.5 11 11.5
ANFIS PID
0.045
0.05
0.055
0.06
0.065
0.07
0.075
0.3
0.25
0.2
Yaw [rad]
Yaw [rad]
0.15
It should be mentioned that PID controller design is easier than that of ANFIS. Also, the inputoutput data of the PID controlled system are used as learning and checking data for the ANFIS design.
0.1
0.05
0
0.05
0.1
0 5 10
Time [s]
15 20 25
References

M. Achtelik, A. Bachrach, R. He, S. Prentice and N. Roy, Autonomous Navigation and Exploration of a Quadrotor Helicopter in GPSdenied Indoor Environments, first symposium on indoor flight
Figure 17 Output responses of ANFIS and PID for the yaw channel
issues, Puerto Rico, July 2009.

Liverpool Police get mini Black Helcopter, http://www.theregister.co.uk
2.1
2.08
Altitute [m]
Altitute [m]
2.06
2.04
2.02
2
1.98
1.96
/2007/05/21/black_helicopters_over_merseyside, June 2007
ANFIS
PID
ANFIS
PID

C. Eck, Navigation Algorithms with Applications to Unmanned Helicopters, Doctor of technical science thesis, Swiss federal institute of technology, Zurich 2001.

H. Bang, J. Lee, and Y. Eun, Nonlinear Attitude Control for a Rigid Spacecraft by Feedback Linearization, KSME International Journal, Vol, 18,
0 5 10 15 20 25
Time [s]
Figure 18 Output responses of ANFIS and PID for the altitude channel


Conclusion
PID and ANFIS controllers were designed for a quadrotor aircraft in this paper.
PID controller was designed first for the quadrotor as a nonlinear system. The robustness of the controller is studied at different operating points.
The PID controller is implemented on the quadrotor Model. Using the Arduino Mega 2560 controller, the quadrotor was able to achieve stable flight. The IMU sensor could be directly connected to the onboard microcontroller. The results obtained from the flight experiments show that the designed PID controller is capable of controlling the prototype quadrotor aircraft both for level and attitude setpoints.
The inputoutput data of the PID controlled system are used as learning and checking data for the ANFIS design. The results obtained using ANFIS, as a nonlinear controller, are compared with the PID controller results. The simulation results show a stable flight is achieved for both controllers. The two controllers show approximately identical output responses in roll, pitch, and yaw angles. They also show a better performance in case of ANFIS controller over PID controller when dealing with altitude channel. From robust stability point of view, the two controllers are robust. From robust performance point
of view, ANFIS is better than the PID controller.
no. 2, pp. 203210, 2004.

T. Hamel, R. Mahony, R. Lozano, and J. Ostrowski, Dynamic Modelling and Configuration Stabilization for an X4Flyer, 15th triennial world congress of the IFAC, Barcelona, Spain, July 2002

S. McGilvray, Attitude Stabilization of a Quadrotor Aircraft, Master's Thesis, Lakehead University, Canada, 2004.

A. Tayebi, and S. McGilvray, Attitude Stabilization of a VTOL Quadrotor Aircraft, IEEE transaction on control systems technology, Vol 14, no 3, pp. 562571, May 2006.

R. M. Murray, Z. Li, and S. Shankar, A Mathematical Introduction to Robotic Manipulation, CRC press, March 1994.

Cook, F 1999, PWM DC Motor Speed Controlle, http://www.technick.net/public
/code/cp_dpage.php?aiocp_dp=cir_solorb_pwm1, 2007.

H. T. Nguyen, N. R. Prasad, C. L. Walker, and E.

A. Walker, A First course in Fuzzy and Neural Control, CRC press, 2003.