Next Article in Journal
Yield Adaptability and Stability in Field Pea Genotypes Using AMMI, GGE, and GYT Biplot Analyses
Previous Article in Journal
Desorption and Sorption Isotherms of Different Varieties of Hemp Seeds with Different Percentages of Dockage under Different Temperatures and Different Relative Humidities
Previous Article in Special Issue
Artificial Neural Network-Based Seedling Phenotypic Information Acquisition of Plant Factory
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Real-Time Parametric Path Planning Algorithm for Agricultural Machinery Kinematics Model Based on Particle Swarm Optimization

School of Electronic and Information Engineering, Tongji University, Shanghai 201804, China
*
Author to whom correspondence should be addressed.
Agriculture 2023, 13(10), 1960; https://doi.org/10.3390/agriculture13101960
Submission received: 13 August 2023 / Revised: 27 September 2023 / Accepted: 5 October 2023 / Published: 8 October 2023

Abstract

:
In order to meet the obstacle avoidance requirements of unmanned agricultural machinery in operation, it is necessary to plan a path to avoid obstacles in real time after obstacles are detected. However, the traditional path planning algorithm does not consider kinematic constraints, which makes it difficult to realize the plan, thus affecting the performance of the path tracking controller. In this paper, a real-time path planning algorithm based on particle swarm optimization for an agricultural machinery parametric kinematic model is proposed. The algorithm considers the agricultural machinery kinematic model, defines the path satisfying the kinematic model through a parametric equation, and solves the initial path through the analytic method. Then, considering the constraints of obstacles, acceleration, and turning angle, two objective functions are proposed. The particle swarm optimization algorithm is used to search the path near the initial path which satisfies the obstacle avoidance condition and has a better objective function value. In addition, the influence of the algorithm parameters on the running time is analyzed, and the method of compensating the radius of the obstacle is proposed to compensate the influence of the discrete time on the obstacle collision detection. Finally, experimental results show that the algorithm can plan a path in real time that avoids any moving obstacles and has a better objective function value.

1. Introduction

Agriculture is developing towards the goal of improving the utilization rate of resources. Fine agriculture is the core direction of improving the utilization rate of resources, and automatic navigation of agricultural machinery is the prerequisite of fine agriculture. As society develops, people’s living standards steadily improve, and the demand for agricultural products also increases; however, due to the attraction of urbanization to the labor force and population aging factors, the agricultural labor force is increasingly limited. Agricultural machinery automation can reduce the demand for labor, reduce labor intensity, reduce production costs, and improve production efficiency, which is an important technical means to alleviate the agricultural labor shortage. In the operation of unmanned agricultural machinery, obstacle avoidance and path planning are important aspects related to the safety of agricultural machinery itself, reducing economic losses and energy consumption. With the proposal of the concept of unmanned farms, unmanned agricultural machinery is the focus of future development, and reducing manual intervention is the only way for unmanned farms to operate. However, even before the operation of unmanned agricultural machinery, some static obstacles will be dealt with manually, such as telephone poles, electromechanical wells, stacked materials, etc., and there may still be some moving obstacles, such as personnel, other agricultural machinery, transport vehicles, etc. Therefore, it is necessary to propose a path planning method considering the kinematic model of agricultural machinery, so that agricultural machinery can automatically avoid obstacles after detecting obstacles and continue working.
Traditional path planning algorithms generally simplify the subject into a particle without considering the constraint conditions of the subject. Therefore, although the shortest path to avoid obstacles can be generated, the subject is unable to complete the path, which results in tracking control jumping and reduced control performance and stability. The RoadMap algorithm uses a simple connected graph to represent configuration space. It will first build a continuous graph of the space in the construction phase, which usually takes a lot of time, but the final graph can be used for multiple queries and modified a little. In the query phase, the search algorithm will search the path from the starting point to the target point. The algorithm includes Visibility Graph [1] and Voronoi Diagram [2]. The graph search algorithm relies on the known environment map and the obstacle information in the map to construct the path from the starting point to the end point, including depth first and breadth first. Such algorithms are generally heuristic algorithms, including Dijkasta algorithm [3], A* algorithm [4], D* algorithm [5,6], etc. Li et al. [7] proposed a path planning method combining the improved A* algorithm and improved DWA algorithm to avoid temporary obstacles. Zhang et al. [8] introduced the radar threat estimation function and a 3D bidirectional sector multilayer variable step search strategy into the conventional A-star algorithm. RRT series algorithms [9] rapidly expand tree-like paths to search most areas in space and find feasible paths, which is an algorithm for random sampling of state space. By carrying out collision detection on sampling points, it avoids large computation caused by the accurate modeling of space and effectively solves the path planning problems of high-dimensional space and complex constraints. However, due to randomness, the path found by this kind of algorithm is often not the optimal solution. Wang et al. [10] proposed an improved RRT* algorithm, including dynamic step size, steering angle constraints, and optimal tree reconnection. The artificial potential field method [11] is a common algorithm for local path planning. The algorithm assumes that the subject is moving under a virtual force field, the target point exerts gravity on the subject to guide the object to move towards it, and the obstacle exerts repulsive force on the subject to avoid collision with it. However, this algorithm can easily fall into the local optimal solution. The VFH series algorithm [12] is an improvement on the artificial potential field method. By calculating the traveling cost in each direction, the direction is selected. Theoretically, the area with low cost is convenient for traveling, but it may offset the target direction.
With the vigorous development of subjects with more constraints on kinematic models, such as driverless cars, the path planning problem needs to introduce kinematic models to make it possible for subsequent subjects to be controlled according to the planned path. The Hybrid A* algorithm is an improved algorithm of the A* algorithm, considering the actual motion constraints of objects and defining more complex cost functions. However, as it is still a graph search algorithm, Hybrid A* algorithm is only applicable to static environments. The parametric trajectory method [13,14,15] directly uses dynamic or kinematic models to generate trajectories conforming to model constraints. The algorithm proposed by Yuan et al. [13] contains uneven inputs, which could not be directly used for control. Therefore, Yang et al. [15] proposed smoothing the inputs by rotating the coordinate system and adding intermediate points. On this basis, Yuan et al. [16] proposed to use the dynamics model for modeling, use the ten-degree polynomial to fit the path of the car-like robot, replace the objective function of the shortest path with the objective function of the path closest to the straight line, and conclude that the optimal path solution can be obtained by directly using the analytical solution method. On this basis, a calculation method is further given to find the second-best solution that can avoid obstacles when considering obstacles. However, due to the replacement of the objective function and the addition of the hypothesis of the approximate method, the path obtained by the algorithm is often not optimal, resulting in too long a path. Kuo et al. [17] proposed a dual-optimization trajectory planning algorithm, which consists of optimal path planning and optimal motion profile planning for robot manipulators, where path planning is based on parametric curves. Ghosh et al. [18] proposed the kinematic constraint Bi-RRT (KB-RRT) algorithm to limit the number of nodes generated and generate smooth trajectories combined with kinematic constraints. Essaidi et al. [19] proposed a minimum-time trajectory planning algorithm considering constraints, including obstacle avoidance, boundary conditions, maximum articulation angle between the two platforms, dynamic capacities of the actuators, and dynamic stability of the system. Faroni et al. [20] proposed a predictive approach to trajectory scaling subject to joint velocity, acceleration, and torque limitations.
In addition, there are also path planning algorithms using optimization algorithms, including PSO [21]. Such algorithms can only be used as global path planning due to the problem of search efficiency but cannot be used for real-time path planning directly. Kun et al. [22] proposed a path planning algorithm based on an improved obstacle avoidance strategy and double ant colony optimization algorithm. How to model the path planning problem into an optimization problem that can be solved quickly is the key to this kind of method. Xue et al. [23] combined the particle swarm optimization algorithm with the sine cosine algorithm to improve the performance of PSO, which maintains a balance in exploration and exploitation. Xu et al. [24] proposed a new approach for the smooth path planning of a mobile robot based on a new quartic Bezier transition curve and an improved particle swarm optimization algorithm. In fact, optimization algorithms are used in many fields. Chen et al. [25] used an optimization algorithm in multi-agents to achieve better performance. Ker et al. [26] introduced an optimization algorithm to improve the efficiency of the farm supply and demand relationship. Wang et al. [27] used optimization algorithms in machine selection to push the method widely used in real companies.
However, there are not many studies about the obstacle avoidance path planning of agricultural machinery. Liu et al. [28] proposed a path consisting of three circular arcs, which can achieve obstacle avoidance for single small obstacles. This kind of path is fixed and cannot solve problems in different situations. Zhao et al. [29] proposed a collision-free path planning method using the minimum snap algorithm to enable a tractor to safely navigate from one point to another. This method directly uses a polynomial to describe the path, resulting in too many optimization parameters and low optimization efficiency.
On the basis of the above studies, this paper proposes a real-time path planning algorithm based on particle swarm optimization [21] for an agricultural machinery parametric kinematic model. On the basis of Yuan [16], the overly complex dynamic model is replaced by a kinematic model, and the search space is defined adaptively through quantitative experiments. The particle swarm optimization algorithm is used to optimize the path that avoids obstacles and meet the operation requirements of agricultural machinery. In addition, two objective functions are designed according to different tasks. The following sections are organized as follows: Section 2 introduces the algorithm in detail according to the research process. Section 3 outlines the experiment of the static obstacle and dynamic obstacle. Section 4 gives a conclusion of this paper.

