Development of a Model based Fuzzy-PID Controller for the AeroQuad Cyclone Quad-copter

8
American Institute of Aeronautics and Astronautics 1 Development of a Model based Fuzzy-PID Controller for the AeroQuad Cyclone Quad-copter Wei Wei 1 and Kelly Cohen 2 University of Cincinnati, Cincinnati, Ohio 45221 Over the years multi-rotor aircraft have been chosen as a viable configuration for small- scaled VTOL UAVs in the form of quad-copters, hexa-copters and octo-copters. Multi-rotor airframes require a simpler feedback control system and fewer mechanical parts. These characteristics make these UAV platforms, especially quad-copters, a rugged and competitive candidate for many applications in both military and civil areas. In this effort a fuzzy-PID controller was developed to control a quad-copter model extracted from flight testing data using system identification method. Characteristics of the new system with fuzzy-PID controller were analyzed and compared to that with classic PID controller. Results show that the fuzzy-PID controller has better stability and robustness performance when compared to the classic PID controller. Nomenclature = roll angular velocity = pitch angular velocity = yaw angular velocity = lateral axis input = longitudinal axis input = lateral pilot input = directional axis input โ„Ž = vertical axis input = pitch angle = roll angle = yaw angle I. Introduction HE research interest in unmanned aerial vehicles (UAVs) has dramatically increased in recent years. The applications of UAVs used to be limited to military uses. In the past decade, there is a growing market for civilian UAVs in a wide spectrum of areas such as surveillance, agriculture, disaster management, film making, sports coverage and training, mapping, weather determination, and many others. 1 For small-scale UAV applications, multi-rotor systems, especially quad-copters have been the most popular configuration. Compared to single main rotor helicopters, quad-copters require a simpler feedback control system and fewer mechanical parts. These characteristics make quad-copter a competitive candidate for many applications in both military and civil areas. All controller development of dynamic systems will be based on mathematic model of the system in a simulation environment. One traditional method is to analyze the aerodynamic, inertial, and structural characteristics of an aircraft or rotorcraft to predict a dynamic model. This preliminary model is then simulated and compared with flight testing data. It is always necessary to fine-tune the model based on the comparison results. For small-scale rotorcraft configurations, this method is not very effective due to their complex coupled aerodynamic forces and high vulnerability to turbulences. In this paper, the dynamic model of the quad-copter was extracted from flight testing data 1 Graduate Student, Department of Aerospace Engineering and Engineering Mechanics, Student Member AIAA. 2 Professor, Department of Aerospace Engineering and Engineering Mechanics, Associate Fellow AIAA. T Downloaded by Kelly Cohen on January 9, 2015 | http://arc.aiaa.org | DOI: 10.2514/6.2015-2029 AIAA Infotech @ Aerospace 5-9 January 2015, Kissimmee, Florida AIAA 2015-2029 Copyright ยฉ 2015 by Wei Wei, Kelly Cohen. Published by the American Institute of Aeronautics and Astronautics, Inc., with permission. AIAA SciTech

Transcript of Development of a Model based Fuzzy-PID Controller for the AeroQuad Cyclone Quad-copter

American Institute of Aeronautics and Astronautics

1

Development of a Model based Fuzzy-PID Controller for the

AeroQuad Cyclone Quad-copter

Wei Wei1 and Kelly Cohen2

University of Cincinnati, Cincinnati, Ohio 45221

Over the years multi-rotor aircraft have been chosen as a viable configuration for small-

scaled VTOL UAVs in the form of quad-copters, hexa-copters and octo-copters. Multi-rotor

airframes require a simpler feedback control system and fewer mechanical parts. These

characteristics make these UAV platforms, especially quad-copters, a rugged and competitive

candidate for many applications in both military and civil areas. In this effort a fuzzy-PID

controller was developed to control a quad-copter model extracted from flight testing data

using system identification method. Characteristics of the new system with fuzzy-PID

controller were analyzed and compared to that with classic PID controller. Results show that

the fuzzy-PID controller has better stability and robustness performance when compared to

the classic PID controller.

Nomenclature

๐‘ = roll angular velocity

๐‘ž = pitch angular velocity

๐‘Ÿ = yaw angular velocity

