Abstract

The main goal of this research project is to enhance decision making of a controllerusing fuzzy logic to adapt to various dynamic changes in an environment. More specifically, it will allow the controller system to emulate human reasoning. This topic is related to the NAE Grand Challenge of Reverse Engineering the Brain. To accomplish this goal, an inverted pendulum model will be developed as a benchmark control platform. The model will be used to test and compare a Fuzzy Logic based PID controller with a conventional PID controller. The Fuzzy PID controller for the pendulum model will then be adapted to stabilize a multi-rotor aircraft. The particular advantage of using a Fuzzy system is that it streamlines the design process by simplifying if-then rules for action-reaction scenarios to a more general field. This would allow for a high level of controllability with minimal effort on the part of the human pilot, due to the inherit autonomy gained through enhanced performance in the dynamic environmental changes.

Table of Contents

Abstract…………………………………………………………………………………………………..2

  1. Introduction…………………………………………………………………………………………...4

1.1 Introduction to Multi-Rotor Control………………………………………………………..4

1.2 Introduction to Fuzzy Logic………………………………………………………………...4

1.3 Objective Goals……………………………………………………………………………..6

2. Inverted Pendulum Problem…………………………………………………………………………..6

2.1 Inverted Pendulum Model (IPM) Development…………………………………………….6

2.2 Creating a PID Controller…………………………………………………………………...7

2.3 Creating a Fuzzy PID Controller……………………………………………………………9

2.3.1 Pendulum Angle Fuzzy PID Inference System………………………………………11

2.3.2 Cart Position Fuzzy PID Inference System………………………………………….13

2.4 Performance Envelope Testing Constraints……………………………………………….14

2.5 Dual PID Performance Envelope…………………………………………………………..15

2.6 Dual Fuzzy PID Performance Envelope…………………………………………………...17

2.7 PID vs. Fuzzy PID ………………………………………………………………………….19

3. Dynamic Quad-Rotor Model…………………………………………………………………………20

3.1 Dynamic Quad-Rotor Model Overview……………………………………………………20

3.2 Dual Fuzzy PID Structure…………………………………………………………………..21

3.3 Single Fuzzy PID Structure…………………………………………………………………23

3.4 PID vs. Single Fuzzy PID Step Response………………………………………………….26

3.5 PID vs. Single Fuzzy PID Flight Data……………………………………………………..28

4. Discussion…………………………………………………………………………………………….29

5. Conclusions…………………………………………………………………………………………...32

6. Acknowledgements…………………………………………………………………………………...33

7. References…………………………………………………………………………………………….33

8. Nomenclature…………………………………………………………………………………………34

9. Appendicies...... 34

  1. Introduction

1.1Introduction to Multi-Rotor Control

The multi-rotor copter is a versatile flight platform growing ever more popular in many fields due to its low cost and utility. However, the multi-rotor aircraft is inherently unstable and extremely hard to control without an onboard stabilization process. Using a previously developed quad-rotor simulation, a Fuzzy PID controller was designed and tested. The flight mechanics of a quad-rotor are straightforward and relate directly to the principle rotational axes of pitch, role, and yaw of which can be considered independently. This will allow for a simple yet robust controller that can be easily adapted to more complex platforms, such as a hex-copter or octo-copter.

1.2Introduction to Fuzzy Logic

Conventional computer based intelligence systems typically entail very specific boolean logic principles in order to intelligently control a system. This boolean logic operates under the principle of highs or lows, through logic gates to create a reaction, thus they contain rigid if-then rule bases. Fuzzy logic is a different take on this type of control or intelligence system, which is based on a more human description of the world. Fuzzy logic uses if-then statements that use what are known as linguistic variables to describe system states. (Mendel 1995) These linguistic variables a are human descriptors of a situation such as, the room is very hot, or somewhat cold, versus the room is 75 or 10 degrees. This interpretation allows for a more generalized development of logical systems, utilizing a ramped mapping of inputs to outputs according to different functions, weights, and interpolation. The entire process of mapping the inputs to outputs occurs in what is known as a Fuzzy Inference System (FIS), which works by utilizing four basic components: fuzzification, the fuzzy rule base, fuzzy inference, and defuzzification, as depicted below. (Bih 2006)

Figure 1. Fuzzy Process Diagram.

  1. Fuzzification

This is the process of collecting crisp input data and evaluating it in relation to membership functions, where the amount of truth (or degree of membership) to each membership is analyzed (i.e. 1.77m might be 75% tall, and 25% not tall) – this is known as a fuzzy set. (Bih 2006)

  1. Fuzzy Rule Base

This process takes the newly developed fuzzy set and analyzes it across if-then rules where logical operators (AND, OR, NOT, etc.) can be used. All rules that have any membership (regardless of amount) that is greater than zero will be evaluated. (Bih 2006)

  1. Fuzzy Inference

Once the rules are evaluated, the resulting output is then mapped to the appropriate defuzzification membership functions, where it will be converted into crisp data (i.e. if temperature is hot, then cooling is activated). (Bih 2006)

  1. Defuzzification

