2004 - An Effective Robot Trajectory Planning Method Using A Genetic Algorithm - Tian
2004 - An Effective Robot Trajectory Planning Method Using A Genetic Algorithm - Tian
Abstract
In this paper, we propose a novel trajectory planning method for a robot manipulator
whose workspace includes several obstacles. To generate the robot’s trajectory we developed a
genetic algorithm (GA) to search for valid and optimal solutions to the trajectory in task
space. In this method, a polynomial based on Hermite cubic interpolation is applied to ap-
proximate the time histories of the trajectory in task space. The GA determines the para-
meters, which are the interior points to be interpolated to formulate the polynomial
representing the trajectory, to minimize the fitness of the desired objective function. It does not
need a special formulation and can evaluate the trajectory to an optimal one quickly. The
effectiveness and capability of the proposed approach are demonstrated through simulation
studies.
Ó 2003 Elsevier Ltd. All rights reserved.
Keywords: Trajectory planning; Obstacle avoidance; Robot manipulator; Piecewise interpolation; Genetic
algorithm
1. Introduction
The problem of motion planning with obstacle avoidance has been extensively
studied over the last decade. The main task of path planning for robot manipulators
is to find an optimal collision-free trajectory from an initial to a final configuration.
Many important contributions to this problem have been made in recent years.
Henrich et al. [1] presented a heuristic hierarchical search method for an industrial
robot with 6 degree-of-freedom (DOF). The collisions are detected in the Cartesian
workspace by a hierarchical distance computation based on the given CAD model,
which is done by adjusting the step size of the search to the distance between the
*
Corresponding authors.
E-mail address: [email protected] (L. Tian).
0957-4158/$ - see front matter Ó 2003 Elsevier Ltd. All rights reserved.
doi:10.1016/j.mechatronics.2003.10.001
456 L. Tian, C. Collins / Mechatronics 14 (2004) 455–470
robot and the obstacle. Saab and VanPutte [2] introduced an algorithm for shortest
path planning using topographical maps. The algorithm partitions the search space
into free regions and obstacle regions, and combines the benefits of node generation
searches with a geometric technique to find a near optimal path. Helguera et al. [3]
addressed a method for the path planning problem for manipulators based on a local
approach. The task is defined as a combination of two displacements. The first one
brings the robot closer to the goal configuration, and the second one enables the
robot to avoid the local minimum. This method solves many of classical problems
found in potential field methods [4].
Several neural network models have been proposed for robot motion planning
through learning. Muniz et al. [5] proposed a neural network model for dynamic
navigation of a mobile robot with obstacle avoidance through unsupervised learning.
Yang and Meng [6] described an efficient neural network approach to dynamic
collision-free motion planning for mobile robots or robot manipulators in a non-
stationary environment. Each neuron is topologically organized by local con-
nections, and the neural dynamics are characterized by a shunting equation. Its
computational complexity depends linearly on the neural network size.
Recently, genetic algorithms (GAs) have been applied to robot path and motion
planning problems. Yano and Tooda [7] applied a genetic algorithm to solve the
position and movement of an end-effector on the tip of a two-joint robot arm. He
defined objective functions in both Cartesian space and joint space, and combined
them to optimize the robot trajectory. Optimum solutions with smooth trajectories
and minimal joint rotation were obtained. Shintaku [8] proposed a simple method
based on a genetic algorithm, where a polynomial approximates time histories of the
trajectory in joint space. The GA determines the parameters of the polynomial to
minimize the fitness of the objective function. Pack [9] developed a method to search
for valid solutions in configuration space based on a genetic algorithm. He formu-
lated the trajectory planning problem with point obstacles. His method can also be
extended to an n-dimensional space.
In this paper, we study the trajectory planning problem for a two-degree-of-
freedom robot in a workspace with point obstacles. Our goal is to move the end-
effector of the robot from a given starting point to a target while avoiding the point
obstacles. We develop a novel genetic algorithm to search for the trajectory. In our
method, a cubic interpolation function, which is twice differentiable, is applied to
approximate the desired trajectory. We search for several interior points between the
starting point and the target, and then use the Hermite cubic interpolation method to
construct the path. Our method has the following advantages: (1) it is easy to pro-
gram and efficiently implement, (2) it ensures that the resulting optimized trajectory
is smooth, and (3) it can be extended to solve spatial and redundant robot problems.
2. Problem formulation
In this paper, we consider a robot with two joints and two links as shown in Fig.
1. The end-effector moves on an XY plane, let the length of links 1 and 2 be L1 and L2 ,
L. Tian, C. Collins / Mechatronics 14 (2004) 455–470 457
2
Po1 ( xo1 , yo1 ) P2 ( x2 , y 2 )
P1 ( x1 , y1 ) θ2
1
Po 2 ( xo 2 , yo 2 )
Ps ( x s , y s )
θ1
Y-Axis
Pt ( xt , yt )
0
R2
-1
R1
-2
-3 -2 -1 0 1 2 3
X-Axis
respectively. Let the angles between link 1 and the positive X axis, link 2 and the
extension of link 1, be h1 and h2 , respectively.
The goal is to search a sequence of desired points which make up a detailed
smooth path, such that the end-effector of the robot moves from the given start point
to the target while avoiding obstacles. Fig. 1 is the diagram of the robot in world
space, while Fig. 2 is the diagram in joint space. In Fig. 1, Ps ðxs ; ys Þ and Pt ðxt ; yt Þ are
the given start and target points of the robot end-effector. Po1 , Po2 and Po3 represent
the point obstacles in three different cases. P1 and P2 are the interior points we will
search for to formulate the desired trajectory for the end-effector of the robot. In Fig.
2, the top half depicts the elbow-up configuration of the robot, while the bottom half
is for the elbow-down configuration. From Fig. 2 it can be seen that the start and the
target points are still a point in configuration space. The point obstacle becomes a
line in joint space, which represents all possible configurations in which the end-
effector contacts the obstacle.
For obstacles, there are three cases we must consider when planning the trajectory
for the end-effector of the robot. Let the distance from the obstacle to the origin of
the robot be Lo . The three cases are as follows:
(1) Lo > L1 þ L2
(2) L1 < Lo < L1 þ L2
(3) Lo < L1
458 L. Tian, C. Collins / Mechatronics 14 (2004) 455–470
180
Po1
120
Pt
60 Ps
Po2
Joint 2
-60
-120
-180
0 30 60 90 120 150 180 210
Joint 1
Fig. 2. Robot and its environment in joint space, the upper half corresponds to the elbow-down con-
figuration, the lower half corresponds to the elbow-up configuration.
In the first case, when the distance Lo is greater than the sum of the length of links
1 and 2, such as obstacle Po3 , the obstacle has no effect on the robot trajectory. Thus
the trajectory planner does not need to consider these obstacles.
In the second case, when the distance Lo is less than the length of link 1, such
as obstacle Po2 , the robot is constrained by the obstacle, and can not pass it with
positive joint motion. This can be demonstrated more clearly in its configuration
space shown in Fig. 2. The configuration space is cut into two parts, with respect
to joint 1, by the obstacle. It also has two residual lines that result from link 2
making contact with the obstacle. Therefore, the trajectory for the end-effector can
not be designed in the first and second quadrant shown in Fig. 1. It is possible to
plan it in the third and fourth quadrant, but this problem will not be considered
here.
The third case is when the distance Lo is between the length of link 1 (L1 ) and the
sum of length of links 1 and 2 (L1 þ L2 ), such as obstacle Po1 . In this case, a single
point obstacle in world space becomes a line in configuration space illustrated in Fig.
2. The line for obstacle Po1 in configuration space represents all possible robot
L. Tian, C. Collins / Mechatronics 14 (2004) 455–470 459
configurations that result in some part of link 2 coming in contact with the obstacle.
A feasible trajectory should manage to go by the obstacle and avoid touching it in
configuration space. That means the planner must consider not only when the end-
effector of the robot hits the point obstacles but also all the cases when any point
along the link 2 comes in contact with the obstacle. In this paper we will focus on the
problem of finding an optimal trajectory for the robot in the presence of obstacles
between the circles R1 and R2 shown in Fig. 1. The formulation defining when the
robot link comes into contact with the obstacle in joint space can be described as
follows
yo L1 sinðh1 Þ
h2 ¼ a tan h1 ð1Þ
xo L1 cosðh1 Þ
Our aim is to find a path which connects the given start point and the target, and
make the end-effector of the robot move smoothly between the two end points while
avoiding all obstacles in the process. While there are numerous approaches to
solving the trajectory generation problem [7–10], however, some require large
computational effort, and may not result in a smooth trajectory.
In our approach, a Hermite cubic interpolation based method is applied to
construct the trajectory. In this method, the polynomial is a Hermite cubic poly-
nomial, which has some significant advantage over the simple polynomials of high
degree such as those used in Lagrange interpolation [11]. It can be twice differenti-
ated, and thus ensures the smoothness of the trajectory. In addition, it only requires
a small number of points to form the trajectory. The following describes the details
of the approach.
Let SðxÞ represent the Hermite cubic polynomial on the set of n þ 1 distinct points
x0 ; x2 ; . . . ; xn , (x0 < x2 < < xn ), where f ðx0 Þ; f ðx1 Þ; . . . ; f ðxn Þ and f 0 ðx0 Þ; f 0 ðx1 Þ; . . . ;
f 0 ðxn Þ are the value and the first derivative at points x0 ; x2 ; . . . ; xn , respectively. Based
on the Hermite cubic interpolation method [11,12], the formulation of the piecewise
interpolation for SðxÞ can be written as follows:
X
n
SðxÞ ¼ ðui ðxÞf ðxi Þ þ /i ðxÞf 0 ðxi ÞÞ ð2Þ
i¼0
where ui ðxÞ and /i ðxÞ are Hermite based cubic polynomials shown in Fig. 3.
460 L. Tian, C. Collins / Mechatronics 14 (2004) 455–470
ϕ 0 ( x) ϕ i (x) ϕ n (x)
x0 x1 xi − 1 xi xi +1 xn −1 xn
(a)
φ 0 ( x) φ i (x)
xi −1 xn−1 xn
x0 x1 xi xi +1
φ n (x)
(b)
The expression of cardinal functions ui ðxÞ and /i ðxÞ can be determined based on
the values and derivatives at two end points by imposing some interpolation con-
ditions. The condition has the following properties:
ui ðxj Þ ¼ kij ; u0i ðxj Þ ¼ 0 ð3aÞ
Start
Initialization
Reproduction
Crossover
Mutation
No Is termination
condition satisfied?
Yes
End
individual in the population. Then, we evaluate every individual to test if they meet
the boundary conditions, that is, if they are located in the feasible area for the
trajectory planning.
It is assumed that we have k interior points to be selected for trajectory planning.
Every parameter is represented by an L ( ¼ 12) bit binary number, which is called a
gene in a chromosome. Thus, every individual (chromosome) includes 2k genes
corresponding to the interior points to be selected. The value for every gene
(parameter) ranges from 0 to 2L 1. Let Minx and Maxx be the minimum and
maximum values of the x coordinate. Let Miny and Maxy be the minimum and
maximum values of the y coordinate. The coordinates of any interior points, for
example P1 , can be calculated as follows:
8
>
> Maxx Minx
< x1 ¼ Minx þ Bx
2L 1
ð5Þ
>
: y1 ¼ Miny þ By Maxy Miny
>
2L 1
where Bx and By are the decimal value of the binary number corresponding to the
searched interior point.
After the initial population is generated, the genetic operators can be applied.
Usually, the general reproduction strategy for generating the next generation is that
parents with better fitness have the better chance of reproducing. The fitness is the
value of the objective function. To evaluate the fitness, an objective function can be
selected according to different goals. In this example, the sum of the rotation angles
of joints 1 and 2 from the start point to the target is selected as the objective function.
This corresponds to minimum joint motions which increases speed and reduces
energy consumption. The objective function can be expressed as follows:
T ¼ lT1 þ ð1 lÞT2 ð0 < l < 1Þ ð6Þ
where T is the sum of the rotation angles of joints 1 and 2, T1 and T2 are the rotation
angles of joints 1 and 2, respectively. That is,
8
> Pm
ð1Þ ð1Þ
>
< T1 ¼ ðhi hi1 Þ
i¼1
Pm ð7Þ
>
> ð2Þ ð2Þ
: T2 ¼ ðhi hi1 Þ
i¼1
where m is the number of steps, and hið1Þ and hið2Þ are the positions of joints 1 and
2 at the ith step. The smaller the fitness of the objective function T , the better
chance it has of being selected to produce the next generation. Using the Roulette
Wheel method [12], the fitter parents are selected for generating the next gener-
ation.
After reproduction, crossover is implemented. Crossover involves selecting any
two individuals from the parent chromosomes in the mating pool and mating
them. In the mating process, part of their strings undergo crossing over at a
randomly selected position. From the point of view of biology and evolutionary
theory, the crossover operator is an important mechanism for producing the next
L. Tian, C. Collins / Mechatronics 14 (2004) 455–470 463
Start
Initialization:
Randomly generate the first population
Fitness Function:
Calculation of fitness for every chromosome
Alternation of
Next Generation
Genetic Operators
Reproduction, crossover, mutation
Goal
or Max Generation?
No
Yes
End
generation. It exchanges the genes between two parent chromosomes, but it can
not create new gene. It is the mutation operator that is in charge of creating new
genes and reintroducing new missing information to the child chromosome. It is
usually difficult to determine the optimal mutation ratio, but in general a lower
rate is preferable. The procedure mentioned above is repeated up to a specified
number of generations or some other stopping criteria. The whole design proce-
dure is shown in Fig. 5.
5. Case studies
Following [7], we let kij ¼ 1 and lij ¼ 1 in Eqs. (3a) and (3b). Then, the cardinal
functions uðxÞ and /ðxÞ can be written as follows:
464 L. Tian, C. Collins / Mechatronics 14 (2004) 455–470
8
> 0; x < xi1
< ð2=w3 Þðx x Þ2 x x 1 w ;
>
xi1 6 x < xi
i1
uðxÞ ¼ 3
i
1
i 2 i 2 ð8Þ
>
> ð2=w Þ x x i þ w iþ1 ðx xiþ1 Þ ; xi 6 x < xiþ1
: iþ1 2
0; x P xiþ1
where i ¼ 0; 1; . . . ; n, wi ¼ xi xi1 . For i ¼ 0, only the last two parts of the defini-
tion of ui ðxÞ apply, whereas if i ¼ n, only the first two parts are needed.
In the same way, we can write /ðxÞ as
8
>
> 0; x < xi1
< ðw2 Þ1 ðx x Þ2 ðx x Þ; x
i i1 i i1 6 x < xi
/ðxÞ ¼ 2 1 2 ð9Þ
>
> ðw Þ ðx xi Þðx xiþ1 Þ ; xi 6 x < xiþ1
: iþ1
0; x P xiþ1
The effectiveness and capability of the proposed method has been tested by a series
of simulations using different work environments. As shown in Fig. 6, the design
parameters for the work environment are as follows: the coordinates of start point Ps
and target Pt are given at ð1:7; 0:8Þ and ð1:8; 0:2Þ, respectively. In the first example,
we have one point obstacle in the work environment, which is located at ð0:2; 1:5Þ.
The parameters for the proposed GA are as follows: the population is 120, the gene
is 12 bits long, the probability of crossover is 30%, the probability of mutation is
0.5%, and the number of generations is 500. Without loss of generality, the range of
joint 1 is restricted to 0 < h1 < 180, and the range of joint 2 is restricted to
0 < h2 < 180. Then, the search area for interior points is R3 < R < R1 , where
R1 ¼ L1 þ L2 and R1 ¼ L1 L2 as depicted in Fig. 5.
Po
P2
P1
L2 θ2
Ps
L1
Pt θ1
R3 X
R1
We use the proposed GA to search for two interior points: one in the range from
Pt to Po , the other in the range from Po to Ps . After we find the interior points, the
interpolation method described in Section 3 is employed to approximate the desired
trajectory. By imposing the constraints and objective function described in Eq. (8) to
all the candidate trajectories in a generation, the optimal solution is determined.
The result is shown in Fig. 7. Fig. 6(a) shows the optimal trajectory in world space
after searching for 500 generations. The trajectory is smooth and continuous by
design. The two interior points are located at ð1:61; 0:51Þ and ð1:45; 1:04Þ, re-
spectively. As analyzed in Section 3, the trajectory is twice differentiable. This en-
sures the end-effector of the robot moves along this trajectory smoothly.
Furthermore, the end-effector moves from the start point to the target with minimum
joint rotation, and avoids the point obstacle. Fig. 7(b) shows the trajectory and the
obstacle in joint space. Fig. 7(c) shows the joint trajectories for joints 1 and 2, re-
spectively. Fig. 8 shows the configuration of the robot as it moves along the world
2 120
Path
Obstacle
1.6
Joint 2 (Degree)
80
1.2
Y-Axis
0.8
40
Path
0.4 Internal points
End points
Point Obstacle
0 0
-2 -1 0 1 2 0 30 60 90 120 150 180
(a) X-Axis (b) Joint 1 (Degree)
180
Joint 1
Joint 2
150
Joint 1 and 2 (Degree)
120
90
60
30
0
0 10 20 30 40
(c) Number of steps
Fig. 7. Trajectory planning with one point obstacle: (a) world space, (b) joint space, (c) curves of joints 1
and 2 for the optimal trajectory.
466 L. Tian, C. Collins / Mechatronics 14 (2004) 455–470
2
Obstacle
1.5
Y-Axis
1
0.5
0
-2 -1 0 1 2
X-Axis
1.6
1.2
Y-Axis
0.8
Obstacle
Generation=5
0.4 Generation=100
Generation=500
0
-2 -1 0 1 2
X-Axis
trajectory. Fig. 9 shows the evolutionary process of the trajectory at the 5th, 100th
and 500th generations, respectively. This shows that the trajectory gradually con-
verges to the optimal one.
Next, the number of obstacles is increased to four, and located at ð1:2; 1:1Þ,
ð0:6; 1:5Þ, ð0:4; 1:5Þ and ð1:2; 1:2Þ, respectively. The number of interior search
points is increased to three accordingly. Initial locations of the interior points are
defined between the obstacles. The optimized interior points are located at
ð0:85; 1:37Þ, ð0:49; 1:497Þ and ð0:62; 1:42Þ, respectively, and can be seen along
with the final trajectory in Fig. 10(a). Fig. 10(b) demonstrates the trajectory and
obstacles in joint space. Fig. 10(c) shows the joint trajectories for joints 1 and 2,
respectively. Fig. 11 shows the configurations of the robot in the task space. From
L. Tian, C. Collins / Mechatronics 14 (2004) 455–470 467
2 180
Path
Obstacle (-1.2, 1.1)
Obstacle (-0.6, 1.5)
150 Obstacle (0.4, 1.5)
1.6 Obstacle (1.2, 1.2)
120
1.2
Joint 2
Y-Axis
90
0.8
60
0.4 Path
End points 30
Internal points
Point Obstacle
0 0
-2 -1 0 1 2 0 40 80 120 160
(a) X-Axis (b) Joint 1
160
Joint 1
Joint 2
120
Joint 1 and 2 (Degree)
80
40
0
0 10 20 30 40
(c) Number of Steps
Fig. 10. Trajectory planning with four point obstacles: (a) world space, (b) joint space, (c) curves of joints
1 and 2 for the optimal trajectory.
2
Point Obstacle
1.6
1.2
Y-Axis
0.8
0.4
0
-2 -1 0 1 2
X-Axis
Fig. 11. Configuration for trajectory planning with four point obstacles.
468 L. Tian, C. Collins / Mechatronics 14 (2004) 455–470
the simulation results, it can be seen the proposed method is still effective when the
number of obstacles is increased to four. While the method can be used for an ar-
bitrary number of obstacles in the workspace, the computation time naturally in-
creases with the number of obstacles.
Simulations were also carried out with the obstacle located in the neighborhood
of the end point as shown in Fig. 12. Fig. 12(a) is the trajectory of robot in world
space, where the obstacle, located at ð1:3; 0:7Þ, is very near the start point. Therefore,
in order to move the end-effector of the robot from the start point to the target, it
must first move backward to avoid the obstacle, and then move forward. Fig. 12(b) is
the trajectory demonstrated in joint space. Compared with Fig. 7(b), the difference
2 180
Path
End points Path
Internal points Obstacle
Point Obstacle 150
1.5
Joint 2 (Degree)
120
Y-Axis
1 90
60
0.5
30
0 0
-2 -1 0 1 2 -30 0 30 60 90 120 150
(a) X-Axis (b) Joint 1 (Degree)
180
Joint 1
Joint 2
150
Joint 1 and 2 (Degree)
120
90
60
30
-30
0 20 40 60 80
(c) Number of Steps
Fig. 12. Trajectory planning with obstacle near end points: (a) world space, (b) joint space, (c) curves of
joints 1 and 2 for the optimal trajectory.
L. Tian, C. Collins / Mechatronics 14 (2004) 455–470 469
2
Point Obstacle
1.5
Y-Axis
0.5
-0.5
-2 -1 0 1 2
X-Axis
Fig. 13. Configuration for trajectory planning with obstacle near end points.
between them is clear. In Fig. 12(b), joint 1 first moves backward, then goes forward.
Fig. 12(c) shows the curves of joints 1 and 2. Fig. 13 is the set of configurations for
the optimal trajectory. Comparing Fig. 13 with Fig. 8, we see that the proposed
method is robust to changes in the locations of the obstacles.
References
[1] Henrich D, Wurll C, Worn H. On-line path planning by heuristic hierarchical search. In: IECON’98
Proceedings of the 24th Annual Conf. of the IEEE Industrial Electronics Society, New York, NY,
USA, 1998. p. 2239–44.
470 L. Tian, C. Collins / Mechatronics 14 (2004) 455–470
[2] Saab Y, VanPutte M. Shortest path planning on topographical maps. IEEE Trans Syst Man Cy A
1999;29(1):139–50.
[3] Helguera C, Zegloul S. A local-based method for manipulators path planning in heavy cluttered
environments. In: Proceedings of the 2000 IEEE Int. Conf. on Robotics and Automation, San
Francisco, CA, USA, 2000. p. 3467–72.
[4] Volpe JR, Khosla P. Artificial potentials with elliptical contours for obstacle avoidance. In: IEEE
Proceedings of the 26th Conf. on Decision and Control, Los Angeles, CA, USA, 1997. p. 180–5.
[5] Muniz F, Zalama E, Gaudiano P, Lopez-Coronado J. Neural controller for a mobile robot in a
nonstationary environment. In: Proceedings of 2nd IFAC Conf. on Intelligent Autonomous Vehicles,
Helsinki, Finland, 1995. p. 279–84.
[6] Yang SX, Meng M. An efficient neural network approach to dynamic robot motion planning. Neural
Networks 2000;13:143–8.
[7] Yano F, Tooda Y. Preferable movement of a multi-joint robot arm using genetic algorithm. In: Part
of the SPIE Conf. on Intelligent Robots and Computer Vision, vol. 3837, 1999. p. 80–8.
[8] Shintaku E. Minimum energy trajectory for an underwater manipulator and its simple planning
method by using a genetic algorithm. Adv Robotics 1999;13:115–38.
[9] Pack D, Toussaint G, Haupt R. Robot trajectory planning using a genetic algorithm. SPIE
1996;2824:171–82.
[10] Meng M, Yang X. A neural network approach to real time trajectory generation. In: Proceedings of
the 1998 IEEE Int. Conf. on Robotics and Automation, Leuven, Belgium, 1998. p. 1725–30.
[11] Lancaster P, Salkauskas K. Curve and surface fitting, an introduction. San Diego, CA, USA:
Academic Press Inc; 1986.
[12] Rice JR. Numerical methods, software, and analysis. New York, NY: McGraw-Hill Inc; 1983.
[13] Shibata T, Abe T, Nose M. Motion planning by genetic algorithm for a redundant manipulator using
a model of criteria of skilled operators. Inform Sci 1997;102:171–86.