Li-wei TANG, Hong-qin YAN
(1Loudi Vocational and Technical College, Loudi 417000, China)(2The College of Electric and Information Engineering, Hunan University, Changsha 410082, China)
Abstract: The PID controller is often used in the motion control of series manipulator, which has the problems of large overshoot and low tracking accuracy. Based on this, a fuzzy PID controller based on particle swarm optimization (PSO) algorithm is designed. First of all, the dynamic equation and transfer function were deduced based on the model of serial manipulator with two arms. Secondly, the system structure of the controller was designed, and the PSO algorithm was used to optimize the control parameters of fuzzy PID controller, which improved the adaptive ability and tracking precision of the system. Finally, the tracking and control of manipulator position were simulated by the MATLAB. The simulation results show that the PID controller has certain oscillation and large overshoot. After fuzzy adjustment, the overshoot becomes small and the stability is better; on this basis, the response speed gets faster, and the overshoot is basically eliminated through PSO optimization.
Key words: Manipulator, Fuzzy-PID control, Particle swarm optimization, MATLAB simulation
At present, international scholars have carried out relevant research work on manipulator motion control, including PID control [1], sliding mode control [2], fuzzy control [3], neural network control [4], etc. PID control is an algorithm to implement control according to the real-time deviation of system tracking through linear combination of proportion, integral and differential, which advantages are simple structure, easy implementation and strong robustness. However, in actual production, PID controller is troubled by complicated parameter setting, the low accuracy, and the weak adaptability. There is a strong coupling between the joints of the series manipulator, and the grasping load of the manipulator is often changing, so the traditional PID control is difficult to obtain a satisfactory control effect. Sliding mode control has strong robustness and practicability in dealing with the uncertainties and the external disturbances of system, but there are discontinuous switching characteristics in sliding mode control, which causes the vibration of the control system. Fuzzy control has the characteristics of strong robustness and good fault tolerance. It has a good control effect on problems such as non-linearity and lag in manipulator motion control. However, this control method based on fuzzy thinking also leads to low control precision and poor dynamic characteristics. Neural network control has a very obvious control effect in dealing with complicated and uncertain systems, but the control algorithm is relatively complex.
PSO is a new swarm intelligence optimization algorithm proposed by J.Kennedy and R.Eberhart[5], inspired by the foraging and migration of birds. It has characteristics for easy coding, fast calculation speed, high optimization efficiency, and strong global convergence ability in solving complex optimization problems. Therefore, as an efficient parallel search algorithm, PSO is very suitable for solving optimization problems in complex environments and can be widely used in fields such as combinatorial optimization, machine learning, self-adaption control, and artificial intelligence.
In this paper, PSO and fuzzy logic are combined organically, and the quantization factorsKe,Kecand the scale factorKuof the fuzzy controller is adjusted online by PSO algorithm automatically. At the same time, it acts on the PID controller to realize the high-precision trajectory tracking control of the serial manipulator.
The structure of the two-arm series manipulator is shown in Fig.1.m1andm2are the masses of the boom and the forearm respectively;r1andr2are the lengths of the boom and the forearm respectively;θ1is the angle between the boom and theX-axis, andθ2is the angle between the forearm and the extension of the boom.

Fig.1 Structural sketch of two-arm series manipulator
For a two-joint manipulator, when the external interference is ignored, its dynamic equation can be described as follows:

(1)
The dynamic equation of joint 1 is as follows:

(m1+m2)gr1cos(θ2)+m2gr2cos(θ1+θ2)
(2)
The dynamic equation of joint 2 is as follows:

(3)
Assuming that joint 1 remains motionless andθ1is constant, formula (3) can be simplified as follows:
(4)
Taking the joint 2 as the research object, linearize the formula (4):

(5)
(6)
The structure of the fuzzy PID controller system based on PSO is shown in Fig.2. Among them,θdis an expected value of the position for the manipulator joint;θis the actual position of the manipulator joint;eandecare the position deviation and the deviation change rate respectively;KeandKecare the quantization factors ofeandecrespectively[6],Kuis the scale factor of the fuzzy controller output;τis the moment that controls the joint for the manipulator.

