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

Authors: Ting Wang; Zhijie Xin; Hongbin Miao; Huang Zhang; Zhenya Chen; Yunfei Du
Journal: Mathematical Problems in Engineering
 (2020)

---

## Abstract

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. The 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. The 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. This method presented in this paper may have some indirect significance in robot business.


---

## Body

## 1. Introduction

The optimal trajectory planning of a robot is based on the optimization of parameters and the improvement of methods. The 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–4]. Trajectory planning in joint space can avoid those problems. The joint trajectories are obtained by interpolating functions which satisfy kinematic and dynamic constraints. The trajectory based on a system controller is easier to adjust in joint space [5–7].A time-optimal trajectory planning method with constraints of velocity, acceleration, and jerk is presented in [8]. This optimization method adopts a hybrid optimization strategy and solves the problem from path description, kinematics of the robot, and constraints. The 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.The 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. The paper is organized as follows: in Section2, 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.


## 2. Define Objective Function

The 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. Therefore, trajectory planning is needed to meet the requirements of minimum time and minimum jerk in some extent by introducing weight parameters KT and KJ. 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:(1)min F=KT∑i=1n−1li+KJ∑J=1M∑i=1n−11li∫t=0twPj‴t2dt,with(2)Pj′t≤Vmj,Pj″t≤Amj,Pj‴t≤Jmj,where j=1,2,…,M is the number of joints and i=1,2,…,n is the number of points in the grinding path. The 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. KT and KJ are weight coefficients. li is the computational time interval between two continuous points on the joint path. tw is the whole grinding time. Pj′t,Pj″t, and Pj‴t are velocity, acceleration, and jerk of the jth joint, respectively. Vmj,Amj, and Jmj are the upper bounds of velocity, acceleration, and jerk of the jth joint, respectively.The 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.(3)li=maxjPj,i+1−Pj,iP′,i=1,2,…,n;j=1,2,…,M,(4)P‴=Pj,i+1″−Pj,i″li,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).


## 3. Improved WOA

### 3.1. WOA

WOA is an efficiency nature-inspired meta-heuristic optimization algorithm, which mimics the social behavior of humpback whales. The 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–29].Step 1: the population is initializedStep 2: the fitness value of each search agent is calculated, and the current best individual is selectedStep 3: the strategy of shrinking circle and up with spiral-shape is selectedStep 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 updatedStep 5: the maximum iteration is reached, and the final results are obtainedDetails 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. The mathematical model is as follows:(5)X⟶t+1=X∗⟶t−A⟶⋅D⟶,ifp<0.5,D′⟶⋅ebl⋅cos2πl+X∗⟶t,ifp≥0.5,where p is a random number in [0,1], t is the current iteration, A⟶ and D⟶ are coefficient vectors, X∗⟶ is the position of the best solution so far, and X⟶ is the position vector. X∗ is a better solution that will be updated in each iteration. D′⟶=X∗⟶t−X⟶t indicates the distance of the ith whale to the prey, b is a constant for defining the shape of logarithmic spiral, and l is a random number in [−1, 1].


#### 3.1.2. 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. This behavior is expressed in the following equations:(6)D⟶=C⟶⋅X∗⟶t−X⟶t,(7)X⟶t+1=X∗⟶t−A⟶⋅D⟶.The vectorsA⟶ and C⟶ are calculated as follows:(8)A⟶=2a⟶⋅r⟶−a⟶,(9)C⟶=2⋅r⟶,where a⟶ is linearly decreased from 2 to 0 and r⟶ is a random vector in [0, 1].


#### 3.1.3. Prey Search

Humpback whales search randomly based on each other’s position. Therefore, a random value greater than 1 or less than −1 is used to force the search agent away from a reference individual. The position of the search agent is updated according to the random selected search agent. The mechanism and theA⟶ > 1 allow WOA achieve global search. The mathematical model is as follows:(10)D⟶=C⟶⋅Xrand⟶−X⟶,(11)X⟶t+1=Xrand⟶−A⟶⋅D⟶,where Xrand⟶ 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. Figure1 is P-code of IWOA.Figure 1
Pseudocode of IWOA.By imitatating the operation of mutation and selection in DE, the initialize program of WOA is improved. This new initialize program makes population more representative and easier to obtain a global optimal solution. Population size is considered as the number of whales,Gm is the maximum number of iterations, mutation factor F is calculated by (11), and F0 is the initial value of F:(12)F=F0⋅2exp1−GmGm.


#### 3.2.1. Mutation Operation

