## 4 Control Design
### Evolutionary Algorithms
#### 4.2.2 Genetic Algorithm  
* Step 1: Coding scheme  
\(N\) binary strings with 10 bits in length are used to represent the identified parameters respectively. Then the \(N\) strings are connected into a complete chromosome to form the individual in the population.  
* Step 2: Initial population formation  
A set of parameters that need to be identified are selected as the initial parameters. Then we extend this set of parameters around the left and right sides to form an extended population search space. The initial population is assigned by a computer. First, generate random numbers that are evenly distributed between [0,1]. Then specify that the generated random numbers between [0,0.5] represents 0, and the numbers between [0.5,1] represents 0.  
* Step 3: Fitness function design  
Each individual in the population is decoded into the corresponding parameter value, and the cost function value \(J\) and the fitness function value \(f\) are obtained by using this parameter. There is \(f=\frac{1}{J}\).  
* Step 4: Evolutionary process
* Selection: Produce a new generation population by selecting operation.
* Crossover: Implement crossover operation with the cross probability \(P_{c}\).
* Mutation: Implement mutation operation with the mutation probability \(P_{m}\).  
According to fitness function values, we adopt optimal preservation and regenerate individual strategy. That is to say, when the ratio of the average fitness of individuals to the maximum fitness of the current population reaches a certain range, the best individuals are retained and the rest of the individuals are regenerated. The former makes the whole evolution process move towards the optimization direction, and the latter overcomes the precocity phenomenon in genetic search to some extent.  
* Step 5: Iteration and end condition  
Repeat steps 3 and 4 until the maximum number of iteration is reached. Then the optimal results are obtained after decoding.  
In order to facilitate contrast and analysis, the unit of the angle \(\theta\) in experiment is expressed by degrees. In the figures, PD with friction compensation stands for the PD control with friction feedforward compensation without evolutionary algorithm tuning, DE-PD denotes the PD control with friction feedforward compensation based on the DE algorithm, and GA-PD represents the PD control with friction feedforward compensation based on the GA.  
As shown in Figure 11b, the maximum angular errors of four control strategies (traditional PD control, PD with friction compensation, DE-PD and GA-PD control) were 0.85\({}^{\circ}\), 0.35\({}^{\circ}\), 0.1\({}^{\circ}\) and 0.25\({}^{\circ}\) respectively. The error curve of the PD control with friction feedforward compensation without evolutionary algorithm tuning continued the error fluctuation frequency of the traditional PD control strategy because they used the same controller parameters. This method can reduce the error to a certain extent, but, since the controller parameters and friction parameters were not optimized, the error values were still relatively large. While the friction feedforward compensation based on evolutionary algorithm greatly reduced the position tracking error of the pneumatic rotary actuator, the error values were still relatively large.  
Figure 10: Identification process of the friction parameters in the position tracking experiment.  
Figure 9: Optimization process of \(k_{\text{p}}\) and \(k_{\text{d}}\) in the position tracking experiment.  
and the DE-based case had the best performance. Figure 11c shows the velocity fluctuations of the pneumatic rotary actuator with different control algorithms, revealing that the actuator with the DE-PD control strategy was more stable.  
Figure 11: Position tracking performances under four control strategies. (**a**) Angle contrast curve; (**b**) error contrast curve; and (**c**) angular velocity contrast curve.