2. Materials and Methods

This section introduces the research process method, as shown in Figure 1. Firstly, parametric equations are established through the kinematic model; then, the optimization space of parameters and the objective function are determined, and, finally, the efficiency of the algorithm is analyzed.

2.1. Parameter Equation Path Considering Kinematic Model

The kinematics model of typical wheeled agricultural machinery can be described according to Equation (1):
x ˙ = v cos θ y ˙ = v sin θ θ ˙ = v tan ϕ l v ˙ = a c c
where ( x , y ) represents the Cartesian coordinate of the middle point of the rear axle of agricultural machinery, v represents the linear velocity of agricultural machinery, θ represents the heading angle of agricultural machinery, ϕ represents the steering angle of agricultural machinery, a c c represents the acceleration of agricultural machinery, and l is the wheel base.
For the given initial time and arrival time, agricultural machinery has initial constraints q 0 at t 0 and end constraints q f at t f , where
q 0 = ( x 0 , y 0 , θ 0 , ϕ 0 , v 0 , a c c 0 ) q f = ( x f , y f , θ f , ϕ f , v f , a c c f )
In practical applications, the initial time t 0 is generally 0 and the other state constraints are the current state of the machinery. And, in the end constraint, since the radius of obstacles on the farm is generally much smaller than the desired path, the ideal path to avoid obstacles should be similar to the length of the desired path, so the end time t f can be calculated from the given initial and end positions and the average speed with Equation (3), which is defined in Equation (2):
t f = 2 ( x f x 0 ) 2 + ( y f y 0 ) v 0 + v f + t a
where t a is an adjustable parameter that can be set to be larger for smooth operation and smaller for efficient operation of the machinery. In this way, the machinery is able to avoid obstacles by slightly accelerating. In addition, in order to ensure the stable state of the machine at the end, ϕ f and a c c f are set as 0.
Thus, the parameter equation path x d ( t ) should satisfy Equation (4) according to the initial and end limits:
x d ( t 0 ) = x 0 = h 1 x ˙ d ( t 0 ) = v 0 cos θ 0 = h 2 x ¨ d ( t 0 ) = a c c 0 cos θ 0 v 0 2 sin θ 0 tan ϕ 0 l = h 3 x d ( t f ) = x f = h 4 x ˙ d ( t f ) = v f cos θ f = h 5 x ¨ d ( t f ) = a c c f cos θ f v f 2 sin θ f tan ϕ f l = h 6
According to Equation (4), x d ( t ) needs 6 parameters at least. In the same way, y d ( t ) must satisfy a similar constraint. Adding one degree of freedom, the following polynomial trajectory is proposed:
x d ( t ) = a 0 + a 1 t + a 2 t 2 + a 3 t 3 + a 4 t 4 + a 5 t 5 + a 6 t 6 y d ( t ) = b 0 + b 1 t + b 2 t 2 + b 3 t 3 + b 4 t 4 + b 5 t 5 + b 6 t 6
which defines:
x d ( t 0 ) = h 1 , y d ( t 0 ) = h 11 x ˙ d ( t 0 ) = h 2 , y ˙ d ( t 0 ) = h 12 x ¨ d ( t 0 ) = h 3 , y ¨ d ( t 0 ) = h 13 x d ( t f ) = h 4 , y d ( t f ) = h 14 x ˙ d ( t f ) = h 5 , y ˙ d ( t f ) = h 15 x ¨ d ( t f ) = h 6 , y ¨ d ( t f ) = h 16
Combining Equations (4) and (5):
a 0 + a 1 t 0 + a 2 t 0 2 + a 3 t 0 3 + a 4 t 0 4 + a 5 t 0 5 = h 1 a 6 t 0 6 a 1 + 2 a 2 t 0 + 3 a 3 t 0 2 + 4 a 4 t 0 3 + 5 a 5 t 0 4 = h 2 6 a 6 t 0 5 2 a 2 + 6 a 3 t 0 + 12 a 4 t 0 2 + 20 a 5 t 0 3 = h 3 30 a 6 t 0 4 a 0 + a 1 t f + a 2 t f 2 + a 3 t f 3 + a 4 t f 4 + a 5 t f 5 = h 1 a 6 t f 6 a 1 + 2 a 2 t f + 3 a 3 t f 2 + 4 a 4 t f 3 + 5 a 5 t f 4 = h 2 6 a 6 t f 5 2 a 2 + 6 a 3 t f + 12 a 4 t f 2 + 20 a 5 t f 3 = h 3 30 a 6 t f 4
which can be described in matrix form:
L a = H 1 M a 6
where
L = 1 t 0 t 0 2 t 0 3 t 0 4 t 0 5 0 1 2 t 0 3 t 0 2 4 t 0 3 5 t 0 4 0 0 2 6 t 0 12 t 0 2 20 t 0 3 1 t f t f 2 t f 3 t f 4 t f 5 0 1 2 t f 3 t f 2 4 t f 3 5 t f 4 0 0 2 6 t f 12 t f 2 20 t f 3 a = [ a 0 , a 1 , a 2 , a 3 , a 4 , a 5 ] T H 1 = [ h 1 , h 2 , h 3 , h 4 , h 5 , h 6 ] T M = [ t 0 6 , 6 t 0 5 , 30 t 0 4 , t f 6 , 6 t f 5 , 30 t f 4 ] T
H 1 is defined in Equation (6).
Similarly, y d ( t ) must satisfy:
L b = H 2 M b 6 ,
where
b = [ b 0 , b 1 , b 2 , b 3 , b 4 , b 5 ] T H 2 = [ h 11 , h 12 , h 13 , h 14 , h 15 , h 16 ] T
H 2 is defined in Equation (6).
For a practical mission, it is always true that t f > t 0 . Hence, the matrix L is nonsingular. Thus, a and b can be calculated via Equation (10):
a = L 1 ( H 1 M a 6 ) b = L 1 ( H 2 M b 6 )
The planned trajectory ( x d , y d ) can be rewritten as:
x d ( t ) = f ( t ) a + a 6 t 6 = f ( t ) L 1 ( H 1 M a 6 ) + a 6 t 6 y d ( t ) = f ( t ) b + b 6 t 6 = f ( t ) L 1 ( H 2 M b 6 ) + b 6 t 6
where
f ( t ) = [ 1 , t , t 2 , t 3 , t 4 ]
In short, given the initial constraints q 0 at t 0 and end constraints q f at t f , fixed a 6 and b 6 give a path, satisfying the constraints mentioned above, which is described in Equation (11). The following algorithm optimizes a 6 and b 6 to obtain a path.

