School of Engineering, Mechanical Engineering Division 2. How to

advertisement
School of Engineering, Mechanical
Engineering Division
Singapore Robotics Games 04 Symposium
Title:
An Efficient Maze Solving Algorithm for a Micromouse
Presented by
Mr. Hui Tin Fat
htf@np.edu.sg
Alpha Centre
Ngee Ann Polytechnic
July 2004
1
School of Engineering, Mechanical
Engineering Division
1. Abstract
In a competition, the performance of a micromouse is largely
dependent on two factors. They are the maze searching ability and the
maximum maze cruising speed of a micromouse. The maze searching
ability of a micromouse reflects on the elapsed time for it to reach the
goal and the elapsed time for it to finalize the dash path. The dash path
is crucial for a micromouse to score its fastest runtime.
This paper demonstrates a method of using a simple expert
algorithm to complement the Bellman flooding algorithm to tackle a
maze-solving problem. Considerations are given to a limited on-board
processing power and memory space. Results from implementation
and simulation of the algorithm using for a competing micromouse are
presented.
July 2004
2
School of Engineering, Mechanical
Engineering Division
2. How to describe a Maze?
A maze is formed by a group of alleyways arranged in longitude
and transverse directions in an enclosed square platform. The
maximum length of a alleyway is 16 units and the minimum length is 1
unit.
In a maze, the alleyways will form the junctions when the
transverse and longitude meets, the dead ends when the alleyway
closes in one end, the loops when a alleyway joins at the begin and
end.
All the alleyways are assembled from walls and poles. They are
either made in plywood or plastics.
The maze starts at one of the four corner squares and it finishes
at one of the center 4 squares.
July 2004
3
School of Engineering, Mechanical
Engineering Division
3. A Sample Maze
Y
July 2004
4
School of Engineering, Mechanical
Engineering Division
4. How to define the complexity of a maze?
For Human Brain
The characteristics of human brain is the sense of direction and
the sense of position are not strong. The brain is easily confused by the
similar environments. It is difficult to identify the same location and
orientation.
Therefore if a maze comprises of many junctions, dead ends and
loops. The maze is considered a complex one for people.
For Micromouse Brain
The micro-controller is able to remember the orientation and
position correctly. This is due to the ability of software algorithm and the
retrieval from memory storage.
Therefore a maze with many junctions, dead ends and loops is no
longer difficult for the micromouse to solve.
July 2004
5
School of Engineering, Mechanical
Engineering Division
5. How to define the complexity of a maze for a micromouse to solve?
When a maze comprises of many long dead ends, it is considered
as a complex maze because the micromouse requires extra-efforts to
reach the goal and locates the dash path between the start and goal.
We can evaluate the performance of a maze solving algorithm by
the number of backtracks carried out by the micromouse. If there is
less backtrancks, it shows the algorithm more efficient.
In micromouse competition, the performance does not only judge
on how soon the robot reached the goal but also how much time to
spend for locating the dash path. By counting the number of backtracks
carried out in both tasks, we can judge whether the algorithm is good or
not.
July 2004
6
School of Engineering, Mechanical
Engineering Division
7. Bellman Flooding Algorithm
Bellman flooding algorithm is a common maze solver using by the
contestants. The standard Bellman algorithm solves a given maze for
the shortest route but this is not always the fastest. Many contestants
modify the algorithm which floods with time instead of distance.
There will be different time constants assigned to the flooding
array according to the movement to reach the new square such as a
straight, a 900 turn or a 1800 turn.
The Modified Bellman Flooding Algorithm is implemented as
following:
a) There is only boundary walls along the outside perimeter. No internal
walls.
b) The target square is number 0. The squares joining the target
square(s), - front, right and left; with no separating walls, are numbered
by the time constant taken to travel there from the target square.
July 2004
7
School of Engineering, Mechanical
Engineering Division
7. Bellman Flooding Algorithm (continued)
c) The squares, front, right and left; joining the above squares, with no
separating walls, are also numbered by the time constant taken to
travel there from the target square.
d) The c) process will be continued until the flooding stops when the
square being renumbered is the current mouse square.
e) The mouse makes the fastest move from the current mouse square
by selecting the lowest flooding number.
f) If the flooding encounters a situation where there are two possible
routes, with the same Bellman number, then the mouse will select the
route with the following priority as straight first. Otherwise, the algorithm
chooses the route with lower flooding number.
July 2004
8
School of Engineering, Mechanical
Engineering Division
7. Bellman Flooding Algorithm (continued)
30 27 24 21 24 25 00
33 26 23 18 15 28 01
34 37 20 17 12 09 02
43 40 43 14 11 06 03
46 41 52 49 08 07 04
47 42 45 46 47 48 05
S
43 52 49 10 09 06
Bellman Flooding Array
July 2004
9
School of Engineering, Mechanical
Engineering Division
7. Bellman Flooding Algorithm (continued)
E
E
S
S
W
W
N
N
E
S
E
S
N
N
N
W
E
S
E
S
N
E
N
W
E
S
E
N
N
N
E
S
E
E
N
N
N
W
W
W
W
N
S
N
E
N
E
E
N
Bellman Direction Array
July 2004
10
School of Engineering, Mechanical
Engineering Division
7. Bellman Flooding Algorithm (continued)
Determine next square
for micromouse
Instruct the micromouse
to move to new square
B
Update wall information
on move
Wait for micromouse to
reach new square
A
July 2004
11
School of Engineering, Mechanical
Engineering Division
7. Bellman Flooding Algorithm (continued)
A
Has wall information
Changed?
Yes
No
Re-calculate Bellman
Flooding Array
Check Flooding
direction
July 2004
B
12
School of Engineering, Mechanical
Engineering Division
8. Does Bellman Flooding Algorithm Work Well?
From the Bellman flow-chart, it is easily to point out that every
new wall information update, the algorithm has to re-calculate again. It
may cause too much CPU time for a high speed micormouse.
To overcome this, a suggestion is to re-calculate the flooding
array only when it really needs such as to obtain a back-track path or a
dash path.
A simple expert algorithm is proposed to resolve the micromouse
movement when it reaches a new square. An expert rule array is used
to determine the next move, front, right or left. Since no calculation
involved, this algorithm only requires the minimum CPU time. It is very
effective for a fast speed micromouse.
July 2004
13
School of Engineering, Mechanical
Engineering Division
9. A Simple Expert Maze Solving Algorithm
The algorithm assumes each square in the maze is a junction. A
pre-determined rule will be assigned to the square. If the micromouse
reaches this square, the rule will be draw from the expert rule assay of
this square to decide the next move.
The expert rules are derived from the movement, front, right, back
and left.according to the priority of checking the openings in the square.
There are total 24 rules. They are North-East-South-West, NorthEast-West-South, North-South-East-West, North-South-West-East,
North-West-East-South, North-West-South-East, and etc.
The assignment of the top priority of expert rules to each square
can be done according to the design of past competition mazes. The
second and third priorities are assigned either according to the
outcome of the movement that leads to the goal or starting square.
July 2004
14
School of Engineering, Mechanical
Engineering Division
9. A Simple Expert Maze Solving Algorithm (continued)
2
3
1
North
0
4
5
7
6
Expert rules assignment for the Algorithm
July 2004
15
School of Engineering, Mechanical
Engineering Division
9. A Simple Expert Maze Solving Algorithm (continued)
Determine next square
for micromouse
Instruct the micromouse
to move to new square
B
Update wall information
on move
Wait for micromouse to
reach new square
A
July 2004
16
School of Engineering, Mechanical
Engineering Division
9. A Simple Expert Maze Solving Algorithm (continued)
A
Has wall information
Changed?
Yes
Yes
No
Back-track or
dash run
Re-calculate Bellman
Flooding Array
No
Check expert rule
direction
Check Flooding
direction
B
B
July 2004
17
School of Engineering, Mechanical
Engineering Division
10. Conclusion
The Expert Rule Maze Solving Algorithm is applied in the school
micromouse kit that performs outstandingly. It reduces the paused time
whenever the micromouse reaches new junction square.
The values of time constants assigned for the flooding array are
reduced to 1 for the diagonal dash path. But it requires a software to
covert the dash path from curve turns to diagonal turns.
My experience in the micromouse project is the speed of
micromouse playing a vital role beside the maze-solving algorithm for
winning the championship title in a competition.
July 2004
18
School of Engineering, Mechanical
Engineering Division
Thank You!
July 2004
19
Download