Optimal Trajectory Planning of Grinding Robot Based on Improved Whale Optimization Algorithm

Robot will be used in the grinding industry widely to liberate human beings from harsh environments. In the grinding process, optimal trajectory planning will not only improve the processing quality but also improve the machining efficiency. -e aims of this study are to propose a new algorithm and verify its efficiency in achieving the optimal trajectory planning of the grinding robot. An objective function has been defined terms of both time and jerk. Improved whale optimization algorithm (IWOA) is proposed based on whale optimization algorithm (WOA) and differential evolution algorithm (DE). Mutation operation and selection operation of DE are imitated in the part of initialization to process the population initialized by WOA, and then, the search tasks of WOA are performed. Motion with a constant velocity of the end-effector is considered during fine grinding. -e continuity of acceleration and velocity will be achieved by minimizing jerk, and at the same time, smooth robot movement can be obtained. Cubic spline interpolation is implemented. A six-axis industrial robot is used for this research. Results show that optimal trajectory planning based on IWOA is more efficient than others. -is method presented in this paper may have some indirect significance in robot business.


Introduction
e optimal trajectory planning of a robot is based on the optimization of parameters and the improvement of methods. e most significant optimization criteria are the minimum execute time, minimum energy, and minimum jerk. Trajectory planning in Cartesian space is intuitive, and the movement trajectory and attitude of the end-effector are easy to observe. But, this method did not consider problems caused by kinematic singularities [1][2][3][4]. Trajectory planning in joint space can avoid those problems. e joint trajectories are obtained by interpolating functions which satisfy kinematic and dynamic constraints. e trajectory based on a system controller is easier to adjust in joint space [5][6][7].
A time-optimal trajectory planning method with constraints of velocity, acceleration, and jerk is presented in [8].
is optimization method adopts a hybrid optimization strategy and solves the problem from path description, kinematics of the robot, and constraints. e resulting trajectory is optimal relative to time, but not smooth enough.
An analytic method is used to obtain the solution of the minimum jerk trajectory of a point-to-point path. A minimum-time/jerk algorithm is presented, and it is verified by experiments in [9]. A direct analytical method is proposed in [10] to achieve the linear transformation of the industrial robot's characteristic equation, which is useful for industrial robot trajectory planning and control. According to [11], time-optimal trajectory planning can be considered as a nonconvex problem. Previous robot trajectory planning mainly focused on time optimization [12,13]. In the recent years, multiobjective optimization under kinematic constraint has been under attention so as to improve the efficiency and quality and save energy. Meanwhile, many algorithms used to achieve optimal trajectory planning of robot are emerged. In order to get the global minimum jerk for trajectory planning of a 2-dof planar robot, a new method using GA is proposed in [14]. Aiming at trajectory planning of a free-floating robot, a jerk optimal trajectory planning algorithm based on particle swarm optimization algorithm is proposed in [15]. Joint Angle trajectory is smooth and continuous, and the driving torque of the robot joint angle is minimized while the attitude adjustment of the free-floating space robot is completed. To obtain the optimal solution for the trajectory of the space robot, a multiobjective particle swarm optimization method is used in [16]. Invasive Weed Optimization algorithm is used to research the optimal solution for a robot arm in [17]. We consider general asymmetric bounds on velocity, acceleration, and jerk [18] and present a complete trajectory generation algorithm. A multiobjective differential evolution algorithm proposed in [19] is used in trajectory planning of a mobile robot. A multiobjective teaching learning-based optimization method proposed in [20] is used to achieve optimal trajectory planning of a welding robot. In [21], a combination of the modified potential field and numerical approach-based Jacobian to achieve path planning of a redundant robot is proposed. An improved B-spline curve is proposed, which made the angular velocity and angular acceleration smooth and continuous during trajectory movement, and the path of the robot end-effector in the Cartesian space is improved while guaranteeing the smoothness of joint movement [22]. Cubic spline is used to interpolate trajectories to ensure the continuity of jerk in [14]. Based on improved cuckoo search algorithm, a 3-5-3 polynomial interpolation trajectory planning algorithm is proposed in [23]. Aiming at an autonomous operation of the mobile system, Pirník et al. [24] present a designed algorithm, which is able to integrate inertial sensor data and can improve the trajectory planning efficiency. e optimization methods proposed by different scholars are applied in specific scenes. In this paper, IWOA is used in grinding robot optimal trajectory planning with certain objective function, and the optimization results are interpolated by cubic spline. e paper is organized as follows: in Section 2, an optimization problem is introduced and objective function is defined. Section 3 describes the details of WOA and IWOA. In Section 4, grinding path and constraints of kinematic are given. Section 5 shows the results of some simulation and comparison of the jerk and work time before and after optimization. In Section 6, the conclusion is given, and the reasons of optimization results are discussed.