Defuzzification takes the fuzzy output data from the inference portion, and weights the defuzzification membership functions according to the initial degree of membership for that type of response. There, the output can be chosen as a crisp value by evaluating the new weighted data in a variety of ways. Typically the centroid of the resulting, weighted defuzzification membership functions is used. (Bih 2006)

1.3Objective Goals

In order to accomplish the autonomous flight and stabilization of a multi-rotor aircraft, the following goals have been laid out:

  1. Perform a Literature review. (PID/ Fuzzy logic control systems, MATLAB Fuzzy Logic Toolbox)
  2. Model an inverted pendulum.
  3. Obtain or Create a PID controller to be used for the benchmark pendulum model.
  4. Create a Fuzzy PID controller for the pendulum model.
  5. Use the Fuzzy PID pendulum controller to develop a Fuzzy PID controller for a multi-rotor aircraft.
  6. Learn how to effectively compile a technical paper, poster and presentation.
  7. Develop team collaboration.
  8. Learn the basics behind technical research.
  1. Inverted Pendulum Problem

2.1Inverted Pendulum Model (IPM) Development

The first step in modeling most dynamic systems is to begin with the equations of motion that govern their behavior. From these equations, a model is developed using the Simulink toolbox in MATLAB. Equations (1) and (2) below describe the nonlinear system for an IPM with θ being the pendulum angle and x being the horizontal displacement of the cart. The equations describe a single input multiple outputs (SIMO) system that is normally unstable about a reference angle, θ = π radians counterclockwise from the negative y-axis. A force input will create an angle movement and a cart displacement as the reaction outputs.


Figure 2. Inverted Pendulum Diagram

(1)

(2)

2.2Creating a PID Controller

A PID controller works by evaluating the error present in the feedback from a system. More specifically, the controller evaluates three specific error terms; proportional, integral, and derivative. The proportional term is the current system error, the integral is the summation of the errors up to that point, and the derivative term refers to the rate of change of error. These three terms are then weighted based on the system constraints in order to provide the optimal control input. (Araki 2006) Multiplying each of the three terms by a gain results in the desired weights. This type of controller can be powerful in providing accurate and quick action responses when well-tuned. For this reason, the PID controller is the accepted convention for many feedback control systems and is the chosen benchmark for comparison with the Fuzzy PID controller.

The two primary structures for a PID controller are the parallel PID and the ideal PID. The parallel PID configuration splits the error signal into its proportional, integral, and derivative terms then simultaneously applies the gains to the three terms before summing them into a single output signal. On the other hand, the ideal PID applies the integral and derivative gains and sums them with the original error term. Once these three terms are summed together, the entire signal is multiplied by a proportional gain before feeding back into the system.

The graph in Figure 3 demonstrates the system’s response to a single step input using a single custom built ideal PID controller. The controller is accounting for the error in θ and tracking the cart velocity to match the needed force magnitude. However, the cart never returns to the reference position once the system reaches a steady state. Two reasons for this type of response are, the PID controller is only correcting the error between θ and its reference, and there is no consideration taken for the cart’s reference position. The cart will simply move to any position that makes θ steady. The addition of a second PID controller, that takes into account the error between current position and cart origin, remedied the condition.

Figure 3. Single PID Impulse Response

The introduction of a cart position PID controller in series after the pendulum PID controller improved the cart position response without significantly diminishing θ response. While this setup was a tremendous improvement over the single PID, it did not solve the problem of the cart settling position. Analysis of signal data throughout the dual PID system revealed that once θsettled to steady state the signal entering the cart position PID diminished to zero. With a near zero error signal entering the position PID, the controller could not output an error correction because there was no signal to amplify. It was being tricked into thinking the position was steady because the error input was close to zero. By relocating the position PID before the angle PID, the system would work to keep the pendulum stable while returning the cart to the reference position. This setup did not allow for the signal to diminish until both the cart and angle were stable. This became the final configuration for the PID control of the inverted pendulum model.

Figure 4. Dual PID Impulse Response

2.3Creating a Fuzzy PID Controller

Upon completing the PID controller, a Fuzzy Inference System (FIS) was developed to allow for the dynamic modification of the gains in a PID controller. The conventional PID is a set in stone method that is limited to constant gains that may or may not be ideal for each system condition. Dynamically modifying the PID gains allows for a greater performance envelope and additional resilience to noise and/or small system modifications. To create a Fuzzy PID controller, the generalized effects of each gain was researched, and thus fuzzy logic rules were developed to tailor these gains to their best value for a particular error range (or rate of change of error range). The table used for the generalized fuzzy rule base is listed below:

Table 1.Effects of the Independent Tuning of Each Gain Coefficient. (Ang, Chong, & Li, 2005)

Closed Loop Response / Rise Time / Overshoot / Settling Time / Steady-State Error / Stability
Increasing P / Decrease / Increase / Small Increase / Decrease / Degrade
Increasing I / Small Decrease / Increase / Increase / Large Decrease / Degrade
Increasing D / Small Decrease / Decrease / Decrease / Minor Change / Improve

