Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:

Embedded Robotics (Thomas Braunl, 2 ed, 2006)

.pdf
Скачиваний:
251
Добавлен:
12.08.2013
Размер:
5.37 Mб
Скачать

Dijkstra’s Algorithm

Algorithm Start “ready set” with start node. In loop select node with shortest distance in every step, then compute distances to all of its neighbors and store path predecessors. Add current node to “ready set”; loop finishes when all nodes are included.

1. Init

Set start distance to 0, dist[s]=0, others to infinite: dist[i]=f (for izs), Set Ready = { } .

2. Loop until all nodes are in Ready

Select node n with shortest known distance that is not in Ready set Ready = Ready + {n} .

FOR each neighbor node m of n

IF dist[n]+edge(n,m) < dist[m] /* shorter path found */ THEN { dist[m] = dist[n]+edge(n,m);

pre[m] = n;

}

DE

 

f

 

f

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

From s to:

S

a

b

c

d

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Distance

0

f

f

f

f

6

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Predecessor

-

-

-

-

-

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Step 0: Init list, no predecessors

 

 

f

 

f

 

 

 

 

 

Ready = {}

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

F

 

G

 

 

 

 

 

 

 

DE

 

10

 

f

 

 

 

 

 

 

 

 

 

S

a

b

c

d

 

 

 

 

From s to:

 

 

 

 

 

 

 

 

Distance

0

10

f

5

9

 

 

 

 

 

 

 

 

Predecessor

-

s

-

s

s

6

 

 

 

 

 

 

 

 

 

 

 

 

 

Step 1:

Closest node is s, add to Ready

 

 

 

 

 

 

 

 

 

 

 

 

Update distances and pred. to all neighbors of s

 

5

 

 

 

9

 

 

 

 

Ready = {S}

 

 

 

 

F

 

G

 

 

Figure 14.8: Dijkstra’s algorithm step 0 and 1

207

14 Localization and Navigation

DE

 

8

 

14

 

S

a

 

b

c

d

 

 

 

From s to:

 

 

 

 

 

 

 

 

 

 

 

 

Distance

0

10 8

14

5

9

7

 

 

 

 

 

 

 

 

Predecessor

-

s

c

c

s

s

c

6

 

 

 

 

 

Step 2: Next closest node is c, add to Ready

 

 

 

 

 

Update distances and pred. for a and d

 

5

 

 

7

 

 

 

Ready = {S, c}

 

 

 

 

 

F

G

 

 

 

 

 

 

 

DE

8 13

 

 

 

From s to:

S

a

b

 

c

d

 

 

 

 

 

 

 

Distance

0

8

14 13

5

7

 

 

 

6

 

 

Predecessor

-

c

c

d

s

c

 

 

 

 

 

 

 

 

 

Step 3:

Next closest node is d, add to Ready

 

 

 

 

 

 

 

 

 

 

 

 

Update distance and pred. for b

 

5

 

 

 

7

 

 

 

 

Ready = {s, c, d}

 

 

 

 

F

 

G

 

 

DE

 

8

 

9

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

S

a

b

 

c

d

 

 

 

 

From s to:

 

 

 

 

 

 

 

 

 

 

Distance

0

8

13 9

5

7

 

 

 

 

6

 

 

 

Predecessor

-

c

d

a

s

c

 

 

 

 

 

 

 

 

 

 

Step 4:

Next closest node is a, add to Ready

 

 

 

 

 

 

 

 

 

 

 

 

Update distance and pred. for b

 

5

 

 

 

7

 

 

 

 

Ready = {S, a, c, d}

 

 

 

 

F

 

G

 

 

 

 

 

 

 

 

 

 

DE

 

8

 

9

 

 

 

 

 

 

 

 

 

S

a

b

c

d

 

 

 

 

From s to:

 

 

 

 

 

 

 

 

Distance

0

8

9

5

7

 

 

 

 

6

 

 

 

Predecessor

-

c

a

s

c

 

 

 

 

 

 

 

 

 

Step 5: Closest node is b, add to Ready

 

 

 

 

 

 

5

 

 

7

check all neighbors of s

 

 

 

 

 

 

Ready = {S, a, b, c, d} complete!

 

 

 

 

 

 