๐›ฟ๐‘Ž๐‘–๐‘™ = lateral axis input

๐›ฟ๐‘’๐‘™๐‘’ = longitudinal axis input

๐›ฟ๐‘™๐‘Ž๐‘ก = lateral pilot input

๐›ฟ๐‘Ÿ๐‘ข๐‘‘ = directional axis input

๐›ฟ๐‘กโ„Ž๐‘Ÿ = vertical axis input

๐œƒ = pitch angle

๐œ™ = roll angle

๐œ“ = yaw angle

I. Introduction

HE research interest in unmanned aerial vehicles (UAVs) has dramatically increased in recent years. The

applications of UAVs used to be limited to military uses. In the past decade, there is a growing market for civilian

UAVs in a wide spectrum of areas such as surveillance, agriculture, disaster management, film making, sports

coverage and training, mapping, weather determination, and many others.1

For small-scale UAV applications, multi-rotor systems, especially quad-copters have been the most popular

configuration. Compared to single main rotor helicopters, quad-copters require a simpler feedback control system and

fewer mechanical parts. These characteristics make quad-copter a competitive candidate for many applications in both

military and civil areas.

All controller development of dynamic systems will be based on mathematic model of the system in a simulation

environment. One traditional method is to analyze the aerodynamic, inertial, and structural characteristics of an aircraft

or rotorcraft to predict a dynamic model. This preliminary model is then simulated and compared with flight testing

data. It is always necessary to fine-tune the model based on the comparison results. For small-scale rotorcraft

configurations, this method is not very effective due to their complex coupled aerodynamic forces and high

vulnerability to turbulences. In this paper, the dynamic model of the quad-copter was extracted from flight testing data

1 Graduate Student, Department of Aerospace Engineering and Engineering Mechanics, Student Member AIAA. 2 Professor, Department of Aerospace Engineering and Engineering Mechanics, Associate Fellow AIAA.

T Dow

nloa

ded

by K

elly

Coh

en o

n Ja

nuar

y 9,

201

5 | h

ttp://

arc.

aiaa

.org

| D

OI:

10.

2514

/6.2

015-

2029

AIAA Infotech @ Aerospace

5-9 January 2015, Kissimmee, Florida

AIAA 2015-2029

Copyright ยฉ 2015 by Wei Wei, Kelly Cohen. Published by the American Institute of Aeronautics and Astronautics, Inc., with permission.

AIAA SciTech

American Institute of Aeronautics and Astronautics

2

using system identification method. The model was verified with flight data not used in the system identification

process.

A variety of control techniques have been applied to quad-copter configuration. The most popular controller used

for quad-copter is the classic PID controller.2,3 Other methods including integral sliding mode and reinforcement

learning,4 backstepping controllers,5 and neural network6 were also explored.

In this paper, a fuzzy-PID controller was developed based on the quad-copter dynamic model obtained using

system identification, for stabilization of the lateral and longitudinal axes. A fuzzy-PID controller is a hybrid of fuzzy

logic and classic PID controller. Fuzzy logic control is an intelligent control that emulates humanlike approximate

reasoning and decision making by utilizing fuzzy sets and rule reference. In a fuzzy-PID controller, the gains are tuned

by a fuzzy controller. Characteristics of the legacy classic PID and fuzzy-PID controller are also analyzed and

compared.

II. Quad-copter Dynamic Modeling

A. Hardware

An AeroQuad Cyclone quad-copter was selected as the platform for the quad-copter dynamics modeling. (Fig. 1)

It features an aluminum frame with four APC 12ร—3.8 propellers powered by 950KV motors. The onboard sensors

include an ITG-3200 gyro, ADXL345 accelerometer, HMC5883L magnetometer, BMP085 barometer, and

MaxSonars EZ0 ultrasonic sensor. The main controller is an ATmega 2560 Arduinoโ„ข-based computing platform. A

pair of Digiยฎ XBee-PRO 900MHz modules was utilized for telemetry. The flight data was transmitted at 40 Hz and

was collected through MATLAB on a ground station computer.

Because a quad-copter configuration is inherently unstable in the lateral and longitudinal axes, a classic PID

controller was applied so that it could be easily piloted during flight-testing. PID gains were tuned such that good

handling qualities of the quad-copter was achieved.

