Optimization of PID controller based on The Bees Algorithm for one leg of a quadruped robot

In this paper, we apply The Bees Algorithm to find optimal PID controller gains to control angular positions of robot leg joints with the minimum position error. In order to present more realistic simulation, system modelled in MATLAB/Simulink environment which is close to experimental set up. Solid model of system, which has two degrees of freedom, drawn by using a CAD software. Required physical specifications of robot leg for MATLAB/Simulink modelling is obtained from this CAD model. Controller of the system is designed in MATLAB/Simulink interface. Simulation results derived to show effectiveness of The Bees Algorithm to find optimal PID controller gains.


Introduction
In spite of the fact that legged robots is not new in the literature, today still attracts the attention of researchers.In recent few decades, due to the better performance of the legged robots in the challenging terrain, the number of work related to legged robots increased in the Robotics [1][2][3].The most remarkable of these studies is the BigDog project, which is funding by DARPA [1].Unfortunately, there is insufficient resource about Bigdog in the literature.Another noteworthy study is HyQ Project in I.I.T. [2].Furthermore, in the recent studies, like BigDog and HyQ, hydraulic actuation systems used instead of electric actuation systems increasingly, since the hydraulic systems has high power to weight ratio.But, hydraulic actuation systems are highly nonlinear systems and difficult to control.In this context, designing a proper controller is challenging for hydraulic systems [1][2][3][4].
PID controllers are most common type of robot controllers.PID controllers are widely implemented in industry due to their simplicity but efficiency.Nevertheless, PID gains require fine tuning.Many gain tuning techniques introduced in the literature, such as empirical techniques, analytical techniques, and optimization methods [5][6][7][8].
The Bees Algorithm is a swarm-based optimization algorithm that mimics the food foraging behavior of honey bees.The algorithm has been successfully applied to different optimization problems such as continuous function optimization, artificial neural network training, engineering design, multi-objective optimization, data clustering, and job scheduling [9][10][11][12][13][14].
In this study, we aim to optimize PID controller gains based on The Bees Algorithm to control angular positions of robot leg joints with the minimum error.PID controller gains optimized by using an objective functionthat based on improvements of parameters such as rise time, maximum overshoot and settling time and etc., which is also the aim of controller design.Simulation of the system that we want to control was programmed in MATLAB/Simulink environment.
This paper organized as follows: Section 2 introduces model of the system.Section 3 describes PID gains optimization and also briefly outlines The Bees Algorithm application.PID controller and The Bees Algorithm parameters are provided in this section.In the end, Section 4 gives simulation results of the robot leg.Also, performance of the optimized PID controller discussed and responds to square wave input illustrated graphically in this section.

Identification of the system
The robot leg under study is modelled in SolidWorks.Robot leg CAD model is shown in Fig. 1.The model is designed by considering mobility, light-weight and will then be used on a quadruped robot.Two degrees of freedom model, that has three main components, consists of two rotational joints and a fixed part that will then be mounting to a quadruped robot body.Both joints are driven by independent hydraulic actuators.The model dimensions and physical specifications given in Table .1.

The Bees Algorithm
This section summarizes the main steps of The Bees Algorithm.Fig. 2 shows the pseudo code for the algorithm in its simplest form.As detailed in [9,10], the algorithm requires a number of parameters to be set, namely: number of scout bees (n), number of sites selected for exploitation out of n visited sites (m), number of top-rated (elite) sites among the m selected sites (e), number of bees recruited for the best e sites (nep), number of bees recruited for the other (m-e) selected sites (nsp), initial size of each patch (a patch is a region in search space that includes a visited site and its neighborhood) and stopping criterion.
The algorithm starts with the n scout bees being placed randomly in the search space.The fitness of the sites visited by the scout bees are evaluated in step 2.
In step 3, the m sites with the highest fitness's are designated "selected sites" and chosen for neighborhood search.In steps 4 and 5, the algorithm conducts searches in the neighborhood of the selected sites, assigning more bees to the best e sites.Selection of the best sites can be made directly according to the fitness associated with them.Alternatively, fitness values can be used to determine the probability of sites being selected.Searches in the neighborhood of the best e sites which represent the most promising solutions are made more detailed by recruiting more bees for them than for the other selected sites.Together with scouting, this differential recruitment is a key operation of The Bees Algorithm.In step 5, for each patch, only the one bee that has found the site with the highest fitness (the "fittest" bee) will be selected to form part of the next bee population.In steps 6-8, the remaining bees in the population are assigned randomly around the search

Parameters
Value Units   space scouting for new potential solutions.These steps are repeated until a stopping criterion is met.At the end of each iteration, the colony will have two parts to its new population-representatives from each selected patch and other scout bees assigned to conduct random searches.

PID Gain Optimization
Since the system has two degrees of freedom, two different PID controller designed to control angular positions of the robot leg joints.A schematic diagram of the closed-loop control system and interaction between with The Bees Algorithm is given in Fig. 3.There are six gains need to be optimized for the attainment of the leg joints to desired angular positions.As shown in the Fig. 3, PID blocks generate command signal, u i (t), with the error signal e θi (t) to control joints' angular positions.The mathematical formulation of the PID controllers is given in Eq.1.
As mentioned above, u i (t) is the command signal, which is input signal to the system at the same time.K Pi , K Ii , and K Di are the proportional, integral and derivative gains of the PID controllers, respectively.The error signal e θi (t) is computed as e θi (t) = θ i,ref -θ i , where θ i,ref and θ i are the desired joint angle and measured joint angle, respectively.The Bees Algorithm applied to find optimal values of K Pi , K Ii , and K Di to control angular positions of the leg joints.
Objective function for applying The Bees Algorithm to both PID controllers given in Eq.2.Where t s is settling time, t r is rise time, t p is peak time, M is maximum over-shoot, e ss is steady state error.The weight factors used in this work are taken from previous studies [14].The Bees Algorithm was programmed in MATLAB with respect to the flowchart and objective function to optimize PID gains.The Bees Algorithm parameters and optimization range of gains used for the MATLAB code shown in Table 2-3.

Results and Conclusion
In the MATLAB code, The Bees Algorithm interactively communicates with MATLAB/Simulink model to implement optimized gains to PID controllers and to get the system response in simulation.Thereby, optimization stage is accelerated and get the results rapidly.Desired inputs for angular positions of the robot leg joints were assumed to be a step function in simulation.Objective functions values (cost) computed according to the system step respond.The Bees Algorithm finds optimal gains with respect to this objective function values.
In order to see optimized gains performance, system response to square wave input obtained in MATLAB/Simulink simulation.Results illustrated graphically in Fig. 4. As seen in the graphics, system response with optimized gains are eligible for determined objective function and this study's aim.Also seen that, optimized gains conform to control angular position of the robot leg joints.Simulation results prove that PID controller design optimized by using The Bees Algorithm was both efficient and robust.

Figure 1
Figure 1 Solid model of the two degrees of freedom robot leg.

Figure 3 Figure 4
Figure 3 Schematic diagram of PID gain optimization based on The Bees Algorithm.

Table 1
Physical properties of the robot leg model. 03004-p.2

Table 2
The Bees Algorithm parameters.

Table 3
Optimization range of PID gains.