Path Planning for Excavator Arm: Fuzzy Logic Control Approach

is paper proposes an algorithm to design the path for automated excavator arm. e path designing is divided into two phases. Firstly, the fuzzy logic technique is used to determine the change of the path to adapt with the variation of the material after each digging period. Secondly, the B-spline algorithm is used to build the optimal trajectory. By this, the excavator can maximize the dug weight although the shape of the material is variation. e effectiveness of the algorithm is verified through computer simulation and real-time experiment. e simulation and experimental results show that the generated optimal path keeps the dug weight around the expected value regardless of the change of the environment.


Introduction
Excavator is one of the popular machines in the field of construction and transportation. e working environment of excavator is usually dirty and dangerous; so, automating the operation of the excavator is the trend recently. In the automation working mode of each machine, the reference trajectory is one of the important factors which guarantee the efficiency of the system. For this reason, the trajectory of the unmanual system should be predesigned to satisfy some specific requirements.
For the problems of optimal trajectory, the B-spline technique is widely used in many works. In [1,2], the B-spline is used to build the smooth, minimum-time, and jerk trajectories for manipulator robots. e parameters of the B-spline curves are obtained from solving the cost function with the mechanical constraints. e effectiveness of the method is verified through computer simulation and practical robots. In [3], the cubic B-spline is combined with the particle swarm optimization algorithm to generate the smooth optimal trajectory for the serial and parallel manipulators. e cubic spline interpolation is changed in the first and last knots of the optimized trajectory for having zero jerk at the beginning and end points of the trajectory. In [4], the strategy which combines the multidegree splines in the Cartesian space and multidegree B-spline in the joint space is designed for manipulator robot. e generated trajectory guarantees the controllability, bound, and continuity of the velocity and the acceleration at the initial and ending moments for the end effector.
Unlike the spline methods which are very helpful in solving optimal problems, artificial intelligent including fuzzy logic and neural network is known as a powerful tool to solve the obstacle avoidance problem. In [5][6][7], a fuzzybased path planning technique is introduced for multimobile robot with unknown dynamic environment and obstacles. ere are two fuzzy logic systems are used in these works, one is used for obstacle avoidance, and the other for target reaching [5,6] or planning speed of robots [7]. e unknown environment is detected by sensors which are located on the robots [5]. Meanwhile, the optimal motion path of the robot arm is implemented in [8] based on the fuzzy logic technique. e algorithm can shorten the time of motion and make the robots reach the target smoothly. Moreover, the robots in this work can avoid safety accidents, reduce casualties, and improve industrial productivity. e problem of the collision avoidance for 2 manipulators sharing a workspace is presented in [9]. In this context, one manipulator is considered as moving obstacle with the other; then, based on the output of the artificial potential field and the error between current position of the end effector and the goal, the fuzzy system infers the correction in displacement for each joint of each individual robot's arm. Some other applications of fuzzy logic and neural network in path planning are studied in [10,11].
For the excavator robots, recently there are some research studies which focus on this topic. In [12], the optimal trajectory for the excavator arm is built based on the velocity and acceleration of the bucket; however, measuring velocity and acceleration is difficult in practical cases. Likewise, designing the working time and torque optimal trajectory for the excavator with limitation in the actuator's force is shown in [13]. Otherwise, to create a suitable working path with surrounding environment, in [14], the laser scanner is used to obtain the information of the pile, and then the pile model is analysed and dived into a specific layer. Based on this information, the local path and then the global path are designed. While in [15], the neural network is employed in order to identify the soil model. Based on the interacting force between the bucket and pile, the optimal trajectory is designed by combing this result with reaction exerted force of the bucket. In [16], the adaptive neuron-fuzzy inference system (ANFIS) is combined with B-spline technique to generate the optimal time and jerk for the excavator arm. e scheme gives the good results with a smooth and optimal generated trajectory; however, the working condition in this case is in the static environment.
In this paper, an algorithm based on the B-spline and fuzzy logic techniques is proposed to design the path for the automated excavator arm. e optimal time and jerk for each digging period is supported by the B-spline algorithm while the fuzzy logic scheme is used to determine the change of the path after each digging period. By this way, the reference path for the excavator is adjusted after each digging period, so it can maximize the dug weight despite the variation in the shape of the material. e effectiveness of the scheme is verified through the computer simulation and experimentation. e simulation and experimental results show that the built reference path keeps the dug weight around the expected value regardless of the change of the environment. Also, the time and jerk in each digging period is minimum.

Problem Description.
Let us consider the excavator arm with a block diagram as shown in Figure 1. e excavator arm includes three parts: the boom, the stick, and the bucket.
One of the requirements for excavator during working process is that the weight of material after each excavating period should be within acceptable range to optimize the efficiency. In practical cases, however, working environment is dynamic and always changes through excavating process. Hence, if the trajectory of the excavator is fixed, it cannot ensure that dug weight is maintained during working process. In the manual excavator, the operator must observe constantly the working environment and digging process of the excavator in order to adjust the excavator trajectory suitably. To automate the excavating operation, a trajectory planning module is designed to substitute the role of the operator.
In this paper, the trajectory for the arm is designed to satisfy two requirements: (i) Optimize the time and jerk in each digging period (ii) Change the trajectory after some periods to keep the dug weight in the acceptable range as the working environment changed Before going into the detail work, the following assumptions are used: (i) e material lies under the ground (ii) e material is considered as uniform density It is noted that these assumptions are only used to support for simulation. In the simulation, the change of the material and the dug weight after each digging period are unknown. In order to get the feedback information of the dug weight, the virtual environment is built in Matlab/ SIMULINK with using these assumptions to calculate the weight and to express the change of the material. In the real world, this problem is solved easily by using a load cell, so the assumptions are not necessary.
In each period, the trajectory of the arm is divided into four stages as follows: (i) Stage 1: firstly, the bucket's angle should be opened largely to create a suitable angle with material's surface. Simultaneously, the boom's angle and the stick's angle change to move the end effect to the desired spot. (ii) Stage 2: the bucket's angle is kept constant and the bucket is forced inside the material by moving the other angles. (iii) Stage 3: the bucket angle is closed to get material inside the bucket. In this time, the boom's angle and the stick's angle are kept unchanged. (iv) Stage 4: in the last stage, by remaining the bucket's angle nearly zero, the material is kept inside the bucket. e boom's angle and the stick's angle change to bring the material out of the ground. Figure 2 shows the four stages of the trajectory in the joint coordinate, and Figure 3 shows the shape of the trajectory in the working coordinate. It is noted that the point D in Figure 3 is the deepest spot that the excavator's bucket reaches in one digging period, which is corresponding to the end of the second stage.
From the predesigned trajectory as shown in Figure 3, five via-points are obtained corresponding with the beginning and the end of all stages. Based on these via-points, a smooth and differentiable trajectory is designed to optimize the time and jerk in each period of the working. In the next section, a time and jerk optimization algorithm based on the fifth order B-spline curve is employed to improve the smoothness and time-saving properties of the trajectory.

Time and Jerk Optimization Trajectory Based on 5 th Order B-Spline.
e problem of time and jerk optimization is formulated as follows [17]: 2 Journal of Robotics Subject to: In which, k T and k J are scalars; vp is the number of viapoints; h i is time interval that the trajectory moves from i h point to (i + 1) th point; _ q(t), € q(t), and(t) € q(t) are the velocity, acceleration, and jerk of the j th joint, respectively; VC j , AC j , and JC j are the bound of velocity, acceleration, and jerk for the j th joint, respectively; and N is the number of joints.
In each period of working time, the trajectory of the arm is desired to have the form as shown in Figure 4. From this desired shape, some via-points are defined; then, the optimization problem is solved by using sequential quadratic x 0 Figure 1: Block diagram of the excavator [16].  programming. After solving this problem, the B-spline technique is used to build the smooth curve for each joint in one period of digging by using the following equation: where n is the number of control points, Q i is the control point of the B-spline, and N i,p (t) is the basic function of degree p. e basic function is given in the form of regression as follows: In (3), the values of t i , t i+1 , t i+p+1 are determined from solving optimal problem (1). Finally, the trajectory for the arm has the following form: where the values of Q i are calculated from the condition that the trajectory goes through the via-points which are predesigned.

