Design PID Neural Network Controller for Trajectory Tracking of Differential Drive Mobile Robot Based on PSO

– This paper introduces a nonlinear (Proportional-Integral-Derivative Neural Network) (PID NN) controller for a differential wheeled mobile robot trajectory tracking problem. This neural controller is built based on the principles of neural network (NN) and the equation of conventional structure of PID controller and is applied on kinematic model of the mobile robot. The particle swarm optimization algorithm (PSO) is utilized to find the best values of three PID NN parameters and connection weights that minimize the error between the reference path and the actual path. The results illustrate that the PID NN controller has a satisfied ability to make the mobile robot tracking any path with good performance, high accuracy and acceptable robustness.


Introduction
There are many applications need to use mobile robots in order to facilitate doing some jobs.One of these applications is using the mobile robots to move materials between workstations.They can also be used in many fields such as medical environment, industrial, security and even domestic machines.Since the mobile robots are growingly utilized in a broad scope of applications, the researches in this field attracted so much attention in the recent years [1,2] Therefore, many types of controllers were proposed to tackle the trajectory tracking problem when the nonholonomic constraints were considered.There are many techniques proposed to tackle the problems of path tracking and to guarantee that the mobile robots move on the predefined path without any slipping.The classical controller has utilized the techniques of linear and nonlinear feedback control to result closed loop system for the kinematic model of mobile robot [3,4].The Artificial Intelligent Controllers (AIC) like fuzzy controllers or neural network controllers are greatly used to solve this problem [5,6].In addition, there are other methods proposed for this problem such as, the proposed adaptive controllers based on dynamics of mobile robots [7], also the method of back stepping control technique was proposed in [8,9] but, the designing method and the resultant controller structure are very complex.The sliding mode technique was introduced in [10], in this method, the corporation between the kinematic and dynamic controllers is applied to track the required path.One of the disadvantages of traditional neural network is time consuming in learning because of the random initialization weights of the network connections.This property leads the algorithm to unable achieve fast response of the control system and does not give a stationary performance.In [11] a new control algorithm using a PID NN controller is introduced, this algorithm is a type of Multi-Layer Perceptron (MLP) but the hidden layers of the network are different from traditional layers.This algorithm is composed of three elements, proportional neuron, integral neuron, and derivative neuron.Therefore, PID NN exploits the advantages of PID, the neural network convergence and short learning time [12] [13].There are two categories of PIDNN, the singleoutput (SPIDNN) and the multi-output (MPIDNN).The two types of the networks can be learned off-line or on-line to optimize the values of the connection weights between the three kinds of network layers.In this paper, PSO algorithm was utilized to find the optimum values of connection weights between neural network layers.The rest of this paper is arranged as follows: in section two, the kinematic model equations of the differential wheeled nonholonomic mobile robot are derived; in section three, the proposed structure of the PID neural network controller is depicted as well as the main steps of applying the proposed PSO are explained, in section four the simulations and the 575 obtained results are illustrated, in section five the main points of conclusions are introduced.

Kinematical Model of Mobile Robot
The main property of this kind of mobile robot is; the wheel rotations are limited to only one axis.So, the navigation of mobile robot is controlled by changing the left or right-wheel speed on either side of the mobile robot.Figure 1 depicts the kinematic scheme of a differential wheel mobile robot, where is the robot's linear velocity , r represents the radius for each wheel, L represents the distance between the two wheels, symbolizes the right-wheel angular velocity, symbolizes the left-wheel angular velocity, x and y are the two coordinates of the mobile robot position, and the angle of mobile robot orientation is denoted by θ [14,15].Depending on the principles of motion to derive a kinematic model of rigid body, the mobile robot can be characterized by the two Eqs.( 1) and (2), where is the mobile robot angular velocity , is the mobile robot linear velocity [14,15].
(1) The definition of a mobile robot total linear velocity can be as; a multiplier value of an angular velocity and an instantaneous bending radius of a mobile robot trajectory R.
(2) Therefore, the left-wheel velocity and right-wheel velocity can be represented by Eqs (3) and (4) respectively.
( ) From the solution of Eq. (3) and Eq. ( 4), an instantaneous bending radius of the mobile robot trajectory compared to the midpoint axis can be computed as shown in Eq. ( 5).
(5) Now, by rewriting Eq. ( 2).The resulting Eq. ( 6) represents the mobile robot angular velocity [14,15]: At last, Eq. ( 7) represents the mobile robot linear velocity.(7) The kinematic equations of mobile robot can be defined as: By performing integration to both sides of the Eqs ( 9), (10) and (11): Where, is the initial pose of position and orientation of mobile robot.The kinematics model of a two wheeled mobile robot is described by Eqs. ( 12), ( 13) and ( 14).The position and orientation of the kinematic model of mobile robot represent the control variables (x , y, and ) while the angular velocities of left wheel and right wheel ( , ) of the mobile robot represent the control variables of the system.