Define Objective Function
e smoothness of robot motion plays an important role in robot grinding because it will help reduce vibration and improve the grinding quality. In order to grind the workpiece surface effectively and obtain uniform material removal, it is necessary to plan each point on the grinding path. Better continuity of speed and acceleration can prevent the mechanical body from shock, overshoot, and oscillation [25]. By reducing the jerk, the stability of the robot can improve, and the continuity of speed and acceleration can be achieved. But, the execution time will increase significantly and will affect the production beat. erefore, trajectory planning is needed to meet the requirements of minimum time and minimum jerk in some extent by introducing weight parameters K T and K J . Firstly, the grinding path is defined in the Cartesian space, and then, the inverse kinematics is solved for the ABB IRB2600 robot to obtain the angles of each joint. Considering the constraints of speed, acceleration, and jerk, the objective function is defined as follows: with where j � 1, 2, . . . , M is the number of joints and i � 1, 2, . . . , n is the number of points in the grinding path. e more the points extracted on the curve, the closer it is to the contour curve of the workpiece. But, too many path points will affect the grinding efficiency of the robot, so defining an appropriate number of path points is important. K T and K J are weight coefficients. l i is the computational time interval between two continuous points on the joint path. t w is the whole grinding time. |P j ′ (t)|, |P j ″ (t)| , and |P ‴ j (t)| are velocity, acceleration, and jerk of the jth joint, respectively. Vm j , Am j , and Jm j are the upper bounds of velocity, acceleration, and jerk of the jth joint, respectively. e first part of (1) represents the running time of the robot, and the second part is an expression about jerk. Jerk is vectors, so to introduce it into the objective function, taking its square for operation, cubic spline interpolation is selected.
where i � 1, 2, . . . , n and j � 1, 2, . . . , M. According to the positions in joint space, time interval, and the constraints of the velocity and acceleration, the robot acceleration matrix is obtained and used to solve (3).

Improved WOA
3.1. WOA. WOA is an efficiency nature-inspired metaheuristic optimization algorithm, which mimics the social behavior of humpback whales. e efficiency of the WOA is evaluated by solving 29 mathematical optimization problems and six structural optimization problems, and optimization results demonstrate that WOA is very competitive compared to the state-of-the-art optimization methods [26]. WOA is used to solve many industrial problems and illustrated in the literature [27][28][29].
Step 1: the population is initialized Step 2: the fitness value of each search agent is calculated, and the current best individual is selected Step 3: the strategy of shrinking circle and up with spiral-shape is selected Step 4: it is checked whether each search agent exceeds the search boundary, the fitness value of each search agent is calculated, and the optimal position is updated Step 5: the maximum iteration is reached, and the final results are obtained Details about Step 3 are as follows: 3.1.1. Exploitation. Humpback whales move around their prey in a shrinking circle, while following a spiraling path. To model this behavior, we assume that there is a 50% chance of choosing between shrinking encircling mechanism and a spiral model to update the whale's position. e mathematical model is as follows: where p is a random number in [0,1], t is the current it-

Encircling Prey.
WOA assumes that the current solution is the target prey. First, the best search agent is defined, and then, the other search agents will attempt to update their positions towards the best search agent. is behavior is expressed in the following equations: e vectors A → and C → are calculated as follows: where a → is linearly decreased from 2 to 0 and r → is a random vector in [0, 1].

Prey Search.
Humpback whales search randomly based on each other's position. erefore, a random value greater than 1 or less than −1 is used to force the search agent away from a reference individual. e position of the search agent is updated according to the random selected search agent. e mechanism and the | A → | > 1 allow WOA achieve global search. e mathematical model is as follows: where X rand ���� �→ is a random position vector chosen from the current population.
3.2. IWOA. DE has been proved to be an effective global search algorithm in solving complex global optimization problems. DE and WOA are combined to propose a new algorithm (IWOA), which has better ability of global optimization and great robust. Figure 1 is P-code of IWOA.
By imitatating the operation of mutation and selection in DE, the initialize program of WOA is improved. is new initialize program makes population more representative and easier to obtain a global optimal solution. Population size is considered as the number of whales, G m is the maximum number of iterations, mutation factor F is calculated by (11), and F 0 is the initial value of F:

Mutation Operation.
For the whale position X h,G (h � 1, 2, . . ., N), a new position V h,G+1 can be generated by the following formula: where N is the number of whales and r1 and r2 are different integers randomly selected in [1, N] and instead of index h. e mutation factor is a real constant on [0, 2], and the amplification of differential vector X r2,G − X r3,G is controlled.

Selection Operation.
In order to determine whether vector V h,G+1 can become new positions for whales in the iteration of G + 1, it will be compared with X h,G , and if the fitness value of the former is better than the latter, X i,G will be replaced by V h,G+1 in the G + 1 iteration; otherwise, X h,G will be retained. en, positions of whales are updated.

Implement
In the process of robot fine grinding, keeping the grinding speed as a constant contributes to control the material removal rate, so as to effectively control the grinding quality. erefore, the grinding speed is introduced as the intermediate variable and optimized by IWOA. en, the optimal motion parameters of each joint of the robot are obtained. e constraints of speed, acceleration, and jerk are shown in Table 1.
e first grinding path is divided into 50 trajectory points, as shown in Figure 2.
Mathematical Problems in Engineering en, the joint displacements of six axis for the ABB IRB2600 grinding robot are obtained by inverse kinematics solving. e value of K T and K J are chosen after trial of varying the values of each from 0 to 1 and set as 0.4 and 0.6, respectively. e joint positions are used as the input of the IWOA, and MATLAB 2018b software is used to complete the optimization process. ABB RobotStudio software is used for simulation.

Results
e jerk values before and after optimization with respect to the intermittent points on the grinding path are illustrated in Figures 3(a)-3(f ). In Figure 3(g), every joint's position and orientation are given. e comparison of whole grinding time before and after optimization with four kinds of algorithm is shown in Table 2.
From Figure 3, it can be observed that jerk after optimization is significantly reduced compared with jerk before optimization and fluctuated around a constant value. e maximum value of jerk before optimization for every joint is 2.50 deg/s 3 , 2.50 deg/s 3 , 2.50 deg/s 3 , 250 deg/s 3 , 3.75 deg/s 3 , and 33.75 deg/s 3 . e maximum value of jerk after optimization for every joint is 0.144 deg/s 3 , 0.034 deg/s 3 , 0.066 deg/s 3 , 4.136 deg/s 3 , 0.039 deg/s 3 , and 0.042 deg/s 3 . No matter before or after optimization, the fluctuation range of joint 4 is significantly larger than others.
According to Table 2, it can be observed that grinding time after optimization is increased. e growing rate by using GA is 111.95%, using DE is 95.97%, using WOA is 71.26%, and using IWOA is 68.67%. Also, the growing rate is the smallest by using IWOA.

Discussion and Conclusions
In this paper, the objective function including an expression of jerk and time of total work for every joint IWOA is proposed by combining DE and WOA, and IWOA is used to get optimal trajectory of the grinding robot. After optimization, the goal of jerk being smaller is achieved and time is not increased significantly.
Jerk is reduced significantly by using IWOA. After optimization, jerk of every joint has reduced significantly. By reducing jerk, the movement path is smoother and the speed Initialize the whales population X i (i = I, 2, ..., n) Perform mutation operations by the eq. (12) Perform selection operations Update the whales population X i ' Calculate the fitness of each search agent X * = the best search agent while (t < maximum number of iterations) for each search agent Update a, A, C, I, and p if1 (p < 0.5) if2 (|A| < 1) Update the position of the current search agent by the eq. (6) else if2 (|A| ≥ 1) Select a random search agent (X rand ) Update the position of the current search agent by the eq. (10) end if2 else if1(p ≥ 0.5) Update the position of the current search by the eq. (4) end if1 end for Check if any search agent goes beyond the search space and amend it Calculate the fitness of each search agent Update X * if there is a better solution t = t + 1 end while return X *  x-axis  Mathematical Problems in Engineering and acceleration are more continuous, which can improve the grinding quality to some extent. e jerk fluctuation range of joint 4 is significantly larger than that of others because joint 4 has the biggest range of motion so as to ensure the end-effector passes every point on the grinding path.
IWOA is effective in performing an optimal trajectory planning of a robot. Compared with other three algorithms, the growing rate of time is the smallest by using IWOA. e reason is IWOA performa mutation and selection operation for the population initialized by WOA. Mutation and selection operation of IWOA mimic the operation of DE. x Before After (3) (4) (5)  Mathematical Problems in Engineering en, the initial population becomes more representative, and the algorithm is more robust.
is new method of optimal trajectory planning based on IWOA will be useful in the industry of robot grinding, for example, the grinding of welding line for automobile and its accessories and burrs for hardware products.

Data Availability
All data are defined according to the needs of research and results are achieved by software.

Conflicts of Interest
e authors declare that they have no conflicts of interest.