The quad-copter control structure is depicted in Fig. 2. For the bare-airframe modeling, axis commands (๐›ฟ๐‘Ž๐‘–๐‘™, ๐›ฟ๐‘’๐‘™๐‘’,

๐›ฟ๐‘Ÿ๐‘ข๐‘‘, and ๐›ฟ๐‘กโ„Ž๐‘Ÿ) and vehicle response, including Euler angles (๐œƒ, ๐œ™, ๐œ“), angular rates (p, q, r), and linear accelerations

(๐‘Ž๐‘ฅ, ๐‘Ž๐‘ฆ, ๐‘Ž๐‘ง), are recorded.

Figure 1. AeroQuad Cyclone quad-copter in flight.

Figure 2. Quad-copter control structure.

Dow

nloa

ded

by K

elly

Coh

en o

n Ja

nuar

y 9,

201

5 | h

ttp://

arc.

aiaa

.org

| D

OI:

10.

2514

/6.2

015-

2029

American Institute of Aeronautics and Astronautics

3

B. System Identification

The software package Comprehensive Identification from FrEquency Response (CIFERยฎ) was utilized to acquire

dynamic model of the quad-copter airframe. CIFERยฎ has been successfully implemented and applied in the system

identification of commercial and military aircraft and rotorcraft configurations, including the XV-15, Bell-214ST,

BO-105, AH-64, UH-60, V-22, AV-8 Harrier, and OH-58D.7

System identification in CIFERยฎ is conducted in frequency-domain. Therefore, a series of frequency sweep inputs

are used to excite the quad-copter system, and all flight data was collected. For the flight testing, the pilot starts with

about five seconds in trimmed hover condition, the axis of interest is then excited in a periodic motion starting at a

low frequency. The frequency of the disturbance gently increases until it reaches a pre-defined maximum, driven by

the instrumentation or vehicle limits. After the sweep ends, the quad-copter returns to hover conditions for another

five seconds before data collection is finished. Figure 3 shows concatenated time history of two lateral axis frequency

sweep inputs.

In previous work, the closed-loop model was identified to set up a baseline for controller design.8 The same

approach was used to obtain the quad-copter bare-airframe model. However, instead of transfer function model, a

state-space model structure was used so that coupled dynamics between different states can be identified.

Figure 4 displays the bare-airframe lateral frequency response from both flight data (solid line) and extracted model

(dash line.). It can be seen that the extracted model accurately predicts the response of the quad-copter lateral

dynamics, outlined by the solid line. This indicates that the dynamics is accurately modeled with high confidence.

Notice the very high coherence indicating excellent signal-to-noise and a very linear system.7 The magnitude peak at

Figure 4. Bare-airframe lateral frequency response.

Figure 3. Lateral axis frequency sweep time history.

Dow

nloa

ded

by K

elly

Coh

en o

n Ja

nuar

y 9,

201

5 | h

ttp://

arc.

aiaa

.org

| D

OI:

10.

2514

/6.2

015-

2029

American Institute of Aeronautics and Astronautics

4

about 3 rad/s corresponds to the bare-airframe short-period response also referred to as the โ€œhovering cubic,โ€ which

is unstable as seen by the increasing phase curve near this mode.9

The extracted models were verified in the time-domain with flight data collected during flight testing. Data used

for verification was not used in the system identification process get dynamic model. The measured inputs and initial

conditions were feed into the models, which then predicted the outputs on each axis of interest. The simulation outputs

were then compared with the outputs gathered during flight testing.

Results of lateral axis verification is shown in Fig. 5. The top plot is the input, followed by linear acceleration ๐‘Ž๐‘ฆ,

angular rate p, Euler angle ๐œ™, and lienar velocity ๐‘ฃ. The flight data is shown in solid line, and model output is in

dashed line. It can be seen the flight data and model output agrees very well. These results show that an accurate

dynamic model of a bare-airframe quad-copter system was successfully extracted using system identification, thereby

decreasing modeling time and complexity when compared to traditional modeling techniques based on first principles.

C. Identified Model

The identified state-space model is presented in Eq. (1).9 Due to the unique symmetrical configuration of the quad-

copter, the identified lateral and longitudinal axes model parameters are very similar. Moreover, the attitude stabilize

