## 4 Design of Pit-Probing Control Based on Admittance Control Method
### Comparison of Control Effects of Impedance Optimization Parameters  
The impedance parameters of the single leg directly affect the control effect, so it is difficult to obtain optimal results using the traditional empirical tuning method. Therefore, optimizing the impedance parameters by an optimization algorithm is necessary. The whale migration algorithm (WMA) [23] is a global optimization algorithm that simulates the migration and predation behaviors of humpback whales. It has the characteristics of diverse populations, simplicity, and flexibility. The process of WMA for impedance parameter optimization is as follows:  
(1) Initialization of whale positions  
At the initial stage of the algorithm, a set of whale positions needs to be randomly generated in the search space. Assume that the position vector of a whale is  
\[W_{i}=L+rand(1,D)\odot(U-L),i=1,2\ldots,N_{pop}.\]  
where:  
\(L=(L_{1},L_{2},\ldots L_{D})\) is the lower bound vector of the search space. \(U=(U_{1},U_{2},\ldots,L_{D})\) is the upper bound vector of the search space. \(rand(1,D)\) is a D-dimensional random vector whose elements are in the range of \([0,1]\);  
\(\odot\) represents the Hadamard product (element-wise product); and \(N_{pop}\) is the size of the whale population. (2) Selection of the leader  
In each generation, the whales are sorted according to their fitness values. The whale with the best fitness value is selected as the leader. Assume that the position of the leader is \(W_{Best}\); its fitness value is \(f(W_{Best})\). (3) Update of whale positions  
The update of whale positions is divided into two parts: the position update of followers and the position update of the leader. (a) Position update of followers:  
For each follower whale \(W_{i}\), the position update formula is:  
\[W_{i}^{new}=W_{Mean}+rand(1,D)\odot(W_{i-1}-W_{i})\odot(W_{Best}-W_{\text{ Mean}})\]  
Figure 9: The schematic diagram of admittance control. where \(W_{Mean}\) is the average of the positions of all current leader whales, and its calculation formula is:  
\[W_{Mean}=\frac{1}{N_{L}}\sum_{j=1}^{N_{L}}W_{j}\]  
where \(N_{L}\) is the number of leader whales, and \(W_{i-1}\) is the position of the whale preceding the follower whale \(W_{i}\). (b) Position update of the leader:  
For each leader whale \(W_{i}\), the position update formula is:  
\[W_{i}^{new}=W_{i}+rand(1,D)\odot L+rand(1,D)\odot(U-L)\]  
where \(L\) and \(U\) is the lower bound and upper bound vectors of the search place, respectively; and \(rand(1,D)\) is a D-dimensional random vector whose elements are in the range of \([0,1]\). (4) Boundary handling  
When updating the whale positions, it is necessary to ensure that the new position \(W_{i}^{new}\) still lies within the search space. If \(W_{i}^{new}\) exceeds the boundaries, project it back onto the search space. \[W_{i}^{new}=\max(L,\min(W_{i}^{new},U))\]  
(5) Calculation of fitness values  
In each generation, calculate the fitness value \(f(W_{i}^{new})\) of the position of each whale. If the fitness value of the new position is better than that of the current position, update the position:  
\[f(W_{i}^{new})\leq f(W_{i}),W_{i}=W_{i}^{new}\]  
(6) Iteration termination condition  
The algorithm automatically terminates when it reaches the maximum number of iterations or meets other stopping conditions and returns the position \(W_{Best}\) of the optimal whale as the optimal solution, that is, the optimal parameters of impedance. The fitness curve of this algorithm is shown in Figure 10. The simulation results show that the algorithm converges to a good fitness value within a small number of iterations, which verifies its excellent optimization performance. To evaluate the parameter optimization effect of the WMA, this paper constructs an impedance control model. The empirical tuning method (ETM) and the WMA are used for  
Figure 10: Curve diagram of the fitness value. parameter tuning to compare their control performances.