|
Algorithm 1 Pseudocode for the spanning tree |
-
1:
Input: occupancyGridMap, currentPose
-
2:
Output: spanningTree
-
3:
insert starting cell which contains the robot’s position in the queue spanningTree
-
4:
while all free cells in have been visited do
-
5:
determine all orthogonal and unvisited neighbors of the current cell moving counterclockwise and add them to the queue
-
6:
for all cells in queue do
-
7:
if distance of current cell in spanningTree and neighbor then
-
8:
add current cell to the queue spanningTree
-
9:
set current cell in as visited
-
10:
go to the neighbor cell
-
11:
end if
-
12:
end for
-
13:
if distance of current cell in spanningTree and neighbor then
-
14:
for cells in queue do
-
15:
if distance of current cell in spanningTree and neighbor then
-
16:
go to the neighbor cell
-
17:
else
-
18:
move to the previous cell in queue
-
19:
end if
-
20:
end for
-
21:
end if
-
22:
end while
-
23:
return the spanning tree
|