Fig.2 Structure chart of Fuzzy-PID controller based on PSO
Workflow of the system: firstly, the desired position informationθdis inputted, and PSO automatically adjustsKe,KecandKuonline; secondly, the optimizedKp,KiandKdof the fuzzy controller can be output to adjust the PID controller, and the appropriate control torque can be obtained, so that the manipulator can track the desired position accurately.
Firstly, the fuzzy command is written in the command line window of MATLAB. Through the Fuzzy Editor, a two-input three-output fuzzy controller is constructed. The interface is shown in Fig.3.

Fig.3 Fuzzy controller setting interface
Then the following operations are performed through the menu item:
(1)Select the membership function and fuzzily the input and output variables [7]. The input domain is [-2,2], the corresponding fuzzy linguistic variables are{NL,NS,Z,PS,PL}; the output domain is [-3,3], and the corresponding fuzzy linguistic variables are {NL,NM,NS,Z,PS,PM,PL}. The triangular membership function with simple calculation and high sensitivity is selected. The interface of membership function setting is shown in Fig.4.

Fig.4 Triangular membership function setting interface
(2)Establish fuzzy rules and conduct fuzzy reasoning [8]. There are two input variables, each with five fuzzy subsets, so there are 25(5×5) combinations, that is, 25 rules. Utilizing the control experience accumulated by engineers for a long time, the fuzzy rules are shown in Table 1.

Table1 Δkp、Δki、Δkd fuzzy rules
The fuzzy regulation rules are written into Rule Editor and Mamdani reasoning is used to obtain fuzzy values of Δkp、Δki、Δkd.
(3)Unambiguous. Using centroid method to convert fuzzy quantities into precise digital quantities.

In order to verify the effectiveness of the provided algorithm, a fuzzy-PID controller based on PSO is simulated and compared with PID control.
In the simulation,assuming that joint 1 remains stationary and theta 1 is constant, the trajectory tracking control of joint 2 is simulated. The parameters of the two-arm serial manipulator are set as follows:m1=m2=1 kg,r1=r2=1 m,θ1=1,g=9.82 m/s. By importing the arguments into equations (1~6), the transfer function is obtained as follows:
(7)
Based on the transfer function and controlstrategy, the simulation model of the system is established in the MATLAB/Simulink environment, as shown in Fig.5. Among them,Ke,KecandKuare adjusted by PSO, and PSO.m files are written. The parameters are set as follows:m=50,D=3,G=100, inertia weightw∈[0,1], acceleration constantc1=c2=0.5.

Fig.5 The simulation model of the controller
The sine and step functions are input separately, and the position tracking simulation is performed on the manipulator. The result is shown in Fig.6.
Fig.6 a) is a sinusoidal response curve. The fuzzy-PID(FPID) controller based PSO and PID controller have a good control effect on the position tracking of the manipulator, but the tracking accuracy of the former is obviously higher than the latter. Fig.6 b) is the step response curve. The simulation results show that PID controller has large overshoot and oscillations; after fuzzy adjustment, the overshoot is reduced and the stability is better; the response speed gets higher and the overshoot is basically eliminated after PSO optimization.

Fig.6 Position tracking curve
From the simulation results, it can be seen that PID control is easy to cause oscillation. For a serial manipulator whose loads is often changing and the joints are coupled strongly, so it is difficult to obtain a satisfactory control effect. The revised parameters Δkp,Δkiand Δkdare obtained with fuzzy control rules and synthetic reasoning, and PID control parametersKp,KiandKdare modified online, so that the oscillation is weakened and the stability is improved. However, the fuzzy controller is not sensitive to some parameters, the irrational structure of the fuzzy query table, the improper selection of quantization factors and scale factors will lead to oscillation and slow response speed. PSO has a high convergence speed, which will be used to automatically adjust the quantization factorsKeandKecand the scale factorKuof the fuzzy controller online. As a result, the overshoot is small and the rise time is short, and thus the response speed of the system is necessarily faster. The control strategy adopted in this paper is not limited to the position tracking control of serial manipulators, but it can also be applied to other occasions requiring high-precision tracking control.