Implementing fuzzy logic into the IPM controller system required two separate FISs. Each FIS was developed with different rule bases and membership functions that represented the appropriate reaction needed for the cart position and the pendulum angle. The goal was to allow for the necessary generality in the systems to modify gains (Proportional, Integral, and Derivative) based on current system conditions. This was done by taking the values of the tuned PID controller and allowing them to vary by ±10% according to the fuzzy rule base. The fuzzy rule base was optimized to obtain the best result given the current system state based on gain reactions in Table 1. Once the fuzzy rule base was completed the FIS was placed into the ideal PID controller prior to the gains. The architecture of the Fuzzy PID controller can be seen below in Figure 5.

Figure 5. Fuzzy PID (Ideal) Controller Architecture

Figure 5. Fuzzy PID controller architecture.

2.3.1Pendulum Angle Fuzzy PID Inference System

The pendulum angle (θ) was the sole input for this particular FIS, and allowed for a total range of input (universe of discourse) of -1.57 to 1.57 radians. This range was split between the five possible membership functions seen in Figure 6 which included overlap. The overlap between the memberships allowed a maximum of two function weights to be applied at any given point based on which rules were firing at the time of the calculation.

Figure 6.Pendulum Angle Input Fuzzy Logic Membership Function

Upon evaluation of the signal input through the FIS, the deffuzzification process entailed three output fuzzy sets to be converted to crisp values (the gains). Figure 7 depictsthe deffuzzification membership functions used in this process.

Figure 7. Pendulum Angle Output Proportional, Integral and Derivative Gain Membership Functions

The actual mapping of the input and output of any FIS is based on the fuzzy rule base. Large numbers of trials were run in conjunction with the general trends and rules from Table 1 to yield the final rule base. These results are shown in Tables 2& 3. It should also be noted that when creating the rule base in the inference process, all rules carried the exact same weight.

Table 2. Pendulum Angle Fuzzy Rule Base

Pendulum Angle Fuzzy Rule Base
Pendulum Angle Deviation
Large Positive / Small Positive / Stable / Small Negative / Large Negative
Proportional Gain / Large / Moderate / Moderate / Moderate / Large
Integral Gain / Small / Small / Moderate / Small / Small
Derivative Gain / Small / Small / Moderate / Small / Small

Table 3. Cart Position Fuzzy Rule Base

Cart Position Fuzzy Rule Base
Cart Position Deviation
Small Positive / Stable / Small Negative
Proportional Gain / Moderate / Moderate / Moderate
Integral Gain / Small / Large / Small
Derivative Gain / Small / Large / Small

2.3.2 Cart Position Fuzzy PID Inference System

Similar to the Fuzzy PID controller used for θ, the cart position FIS was configured in the exact same manner; taking a single input for cart position x,and setting the proportional, integral, and derivative gains according to a fuzzy rule base. The cart position input membership functions that were used can be seen below in Figure 8.

Figure 8. Cart Position Input Fuzzy Logic Membership Function


Figure 9. Cart Position Output Proportional, Integral and Derivative Gain Membership Functions

2.4Performance Envelope Testing Constraints

The performance envelope tests contained very specific constraints for which a MATLAB script was written to analyze the results of each simulation run. The simulations were set to run for a maximum of 50 seconds. A “stabilization” was defined as the time it takes the system to get within the determined “bounds” and stay within those “bounds” for the remainder of the simulation such that the time staying within the “bounds” was at least 20% of the simulation time. The “bounds” for the test were a half degree deviation and a half meter deviation (from the centered values). Additionally, the controller systems used were bounded for a maximum output correction to the IPM of ±5 units. It should be noted that, the constraints place on the position deviation were deliberately enlarged to allow for an emphasis on the pendulum angle stabilization.

2.5 Dual PID Performance Envelope

Once completed, extensive testing was conducted on the performance of the PID controller with the pendulum model. To form a performance envelope, it was decided to vary the initial conditions for both pendulum angle (θ) and cart position. Upon changing the initial conditions, the pendulum/cart system was evaluated for its performance in terms of settling time and whether or not the system settled within a desired threshold. To extensively test small increments to form a high resolution image of the envelope, a script was created to automatically run 50 data trials varying the initial position from -10 meters to 10 meters and 50 trials varying the pendulum’s initial angle deviation from –pi/2 radians to pi/2 radians, yielding a total of 2,500 trials. The results of the performance envelopes from this script are displayed below as a series of color maps denoting the actual stabilization time of each degree of freedom within the system.

Figure 10. PID Performance Envelope (No Noise)

After the initial envelope test of the PID control (Figure 10), an additional test was conducted to simulate harsh sensor noise in a real world system (Figure 11). The chosen value for the sensor noise was a ±10% deviation from the input signal for both the position and the angle measurements coming out of the pendulum model itself and going into the respective PID controllers. This is a drastic case of noise, but it describes how the system behaves (and breaks down) given large amounts of noise.

Figure 11. PID Performance Envelope (Sensor Noise)