Chapter 5 Path Planning for Navigation
5.4 Path Simplification
After a path is found, we begin to conduct the proposed path simplification process. The process can be decomposed into two parts: redundant point elimination and distance elimination. The goal of the redundant point elimination is to find two points which are non-connected and can instead be connected together, and then to remove the points between the two points; in other words, the goal is to find a
“shortcut” between two points (like the red line shown in Figure 5.5(a)). The goal of distance elimination is to reduce the total path length by finding two points which are on different line segments and can be connected together; in other words, the goal is to find a “shortcut” between two line segments. As shown in Figure 5.5(b), we can reduce the total length of the path by substituting P2 with two new immediate points
80
(shown as red points).
After the path finding process, we conduct redundant point elimination at first, as described in Algorithm 5.3. The algorithm iterates over all immediate points in a path, and finds the last immediate point which can be connected together for each immediate point.
P1
P2
P3
P4
P1
P2
P3
(a) (b)
Figure 5.5 The redundant point elimination and the distance elimination. The black points represent the original immediate points of a path (a) The redundant point elimination, where the two redundant points P2 and P3 can be removed. (b) The distance elimination, the path length can be eliminated by substituting P2 by the two red points.
Algorithm 5.3 Redundant point elimination.
Input: A set of points of a path P, where P(i) means the ith point in the set.
Output: A set of points of a simplified version of P.
Steps
Step 1. Initialize a variable i = 1 used to represent the index of the start point of the shortcut.
Step 2. If i is equal to size(P), go to Step 8, where size(x) means the number of the points of the set x.
81
Step 3. Initialize a variable j = size(P) used to represent the index of the end point of the shortcut.
Step 4. If i = j 1, go to Step 7.
Step 5. If P(i) can be directly connected to P(j) without colliding obstacles, remove P(i+1), P(i+2), …, P(j1) and go to Step 7.
Step 6. Decrement j by 1 and go to Step 4.
Step 7. Increment i by 1 and go to Step 2.
Step 8. Take P as the output.
A result of redundant point elimination using the above algorithm is shown in Figure 5.6, where Figure 5.6(b) shows the result of applying redundant point elimination on Figure 5.6(a).
(a) (b)
Figure 5.6 Result of path finding and redundant point elimination. (a) Result of path finding. (b) Result of applying the redundant point elimination on (a).
However, the result shown in Figure 5.6(b) is still not of the simplest form. We
82
can find a short cut in the region of the red rectangle outline of Figure 5.6(b) by the distance elimination mentioned previously.
The distance elimination process checks the points on each line segment of a path.
However, if the points on a line segment are continuous, it is impossible to check all points on the segment. Therefore, the points on a line segment are discretized into several points with equal distances Td before distance elimination is conducted.
As shown in Figure 5.7, we check two line segments at a time, which are Li and Li+1, respectively. For each discretized point pi on Li and each pi+1 on Li+1, we check whether pi and pi+1 can be connected together or not. The checking order of Li is from the start point to the end point; that of Li+1 is contrarily from the end point to the start point. We check all discretized points on Li+1 for each pi. If pi (shown as blue points) cannot be connected to a point on Li+1, it is skipped and the next pi on Li+1 is then processed. Finally, we will find a shortcut between Li and Li+1 if there exists one (shown as the red line segment).
P1
Figure 5.7 Process of distance elimination. The black points are the immediate points of a path. The gray region represents the region of an obstacle, the line between the two red points are a shortcut found by the distance elimination process.
83
The following algorithm describes the complete processes to perform the distance elimination work.
Algorithm 5.4 Distance elimination.
Input: A set of points of a path P, where P(i) means the ith point in the set.
Output: A set of points of a simplified version of P.
Steps
where Td is a predefined distance between two neighboring discretized points.
2.3 Initialize two variables pi = P(i) and pi+1 = P(i+2), which are used to represent the two end points of the shortcut, respectively.
2.4 Add di1 to pi+1.
2.5 If p P ii1 ( 1)is in the opposite direction of Li+1 or p P ii1 ( 1) = 0, then go to Step 3 to check the next two line segments.
2.6 If pi can be connected directly to pi+1 without colliding obstacles, take
84
the following steps.
2.6.1. Insert pi and pi+1 into P before the position of P(i+1).
2.6.2. Remove P(i+1) from P.
2.6.3. Go to Step 3 to check the next two line segments.
2.7 Add d to pi i.
2.8 If pi Li ,go to Step 3; otherwise, go to 2.4.
Step 3. Increment i by 1 and go to Step 2.
Step 4. Take P as the output.
The result of applying the distance elimination algorithm described above on Figure 5.6(b) is shown in Figure 5.8. However, there still exist redundant points in the path of Figure 5.8. Therefore, we have to apply Algorithm 5.3 on the resulting path to reduce redundant points again. More specifically, we apply the redundant point elimination and distance elimination processes on a path until the points of the path are not changed. Algorithm 5.5 describes the above process.
Figure 5.8 Result of applying the distance elimination on the path of Figure 5.6(b).
85
Algorithm 5.5 Path simplification.
Input: A set of points of a path P, where P(i) means the ith point in the set.
Output: A set of points of the simplified path.
Steps
Step 1. Make a copy of P, and denote it by P’. Step 2. Apply Algorithm 5.3 on P’.
Step 3. Apply Algorithm 5.4 on P’.
Step 4. If the points of P’are different than the points of P, clear P, copy all points of P’ into P, and go to Step 2; otherwise, finish this algorithm.
We can directly apply Algorithm 5.5 on the resulting points of the path finding process. Figure 5.9 shows the result of applying the above path simplification process on the path of Figure 5.6(a).
Figure 5.9 Result of applying the path simplification on the path of Figure 5.6(a).
86