Sunteți pe pagina 1din 6

Proceedings of the 2010 IEEE International Conference on Information and Automation June 20 - 23, Harbin, China

A Novel Bacterial Foraging Algorithm for Automated tuning of PID controllers of UAVs
John Oyekan and Huosheng Hu School of Computer Science and Electronic Engineering University of Essex, Wivenhoe Park, Colchester CO3 4SQ, United Kingdom Email: jooyek@essex.ac.uk; hhu@essex.ac.uk

AbstractUp to now, PID controllers have been widely deployed in Unmanned Aerial Vehicles (UAVs) and other automatical control systems, and have the benet of simple tuning performed by trial and error. Their applications avoid some complicated modeling efforts however tuning these controllers do need experienced operators and may sometimes be time consuming. This paper presents a novel approach that could be used for the automatic tuning of a PID controller for a UAV. This approach relies on the bacteria foraging technique to guide the search for the optimal parameters of a PID controller in the parameters search space. Experimental results show that the proposed approach is able to improve the parameters chosen by the classical Ziegler Nicholas method. Index TermsBacterium Inspired Algorithm, Environmental Monitoring, Flocking, PID control.

I. I NTRODUCTION Up to now, tuning a PID (Proportional-IntegrationDerivative) controller for UAVs and other automatic control systems is often performed by trial and error, including using classical methods such as Ziegler Nicholas, IFT methods, and among others. As we know, the Ziegler Nicholas classical method provides parameter values obtained from the critical gain Kc of the system. The critical gain of a system is obtained by increasing the proportional gain until the system starts oscillating [1]. From this critical gain, the other parameters of the PID controller are obtained according to the Table I in the Appendix. However, these parameter values sometimes need to be further tuned by a human operator to obtain an optimal control of the system especially if the system is non-linear. This tuning sometimes takes a long time and requires the knowledge of the system being tuned. In addition, optimal parameters for the system at the beginning might not be the optimal later due to various factors such as wear and tear taking place in the system, temperature changes and even hardware changes after system maintenance. As these changes take place, the system might need to be re-tuned to maintain an optimal operation and as a result, an adaptive controller is required. Approaches such as evolutionary and genetic approaches have also been used to tune the PID controller to obtain an optimal system operation[2][3]. These approaches often

eliminate the need for human trial and error and present many optimal and efcient solutions because of their stochastic search features. However, genetic approaches often require that a multiple of solutions are running in parallel and the best solution chosen from them to run the system. This is often not possible on a single physical system. Other approaches to PID tuning include the Extremum Seeking algorithm [4], the particle swarm optimization [5][6], and the bacterial foraging algorithm [7]. Passino used a bacteria inspired algorithm to develop a model based adaptive controller for a system [8], which is based on biological concepts such as swarming, reproduction, dispersal, elimination with the chemotactic behaviour of the bacteria. In his work, the best model to use for the present condition of the system is chosen from a database of system models by using a swarm of bacteria agents. In our work, however, we do not use this biological concepts rather rely solely on the bacteria foraging model discovered by Berg and Brown [9][10]. Dong and Jae used a hybrid combination of Passinos algorithm with genetic algorithm for tuning the PID controller for an AVR [13]. Other researchers have used Passinos bacteria Algorithm in many ways, including improving SLAM [14][15]. The rest of the paper is organized as follows. Section II briey introduces the motivation of this research. In Section III, the implementation of this proposed approach is described, including the introduction of bacterial algorithm, modications to the Berg and Brown model, using a simple simulated DC motor, and the plan implemented on a UAV. Some simulation results are presented in Section IV to demonstrate the feasibility and performance of the proposed approach. Finally, a brief conclusion and future work are given in Section V. II. M OTIVATION In this paper, we present how we plan to use a novel bacteria inspired algorithm to tune the PID feedback loop of an Unmanned Aerial Vehicle. Our platform for consideration in this paper is the DraganFlyer V5 shown in Figure 1. This model uses Brushed Motors. As a result, the electrical properties of each motor changes as it is used due to wear

