Computerized Labyrinth Solver
Download
Report
Transcript Computerized Labyrinth Solver
Computerized Labyrinth Solver
Gregory Schallert
Chad Craw
System Overview
Motors Control Playing
Platform by Video
feedback.
Video processing is done
by the PC
Motor control is done by
the HC12
Computer
HC12
User Interface
Minimal amount of buttons and LEDs
The interface shall report current
operating status, and any encountered
errors through LED codes
User Interface
Analyze
Buttons
Status LEDs
Error LEDs
Start
Stop
System Test on Startup
The system will rotate the maze surface a
maximum deflection on both axes
All status and Error LEDs will flash in unison
to make sure the are operational
The system will analyze the current maze
structure, and output a binary stream
representing the wall placements as well as
values of the current X and Y axis rotation to
the Serial interface.
Dynamic Maze Construction
Maze walls are placed in arbitrary
positions to create a new maze each
time.
Limited Start and End “Tags” are placed
along the outer edge of the wall
Maze Construction Diagrams
Wall Slot
Notches for the wall
segments
…
Maze
Surface
Wall Segment
…
.
.
.
.
.
.
…
.
.
.
Contact Nodes
Wall Segment
Notches for Start and End tabs
Contact Nodes
Maze Scanning Phase
An array of multiplexers are attached
to the contact nodes of each wall
slot.
These connections are scanned
synchronously by the HC12 board to
determine positions of walls.
Once this scan is complete, the
virtual maze is passed to the
connected PC via the serial interface
to start the maze solving algorithm.
0010000111
0101001111
0111101101
0110111100
1010100001
0001000101
1111001010
0010100111
1001011100
Ang X: 1.2 Ang Y: 5.5
X Pos:01 Y Pos:54
Lee Moore Algorithm
Inputs: Walls, Start and End Points.
Output: Finds the a path from start to
finish.
Each cell is given a value of -1.
Starting Cell is given a value of 0
If we have not reached the end, set the
current cell to the highest value not yet
used.
Each cell touching the current cell with a
-1 has the value of this cell + 1
Check each cell to see if we are at the
end
If not, continue
Video Capture
Use the CCD Camera to find ball
location
Compare the current location to the
desired path
Send the offset to the next goal to the
serial interface
The Camera
Logitech QuickCam® CCD
Camera
352x288 Maximum True
Resolution
30 Frames/sec
25cm/120 = 2mm grid
25cm/288 = < 1mm grid
We want 4mm resolution
MEANS WE ARE GOOD TO GO
The Software
OpenCV
DirectShow
Video Capture Filters
Logitech SDK
Video Tracking algorithms
Camera Calibration and Windows Drivers
All of the Software is Free and Documented
The Process
DirectShow captures the video input
The OpenCV algorithms are applied to
track the object
The information is sent to the HC12
Any additional text overlays are added
and rendered to the screen
A System Model
Sum the masses
M g cos Fs M b a
O
Sum the Torques
I
N
Solve for acceleration
Fs r I
Fs
I
a
r2
g cos
1
1 2
mr
This relates the
acceleration to the angle
of the platform
r
a
Fg
a
a
r
Fn
Fs
A System Model (con’t)
Take two snapshots
One at the zero position
One after some time
Note R and d stay constant
R
L
Z
r
Use law of cosines to solve
for the angle
z
l
L2
R2 d 2
cos()
2
Rd
2
Rd
This relates the acceleration
to the distance the control
axle at r has turned
a
g cos
1
1 2
mr
R
Z
L
l
z
R
d
Can also solve for
vertical displacement
z R cos()
d
Control System
The algorithms for the control system shall operate on the HC12
board.
The system will collect feedback data from the Video tracking
algorithm on the PC via the Serial Interface of the HC12 board
This data shall be sent as a 3-byte packet at every sample interval
of the tracking system
It shall contain a signal start byte (to maintain alignment), followed
by 2 data bytes for the current X and Y offsets
The position of the ball while traversing the maze shall be
maintained with a Fuzzy Logic Control system.
The only data that needs to be collected from the PC Video
tracking system is the ball’s current offset from its target
position
Control System
The FLC will use a rule set based on 5 states of the
system:
The
The
The
The
The
ball
ball
ball
ball
ball
is
is
is
is
is
far to the left(top) of its target position
near to the left(top) of its target position
at its target position
near to the right(bottom) of its target position
far to the right(bottom) of its target position
These rules shall be applied symmetrically to both
the X and Y axes of the ball’s position.
Using this rule-set, the control system shall derive
the angular rotation necessary to move the ball in the
desired direction at the desired speed.
Control System (Pathfinder)
Y offset = 0
Y offset = 0
X offset = 10
X offset = 0
Y
Y offset = 10
X offset = 0
X
Y offset = 20
X offset = 0
Start
End
Motor Control
Each motor shall be attached to the
actuators of each axis, and shall
operate independently of one another.
The operation of each motor is identical
due to the symmetrical nature of the
maze surface.
Motor Specs
SL561 Standard, BB
Size:
Length
Width
Height
Torque
Speed
Weight
Voltage
1.51”
0.73”
1.37”
46.1 oz
0.18 sec/60°
1.50 oz
4.8V – 6V
Possible Errors
Nonlinear elements of the system
Fuzzy Logic Control
Keep speed Down
Video Resolution/timing
Damp the system
Keep speed Down
Conclusion