Automatically Adjusting Trajectory's Parameter to Adapt with the Variation of the Working Environment.
During the operation of the excavator, the shape of material changes after each digging period. erefore, adjusting appropriately parameters of the trajectory is necessary to guarantee work efficiency. According to the shape of the trajectory that is described in Section 2.1, one should analyse several potential changes in the trajectory's parameters that can affect the amount of the excavated material in each period. Particularly, it can be seen easily that by shifting the deepest point of the trajectory, D(y D , z D ) in Figure 4, the dug weight can be changed. e structure of the whole system is demonstrated in Figure 4. e fuzzy blocks in Figure 4 are used to estimate the change in amount of y D and z D according to the error between the dug weight in the previous period and the desired value. Once the values of y D and z D are calculated, the complete trajectory is formulated based on the optimization algorithm which is developed in Section 2.2. e algorithm for trajectory inference is shown in Figure 5.
In Figure 5, Δz D 0 is the first chosen value as default decrease amount for z D . Since after each period, the material is taken, so z D must be declined in order that the excavator can move more deeply in the next period. In detail, if the value of Δz D 0 does not help excavating enough material as expectation, one should increase Δz D 0 by adding a small number Δz D and vice versa. is process can be formulated as follows: where the initial values are set as z D (0) � z D0 , Δz D (0) � Δz D0 , and Δm k � m * − m k , with m * is the desired amount of the dug weight and m k is the dug weight in the k th period. e first equation of (5) implies that after each period, the displacement of z D , denoted by Δz D , should be adjusted based on the weight error Δm k . For instance, if Δm k is positive, it means that the amount of displacement in the previous period is not large enough; hence, Δz D in the next step should be increased. Generally, the change in the displacement rate Δz D depends on the function of Δm k that is denoted by ε(Δm k ) as in the first equation of (5). e second equation of (5) describes the shifting of z D based on the position displacement in the first equation. Note that the initial state z D (0) and Δz D (0) are considered as default value of position and shifted position, and z D and Δz D are reset to the default value if the certain criteria are met.
From (5), it is obviously that the probable adjustment in Δz D calculated by ε(Δm k ) determines the work efficiency. erefore, the heart of the trajectory inference algorithm is the function ε(Δm k ). In this work, the ε(Δm k ) is constructed by utilizing fuzzy logic. Structure of the fuzzy logic system representing for ε(Δm k ) is illustrated in Figure 6. e input and output of the system are dug weight error Δm and adjusting amount ε(Δm k ), respectively. Membership function of input is the triangular function: In this paper, seven membership functions of input are used corresponding with linguistic variables as follows: very negative big (vnb), negative big (nb), negative small (ns), zero, positive small (pm), positive big (pb), and very positive big (vpb). e rule base of the fuzzy logic system is expressed as follows: If Δm is vnb, then ε is r 1 . If Δm is zero, then ε is r 4 . If Δm is nb, then ε is r 2 . If Δm is ps, then ε is r 5 . If Δm is ns, then ε is r 3 . If Δm is pb, then ε is r 6 . If Δm is vpb, then ε is r 7 , where [r 1 , r 2 , r 3 , r 4 , r 5 , r 6     will occur. In this case, the value of z D should be reset and the value of y D should be changed an amount Δy D 0 . In the case that singularity still occurs after changing y D and reset value of z D , it means that the manipulator has already reached its limit in workspace, and the algorithm then is terminated. e variable flag in the algorithm indicates that y D is already changed.

Optimal Trajectory for Digging Process.
In each period, after getting the deepest point from the fuzzy module, the via-points for each joint are calculated based on the desired shape. en, optimal problem (1) is solved with the constraint as shown in Table 1.
Velocity, acceleration, and jerk in both starting and ending point are set at 0. By adjust the value of k T , k J in (1), the trajectory can be created either more time-saving or smoother. In this work, two cases (k T � 1, k J � 0 and k T � 0.1, k J � 0.9) are implemented to show the effect of k T , k J to the properties of the trajectory.

Case 1. k T �1 and k J � 0
By setting k T �1 and k J � 0, the designer's intention is to reduce the time of the trajectory without considering the jerk. e joint angle and jerk responses are shown in Figure 7. It can be seen easily that the jerk of the bucket's joint reaches the limit of jerk (60 deg/s 3 ).
Case 2. k T � 0.1 and k J � 0. 9 In this case, the smoothness in working is concerned much more, joint angles and jerks are shown in Figure 8. Total time of the trajectory slightly increases compared to Case 1, from 16.17 s in the first case to 18.38 s in the second case. However, the jerk of all three joints is reduced significantly, and maximum jerk in the second case is only about 40 (deg/s 3 ).

Calculating the Change of Trajectory between Periods to Maximum the Dug Weight as the Environment Changing.
Secondly, the fuzzy logic system that is proposed in Section 2.3 is utilized to calculate the suitable trajectory based on observing dug weight error. At the first step, D is set at default value D � (y D , z D ) � (−9, −0.1), and desired dug weight is m * � 30 kg. After applying the default trajectory, excavated weight is 8.5 kg. e dug weight error in 20 periods is shown in Figure 9. It can be seen that by applying fuzzy logic to change the trajectory, the dug weight after the first step is improved significantly and the maximum error is about 5 kg, but this error occurs only in one period. e trajectories in 1 st , 3 rd , 5 th , 7 th , 11 th , 13 th , 15 th , and 17 th are shown in Figure 10.
Note that, in this example, after the 10 th digging period, the trajectory makes the system reach the kinematic limitation of the excavator, so it is reset to the highest point and the y D should be changed to adjust the horizon of the trajectory. e shape of the material after the 10 th period and the 20 th period is shown in Figure 11.

Experimental Results.
To evaluate the performances of the proposed algorithm, the experimental system has been built and illustrated in Figure 12.
e parameters of the system are as follows: e information about the dug weight is feedback to the computer from the load cell after each digging period. is signal then is fed to the fuzzy system to determine the change of the y D and z D . From these results, the optimization toolbox will solve optimal problem (1) and then the B-spline technique will be used to build the reference trajectory for the excavator arm. e experimental results are shown in Figures 13-15. Figure 13 illustrates the trajectory of the excavator arm in the joint space in the 2 nd period. In the first stage, the bucket opens to reach a suitable angle (about −82 degree), and the boom and stick angles are unchanged. Next, the bucket angle is remained, and the bucket is forced inside the material by increasing the boom angle from initial value (about −72 degree) to the value of −35 degree. In the 3 rd stage, the bucket angle increases to close the bucket and the material is kept inside the bucket during the unload process. Finally, the boom angle changes to move the material out of the ground. During the cycle of digging, the stick angle is kept constant. Figure 14 depicts the angles of the boom, stick, and bucket at the 4 th period. At this cycle, the angle of the stick is reduced to −25 degree to adapt with the change of the material. Figure 15 presents the dug weight error in each period of digging. In the first cycle, the dug weight error is quite high (about 3.5 kg) because the trajectory for this cycle is set randomly. In the 2 nd cycle, the trajectory of the arm is adjusted and then the error reduces to 0.3 kg. is trajectory is also applied to the 3 rd cycle, and the weight error increases to 0.7 kg. is big error leads to the change of the trajectory in the 4 th cycle to maximize the dug weight. e experiments are repeated for other cycles.  e simulation and experimental results illustrated in Figure 9 through 16 all indicate that the proposed algorithm has the good performances in both computer simulation and real-time experiment. e trajectory of the excavator arm is adjusted as the dug weight is out of the acceptable range; so, the weight error is kept small.

Conclusions
e combination of B-spline technique and the fuzzy logic algorithm is proposed in this paper to generate the reference trajectory for the excavator arm robot. e design procedure includes two steps: firstly, the change of trajectory in comparison with the previous period is calculated to adapt with the change of the material during digging process; secondly, the reference trajectory for the current period is determined based on the result from the first step. e contributions of the proposed algorithm can be concluded as follows: e trajectory of the excavator arm is changed automatically depending on the reduction of the material during digging process. e weight of material which is dug in each period is kept in an acceptable range despite of reduction of the material (the shape of the material pile is changed).
e algorithm uses only the information of the trajectories in the previous periods and the error between dug weight and desired value to calculate the reference trajectory. Some previous works solve this problem by using cameras [14] which may have the low reliability in the dust or dark environment. e working of the robot arm in each cycle can reach the time and jerk optimization conditions. e effectiveness of the scheme is verified through the computer simulation and laboratory size test-bed. e simulation and experimental results show that in each period of digging, the system can reach the minimum time and jerk by suitable selected parameters for the optimal function. Also, the dug weight is kept around the expected value regardless of the change of the environment.
Data Availability e datasets used in the present study are available in the article and the references.