978-1-4244-5702-1/10/$26.00 2010 IEEE

693

If however it is moving down or away from the favorable food gradient, it tumbles more in order to nd a favorable food gradient and the run length is reduced. Berg and Brown were the rst to model this behaviour mathematically. Their model is shown in Equations (1)-(3) [9][10]. Where according to Jackson is the mean run time, o is the run length in the absence of food concentration [11]. Equation (4) describes the probability of a tumble occurring within a time interval t. = o exp( dPb 1 = m dt
t

Fig. 1.

DraganFlyer Quadrotor [16].

dPb ) dt

(1)

dPb (t t) exp( )dt dt m

(2) (3)

kD dC dPb = 2 dt dt (kD + C) Pt =

Fig. 2.

Nested Loop PID controller.

and tear. Due to this property, the optimal parameters used for the PID controller would not sufce during the lifetime of the Brushed Motors. Furthermore, after an hardware change (such as a change in motor or gear), the PID controller would need to be re-tuned for the new hardware. In our research, we used a nested loop PID controller structure shown in Figure 2 to make the UAV hover at a specic location. This PID controller relies more on the DraganFlyers dynamics in terms of velocity. To automate the tuning process for the hover PID controller shown in Figure 2, we propose using a Bacteria inspired algorithm and compare the performance of our approach with the Ziegler Nicholas method of tuning. In order to test this approach, we rst use a simple DC motor in our simulations before moving onto the UAV platform. In addition to the PID controller shown above, we have three other PID controllers for controlling the altitude and attitude of the DraganFlyer. For a detailed insight into how we developed the control architecture for the DraganFlyer, please refer to our works in [18] and [19]. III. S YSTEM I MPLEMENTATION A. Bacteria Algorithm The implementation of our approach is based on the foraging chemotactic behaviour of bacteria. The bacteria forages by using two types of behaviour- a tumble behaviour and a run behaviour. Whenever it is moving up a favorable food gradient, it tumbles less and hence the run length is increased.

t (4) is a constant of the system based on the chemotaxis sensitivity factor of the bacteria, Pb is the fraction of the receptor bound at concentration C. In this work, our C is the ISE (Integral Squared Error) cost function obtained from system. This would be discussed further in the next section. KD is the dissociation constant of the bacterial chemoreceptor. dPb is the rate of change of Pb . dPb is the dt dt weighted rate of change of Pb . This is used to simulate the exponentially decaying memory of an event on a bacterium system. In our work, we used a 4-element memory to simulate the 4-second memory of a bacterium [13][14]. m is the time constant of the bacterial system. The above equations determine the time between tumbles and hence the length of runs between tumbles of a bacteria. In our work, the above equations determine whether to keep moving in the direction the search is going presently or to change direction for a more favourable search in the search space. B. Modications to the Berg and Brown Model The aim of our bacteria foraging model is to minimize the cost function ISE so as to obtain the best system performance. We used a modication of the Equations (1)(3) above to explore the search space for the optimal P ID parameters. Our approach to nding the optimal parameters for our system is different from that followed by Kevin Passino in [12]. Passino used the function in Equation (5) to develop a biased random walk towards the food source. i (j + 1, k, l) = i (j, k, l) + C(i) (i) T (i)(i) (5)

694

By following this approach, we come up with the Equations (6) to (8). BactPt+1 = cos(randAngle) + BactPt BactDt+1 = sin(randAngle) + BactDt BactIt+1 = IZN + K (6) (7) (8)

Fig. 3.

Exponential Graphs of ex and ex .

Where j is the chemotactic index step, k is the reproduction step and l is the index for elimination-dispersal. i is the position of the i-th bacteria, C(i) is the chemotactic step size is a random vector used to of the bacteria and (i) T
(i)(i)