For the whale positionXh,G (h = 1, 2, …, N), a new position Vh,G+1 can be generated by the following formula:(13)Vh,G+1=Xr1,G+F⋅Xr2,G−Xr3,G,where N is the number of whales and r1 and r2 are different integers randomly selected in [1, N] and instead of index h. The mutation factor is a real constant on [0, 2], and the amplification of differential vector Xr2,G−Xr3,G is controlled.


#### 3.2.2. Selection Operation

In order to determine whether vectorVh,G+1 can become new positions for whales in the iteration of G + 1, it will be compared with Xh,G, and if the fitness value of the former is better than the latter, Xi,G will be replaced by Vh,G+1 in the G + 1 iteration; otherwise, Xh,G will be retained. Then, positions of whales are updated.


## 3.1. WOA

WOA is an efficiency nature-inspired meta-heuristic optimization algorithm, which mimics the social behavior of humpback whales. The 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–29].Step 1: the population is initializedStep 2: the fitness value of each search agent is calculated, and the current best individual is selectedStep 3: the strategy of shrinking circle and up with spiral-shape is selectedStep 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 updatedStep 5: the maximum iteration is reached, and the final results are obtainedDetails 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. The mathematical model is as follows:(5)X⟶t+1=X∗⟶t−A⟶⋅D⟶,ifp<0.5,D′⟶⋅ebl⋅cos2πl+X∗⟶t,ifp≥0.5,where p is a random number in [0,1], t is the current iteration, A⟶ and D⟶ are coefficient vectors, X∗⟶ is the position of the best solution so far, and X⟶ is the position vector. X∗ is a better solution that will be updated in each iteration. D′⟶=X∗⟶t−X⟶t indicates the distance of the ith whale to the prey, b is a constant for defining the shape of logarithmic spiral, and l is a random number in [−1, 1].


### 3.1.2. 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. This behavior is expressed in the following equations:(6)D⟶=C⟶⋅X∗⟶t−X⟶t,(7)X⟶t+1=X∗⟶t−A⟶⋅D⟶.The vectorsA⟶ and C⟶ are calculated as follows:(8)A⟶=2a⟶⋅r⟶−a⟶,(9)C⟶=2⋅r⟶,where a⟶ is linearly decreased from 2 to 0 and r⟶ is a random vector in [0, 1].


### 3.1.3. Prey Search

Humpback whales search randomly based on each other’s position. Therefore, a random value greater than 1 or less than −1 is used to force the search agent away from a reference individual. The position of the search agent is updated according to the random selected search agent. The mechanism and theA⟶ > 1 allow WOA achieve global search. The mathematical model is as follows:(10)D⟶=C⟶⋅Xrand⟶−X⟶,(11)X⟶t+1=Xrand⟶−A⟶⋅D⟶,where Xrand⟶ is a random position vector chosen from the current population.


## 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. The mathematical model is as follows:(5)X⟶t+1=X∗⟶t−A⟶⋅D⟶,ifp<0.5,D′⟶⋅ebl⋅cos2πl+X∗⟶t,ifp≥0.5,where p is a random number in [0,1], t is the current iteration, A⟶ and D⟶ are coefficient vectors, X∗⟶ is the position of the best solution so far, and X⟶ is the position vector. X∗ is a better solution that will be updated in each iteration. D′⟶=X∗⟶t−X⟶t indicates the distance of the ith whale to the prey, b is a constant for defining the shape of logarithmic spiral, and l is a random number in [−1, 1].


## 3.1.2. 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. This behavior is expressed in the following equations:(6)D⟶=C⟶⋅X∗⟶t−X⟶t,(7)X⟶t+1=X∗⟶t−A⟶⋅D⟶.The vectorsA⟶ and C⟶ are calculated as follows:(8)A⟶=2a⟶⋅r⟶−a⟶,(9)C⟶=2⋅r⟶,where a⟶ is linearly decreased from 2 to 0 and r⟶ is a random vector in [0, 1].


## 3.1.3. Prey Search

Humpback whales search randomly based on each other’s position. Therefore, a random value greater than 1 or less than −1 is used to force the search agent away from a reference individual. The position of the search agent is updated according to the random selected search agent. The mechanism and theA⟶ > 1 allow WOA achieve global search. The mathematical model is as follows:(10)D⟶=C⟶⋅Xrand⟶−X⟶,(11)X⟶t+1=Xrand⟶−A⟶⋅D⟶,where Xrand⟶ 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. Figure1 is P-code of IWOA.Figure 1
Pseudocode of IWOA.By imitatating the operation of mutation and selection in DE, the initialize program of WOA is improved. This new initialize program makes population more representative and easier to obtain a global optimal solution. Population size is considered as the number of whales,Gm is the maximum number of iterations, mutation factor F is calculated by (11), and F0 is the initial value of F:(12)F=F0⋅2exp1−GmGm.