2.2. Definition of Search Space

Before using an optimization algorithm, defining an appropriate search space can help the algorithm find a relatively optimal solution faster. Therefore, it is necessary to first determine the search space of a 6 and b 6 to improve the solving efficiency of the optimization algorithm. To determine the search space, the search center and search radius for each variable need to be determined.
Determine the search center first. Generally, the objective function of a path planning algorithm is the path length:
J s ( x d , y d ) = t 0 t f ( x ˙ d 2 + y ˙ d 2 ) d t
However, since the objective function contains the square root, the optimal analytic solution cannot be derived directly. Therefore, the objective function is considered, as Equation (12) shows, which indicates that the path is expected to be a straight line from the starting point to the end point as far as possible.
J l ( x d , y d ) = t 0 t f [ ( x d x ) 2 + ( y d y ) 2 ] d t
where
x = k x ( t t 0 ) + x 0 y = k y ( t t 0 ) + y 0 k x = x f x 0 t f t 0 , k y = y f y 0 t f t 0
Expanding Equation (13):
J l = t 0 t f { [ f ( t ) L 1 ( H 1 M a 6 ) + a 6 t 6 x ] 2 + [ f ( t ) L 1 ( H 2 M b 6 ) + b 6 t 6 y ] 2 } d t = t 0 t f [ ( f 1 a 6 + f 2 x ) 2 + ( f 1 b 6 + f 3 y ) 2 ] d t = p 1 a 6 2 + 2 p 2 a 6 + p 1 b 6 2 + 2 p 3 b 6 + p 4 = p 1 ( a 6 + p 2 p 1 ) 2 + p 1 ( b 6 + p 3 p 1 ) 2 + p 4 p 2 2 p 1 p 3 2 p 1
where
f 1 = t 6 f ( t ) L 1 M f 2 = f ( t ) L 1 H 1 f 3 = f ( t ) L 1 H 2 p 1 = t 0 t f f 1 2 d t p 2 = t 0 t f f 1 ( f 2 x ) d t p 3 = t 0 t f f 1 ( f 3 y ) d t p 4 = t 0 t f [ ( f 2 x ) 2 + ( f 3 y ) 2 ] d t
The optimal solution of Equation (13) is obtained:
a 6 * = p 2 p 1 b 6 * = p 3 p 1
The optimal trajectory can be described as follows:
x d * ( t ) = f ( t ) L 1 ( H 1 M a 6 * ) + a 6 * t 6 y d * ( t ) = f ( t ) L 1 ( H 2 M b 6 * ) + b 6 * t 6
An optimal analytical solution of the objective function can be obtained directly from Equation (16) efficiently. Therefore, a 6 * and b 6 * are chosen as the center of the search space of a 6 and b 6 .
Then, the search radius is determined via quantitative experiments. Figure 2 shows the paths for different orders of a 6 and b 6 . Figure 2a shows 100 paths when the values of a 6 and b 6 are set as an order of 10 6 , which are within a range of 10 m. Figure 2b shows 100 paths when the values of a 6 and b 6 are set as an order of 10 8 , which are within a range of 0.1 m. Quantitative experiments show that the order of a 6 and b 6 directly affects the scope of search paths, and the scope order of paths is linearly related to the order of a 6 and b 6 . In addition, the value of a 6 and b 6 is also related to the total time; thus, different total times require a different search radius.