determine which direction the bacteria should proceed in. In our own work, we use a completely different approach by using the Berg and Brown Model directly. In order to explain how we used the Berg and Brown Model directly, we rst focus on Equation 1 in which the exponential function can be described by the graph shown in Figure 3. can be seen as the frequency of tumbles in the presence of concentrations. If there is a high food concentration C in the environment, the frequency of tumbles and hence would be of a small value as the bacteria would not need to tumble to search for more favorable food sources. If however there is a small food concentration C in the environment, the frequency of tumbles would be higher as the bacteria would need to search for more favourable food sources. However, since we are trying to minimize a ISE cost function to obtain the best system performance, we would be looking for the minimum food concentration. As a result, we used the function ex shown in Figure 3. This would ensure that when we have a high ISE cost function due to some chosen PID parameters, we try to move away from those parameters so that we can obtain a small ISE cost function. In our work, we use the as the length our bacteria agent has to travel. A high ISE cost function would result in a large length in the search space as the bacteria agent tries to jump away from that location in the search space. As we get smaller ISEs, the value reduces because we are getting closer to the desirable parameter values in the search space. This results in a high resolution search in the parameter search space. The resolution depends however on the chosen o value before simulation. Choosing a too small value could result in local optimum trapping or longer time in converging at the global optimum. Choosing a large value would result in too large jumps and a lack of resolution in nding the optimal parameters.

Where IZN is the integral parameter value chosen by the Ziegler Nicholas approach of tuning as in [17]. The variable randAngle is a uniformly distributed random number generator producing numbers between 0 and 360. The constant K is a factor chosen to regulate the amount of affecting the IZN value. This would enable the algorithm search around the optimal KI value in search of a better value. In our simulations, we set a minimum of zero ISE as the requirement that our bacteria algorithm should achieve. We used a o of 10 in our work. We tackle the problem of local minimum by introducing a random element in the dC dt component as shown below: dC = ((randomno pastISE) presentISE) dt C. Using a Simple Simulated DC Motor: (9)

As mentioned previously, before testing on the real UAV, we implemented our approach rst on a Simple DC Motor Model described mathematically as: J L d2 d +b = Ki dt2 dt (10)

d di + Ri = V K (11) dt dt Where V is the input armature voltage in volts, J is the moment of inertia of the rotor, b is the damping of the dc motor, K is the back electromotive force constant, R is the electric resistance, L is the electric inductance, is the angular velocity of the shaft in radians per second and is the shaft angle in radians. We set J = 0.100kgm2, L = 2.75H, R = 4 and b = 3.5077N ms in our experiments. In order to enable us to evaluate the effect of the new PID parameters on the DC motor, we used the ISE cost function as shown in Equation 12. ISE =
20 t=0

e edt

(12)

The range of t = 0 to 20 for the error e was chosen so as to give enough time for the transient responses for the motor to die away after each parameter change. We used the system architecture shown in Figure 4. The error for the ISE is the error between the setpoint or desired speed for the motor and the present speed of the motor. The cost value of the ISE is then passed to the Bacteria Chemotaxis algorithm to be used to calculate the new KP , KD and KI parameters. These are

695

The pseudocode for this is shown in Algorithm 1. Algorithm 1 Using Our Modied bacterial Algorithm to tune the PID controller. 1: Initialise Bacterial Algorithm parameter values 2: Set DC Motor parameter values 3: update PID controller with Ziegler Nicholas gains 4: P GAIN = ZN P GAIN 5: I GAIN = ZN I GAIN 6: D GAIN = ZN D GAIN 7: run DC Motor simulation 8: ZN ISE = calculate and record ISE value 9: while stop = TRUE do 10: run DC Motor simulation 11: BACT ISE = calculate and record ISE value 12: if BACT ISE < PREVIOUS ISE then 13: BEST ISE = BACT ISE 14: BEST KP = P GAIN 15: BEST KI = I GAIN 16: BEST KD = D GAIN 17: end if 18: if No of iterations == MAX NO OF ITERATIONS then 19: stop = TRUE 20: end if 21: PREVIOUS ISE = BACT ISE 22: pass ISE value to Bacterial Algorithm 23: Obtain P, I and D gain values from the Bacterial Algorithm 24: P GAIN = BACT P GAIN 25: I GAIN = BACT I GAIN 26: D GAIN = BACT D GAIN 27: Update PID controller with PID values. 28: end while 29: if ZN ISE BEST ISE then 30: P GAIN = BEST P GAIN 31: I GAIN = BEST I GAIN 32: D GAIN = BEST D GAIN 33: stop = TRUE 34: end if

