# Mechanical Design and Gait Optimization of Hydraulic Hexapod Robot Based on Energy Conservation
## 4 Parameter Optimization
### Objective Functions  
For the HHR multi-objective optimization problem, it can be explained by three objectives as follows:1 Flow rate  
According to Equations (25) and (26), the flow quantity of the hydraulic system directly affects the energy of the robot. The minimization of the flow quantity is also significant to reduce the mass of the hydraulic driving system. The quantity of flow is closely related to the robot velocity, so the velocity is set to be constant \(v=0.5\) m/s. The first objective function can be written as follows:  
\[f_{1}(x)=\overline{Q}=\frac{1}{T}\int_{0}^{T}Qdt \tag{29}\]  
where \(\overline{Q}\) is the average flow rate of hydraulic driving system; the period of foot trajectory \(T\) is set according to the step length:  
\[T=\frac{2S}{v} \tag{30}\]  
2 Maximum pressure  
The maximum pressure is the secondary optimization objective. When the robot needs to work in a more complex environment, the system pressure can be adjusted to increase the robot output force. The smaller the maximum pressure, the greater load the robot can increase. \(P_{max}\) is the maximum pressure of all hydraulic cylinders containing a piston and rod chamber. \[f_{2}(x)=P_{max}=\max\left(P_{i,j,1},P_{i,j,2}\right) \tag{31}\]  
3 Minimum stability margin  
The third objective function is the stability margin during robot movement, which is designed to increase the motion ability of the robot's mechanical design. \(d_{i}\) is the stability margin of leg \(i\) (\(i=1\)-\(6\)). \[f_{3}(x)=d_{min}=\min(d_{i}) \tag{32}\]  
To simplify the optimization process, an overall function is adopted by multiplying the three objective functions in exponent. The absolute value of the exponent is the impact factor of the objectives, which means the significance of the objective function. When the impact factor is positive, the goal is to make the objective function as small as possible, and vice versa. The flow quantity directly affects the energy consumption, as the pressure of hydraulic system is set to be \(16\) MPa. The mass of a hydraulic system is also affected by its flow rate, so \(\lambda_{1}\) is set as the biggest to determine the leg structure and to reduce the mass of hydraulic system. The maximum pressure \(P_{max}\) and stability margin are the secondary and third optimization objectives, which are set to increase the motion diversity of the robot's mechanical design. When the \(P_{max}\) is smaller than the system pressure, the hydraulic robot can do more difficult movements. The maximization of stability margin can effectively increase the stability under external impact. According to importance, \(\lambda_{2}\) is set at the middle, and \(\lambda_{3}\) is set as the smallest. The values of lambda are adjusted by experience that the latter value is half of the previous value for better optimal results. Therefore, the impact factors of the objectives are set as \(\lambda_{1}=1\), \(\lambda_{2}=0.5\), \(\lambda_{3}=-0.25\). The overall optimization objective function can be obtained as  
\[F(x)=f_{1}(x)^{\lambda_{1}}f_{2}(x)^{\lambda_{2}}f_{3}(x)^{\lambda_{3}} \tag{33}\]  
4.2 Constraints  
From the geometry of the leg structure, limitation of the hydraulic system, and motion stability, a number of non-linear constraints can be derived:1. The distance between the trajectory of the front foot and middle foot should be larger than the allowance, as well as the distance between the trajectory of the middle and hind foot. \[ \begin{array}{l}b+m+s_{1}-s_{4}>S+\varepsilon_{1}\\ b-m+s_{4}-s_{5}>S+\varepsilon_{1}\end{array} \] (34)
2. The foot trajectory should be in the foot workspace. \(L_{max}\) and \(L_{min}\) are the maximum and minimum length from the hip joint to the foot of all the legs. \(\theta_{1 min}\), \(\theta_{1 max}\), \(\theta_{2 min}\), \(\theta_{2 max}\) are the set angular range for the hip and knee joints. \[ \begin{array}{l}L_{\max}<L_{1}+L_{2}\\ L_{\min}>\max(L_{1}-L_{2},0)\\ \theta_{1}\in[\theta_{1\min},\theta_{1\max}]\\ \theta_{2}\in[\theta_{2\min},\theta_{2\max}]\end{array} \] (35)
3.