2.3. Particle Swarm Optimization

The particle swarm optimization algorithm [21] is a heuristic optimization algorithm that uses multiple particles to simulate the cooperation process of bird predation to find the solution that maximizes the value of the objective function. The focus of the particle swarm optimization algorithm is to determine the objective function and search space, which is described in Section 2.2. This section defines the objective function.
For a general path planning algorithm, the objective function is defined by Equation (12), and the objective of the optimization algorithm is to find the shortest path. However, due to the particularity of the work of unmanned agricultural machinery, the unmanned agricultural machinery is expected to avoid obstacles and, as far as possible, to keep itself running along the expected path to complete the task better. Therefore, two kinds of objective functions are defined, one defined by Equation (12) and the other defined by Equation (17), to find a path that minimizes the area enclosed by the path and the expected path.
J a ( x d , y d ) = t 0 t f A x d B y d + C ( B x ˙ d A y ˙ d ) 2 + C 2 A 2 + B 2 d t
where A , B , C are the parameters of the expected path A x + B y + C = 0 .
In addition, the path should satisfy the constraint of not colliding with obstacles. When the path of obstacles is known, the path needs to satisfy Equation (18).
[ x d ( t ) x o i ( t ) ] 2 + [ y d ( t ) y o i ( t ) ] 2 ( r 0 + r i ) 2 , t [ t 0 , t f ]
where x o i ( t ) and y o i ( t ) are the parametric equation of obstacles with respect to time, for i = 1 , 2 , , n , r 0 is the radius of the unmanned agricultural machinery, and r i is the radius of the obstacles, for i = 1 , 2 , , n . To meet the condition described above, define the objective function for avoiding obstacles, as in Equation (19).
J O b ( x d , y d ) = 0 , t [ t 0 , t f ] , [ x d ( t ) x o i ( t ) ] 2 + [ y d ( t ) y o i ( t ) ] 2 ( r 0 + r i ) 2 10 6 , t [ t 0 , t f ] , [ x d ( t ) x o i ( t ) ] 2 + [ y d ( t ) y o i ( t ) ] 2 < ( r 0 + r i ) 2
where 10 6 can be any number much larger than the length of the path, as the goal of path planning is to avoid obstacles first.
In addition, when determining the path, the acceleration and steering angle at each moment can be calculated according to the parametric equation of the path. According to the characteristics of the actual operation of agricultural machinery, acceleration constraints and steering angle constraints need to be added, which are expressed by Equation (20) and Equation (21), respectively.
J a c c = 0 , t [ t 0 , t f ] , a c c l l a c c ( t ) a c c u l 10 6 , t [ t 0 , t f ] , a c c ( t ) < a c c l l | a c c ( t ) > a c c u l
J ϕ = 0 , t [ t 0 , t f ] , ϕ l l ϕ ( t ) ϕ u l 10 6 , t [ t 0 , t f ] , ϕ ( t ) < ϕ l l | ϕ ( t ) > ϕ u l
where a c c l l and a c c u l represent the lower limit and the upper limit of acceleration for agricultural machinery; ϕ l l and ϕ u l represent the lower limit and the upper limit of the steering angle for agricultural machinery.
Based on the above constraints and objective functions, the objective function of the particle swarm optimization algorithm is represented by Equation (22) when the path length is selected as the target and by Equation (23) when the target is to find a path close to the expected path.
J P S O 1 ( x d , y d ) = J s J acc J ϕ
J P S O 2 ( x d , y d ) = J a J acc J ϕ
It is worth noting that when the optimization result of the objective function value is greater than the preset large number, it means that the current optimization algorithm has not found a path to avoid obstacles, while when the optimization result of the objective function value is less than the preset large number, it means that the current optimization algorithm has found a path to avoid obstacles and is relatively better. For the optimization algorithm, avoiding obstacles is the priority, so it has a large penalty. Only when the path does not conflict with the obstacle, other objective functions of the optimized path are considered. In addition, since the parametric equation of obstacle with time is used in J O b ( x d , y d ) , this optimization method can theoretically avoid any dynamic obstacle with a known trajectory, but for an obstacle with too large a radius, it needs to search in a larger search space with a higher end time, so that the algorithm can plan the path that the agricultural machine can achieve. Considering the actual farm scene, it is considered that the radius of the obstacle is far less than the path length, so it is feasible in practical application. What is more, the end speed and end heading angle can also be used as search variables, which can help the optimization algorithm find the second-best solution when the obstacle is close to the end point and still reach the end point with a small deviation in the speed and heading angle, and then the control algorithm can be used to complete the desired path tracking.

2.4. Algorithm Efficiency Analysis