Fig. 4.

Architecture used in our experiment.

passed to the P ID controller to generate a new voltage and hence speed for the DC Motor. As mentioned previously, after each parameter change, we ran the motor for about 20 seconds so that the transient responses would die away before implementing another set of new parameters. For each experiment, we rst set the KP , KI , and KD parameters to the new values obtained from the bacteria algorithm in the previous run so that KP = BactPt+1 , KD = BactDt+1 , and KI = BactIt+1 . This made our algorithm move towards the minimum ISE cost value. D. Planned Implementation on the UAV In order to use our Bacteria Algorithm on the UAV, we rst used the Ziegler Nicholas method to get safe working KP , KI and KD parameters. We then establish reasonable boundaries for each parameter so as to prevent unreasonable parameters. This is similar to the approach carried out in [17]. In our previous work [15][18], we implement the UAV control system so that we can control the location of the UAV by setting new co-ordinates for the PID controller to work upon. We used a VICON motion capturing device to capture the altitude and attitude of the UAV and then respond accordingly. The experiment was conducted in the University of Essex robot arena. We plan to use the same setup in this work. For desired setpoints, the UAV will take off at location (0,0) to an altitude of 1000mm in the Robot arena. It would then be commanded to y to a location of (0,1000) whilst maintaining the altitude of 1000mm. set off from the time the command is issued and allowed to run for 20seconds. During this time, the ISE for each axis is recorded and stored. After 20 seconds, the Bacteria Algorithm is ran with the present ISE and a new set of parameters obtained. A command is then issued to return the UAV to position (0,0) and the ISE recorded and stored again. This process is repeated 10 times. At the end of 10 iterations, the lowest ISE value is obtained and compared with the previous ISE value obtained from the Ziegler Nicholas approach. If the newly obtained ISE value is worse than the old ISE value, then the old parameters are kept, if not the new parameters are used.

IV. S IMULATION R ESULTS AND A NALYSIS As previously mentioned, we used a desired ISE value of 0 in our bacterial algorithm. This makes the algorithm look for parameter values that would drive the error value towards a minimum. We ran our bacterial algorithm for 30 iterations and used a desired PID controller setpoint of 5 rotations per second in our experiments. As there is an element of stochastic behaviour in our approach, we ran the experiment 20 times to nd out what it is doing. In our experiments, we capped the KP and KD values between -1000 and 1000. Fig. 5 and Fig. 6 show comparisons

696

8 7 6 Desired Speed 5 4 3 2 1 0 20

Using BAC Parameters Using Ziegler Nicholas Parameters

40

60

80

100 Time

120

140

160

180

200

Fig. 5. Comparision between using our Bacteria Algorithm and the Ziegler Nicholas Method for tuning. Ziegler Nicholas parameters: K P = 24, KI = 400, KD = 0.36, ISE = 0.8765; Bacteria chosen parameters: K P = 973.94, KI = 5.2039, KD = 38.49, ISE = 0.5072.

Fig. 7.

Graph showing a typical run of the bacteria algorithm.

8 7 6 Desired Speed 5 4 3 2 1 0 20

Using BAC Parameters Using Ziegler Nicholas Parameters

during a run. However there are times that the ISE value sometimes suddenly increases. This is because of over tuning of a parameter during the search process. However, after this, the algorithm aims to correct the over tuning resulting in a descent of the ISE value again. With our approach, we can improve the performance of a PID controller compared to the Ziegler Nicholas approach. If during a run on a UAV, the nal KP ,KI , and KD parameters give worse performance than the Ziegler Nicholas approach, then the Ziegler Nicholas parameter values can be kept for that particular mission. V. I MPLEMENTING ON
A

DC M OTOR

40

60

80

100 Time

120