F

 

G

 

Figure 14.9: Dijkstra’s algorithm steps 2-5

208

Dijkstra’s Algorithm

Example Consider the nodes and distances in Figure 14.8. On the left hand side is the distance graph, on the right-hand side is the table with the shortest distances found so far and the immediate path predecessors that lead to this distance.

In the beginning (initialization step), we only know that start node S is reachable with distance 0 (by definition). The distances to all other nodes are infinite and we do not have a path predecessor recorded yet. Proceeding from step 0 to step 1, we have to select the node with the shortest distance from all nodes that are not yet included in the Ready set. Since Ready is still empty, we have to look at all nodes. Clearly S has the shortest distance (0), while all other nodes still have an infinite distance.

For step 1, Figure 14.8 bottom, S is now included into the Ready set and the distances and path predecessors (equal to S) for all its neighbors are being updated. Since S is neighbor to nodes a, c, and d, the distances for these three nodes are being updated and their path predecessor is being set to S.

When moving to step 2, we have to select the node with the shortest path among a, b, c, d, as S is already in the Ready set. Among these, node c has the shortest path (5). The table is updated for all neighbors of c, which are S, a, b, and d. As shown in Figure 14.9, new shorter distances are found for a, b, and d, each entering c as their immediate path predecessor.

In the following steps 3 through 5, the algorithm’s loop is repeated, until finally, all nodes are included in the Ready set and the algorithm terminates. The table now contains the shortest path from the start node to each of the other nodes, as well as the path predecessor for each node, allowing us to reconstruct the shortest path.

 

D

 

E

 

S

a

b

c

d

 

8

 

9

From s to:

 

 

 

 

Distance

0

8

9

5

7

 

 

 

 

 

 

 

 

 

 

 

 

Predecessor

-

c

a

s

c

 

 

 

 

 

 

 

 

Example: Find shortest path S o b

 

6

 

 

 

 

 

 

 

 

dist[b] = 9

 

 

 

 

 

 

 

 

 

pre[b] = a

 

 

 

 

 

 

 

 

 

pre[a] = c

 

 

 

5

 

 

7

pre[c] = S

 

 

 

 

 

F

 

G

Shortest path: S o c o a o b, length is 9

 

 

 

 

Figure 14.10: Determine shortest path

Figure 14.10 shows how to construct the shortest path from each node’s predecessor. For finding the shortest path between S and b, we already know the shortest distance (9), but we have to reconstruct the shortest path backwards from b, by following the predecessors:

pre[b]=a, pre[a]=c, pre[c]=S

Therefore, the shortest path is: S o c o a o b

209

14 Localization and Navigation

14.5 A* Algorithm

Reference [Hart, Nilsson, Raphael 1968]

Description Pronounced “A-Star”; heuristic algorithm for computing the shortest path from one given start node to one given goal node. Average time complexity is O(k·logkv) for v nodes with branching factor k, but can be quadratic in worst case.

Required Relative distance information between all nodes plus lower bound of distance to goal from each node (e.g. air-line or linear distance).

Algorithm Maintain sorted list of paths to goal, in every step expand only the currently shortest path by adding adjacent node with shortest distance (including estimate of remaining distance to goal).

Example Consider the nodes and local distances in Figure 14.11. Each node has also a lower bound distance to the goal (e.g. using the Euclidean distance from a global positioning system).

 

D

 

1

 

 

 

 

6

7

3

F

 

E

 

0

 

5

G

Node values are lower bound distances to goal b (e.g. linear distances)

Arc values are distances between neighboring nodes

Figure 14.11: A* example

For the first step, there are three choices:

{S, a} with min. length 10 + 1 = 11

• {S, c} with min. length 5 + 3 = 8

{S, d} with min. length 9 + 5 = 14

Using a “best-first” algorithm, we explore the shortest estimated path first: {S, c}. Now the next expansion from partial path {S, c} are:

• {S, c, a} with min. length 5 + 3 + 1 = 9

{S, c, b} with min. length 5 + 9 + 0 = 14

{S, c, d} with min. length 5 + 2 + 5 = 12

210

Potential Field Method

As it turns out, the currently shortest partial path is {S, c, a}, which we will now expand further:

{S, c, a, b} with min. length 5 + 3 + 1 + 0 = 9

There is only a single possible expansion, which reaches the goal node b and is the shortest path found so far, so the algorithm terminates. The shortest path and the corresponding distance have been found.

Note This algorithm may look complex since there seems to be the need to store incomplete paths and their lengths at various places. However, using a recursive best-first search implementation can solve this problem in an elegant way without the need for explicit path storing.

The quality of the lower bound goal distance from each node greatly influences the timing complexity of the algorithm. The closer the given lower bound is to the true distance, the shorter the execution time.

14.6 Potential Field Method

References [Arbib, House 1987], [Koren, Borenstein 1991],

[Borenstein, Everett, Feng 1998]

Description Global map generation algorithm with virtual forces.

Required Start and goal position, positions of all obstacles and walls.

Algorithm Generate a map with virtual attracting and repelling forces. Start point, obstacles, and walls are repelling, goal is attracting; force strength is inverse to object distance; robot simply follows force field.

Example Figure 14.12 shows an example with repelling forces from obstacles and walls, plus a superimposed general field direction from start to goal.

S

G

Figure 14.12: Potential field

Figure 14.13 exemplifies the potential field generation steps in the form of 3D surface plots. A ball placed on the start point of this surface would roll

211

14 Localization and Navigation

Figure 14.13: Potential fields as 3D surfaces

toward the goal point – this demonstrates the derived driving path of a robot. The 3D surface on the left only represents the force vector field between start and goal as a potential (height) difference, as well as repelling walls. The 3D surface on the right has the repelling forces for two obstacles added.

Problem The robot can get stuck in local minima. In this case the robot has reached a spot with zero force (or a level potential), where repelling and attracting forces cancel each other out. So the robot will stop and never reach the goal.

14.7 Wandering Standpoint Algorithm

Reference [Puttkamer 2000]

Description Local path planning algorithm.

Required Local distance sensor.

Algorithm Try to reach goal from start in direct line. When encountering an obstacle, measure avoidance angle for turning left and for turning right, turn to smaller angle. Continue with boundary-following around the object, until goal direction is clear again.

Example Figure 14.14 shows the subsequent robot positions from Start through 1..6 to Goal. The goal is not directly reachable from the start point. Therefore, the robot switches to boundary-following mode until, at point 1, it can drive again unobstructed toward the goal. At point 2, another obstacle has been reached, so the robot once again switches to boundary-following mode. Finally at point 6, the goal is directly reachable in a straight line without further obstacles.

Realistically, the actual robot path will only approximate the waypoints but not exactly drive through them.

212

DistBug Algorithm

Goal

6

5

4

3

2

1

Start

Figure 14.14: Wandering standpoint

Problem The algorithm can lead to an endless loop for extreme obstacle placements. In this case the robot keeps driving, but never reaches the goal.

14.8 DistBug Algorithm

Reference [Kamon, Rivlin 1997]

Description Local planning algorithm that guarantees convergence and will find path if one exists.

Required Own position (odometry), goal position, and distance sensor data.

Algorithm Drive straight towards the goal when possible, otherwise do boundary-follow- ing around an obstacle. If this brings the robot back to the same previous collision point with the obstacle, then the goal is unreachable.

Below is our version of an algorithmic translation of the original paper.

Constant: STEP

min. distance of two leave points, e.g. 1cm

Variables: P

current robot position (x, y)

G

goal position (x, y)

Hit

location where current obstacle was first hit

Min_dist minimal distance to goal during boundary following

1. Main program Loop

“drive towards goal” /* non-blocking, proc. continues while driv. */ if P=G then {“success”; terminate;}

if “obstacle collision” { Hit = P; call follow; }

End loop

213

14 Localization and Navigation

2. Subroutine follow

Min_dist = f; /* init */

Turn left; /* to align with wall */

Loop

“drive following obstacle boundary”; /* non-block., cont. proc. */ D = dist(P, G) /* air-line distance from current position to goal */ F = free(P, G) /* space in direction of goal, e.g. PSD measurement */ if D < Min_dist then Min_dist = D;

if F t D or D–F d Min_dist – STEP then return;