In the running process of the algorithm, the initial solution is solved first. Since the analytical solution is directly solved, the running time is short, about 0.002 s. The main time cost of the algorithm is the process of solving the objective function in the following particle swarm optimization algorithm. As described in Section 2.3, the objective function needs discrete calculation, so the calculation of the objective function is related to the total time and discrete time. In addition, obstacle collision detection is also related to the number of obstacles. The number of iterations and populations in the particle swarm optimization algorithm determines the calculation times of the objective function. In short, the running time of the algorithm is positively correlated with the total time, the number of iterations, and the number of populations, and it is negatively correlated with the discrete time. The number of obstacles has little influence on the running time of the algorithm compared with other factors.

2.5. Influence of Discrete Time on Obstacle Collision Detection

In obstacle collision detection, agricultural machinery coordinates and obstacle coordinates cannot be detected at every moment, so it is necessary to conduct obstacle detection after the discretization of the agricultural machinery path and obstacle path. Therefore, the discrete time has an impact on obstacle detection. In the past, the radius of the obstacle or the collision radius of the moving subject was generally expanded. In this section, the expanded value was quantitatively defined.
As shown in Figure 3, the worst case of collision detection after discretization is that discretized points A and B are close to obstacles, and then the compensation value r o i can be calculated via Equation (24).
r o i = r o i 2 + ( v d t 2 ) 2
where v is the mean speed, and d t is the discrete time. In addition, v d t cannot be greater than the minimum diameter of all obstacles; otherwise, collision detection may fail.

3. Experiments

This section presents the simulation results of the proposed algorithm. The algorithm was run on a personal computer with AMD Ryzen 5 4600H with Radeon [email protected] GHz CPU, 16 GB of RAM, 64-bit Windows 10 professional operating system, and running in python. It should be noted that python is inefficient, and the speed of the algorithm can be further improved if executed in C++, although the algorithm in python is already running at the required speed. In addition, since the average speed of unmanned agricultural machines is only 2 m/s, the discretization step size is selected as 0.5 s, which can be changed. However, too short a discretization step size would lead to inefficiency, and too long a discretization step size will lead to inaccurate objective function value and collision judgement. The wheelbase of unmanned agricultural machinery is set as 3 m. The collision radius of agricultural machinery is set as 2 m, and the distance of obstacle detection of agricultural machinery is set as 30 m. Due to the particularity of unmanned agricultural machinery operation, the following experiments utilizes Equation (23) as objective function.

3.1. Static Obstacle Avoidance Experiment

Before the operation of unmanned agricultural machinery, the global path is planned by the complete path planning algorithm. As shown in Figure 4a, the operating area of the unmanned agricultural machinery is a rectangle farm 100 m long and 100 m wide, and the global path is represented by the red curve. The unmanned agricultural machinery runs straight along the crop line in the operating area. When it reaches the edge of the operating area, it turns around and enters the next crop line. Suppose that the farm contains a static obstacle with a radius of 2 m in (50, 50).
Figure 4b shows the actual driving path of the unmanned agricultural machinery after its full operation. Before detecting an obstacle or detecting an obstacle that will not collide, the unmanned agricultural machinery runs according to the global path. When the agricultural machinery reaches (48, 20), it is 30 m away from the obstacle and detects the obstacle that will collide with the agricultural machinery if it continues to run. Therefore, the algorithm runs for the first time with initial constraints and end constraints set as follows:
t 0 = 0 , q 0 = [ 48 , 20 , π 2 , 0 , 2 , 0 ] , t f = 45 , q f = [ 48 , 100 , π 2 , 0 , 2 , 0 ]
The population of the particle swarm optimization algorithm is set as 10, the number of iterations is set to 10, and the running time is 0.5 s. The result path is shown in Figure 5a. Agricultural machinery runs along this path and continues to run along the global path after arriving at (48, 100). When the agricultural machinery reaches (50, 80), it is 30 m away from the obstacle and detects the obstacle that will collide with the agricultural machinery if it continues to run. Therefore, the algorithm runs for the second time with initial constraints and end constraints set as follows:
t 0 = 0 , q 0 = [ 50 , 80 , π 2 , 0 , 2 , 0 ] , t f = 45 , q f = [ 50 , 0 , π 2 , 0 , 2 , 0 ]
The other parameters are set to be the same as the first time, and the running time is the same. The result path is shown in Figure 5b. Agricultural machinery runs along this path and continues to run along the global path after arriving at (50, 0). When the agricultural machinery reaches (52, 20), it is 30 m away from the obstacle and detects the obstacle that will collide with the agricultural machinery if it continues to run. Therefore, the algorithm runs for the third time with initial constraints and end constraints set as follows:
t 0 = 0 , q 0 = [ 52 , 20 , π 2 , 0 , 2 , 0 ] , t f = 45 , q f = [ 52 , 100 , π 2 , 0 , 2 , 0 ]
The other parameters are set the same as the first time, and the running time is the same. The result path is shown in Figure 5c. Agricultural machinery runs along this path and continues to run along the global path after arriving at (52, 100).
In order to prove that the path planned by the proposed algorithm conforms to the dynamic model, the velocity, heading angle, acceleration, and steering angle of the path at x equal to 50 are shown in Figure 6. All of them have good conductibility and are within the expected range, in accordance with the kinematic model of unmanned agricultural machinery.

3.2. Dynamic Obstacle Avoidance Experiment