controller actually have the same structure and gains for both axes. Therefore, the controller development focuses on

the lateral axis and the same controller will be used in the longitudinal axis. It is also interesting that unlike a

conventional flapping rotor helicopter, it has no rotor damping (๐ฟ๐‘ and ๐‘€๐‘ž). This is because the small rotor area

compared to single main rotor helicopters.

Figure 5. Time-domain verification of lateral axis model.

Dow

nloa

ded

by K

elly

Coh

en o

n Ja

nuar

y 9,

201

5 | h

ttp://

arc.

aiaa

.org

| D

OI:

10.

2514

/6.2

015-

2029

American Institute of Aeronautics and Astronautics

5

[ ๏ฟฝฬ‡๏ฟฝ๏ฟฝฬ‡๏ฟฝ๏ฟฝฬ‡๏ฟฝ๏ฟฝฬ‡๏ฟฝ๏ฟฝฬ‡๏ฟฝ๏ฟฝฬ‡๏ฟฝ๏ฟฝฬ‡๏ฟฝ

๏ฟฝฬ‡๏ฟฝ๏ฟฝฬ‡๏ฟฝ]

=

[ โˆ’0.0429 0 0 0 0 0 0 โˆ’๐‘” 0

0 โˆ’0.0429 0 0 0 0 ๐‘” 0 00 0 0 0 0 0 0 0 00 โˆ’0.4376 0 0 0 0 0 0 0

0.5241 0 0 0 0 0 0 0 00 0 0 0 0 โˆ’0.5231 0 0 00 0 0 1 0 0 0 0 00 0 0 0 1 0 0 0 00 0 0 0 0 1 0 0 0]

[ ๐‘ข๐‘ฃ๐‘ค๐‘๐‘ž๐‘Ÿ๐œ™๐œƒ๐œ“]

+

[

0 0 0.2269 00 โˆ’0.2016 0 0

โˆ’0.7414 0 0 00 0.7066 0 00 0 0.6662 00 0 0 0.13060 0 0 00 0 0 00 0 0 0 ]

[

๐›ฟ๐‘กโ„Ž๐‘Ÿ

๐›ฟ๐‘Ž๐‘–๐‘™

๐›ฟ๐‘’๐‘™๐‘’

๐›ฟ๐‘Ÿ๐‘ข๐‘‘

]

(1)

III. Fuzzy-PID Controller Design

The flight testing of the quad-copter was based on a hand-tuned classic PID controller. Before the fuzzy-PID

controller development, the quad-copter with classic PID controller was firstly analyzed so that a baseline was set up

for comparison. As stated before, the lateral and longitudinal axes have similar dynamics and same controller layout.

So the attitude stabilize controller design focuses on the lateral axis.

The quad-copter classic PID controller layout is shown in Fig. 6. It features a dual-PID controller structure. The

attitude PID controller takes in the error of expected roll angle ๐›ฟ๐‘™๐‘Ž๐‘ก and actual roll angle ๐œ™. The proportional and

integral channel of rate PID takes in the error of the attitude PIDโ€™s output and the actual roll rate ๐‘, while the derivative

channel takes roll rate ๐‘ directly. This is to avoid sudden controller output spike due to pilot inputs.

Analysis of the handling quality with legacy classic PID controller shows that it has very high bandwidth (10.97

rad/s), which ensures response speed. But the price is very low stability margins (1.93 dB of gain margin, 11.93

degrees of phase margin), and low damping ratio (0.18). These are signs of the system very close to an unstable

condition and measures need to be taken to better meet these criteria.

A fuzzy-PID controller was built for the quad-copter lateral axis model. Fuzzy reference systems were developed

to tune individual gains in the dual-PID controller. Because the att_D has the same effect as rt_P, and rt_I as att_P, so

both ๐พ๐‘Ž๐‘ก๐‘ก_๐ท and ๐พ๐‘Ÿ๐‘ก_๐ผ are set to 0. The derivative channel of rate PID rt_D is only takes roll rate ๐‘ as input, and lateral

input ๐›ฟ๐‘™๐‘Ž๐‘ก has no effect on this channel at all. So this gain ๐พ๐‘Ÿ๐‘ก_๐ท was not included in the fuzzy tuning system and was

left constant. Figure 7 shows the fuzzy-PID controller layout.

The integral gain of the attitude controller ๐พ๐‘Ž๐‘ก๐‘ก_๐ผ was tied to proportional gain ๐พ๐‘Ž๐‘ก๐‘ก_๐‘ƒ such that the ratio of ๐พ๐‘Ž๐‘ก๐‘ก_๐ผ

to ๐พ๐‘Ž๐‘ก๐‘ก_๐‘ƒis equal to 1/10 of the crossover frequency (about 10 rad/s). This ensures that integral effect does not degrade

phase margin, and also that integral effect is not too small to quickly recover steady state error. 10 So in this case, ๐พ๐‘Ž๐‘ก๐‘ก_๐ผ

and ๐พ๐‘Ž๐‘ก๐‘ก_๐‘ƒ use the same fuzzy controller for gain tuning.

Figure 6. Classic PID controller layout.

Dow

nloa

ded

by K

elly

Coh

en o

n Ja

nuar

y 9,

201

5 | h

ttp://

arc.

aiaa

.org

| D

OI:

10.

2514

/6.2

015-

2029

American Institute of Aeronautics and Astronautics

6

As initial step of the fuzzy logic controller building process, the membership functions for each input and output

were first established. A series of flight data with different maneuver magnitudes was examined, so that appropriate

ranges can be applied for each individual membership function. Experience show that simpler membership functions

(fewer fuzzy sets) really enhance response speed. So only three input fuzzy sets were used for inputs (Negative,

Positive, and Stable), and two were used for outputs (Small, Large). Membership functions for the attitude and rate

fuzzy-PID controller are depicted in Fig. 8. It can be seen that because the attitude gain has the most influence on the

overall response, the stable fuzzy set was built around a small region, and has large broad regions outside of stable.

This ensures a smooth reaction when the error is small, and also allows quick convergence from extreme angles to

stable state when the error is large.

As discussed earlier, by examining the legacy classic PID controller flight characteristics, it was decided the

stability margins of the current setup was too low, so both attitude and rate gains need to be limited. This was

considered when building the output membership functions as can be seen below in Fig. 8.

Generally, it will be a two input three output fuzzy reference system for a fuzzy-PID controller: error, error

derivative, and P, I, D gains. However, due to the dual-PID controller structure used in this case, three single input

single output fuzzy inference systems are used. This greatly relieves the computing requirement to the hardware, and

allows for less computing time.

The commonly use Mamdani fuzzy inference method was chosen for the fuzzy-PID system, and the rule bases for

each controller were very straight forward as shown in Table 1.

Figure 7. Fuzzy-PID controller layout.

a) attitude

b) rate

Figure 8. Membership function of fuzzy controller.

Dow

nloa

ded

by K

elly

Coh

en o

n Ja

nuar

y 9,

201

5 | h

ttp://

arc.

aiaa

.org

| D

OI:

10.

2514

/6.2

015-

2029

American Institute of Aeronautics and Astronautics

7

IV. Results

The quad-copter system with fuzzy-PID controller was tested in SIMULINKยฎ and flight characteristics are

analyzed and compared to legacy classic PID controller. The results are summarized in Table 2. It can be seen that

stability margins and damping ratio have been substantially improved, and these numbers falls into the โ€œsafe zoneโ€ of

a robust system. Bandwidth has decreased, but 6.69 rad/s still guarantees sufficient responsiveness to the pilot.

To get a more intuitive understanding of the difference, step responses of the system with legacy classic PID and

fuzzy-PID are shown respectively below in Fig. 9. It is clearly seen that the fuzzy-PID controller gets rid of the

oscillation associated with the legacy classic PID design.

Figure 9. Step response with different controllers.

Table 1. Rule bases.

Error Stable P N

attitude S L L

rate S L L

Table 2. Flight characteristics comparison.

Design Parameter Classic PID Fuzzy-PID Change

Gain Margin (dB) 1.93 4.78 147.67%

Phase Margin (deg) 11.93 47.14 295.14%

Bandwidth (rad/s) 10.97 6.69 -39.02%

Damping Ratio 0.18 0.27 50.00%

Time @ 0.1 Steady State (s) 0.2 0.21 5.00%

Time @ 0.9 Steady State (s) 0.36 0.41 13.89%

Rise Time (s) 0.16 0.19 18.75%

Natural Freq (rad/s) 11.227 8.65 -22.95%

Overshoot (%) 20.894 41.5 98.62%

Dow

nloa

ded

by K

elly

Coh

en o

n Ja

nuar

y 9,

201

5 | h

ttp://

arc.

aiaa

.org

| D

OI:

10.

2514

/6.2

015-

2029

American Institute of Aeronautics and Astronautics

8

V. Conclusions

A state-space model of a quad-copter system was developed using system identification techniques, and a fuzzy-

PID controller was developed based on this model to stabilize the lateral and longitudinal axes. Flight characteristics

of the system with legacy classic PID and fuzzy-PID controllers are provided. Results show that fuzzy-PID was able

to give more stability margins and damping with the price of slightly reduced bandwidth. It is worth mentioning that

fuzzy logic is not a โ€œmagic boxโ€ that gives ideal results autonomously, membership functions and fuzzy rules set up

needs priori knowledge of the system, as well as design requirements.

In future work, the fuzzy-PID controller will be compared with finely tuned classic-PID through comprehensive

flight testing, and handling quality of each controller will be analyzed. Furthermore, future work may include a more

sophisticated autonomous system for rule development and tuning of the membership functions using a genetic fuzzy

approach which had several successful applications in our lab.

Acknowledgments

The authors would like to thank Dr. Mark Tischler from AFDD, Ames Research Center for his valuable time and

advice on the system identification of the quad-copter system.

References

1โ€œUnmanned Aerial Vehicle (UAV) Market (2013 - 2018),โ€ PR Newswire, 19 Jun, 2013. 2Pounds, P., Mahony, R., and Corke, P., โ€œModelling and Control of a Large Quadrotor Robot,โ€ Control Engineering

Practice, Vol. 18, No. 7, 2010, pp. 691-699. 3Goel, R., Shah, S. M., Gupta, N. K., and Ananthkrishnan, N., โ€œModeling, Simulation and Flight Testing of an Autonomous

Quadrotor,โ€ IISc Centenary International Conference and Exhibition on Aerospace Engineering, Bangalore, India, 2009. 4Waslander, S. L., Hoffmann, G. M., Jang, J. S., and Tomlin, C. J., โ€œMulti-agent Quadrotor Testbed Control Design: Integral

Sliding Mode vs. Reinforcement Learning,โ€ IEEE/RSJ International Conference on Intelligent Robots and Systems, Edmonton,

Alberta, Canada, 2005. 5Madani, T., and Benallegue, A., โ€œBackstepping control for a quadrotor helicopter,โ€ IEEE/RSJ International Conference

on Intelligent Robots and Systems, Beijing, China, 2006. 6Nicol, C., Macnab, C. J. B., and Ramirez-Serrano, A., โ€œRobust Neural Network Control of a Quadrotor Helicopter,โ€

Canadian Conference on Electrical and Computer Engineering, Niagara Falls, Ontario, Canada, 2008. 7Tischler, M. B., and Remple, R. K., Aircraft and Rotorcraft System Identification: Engineering Methods with Flight-Test

Examples, 2nd ed., AIAA Education Series, AIAA, Reston, VA, 2012. 8Wei, W., Tischler, M. B., Schwartz, N., and Cohen, K., โ€œFrequency-Domain System Identification and Simulation of a

Quadrotor Controller,โ€ Proceedings of the AIAA Modeling and Simulation Technologies Conference, National Harbor, MD,

2014, pp. 1834โ€“1839. 9Wei, W., Tischler, M. B., Schwartz, N., and Cohen, K., โ€œSystem Identification and Controller Optimization of a Quadrotor

UAV,โ€ Proceedings of the American Helicopter Society 71th Annual Forum, Virginia Beach, VA, May 5-7, 2015. 10Anon, โ€œCONDUITยฎ Training Course,โ€ University Affiliated Research Center, Moffett Field, CA, 2009.

Dow

nloa

ded

by K

elly

Coh

en o

n Ja

nuar

y 9,

201

5 | h

ttp://

arc.

aiaa

.org

| D

OI:

10.

2514

/6.2

015-

2029