### 3.2.1. Mutation Operation

For the whale positionXh,G (h = 1, 2, …, N), a new position Vh,G+1 can be generated by the following formula:(13)Vh,G+1=Xr1,G+F⋅Xr2,G−Xr3,G,where N is the number of whales and r1 and r2 are different integers randomly selected in [1, N] and instead of index h. The mutation factor is a real constant on [0, 2], and the amplification of differential vector Xr2,G−Xr3,G is controlled.


### 3.2.2. Selection Operation

In order to determine whether vectorVh,G+1 can become new positions for whales in the iteration of G + 1, it will be compared with Xh,G, and if the fitness value of the former is better than the latter, Xi,G will be replaced by Vh,G+1 in the G + 1 iteration; otherwise, Xh,G will be retained. Then, positions of whales are updated.


## 3.2.1. Mutation Operation

For the whale positionXh,G (h = 1, 2, …, N), a new position Vh,G+1 can be generated by the following formula:(13)Vh,G+1=Xr1,G+F⋅Xr2,G−Xr3,G,where N is the number of whales and r1 and r2 are different integers randomly selected in [1, N] and instead of index h. The mutation factor is a real constant on [0, 2], and the amplification of differential vector Xr2,G−Xr3,G is controlled.


## 3.2.2. Selection Operation

In order to determine whether vectorVh,G+1 can become new positions for whales in the iteration of G + 1, it will be compared with Xh,G, and if the fitness value of the former is better than the latter, Xi,G will be replaced by Vh,G+1 in the G + 1 iteration; otherwise, Xh,G will be retained. Then, positions of whales are updated.


## 4. 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. Therefore, the grinding speed is introduced as the intermediate variable and optimized by IWOA. Then, the optimal motion parameters of each joint of the robot are obtained. The constraints of speed, acceleration, and jerk are shown in Table1.Table 1
Kinematic limits of a six-axis robot.
JointVelocity (deg/s)Acceleration (deg/s2)Jerk (deg/s3)11751001202175100903175100125436010020053601001806500100230The first grinding path is divided into 50 trajectory points, as shown in Figure2.Figure 2
Defined trajectory points in the Cartesian coordinate system.Then, the joint displacements of six axis for the ABB IRB2600 grinding robot are obtained by inverse kinematics solving. The value ofKT and KJ are chosen after trial of varying the values of each from 0 to 1 and set as 0.4 and 0.6, respectively.The 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.


## 5. Results

The jerk values before and after optimization with respect to the intermittent points on the grinding path are illustrated in Figures3(a)–3(f). In Figure 3(g), every joint’s position and orientation are given. The comparison of whole grinding time before and after optimization with four kinds of algorithm is shown in Table 2.Figure 3
Jerk values of joints with respect to each trajectory point before and after optimization. (a) Jerk values of joint 1, (b) jerk values of joint 2, (c) jerk values of joint 3, (d) jerk values of joint 4, (e) jerk values of joint 5, (f) jerk values of joint 6, and (g) joints of the robot.
(a)(b)(c)(d)(e)(f)(g)Table 2
The comparison of whole grinding time before and after optimization with algorithms.
AlgorithmGrinding time before (s)Grinding time after (s)Growing rate (%)GA20.0842.56111.95DE20.0839.5595.97WOA20.0834.3971.26IWOA20.0833.8768.67From Figure3, it can be observed that jerk after optimization is significantly reduced compared with jerk before optimization and fluctuated around a constant value. The maximum value of jerk before optimization for every joint is 2.50 deg/s3, 2.50 deg/s3, 2.50 deg/s3, 250 deg/s3, 3.75 deg/s3, and 33.75 deg/s3. The maximum value of jerk after optimization for every joint is 0.144 deg/s3, 0.034 deg/s3, 0.066 deg/s3, 4.136 deg/s3, 0.039 deg/s3, and 0.042 deg/s3. No matter before or after optimization, the fluctuation range of joint 4 is significantly larger than others.According to Table2, it can be observed that grinding time after optimization is increased. The 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.


## 6. 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 and acceleration are more continuous, which can improve the grinding quality to some extent. The 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. The 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. Then, the initial population becomes more representative, and the algorithm is more robust.This 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.



---

*Source: 3424313-2020-08-19.xml*