# Trajectory Planning and Optimization for a Par4 Parallel Robot Based on Energy Consumption
## 4 Trajectory Optimization Based on GWO
### Trajectory Optimization
#### 4.2.2 Trajectory Optimization Based on the GWO Algorithm  
Next, we arrive at the main question of this research work--the minimum mechanical energy consumption and the optimization of the parameters \(e\) and \(f\). For the trajectory optimization of the Par4 parallel robot, the mechanical energy consumption is taken as the fitness value and the parameters \(e\) and \(f\) are selected as the elements of the wolf's position vector. The specific design scheme of the trajectory planning optimization is described as follows: First, the value ranges of parameters \(e\) and \(f\) are determined by the pick-up span and the pick-up height respectively, i.e., the value range of \(e\) is \([0,\)\(B_{a}/2]\), and the value range of \(f\) is \([0,\)\(H_{a}]\). The pick-up span can be computed from the pick-and-place endpoint coordinates, and the pick-up height can be set at an appropriate value by the user. Then, according to the current distances from Wolf \(\omega\) to Wolf \(\alpha\), Wolf \(\beta\) and Wolf \(\delta\), namely \(D_{1}\), \(D_{2}\), and \(D_{3}\), respectively, as shown in Figure 3, we can calculate the likely location of the prey by Equations (28)-(31), which falls within the range of Radius r in Figure 4, representing the possible optimal value range of parameters \(e\) and \(f\) in the trajectory planning of the Par4 parallel robot. Then, we substitute the obtained optimal \(e\) and \(f\) values into the gate-shaped path formula which has been planned above, and the corresponding minimum mechanical energy consumption is obtained by following the fifth-order or sixth-order polynomial motion law. Finally, we determine whether the mechanical energy consumption after several iterations is at the minimum. If it is at the minimum, the trajectory optimization is ended; otherwise, we continue to find the optimal parameters \(e\) and \(f\) by using the GWO algorithm. In Figure 4, \(c_{1}\), \(c_{2}\), \(c_{3}\), \(a_{1}\), \(a_{2}\), and \(a_{3}\) correspond to the parameters in Equations (28)-(30). Among them, \(c_{1}\), \(c_{2}\), and \(c_{3}\) represent the weights of Wolf \(\alpha\), Wolf \(\beta\), and Wolf \(\delta\), respectively, in the searching calculation, and the numerical calculations all adopt the formula of Equation (33); \(a_{1}\), \(a_{2}\), and \(a_{3}\) represent the distance factors from Wolf \(\alpha\), Wolf \(\beta\), and Wolf \(\delta\), respectively, to the current Wolf \(\omega\), whose calculations follow Equation (32).  
The optimization of the planned trajectory with the GWO algorithm has the following advantages:  
1. The GWO algorithm takes a simple structure and legible logic, making the programming easily accessible and the program statement more concise. Therefore, the GWO to some extent achieves a complementary effect for the complex programmed control system of the Par4 parallel robot itself, acting as a time balancer in the total running time.  
2. The parameters of the GWO algorithm need little setting, making the operation of the Par4 parallel robot more convenient and easier when changing the parameters, such as the pick-and-place endpoints and the pick-up height.  
3. In the GWO algorithm, the searching method around the location of the three leader wolves is adopted, which helps towards a fast convergence.  
Although the GWO algorithm has the disadvantage of easily falling into the local optimum when all the three leader wolves are in the same local optimal region, it has little impact on the practical application with limited parameters in a fixed range under certain conditions. Therefore, the possibility of the algorithm falling into the local optimum is greatly reduced when applied in the above trajectory optimization.