/* goal is directly reachable or a point closer to goal is reachable */ if P = Hit then { “goal unreachable”; terminate; }

End loop

Problem Although this algorithm has nice theoretical properties, it is not very usable in practice, as the positioning accuracy and sensor distance required for the success of the algorithm are usually not achievable. Most variations of the DistBug algorithm suffer from a lack of robustness against noise in sensor readings and robot driving/positioning.

Examples Figure 14.15 shows two standard DistBug examples, here simulated with the EyeSim system. In the example on the left hand side, the robot starts in the main program loop, driving forward towards the goal, until it hits the U-shaped obstacle. A hit point is recorded and subroutine follow is called. After a left turn, the robot follows the boundary around the left leg, at first getting further away from the goal, then getting closer and closer. Eventually, the free space in goal direction will be greater or equal to the remaining distance to the goal (this happens at the leave point). Then the boundary follow subroutine returns to the main program, and the robot will for the second time drive directly towards the goal. This time the goal is reached and the algorithm terminates.

Goal

Leave

Goal

 

point 2

Leave

point Leave Hit point 2 point 1

Hit point

Start

Hit point 1

Start

Figure 14.15: Distbug examples

214

References

Figure 14.15, right, shows another example. The robot will stop boundary following at the first leave point, because its sensors have detected that it can reach a point closer to the goal than before. After reaching the second hit point, boundary following is called a second time, until at the second leave point the robot can drive directly to the goal.

Figure 14.16 shows two more examples that further demonstrate the DistBug algorithm. In Figure 14.16, left, the goal is inside the E-shaped obstacle and cannot be reached. The robot first drives straight towards the goal, hits the obstacle and records the hit point, then starts boundary following. After completion of a full circle around the obstacle, the robot returns to the hit point, which is its termination condition for an unreachable goal.

Figure 14.16, right, shows a more complex example. After the hit point has been reached, the robot surrounds almost the whole obstacle until it finds the entry to the maze-like structure. It continues boundary following until the goal is directly reachable from the leave point.

Goal

Goal

 

Leave

point

Hit

 

 

Hit

 

 

point

 

point

 

 

Start

Start

 

Figure 14.16: Complex Distbug examples

14.9 References

ARBIB, M., HOUSE, D. Depth and Detours: An Essay on Visually Guided Behavior, in M. Arbib, A. Hanson (Eds.), Vision, Brain and Cooperative Computation, MIT Press, Cambridge MA, 1987, pp. 129-163 (35)

ARKIN, R. Behavior-Based Robotics, MIT Press, Cambridge MA, 1998

215

14 Localization and Navigation

BORENSTEIN, J., EVERETT, H., FENG, L. Navigating Mobile Robots: Sensors and Techniques, AK Peters, Wellesley MA, 1998

CHOSET H., LYNCH, K., HUTCHINSON, S., KANTOR, G., BURGARD, W., KAV-

RAKI, L., THRUN, S. Principles of Robot Motion: Theory, Algorithms, and Implementations, MIT Press, Cambridge MA, 2005

CRAIG, J. Introduction to Robotics – Mechanics and Control, 2nd Ed., AddisonWesley, Reading MA, 1989

DIJKSTRA, E. A note on two problems in connexion with graphs, Numerische Mathematik, Springer-Verlag, Heidelberg, vol. 1, pp. 269-271 (3), 1959

HART, P., NILSSON, N., RAPHAEL, B. A Formal Basis for the Heuristic Determination of Minimum Cost Paths, IEEE Transactions on Systems Science and Cybernetics, vol. SSC-4, no. 2, 1968, pp. 100-107 (8)

KAMON, I., RIVLIN, E. Sensory-Based Motion Planning with Global Proofs, IEEE Transactions on Robotics and Automation, vol. 13, no. 6, Dec. 1997, pp. 814-822 (9)

KOREN, Y., BORENSTEIN, J. Potential Field Methods and Their Inherent Limitations for Mobile Robot Navigation, Proceedings of the IEEE Conference on Robotics and Automation, Sacramento CA, April 1991, pp. 1398-1404 (7)

PUTTKAMER, E. VON. Autonome Mobile Roboter, Lecture notes, Univ. Kaiserslautern, Fachbereich Informatik, 2000

216