## 4 Control Algorithm Design for Joint Torsional Vibration  
Fuzzy-PID control method has the advantages of the flexible and adaptable of the fuzzy controller and the high precision of the PID controller [26; 27]. It can effectively solve the contradiction between dynamic quality and control precision of the conventional PID controller and realize the effective control for the elastic vibration of the flexible-joint robot system. The fuzzy PID controller of the flexible-joint robot system takes the speed error (_e_) and the error change rate of joint II (_e_) as the inputs, and the increment of the PID control parameters as the outputs. Then the control parameters of the fuzzy PID controller can be expressed as follows:  
\[K_{p}\ =\ K_{p}^{\prime}+\Delta K_{p} \tag{15}\]  
Figure 4: Tracking effect and identification error of the simulation model on the angular velocity of joint I: (**a**) tracking effect; (**b**) tracking error. Figure 5: Tracking effect and identification error of the simulation model on the angular velocity of joint II: (**a**) tracking effect; (**b**) tracking error. \[K_{i} = K_{i}^{\prime}+\Delta K_{i} \tag{16}\] \[K_{d} = K_{d}^{\prime}+\Delta K_{d} \tag{17}\]  
where, \(K_{p}^{\prime}\), \(K_{i}^{\prime}\) and \(K_{d}^{\prime}\) are the initial setting values of the control parameters which are determined by the trial and error method through simulation, \(\Delta K_{p}\), \(\Delta K_{i}\) and \(\Delta K_{d}\) are the increment of the corresponding control parameters which are determined by the designed adaptive fuzzy inference machine, respectively. The fuzzy PID controller structure of the flexible-joint robot system is shown in Figure 6, where \(\omega_{2r}\) represents the desired speed of joint II. The variation ranges of the deviation, the deviation change rate, the increment of the proportional coefficient, the increment of the integral coefficient and the increment of the differential coefficient are defined as the basic domain of the fuzzy set, which can be represented as follows:  
\[e,\dot{e},\Delta K_{p},\Delta K_{i},\Delta K_{d}\ =\ (-3,-2,-1,0,1,2,3) \tag{18}\]  
The corresponding fuzzy subset is \(\{NB,NM,NS,0,PS,PM,PB\}\) and the elements in the subset represent negative big, negative middle, negative small, zero, positive small, positive middle and positive big. Considering that the shape of the triangle membership function is only related to the slope of its straight line and the calculation is simple, the membership functions of each linguistic variable are chosen as the triangle with negative middle, negative small, zero, positive small and positive middle. In addition, with the transitivity of the negative big and the positive big considered, the membership functions of the fuzzy subsets of the negative big and the positive big in each fuzzy state are selected as Gauss type, which is shown in Figure 7.  
On the basis of the membership functions of the speed deviation of joint II, the change rate of the speed deviation of joint II, the increment of the proportional coefficient, the increment of the integral coefficient and the increment of the differential coefficient, the fuzzy rules of the fuzzy PID controller for the flexible-joint robot are determined by experience and perceptual reasoning. Then, in different control stages, the proportional coefficient, the integral coefficient and the differential coefficient of the fuzzy PID controller can be adjusted adaptively.