## 3 Control System Design
### GA Approach for Optimally Tuning the Controller Parameters  
One can see that minimizing the right-hand side of Equation (23) would result in the smallest boundedness of the tracking errors, thus enhancing the robot's performance and stability. However, better performance usually comes along with larger control energy. In the case of the proposed firefighting robot, the control energy includes the water pump energy and, especially, the kinetic energies of the two weight blocks in the weight shifting mechanism. From Equation (11), it is worth noting that the fast movement of the actuating weights makes the non-minimum phase phenomenon become worse and even causes the system to be unstable. In fact, if the acceleration of the actuating weights is separated from the vector \(\widetilde{\mathbf{D}}\) of the unmodelled dynamics, the boundedness \(\gamma\) of \(\widetilde{\mathbf{D}}\) can be considered as follows:  
\[\gamma\leq\gamma_{w}+\gamma_{d}, \tag{24}\]  
where \(\gamma_{w}\) contains the weights' acceleration and \(\gamma_{d}\) bounds the remainder. Minimizing the effect of \(\gamma_{w}\) while minimizing the tracking error strikes a balance between enhancing the system performance and reducing the non-minimum phase  
These fitness values are arranged in ascending order based on the linear ranking selection, in which the best individual is placed last and the worst one is in the first position. The \(j\)th individuals are selected for the next step via its accumulative probability \(p_{j}\), as described in Algorithm 1a. The higher a fitness value, the greater the probability of the individual being selected  
_Step 5: Crossover_  
Several individuals are randomly chosen to carry out the crossover. The number of conducted individuals is determined by a predefined crossover probability \(\kappa\). Two crossover points in the chromosome series are selected randomly. A two-point crossover method, as in Algorithm 1b, swaps the chromosomes between two points from one individual to another.  
```
a. Linear Ranking Selection for\(k=1\):\(N\) \(r=\) rand(0,\(N\)); if(\(p_{j-1}\leq r<p_{j}\))then\(l_{k}=l_{j}\) end end b. Two-point Crossover for\(m=1\):\(N\) \(k_{1}=\) rand(0,\(J\)); \(k_{2}=\) rand(0,\(J\)) if(\(\kappa>\) rand (0,1))then \(l_{m}(1\):\(k_{1}):=p1(1\):\(k_{1})\); \(l_{m}(k_{1}+1\):\(k_{2}):=p2(k_{1}+1\):\(k_{2})\); \(l_{m}(k_{2}+1\):\(k)=p1(k_{2}+1\):\(k)\) end c. Uniform Mutation for\(m=1\):\(N\) for\(k=1\):\(l\) if(\(\eta>\) rand(0,1))then\(l_{m}(k)=\) rand(0,9) end end
```  
**Algorithm 1**The evolutionary process within the GA optimization  
As in Algorithm 1c, the mutation process arbitrarily changes one or more chromosomes, with a small probability \(\eta\), in an individual to avoid premature convergence.  
Figure 5: Flow chart of the GA optimization process.  
_Step 7: Decode_  
The series of chromosomes \(\mathbf{s_{i}}\) is decoded and returns the corresponding matrices \(\mathbf{Q_{i}}\) and \(\mathbf{R_{i}}\).  
_Step 8: Fitness evaluation_  
The dependent matrices are computed in the same manner as in Step 2. The simulation is carried out to evaluate the best fitness value.  
_Step 9: Stop condition_  
The optimization process will be stopped if there is no change to the best fitness for a specified number of generations. Otherwise, the new loop will be continued.