140

160

180

200

Fig. 6. Comparision between using our Bacteria Algorithm and the Ziegler Nicholas Method for tuning. Ziegler Nicholas parameters: K P = 24, KI = 400, KD = 0.36, ISE = 0.8765; Bacteria chosen parameters: K P = 1000, KI = 401.0974, KD = 5.6089, ISE = 0.0913.

between the parameters obtained from using our tuning approach and the Ziegler Nicholas tuning approach. During our experiments, we rst tested our algorithm by searching the entire parameter space to nd out if it could nd optimal parameters other than the Ziegler Nicholas parameters. Our results of doing this is shown in Fig. 5 in which we were able to obtain a ISE of 0.5072. We then used the Ziegler Nicholas parameters as a starting point for our algorithm and were able to obtain an ISE of 0.0913 as shown in Fig. 6. In both results, we were able to achieve less overshoots, faster settling time and faster rise time than the parameters chosen by the Ziegler Nicholas method. Figure 7 shows a typical run of our algorithm. It can be seen that the algorithm aims to reduce the ISE value obtained

In order to investigate the effectiveness of our approach on real platforms, we implemented the Bacteria Algorithm and the PID controller on the lego mindstorm and automated the process as shown in Algorithm 1. During our runs, we took readings for the Integral Squared Error (ISE). Before running our bacteria algorithm, we performed Ziegler Nicholas tuning and then improved the results by using trial and error. We came up with the following optimal parameters: P = 2.0, I = 0.04 and D = 4.0. For the bacterial algorithm, we set = 5, o = 0.05, and kD = 10. Details of how we chose this parameters would be presented in subsequent publications. We then set BactP = 2.0, BactD = 4.0, and BactI = 0.04 as a starting point for our bacteria algorithm. Each new set of parameters is ran for 10 seconds. The motor is then stopped and a new set of parameters calculated before the run commences again. Figure 8 shows a comparison between the performance of the lego mindstorm when using the manually chosen parameters and the parameters chosen by the bacteria algorithm. The choice of bacteria parameters caused a smaller overshoot and smaller steady state ripples when compared to the choice of Ziegler Nicholas parameters. It also resulted in a faster settling time. As can be seen in Figure 8, the parameters chosen by the bacteria algorithm is very close to those chosen manually.

697

600

R EFERENCES
Using Ziegler Nicholas Parameters Using BAC Parameters

500

400 Speed

300

200

100

500

1000

1500

2000

2500 Time

3000

3500

4000

4500

5000

Fig. 8. Comparison between our Bacteria Algorithm and the Ziegler Nicholas Method for tuning. Ziegler Nicholas parameters: K P = 2.0, KI = 0.04, KD = 4.0; Bacteria chosen parameters: KP = 2.0269415, KI = 0.044980094, KD = 3.958603

However the performance of the bacteria chosen parameters is better than the manually chosen parameters. One of the reasons for this is that the bacteria algorithm is able to achieve a high degree of resolution than that achieved manually. The effectiveness of our approach can also be demonstrated by its rapidness at nding a minimum point. For instance, the minimum point in Figure 7 was found at the ninth iteration. VI. C ONCLUSION
AND

F UTURE W ORK

This paper presents a novel meta heuristic approach to automated PID tuning of an Unmanned Aerial Vehicle using a novel bacterial foraging algorithm. It frees engineers or novice users of PID controllers from having to understand the complicated system dynamics, making the system tuning much faster. The proposed approach is also model free and does not require knowledge about the zeros and poles of the system. In addition, if the system being controlled has various operating characteristics at different conditions, the approach could automatically choose an optimal set of parameters for a particular condition. The future work will investigate how to tune the parameters of a bacteria algorithm to achieve the best performance during its search, including testing our approach on the optimization of Fuzzy systems, wall following capability of Unmanned Ground Vehicles and tracking capability of an Unmanned Aerial Vehicle following a moving target. Appendix
TABLE I Z IEGLER N ICHOLAS T UNING RULE PARAMETER VALUES . ControlT ype P PI PID Kp 0.50Kc 0.45Kc 0.60Kc Ki 1.2Kp /Pc 2.0KP /Pc Kd Kp Pc /8