In practical application, dynamic obstacles are detected and tracked via computer vision. After obtaining continuous spatial coordinates of a certain time, the motion trajectory of dynamic obstacles is estimated, and a parametric equation with time as a parameter is generated, as shown in the following equation. After estimating the motion trajectory, collision detection is performed first. If a collision occurs, the algorithm is run to obtain the obstacle avoidance path trajectory; otherwise, the algorithm is not run. It should be emphasized that the parameter t of the above parametric equation is unified with the initial time t 0 in the algorithm; that is, the coordinate obtained in the parametric equation when t is equal to t 0 is the same as the coordinate of the dynamic obstacle at the initial time. When the algorithm is used, t 0 is usually set as 0; then, the constant term of the parametric equation is the dynamic obstacle coordinate when the algorithm is run, and the coefficient of the primary term is the dynamic obstacle velocity component estimated by the continuous coordinate of the dynamic obstacle in a period of time before the algorithm is used.
x o i = x o i 0 + v o i x ( t t 0 ) y o i = y o i 0 + v o i y ( t t 0 )
Suppose that there is a dynamic obstacle with a radius of 2 m, whose equation of locus is as follows:
x o 1 = 50 + 3.6 t y o 1 = 50
The initial constraints and end constraints are set as:
t 0 = 0 , q 0 = [ 50 , 20 , π 2 , 0 , 2 , 0 ] , t f = 45 , q f = [ 50 , 100 , π 2 , 0 , 2 , 0 ]
The path before optimization and path, speed, and heading angle after optimization is shown in Figure 7. When facing a dynamic obstacle, due to the setting of the objective function, the algorithm preferentially avoids obstacles by adjusting the running speed of agricultural machinery, in which case, the objective function value remains optimal, while the objective function values will be sub-optimal if the path is altered. As shown in Figure 7a, before optimization, the agricultural machinery is closest to the dynamic obstacle at 18 s and collision occurs. In Figure 7b, the position of the agricultural machinery and the dynamic obstacle is shown at 18 s, and no collision occurs. As shown in Figure 7c, the agricultural machinery first slows down to wait for the obstacle to leave the expected path and then accelerates to the normal speed to reach the target point. As shown in Figure 7d, the heading angle is almost unchanged. It is worth mentioning that if the radius of the dynamic obstacle is too large and the agricultural machinery decelerates to zero but still cannot avoid the collision with the obstacle, the algorithm will plan a path for the agricultural machinery to avoid the dynamic obstacle by changing the moving path of the agricultural machinery.

3.3. Comparison for Algorithm with Two Objective Functions

An experiment for comparing the algorithm with two objective functions is carried out. When facing a static obstacle with a radius of 2 m in (50, 50), the results of the algorithm with two objective functions are shown in Figure 8.
As shown in Figure 8a, agricultural machinery remains straight to the goal point, while in Figure 8b, agricultural machinery drives back to the desired path, which meets the requirements of agricultural machinery. So, the objective function defined by Equation (17) is normally used in agricultural machinery, while the objective function defined by Equation (12) can be used in other fields.

3.4. Comparison with Other Algorithms

An experiment comparing the proposed algorithm with classical path planning algorithms is carried out. Facing the same static obstacle with a radius of 2 m in (50, 50), the results of the A* algorithm and an analytical algorithm [16] for parametric path are shown below.
As shown in Figure 9a, the path planned by A* algorithm is not differentiable, which means not feasible for agricultural machinery. What’s more, the path also cannot meet the requirements of agricultural machinery operation. As shown in Figure 9b, the path planned using the analytical method in [16] for the parametric path is feasible, and the algorithm is extremely efficient. But it cannot meet the requirements of agricultural machinery as well. Comparing with two typical algorithms, the proposed algorithm combines the advantages of both. The path is feasible and satisfies the kinematic model. The design of the objective function also makes the algorithm flexible for different scenes.

3.5. Experiments for PSO Parameters

Epochs and the number of populations are the most important parameters in PSO. In order to further study the effect of the parameters of PSO on the results of the proposed algorithm, experiments are carried out. In experiments, other parameters are the same as above.
As is shown in Table 1, with the increase in the epochs and the number of populations in the algorithm, the time consumed is increasing, and the algorithm can find better solutions. It can be seen that when the number of populations is too small, the population path may be randomly initialized to solutions that do not satisfy the constraints, leading to optimization failure. Increasing the number of populations has a more profound effect on the results of the algorithm than epochs.

4. Conclusions

In this paper, the kinematic model of agricultural machinery is used to construct a parametric curve under the initial constraints and end constraints. The curve contains two degrees of freedom, a 6 and b 6 . On this basis, firstly, the center of the search space is obtained directly via the analytical method. Through quantitative experiments, the search radius is determined. Then, the particle swarm optimization algorithm is used to optimize the path that satisfies the constraints of obstacles, acceleration, and steering angle and has relatively optimal objective function value. The objective function can select the length of the path, the area enclosed by the path, and the expected path. And the algorithm’s operating efficiency and the effect of discrete time on obstacle collision detection are analyzed. Finally, the effectiveness and real-time performance of the algorithm for static and dynamic obstacles are verified through experiments.
The uniqueness of the proposed algorithm is that it is aimed at the working purpose of the actual operation of agricultural machinery, while other obstacle avoidance path planning algorithms limit the optimization objective to the path length or operation efficiency. In addition, the proposed algorithm can satisfy the kinematic model constraints, and the planned path is feasible, directly controlled by algorithms. Although the proposed algorithm can obtain better obstacle avoidance path planning results in simulation, the parameterized path method still has limitations. Some parameters such as termination time need to be set manually. Therefore, more effective automatic setting methods of such parameters can be explored in the future.

Author Contributions

Conceptualization, H.Y. and L.X.; methodology, H.Y., L.X. and J.Y.; software, J.Y.; validation, J.Y.; formal analysis, J.Y., H.Y. and L.X.; investigation, J.Y. and H.Y.; resources, L.X. and H.Y.; data curation, J.Y.; writing—original draft preparation, J.Y.; writing—review and editing, H.Y. and L.X.; visualization, J.Y.; supervision, H.Y. and L.X.; project administration., L.X. and H.Y.; funding acquisition, L.X. and H.Y. All authors have read and agreed to the published version of the manuscript.

Funding

This work was supported by Ministry of Education—China Mobile Research Fund major project: (MCM2020—J-2).

Institutional Review Board Statement

Not applicable.

Data Availability Statement

Not applicable.

Acknowledgments