The Proposed PID NN Controller
In general, the control system of the mobile robot composed of three major portions; the kinematic model of the differential wheel mobile robot, the suggested neural network controller PID NN, and the proposed PSO algorithm for adjusting the parameters of the controller.

I. The Design of PIDNN Controller
The proposed PID NN controller is represented as a forward multi-layer neural network.The input/output functions of hidden layer neurons are selected according to PID control law, where these neuron functions are made to represent the same role of proportional, integral and derivative actions.The PID control law can be defined as; Where, e is the error between the system input and desired output.The accumulator error or the integral function of the error is employed to realize better tracking.' e is the error derivative, or the change rate of error which assists to decrease the overshoot of the output.The suggested PID NN controller consists of an input layer, hidden layer, and the output layer (3nX9nX2n).Figure 3 shows this neural network.The first layer or input layer has three inputs;  The input/output functions of PID NN at any time of sampling subject to the following specifications: 1-All input layer neurons are described by the following input/output function.
(17) Where: the input value the output value of input layer neuron.i , is the part number of sub network.
Where , are the hidden layer input values and are the weights of connections between the input layer and hidden layer of neural network.The outputs of the hidden neurons, which participate to create proportion action is: The outputs of the hidden neurons, which participate to create integral action is: ( ) (20) The outputs of the hidden neurons, which participate to create differential action is: (21) Where; (Sigmoid function).( 22) 3-The neuron function of the output layer is a summation function which sum all its inputs (outputs of hidden layer neurons) and give its output.This function is illustrated as follows.

II. Particle Swarm Optimization (PSO).
The PSO is considered as another kind of evolutionary computation technique which was proposed by Kennedy and Eberhart [16].This algorithm is based on simplified social behavior of animal such as bird flocking and fish schooling.In PSO, each solution is represented as a flying bird in the searching space which is called particle.The algorithm of PSO simulates the social behavior of each particle in the swarm.At each generation or iteration, the algorithm adapting the trajectory of each particle in the swarm based on the best discovered trajectory for this particle and toward the trajectory of global best particle in the entire swarm.Many optimization problems are solved successfully by the PSO algorithm.In comparison, between PSO and genetic algorithm, the PSO has advantages which are easier than GA in the implementation and fewer adjusted parameters to control the algorithm.In this paper, in order to discover the optimal parameters of the PIDNN controller, PSO algorithm was suggested to find them in order to precisely control the velocities of right wheel and left wheel ( , ).
1. Procedure of PSO The mathematical description of PSO is as follow; Suppose the search space has D dimensions and the number of particles is n.The vector ( ) performs the vector of position of i-th particle in the population.The is the best position for particle j searched by now, and the best position of whole particles in the swarm is symbolized as: The vector ( ) is the rate of change for the i-th particle position.The position of each particle is updated depending on the following formulates.
(24) (25) Where, c1 and c2 are acceleration coefficients that have positive constant values.The rand () is a function of random number or a function which generates a random number in range (0 to 1).The symbol w is the weight of inertia (where, w <1).

Tuning PID NN Parameters by PSO.
The following steps illustrate in details the implementation of PSO algorithm to discover the optimum values of the PIDNN controller parameters.
Step 1: Determine the dimension space of the problem, we have 27wieghts.
Step 2: Initialize group of particles as an array with random velocities and random positions Step 3: Using the fitness function Eq. ( 26) to evaluate the fitness of each particle.

∫ (26)
Step 4: Choose the best individual position saw so far for each particle in the group.
Step 5: Decide the superior universal position encountered so far by all the particles in the group.
Step 6: Using Eq. (24) to update the velocities of all particles.
Step7: Using Eq. (25) to update positions of all particles.
Step 8: If the maximum number of iterations is reached go to step 9 otherwise increase the counter of iteration by one and return to step 3.
Step 9: The superior universal position encountered so far is considered as the solution for the PIDNN controller parameters.
Step 10: End.From Figure 2 which shows the block diagram of a differential wheel mobile robot, the error is determined from the difference between the desired path and the actual path as depicted below: ) where; The outputs of the PID NN controllers produce the right-wheel and left-wheel velocities ( , ) of the mobile robot which are used to apply at the kinematic model of mobile robot.Each particle represents a certain path which is needed to evaluate.The actual output for each particle is calculated and compared with the desired output path in order to evaluate the fitness of this particle.This operation is repeated every generation to adjust the particle's position until to reach the minimum tracking error between the desired and actual path.

Analysis and Results
The proposed control system of mobile robot shown in Figure 2 was simulated using MATLAB 2013.The differential wheel mobile robot kinematic model was employed and the values of its physical parameters were chosen as: (model is taken from [9]: M=0.65kg, L=0.105 m, r =0.033 m and the sampling time is 0.1 second).The proposed PSO algorithm is applied to find the optimal values of PID NN controller's weights.The control parameters of PSO algorithm are chosen as: c1=2, c2=2, rand between (0-1), swarm population size 30 particles, the number of maximum iterations 100.In order to verify the ability of the PID NN controller to force the mobile robot tracking any path, two paths were taken as test in order to check.

Trajectory path (1):
The first path has like infinity symbol and the following equations described this type of path.

( ) (( ) ( ))
Where: t = 0.01 sec is sampling time and the observation time is 100 sec., and , are the current and past position and orientation.The initial position and orientation of this path is (0.75, 0, 0).Figures 4-7 show the actual and the reference paths and responses for and .The mobile robot left-wheel and right-wheel velocities , are shown in Figures 8 and 9 respectively.Finally, Figure 10 depicts the MSE between actual infinity path and reference path during tracking.

Trajectory path (2):
The second path is like star symbol and this path is described by the following equations.The obtained results show clearly that, the suggested PID NN controller is effective to make the mobile robot tracks the required trajectory with a very small tracking error.The MSE values for all variables x , y and for the two paths mentioned above are shown in Table 1.  2 and Table 3.
In fact, the proposed PID NN controller structure is basically a special structure.The PID NN controller is equivalent to the classical PID controller when suitable connective weights are chosen.These weights represent PID controller gains proportional, integral, and derivative as: .In Table 2 and Table 3 the optimal values of weights for the three PID NN controllers are shown.These values of weights, specify the lowest possible mean square error (MSE) between the reference variables and actual variables for position and orientation.Finally, from the obtained results, we have noticed clearly that the proposed PID NN intelligent controller proves its ability to drive the differential wheeled mobile robot kinematic model well for any path.Moreover, in order to check the robustness of the PID NN controller, another initial posture (0.2, 0.1, -3.9).(0, 0, -4.1) was applied to test the behavior of mobile robot.The results are shown in Figures 18 -23.The resultant Figures 18 -23 show that the proposed PID NN controller results a good performance and fast response to track the desired trajectory when the disturbance applied for a short time or the deviation of the actual trajectory from the reference trajectory is small.This property confirms that the method is feasible and applicable.

Conclusion
This paper introduced the proposed PID NN controller to apply on the kinematic model of differential wheel mobile robot.The role of PSO algorithm in the design was to find the best controller parameters that minimize the error between the reference trajectory and the actual trajectory.In fact, the proposed PID NN controller is a dynamic multilayer neural network.This controller consists of three PID sub controllers.One PID sub controller for each control variable x, y, and Ɵ.Each PID sub controller has three neurons P-neuron, I-neuron and D-neuron.Therefore, the PID NN controller has nine neurons in its hidden layer.Table 4 shows the values of MSE for all control variables when the initial posture is changed, although the controller parameters were not adapted.Figure 18 shows that the controller can quickly force the mobile robot to join the reference path with small values of tracking errors.The above results display that the PID NN controller has a good ability to make the mobile robot tracking any path with good performance, high accuracy and acceptable robustness. -

Figure 1 :
Figure 1: Model of nonholonomic mobile robot

Figure 2
depicts the control system block diagram and the three parts of the controller.575

Figure 2 :
Figure 2: The proposed structure of the PID NN control system

.
These inputs represent the distance error between the required or reference trajectory and the actual trajectory of the mobile robot.The hidden layer owns nine neurons and the inputs to these nine neurons represent the gains of three PID controllers, because we have three terms must be controlled (x, y, z), where each neuron represents either P or I or D function.ji V symbolize the weights connections between input layer and hidden layer, while kj W symbolizing the weights connections between the hidden layer and output layer.

Figure 3 :
Figure 3: The PID NN Neural Network Controller The two outputs o/p (k) of two output layer neurons represent the control actions to the mobile robot and .Where, represent the weight connections between the hidden layers and the output layers.The real numbers of the output neurons are k =1,2.The characteristics of PID control of PIDNN controller are reflected by the connections between the input layer and hidden layer as well as the functions of the hidden layer neurons.The optimal values of weighted coefficients and are found by the PSO algorithm.
are fed to the rotation matrix which are utilized to convert the frame of coordinate i.e from the global frame to the local frame of the mobile robot.The rotation matrix output is passed into PID NN controllers.The error of each control variable is passed to the PID NN controller.Therefore, there are three PID NN controller, each one consists of three elements (P, I and D).The first PID NN controller for x axis and the second PID NN controller for y axis while the third PID NN controller for angle Ɵ.The proposed PSO algorithm is applied to tune off-line the parameters of the PID NN controllers.

Figure 4 :Figure 5 :Figure 6 :Figure 7 :Figure 8 :
Figure 4: The actual and reference infinity paths of mobile robot

Figure 9 :Figure 10 :
Figure 9: The velocity response of right wheel during tracking reference infinity path

Figure 11 :Figure 12 :Figure 13 :
Figure 11: The mobile robot reference and actual star path

Figure 14 :Figure 15 :Figure 16 :
Figure 14: The variable response during tracking reference star path