[1] PID Theory Explained, National Instruments Corporation, 2006. [2] M.W. Iruthayarajan and S. Baskar, Evolutionary Algorithms based design of multivariable PID controller, Expert Systems with Applications, Elsevier, Vol.36, 2009, pp. 9159-9167. [3] H.C Chen and S.H. Chang, Genetic Algorithms Based Optimization Design of a PID Controller for an Active Magnetic Bearing, Interantional Journal of Computer Science and Network Security, Vol. 6, No. 12, Dec. 2006. [4] N.J. Killngsworth and M. Krstic, PID Tuning Using Extremum Seeking- Online, Model-free performance optimization, IEEE control systems magazine, Issue 1, Vol. 26, Feb. 2006, pp. 70-79. [5] M. Nasri, H. Nezamabadi-pour and M. Maghfoori, A PSOBased Optimum Design of PID Controller for a Linear Brushless DC Motor, World Academy of Science, Engineering and Technology, 2007. [6] H.M. Soliman, E.H.E. Bayoumi and M.F. Hassan, PSO-Based Power System Stabilizer for minimal overshoot and control constraints, Journal of Electrical Engineering, Vol. 59, No. 3, 2008, pp. 153-159. [7] D. H. Kim and J. H. Cho, Intelligent Control of AVR System Using GA-BF, Lecture Notes in Computer Science, Springer Berlin/Heidelberg, Vol. 3684, August 23 2005, pp 854-859. [8] K.M. Passino, Biomimicry of bacterial Foraging for distributed Optimization and Control, IEEE Control Systems Magazine, Vol.22, June 2002. [9] D.A. Brown and H.C. Berg, Temporal Stimulation of Chemotaxis in Escherichia coli, Proc. Nat. Acad, Sci. USA Vol. 71, No. 4, pp. 1388-1392, April 1974. [10] H.C Berg and D. A. Brown, Chemotaxis in Escherichia coli analysed by three-dimensional tracking. Nature (London) 239:500-504, 1972. [11] G. A. Jackson, Simulating chemosensory responses of marine microorganisms Limnol. Oceanog. 32:12531266, 1987. [12] K.M. Passino, Biomimicry for Optimization, Control and Automation, Springer-Verlag London Limited, 2005. [13] D.H. Kim and J.H. Cho, A Biologically Inspired Intelligent PID controller Tuning for AVR Systems International Journal of Control, Automation and Systems, Vol. 4, No. 5, Oct. 2006, pp. 624-636. [14] A. chatterjee and F. Matsuno, Baterial foraging techniques for solving EKF-based slam problems International Control Conference (ICC2006), Glasgow, Scotland, U.K., 30 Aug-1st Sept. 2006. [15] J.H. Cho and D.J. Lee, Parameter Optimization of Extreme Learning Machine Using Bacterial Foraging Algorithm ISAI Systems, Sokcho, Korea, 5-8 Sept. 2007. [16] The DraganFlyer, Remote Control Helicopter, http://www.otherlandtoys.co.uk/dragfaq.htm (19 March 08). [17] G.M. Almeida, V.V.R. Silva, E.G. Nepomuccno and R. Yokoyama, Application of Genetic Programming for Fine Tuning PID Controller Parameters Designed Through Ziegler-Nichols Technique Springer-Verlag Berlin Heidelberg, 2005. [18] J. Oyekan and H. Hu, Towards Autonomous Patrol Behaviours for UAVs, Proceedings of UK EPSRC Workshop on Human Adaptive Mechatronics, Staffordshire University, Stafford, U.K., 15-16 Jan. 2009. [19] B. Li, B. Lu, J. Oyekan, H. Hu and D. Gu, Towards Autonomous Indoor Navigation of small UAVs, Submitted to the 8th World Congress on Intelligent Control and Automation, Jinan, China, 6-9 July 2010.

698

S-ar putea să vă placă și