Thanks to Qiang Fu, Rui Tang and Jianwei Du in China Mobile (Chengdu) Industry Research Institute for their strong support.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Masehian, E.; Amin-Naseri, M.R. A voronoi diagram-visibility graph-potential field compound algorithm for robot path planning. J. Robot. Syst. 2004, 21, 275–300. [Google Scholar]
  2. Wang, X.; Quan, L.I.; Guo, Q.; He, W.U.; Fu, F.U. The generalization and construction of Voronoi diagram and its application on delimitating city’s affected coverage. J. Cent. China Norm. Univ. 2002, 36, 107–111. [Google Scholar]
  3. Dijkstra, E.W. Two problems in connection with graphs. Numer. Math. 1959, 1, 269–271. [Google Scholar] [CrossRef]
  4. Hart, P.E.; Nilsson, N.J.; Raphael, B. A formal basis for the heuristic determination of minimum cost paths. IEEE Trans. Syst. Sci. Cybern. 1968, 4, 100–107. [Google Scholar] [CrossRef]
  5. Stentz, A. Optimal and efficient path planning for partially-known environments. In Proceedings of the IEEE International Conference On Robotics and Automation, San Diego, CA, USA, 8–13 May 1994; Volume 1, p. 3310. [Google Scholar]
  6. Stentz, A. The focused D* Algorithm for Real-Time Replanning. In Proceedings of the International Joint Conference on Artificial Intelligence, Vienna, Austria, 23–29 July 2000. [Google Scholar]
  7. Li, X.; Hu, X.; Wang, Z.; Du, Z. Path Planning Based on Combination of Improved A-STAR Algorithm and DWA Algorithm. In Proceedings of the 2nd International Conference on Artificial Intelligence and Advanced Manufacture (AIAM), Manchester, UK, 15–17 October 2020. [Google Scholar]
  8. Zhang, Z.; Wu, J.; Dai, J.; He, C. Optimal path planning with modified A-Star algorithm for stealth unmanned aerial vehicles in 3D network radar environment. J. Aerosp. Eng. 2022, 236, 72–81. [Google Scholar]
  9. Kim, J.; Ostrowski, J.P. Motion planning of aerial robot using rapidly-exploring random trees with dynamic constraints. In Proceedings of the 20th IEEE International Conference on Robotics and Automation (ICRA), Taipei, Taiwan, 14–19 September 2003. [Google Scholar]
  10. Wang, H.; Li, G.; Hou, J.; Chen, L.; Hu, N. A Path Planning Method for Underground Intelligent Vehicles Based on and Improved RRT* Algorithm. Electronics 2022, 11, 294. [Google Scholar] [CrossRef]
  11. Khatib, O. Real-time obstacle avoidance for manipulators and mobile robots. Int. J. Robot. Res. 1990, 5, 90–98. [Google Scholar] [CrossRef]
  12. Borenstein, J.; Koren, Y. The vector field histogram-fast obstacle avoidance for mobile robots. IEEE Trans. Robot. Autom. 1991, 7, 278–288. [Google Scholar] [CrossRef]
  13. Yuan, H.; Qu, Z. Optimal real-time collision-free motion planning for autonomous underwater vehicles in a 3D underwater space. IET Control Theory Appl. 2009, 3, 712–721. [Google Scholar] [CrossRef]
  14. Qu, Z.; Jing, W.; Plaisted, C.E. A new analytical solution to mobile robot trajectory generation in the presence of moving obstacles. IEEE Trans. Robot. 2004, 20, 978–993. [Google Scholar] [CrossRef]
  15. Yang, J.; Daoui, A.; Qu, Z.; Wang, J.; Hull, R.A. An Optimal and Real-Time Solution to Parameterized Mobile Robot Trajectories in the Presence of Moving Obstacles. In Proceedings of the 2005 IEEE International Conference on Robotics and Automation, Barcelona, Spain, 18–22 April 2005. [Google Scholar]
  16. Yuan, H.; Shim, T. Model based real-time collision-free motion planning for mobile robots in unknown dynamic environments. In Proceedings of the 2011 14th International IEEE Conference on Intelligent Transportation Systems (ITSC), Washington, DC, USA, 5–7 October 2011. [Google Scholar]
  17. Kuo, Y.L.; Lin, C.C.; Lin, Z.T. Dual-optimization trajectory planning based on parametric curves for a robot manipulator. Int. J. Adv. Robot. Syst. 2020, 17, 1135–1145. [Google Scholar] [CrossRef]
  18. Ghosh, D.; Nandakumar, G.; Narayanan, K.; Honkote, V.; Sharma, S. Kinematic Constraints Based Bi-directional RRT (KB-RRT) with Parameterized Trajectories for Robot Path Planning in Cluttered Environment. In Proceedings of the 2019 International Conference on Robotics and Automation (ICRA), Montreal, QC, Canada, 20–24 May 2019. [Google Scholar]
  19. Essaidi, A.B.; Haddad, M.; Lehtihet, H.E. Minimum-time trajectory planning under dynamic constraints for a wheeled mobile robot with a trailer. Mech. Mach. Theory 2022, 169, 104605. [Google Scholar]
  20. Faroni, M.; Beschi, M.; Guarino, C.; Visioli, A. Predictive joint trajectory scaling for manipulators with kinodynamic constraints. Control Eng. Pract. 2019, 95, 104264. [Google Scholar]
  21. Chen, G.C.; Jin-Shou, Y.U. Particle Swarm Optimization Algorithm. Inf. Control 2005, 186, 454–458. [Google Scholar]
  22. Kun, H. Path Planning of Mobile Robot Based on Improved Obstacle Avoidance Strategy and Double Optimization Ant Colony Algorithm. Trans. Chin. Soc. Agric. Mach. 2022, 53, 8. [Google Scholar]
  23. Xue, H. A quasi-reflection based SC-PSO for ship path planning with grounding avoidance. Ocean. Eng. 2022, 247, 110772. [Google Scholar] [CrossRef]
  24. Xu, L.; Cao, M.; Song, B. A new approach to smooth path planning of mobile robot based on quartic Bezier transition curve and improved PSO algorithm. Neurocomputing 2022, 473, 98–106. [Google Scholar] [CrossRef]
  25. Chen, M.; Sharma, A.; Bhola, J.; Nguyen, T.V.T.; Truong, C.V. Multi-agent task planning and resource apportionment in a smart grid. Int. J. Syst. Assur. Eng. Manag. 2022, 13, 444–455. [Google Scholar] [CrossRef]
  26. Kler, R.; Gangurde, R.; Elmirzaev, S.; Hossain, M.S.; Vo, N.V.; Nguyen, T.V.; Kumar, P.N. Optimization of Meat and Poultry Farm Inventory Stock Using Data Analytics for Green Supply Chain Network. Discret. Dyn. Nat. Soc. 2022, 2022, 8970549. [Google Scholar] [CrossRef]
  27. Wang, C.N.; Yang, F.C.; Vo, T.M.N.; Nguyen, V.T.T.; Singh, M. Enhancing Efficiency and Cost-Effectiveness: A Groundbreaking Bi-Algorithm MCDM Approach. Appl. Sci. 2023, 13, 9105. [Google Scholar]
  28. Liu, C.; Zhao, X.; Du, Y.; Cao, C.; Zhu, Z.; Mao, E. Research on static path planning method of small obstacles for automatic navigation of agricultural machinery. IFAC-PapersOnLine 2018, 51, 673–677. [Google Scholar] [CrossRef]
  29. Zhao, X.; Wang, K.; Wu, S.; Wen, L.; Chen, Z.; Dong, L.; Sun, M.; Wu, C. An obstacle avoidance path planner for an autonomous tractor using the minimum snap algorithm. Comput. Electron. Agric. 2023, 207, 107738. [Google Scholar] [CrossRef]
Figure 1. Study flow chart.
Figure 1. Study flow chart.
Agriculture 13 01960 g001
Figure 2. Path with different a 6 and b 6 . (a) a 6 and b 6 with order of 10 6 . (b) a 6 and b 6 with order of 10 8 .
Figure 2. Path with different a 6 and b 6 . (a) a 6 and b 6 with order of 10 6 . (b) a 6 and b 6 with order of 10 8 .
Agriculture 13 01960 g002
Figure 3. Influence of discrete time on obstacle collision detection.
Figure 3. Influence of discrete time on obstacle collision detection.
Agriculture 13 01960 g003
Figure 4. Path before and after optimization for static obstacle. (a) Path before optimization. (b) Path after optimization.
Figure 4. Path before and after optimization for static obstacle. (a) Path before optimization. (b) Path after optimization.
Agriculture 13 01960 g004
Figure 5. Three paths after optimization for static obstacle. (a) Path at x is equal to 48. (b) Path at x is equal to 50. (c) Path at x is equal to 52.
Figure 5. Three paths after optimization for static obstacle. (a) Path at x is equal to 48. (b) Path at x is equal to 50. (c) Path at x is equal to 52.
Agriculture 13 01960 g005
Figure 6. State variables of path after optimization. (a) Speed curve. (b) Heading angle curve. (c) Acceleration curve. (d) Steering angle curve.
Figure 6. State variables of path after optimization. (a) Speed curve. (b) Heading angle curve. (c) Acceleration curve. (d) Steering angle curve.
Agriculture 13 01960 g006
Figure 7. Path before and after optimization and its speed and heading angle. (a) Path before optimization. (b) Path after optimization. (c) Speed after optimization. (d) Heading angle after optimization.
Figure 7. Path before and after optimization and its speed and heading angle. (a) Path before optimization. (b) Path after optimization. (c) Speed after optimization. (d) Heading angle after optimization.
Agriculture 13 01960 g007
Figure 8. Comparison for algorithm with two objective functions. (a) Path after optimization with objective function defined by Equation (12). (b) Path after optimization with objective function defined by Equation (17).
Figure 8. Comparison for algorithm with two objective functions. (a) Path after optimization with objective function defined by Equation (12). (b) Path after optimization with objective function defined by Equation (17).
Agriculture 13 01960 g008
Figure 9. Comparison with other algorithms. (a) Path planned by A* algorithm. (b) Path planned by analytical method for parametric path.
Figure 9. Comparison with other algorithms. (a) Path planned by A* algorithm. (b) Path planned by analytical method for parametric path.
Agriculture 13 01960 g009
Table 1. Experiments of different PSO parameters.
Table 1. Experiments of different PSO parameters.
Parameters SetTime Consumed (s)Value of Objective Function
Epochs = 1, Num = 10.01Fail
Epochs = 1, Num = 50.04153
Epochs = 1, Num = 100.08137
Epochs = 1, Num = 200.15120
Epochs = 5, Num = 10.04Fail
Epochs = 5, Num = 50.14139
Epochs = 5, Num = 100.28138
Epochs = 5, Num = 200.55119
Epochs = 10, Num = 10.08Fail
Epochs = 10, Num = 50.28136
Epochs = 10, Num = 100.53130
Epochs = 10, Num = 201.02116
Epochs = 20, Num = 10.15Fail
Epochs = 20, Num = 50.54134
Epochs = 20, Num = 101.03127
Epochs = 20, Num = 202.01112
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Xu, L.; You, J.; Yuan, H. Real-Time Parametric Path Planning Algorithm for Agricultural Machinery Kinematics Model Based on Particle Swarm Optimization. Agriculture 2023, 13, 1960. https://doi.org/10.3390/agriculture13101960

AMA Style

Xu L, You J, Yuan H. Real-Time Parametric Path Planning Algorithm for Agricultural Machinery Kinematics Model Based on Particle Swarm Optimization. Agriculture. 2023; 13(10):1960. https://doi.org/10.3390/agriculture13101960

Chicago/Turabian Style

Xu, Lihong, Jiawei You, and Hongliang Yuan. 2023. "Real-Time Parametric Path Planning Algorithm for Agricultural Machinery Kinematics Model Based on Particle Swarm Optimization" Agriculture 13, no. 10: 1960. https://doi.org/10.3390/agriculture13101960

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop