| |
|
HanoiSolver picks up Lego 'discs' and moves them between three different 'posts' to solve the Towers of Hanoi puzzle. The program is capable of solving for any number of discs between 1 and 5. The bot has a pneumatically powered claw which travels vertically on a forklift-type boom to grab the 'discs' and pick them up.
|
In the classic puzzle, the posts are located in a line, but in my version they are located in a semi-circle: the entire grabber assembly rotates on a large Technic turntable to transfer the discs from one post to another. The picture below shows the main grabber assembly, the 'discs', and the 'posts'.
|
|
|
|
What the heck is the 'Towers of Hanoi' puzzle?
The 'Towers of Hanoi' is a classic puzzle in which you have three 'towers' sticking up (numbered 1, 2, and 3) and a number of different sized discs threaded on them. At the start, all the discs are threaded on post #1 in order of size -- the biggest disc at the bottom and the smallest at the top.
The object is to move all the discs to post #3 -- the solution is complete when all discs are on post #3 in the same size order as they started on post #1.
|
You can move one disc at a time. The tricky part is that:
- you are not allowed to put a bigger disc on top of a smaller
disc, you can only thread a smaller disc on top of a bigger
disc (or onto an empty post), and
- you can only move the topmost disc from any post.
Sounds easy? You can try it
online here.
|
|
MECHANICS
OUT_A controls the compressor and the switch for the air supply to the small pneumatic piston that opens and closes the claw.
OUT_B sits below the central turntable and rotates the upper portion of the turntable via a motor-12db:20db-8:turntable gear train. The top of the turntable supports the upper frame, on which the claw assembly is mounted.
OUT_C at the rear of the upper frame powers a chain-drive to move the claw up and down the boom. This motor has a motor-24:8-worm:24(chain) gear train which allows rapid movement of the chain. Rapid chain movement is not always desirable -- if the movement is halted (as when the claw reaches the top or bottom of its travel) the chain can be broken apart. However, the initial 24:8 gear ratio means that, if the chain is halted with the motor still running, the motor will stall before the chain breaks.
Note that the RCX used here is a RIS1.0 unit and electrical power is supplied by a 9VDC wall-wart transformer rather than batteries. The chain drive that moves the grab up and down is pretty frictional and needs the extra power of the external transformer. If you're running from batteries, you might want to change the OUT_C drive from motor-24:8-worm... to a motor-16:16-worm... or even motor-8:24-worm...
|
|
CONTROL
Control employs four touch sensors.
The first two touch sensors
control the up/down movement of the claw.
- A long axle assembly reaches down, through a 1x2 Technic brick,
to a gray axle hub suspended between the grabber claws.
Tucked behind the small pneumatic cylinder which powers the claw
is a touch sensor. When the grabber moves down the lift boom the
hub makes contact with the top of a 'disc', pushing the axle
assembly up against the touch sensor. When the touch
sensor detects the pressure of the axle, the RCX halts the
downward movement of the claw and trips the pneumatic
switch to close the claw.
- The second touch sensor limits the upward movement of the
and is located so that it is tripped when the claw has
traveled to the top of the lift boom.
A third touch sensor controls the rotation of the frame. This sensor is
located at the bottom front of the grabber frame, and is
activated by Technic axle-balls, friction fitted into a short
stack of 2x2 round plates in front of each of the posts. To move from one
post to another, the RCX first powers the rotation motor for a preset
time which is sufficient to rotate the touch
sensor very close to the next ball. The RCX then
commands the rotation motor to make a series of small, stepped
movements in the same direction until the touch sensor is
pushed by the tip of the ball. The grabber arm will now be
directly facing the post, with the claw centered over the post.
(The height of the axle-balls in the 2x2 round plates needs to be
adjusted up and down slightly to fine-tune the point at which
they are detected by the touch sensor.)
The final touch sensor is used by the pneumatic system to monitor air pressure.
|
|
PROGRAM
The program uses Er's non-recursive solution to the Towers of
Hanoi problem.
Viewed from above, there are two directions of rotation:
clockwise or anti-clockwise. Before the program is started,
the grabber arm must be rotated so that it is slightly
anti-clockwise of post #1. Also, the compressor
must be allowed to work until the air pressure switch turns it
off so that we have sufficient air pressure at the start of
the solution. A number of
Lego 'discs' (between 1 to 5) are threaded onto post
#1.
|
When the 'Run' button is pressed, the RCX moves the
grabber to the top of the lift boom, opens the grabber jaw,
and then rotates the grabber assembly clockwise until the
bottom touch sensor detects the first axle ball. The RCX
then waits until you send it a message (e.g., using RCXCC)
which contains the number of discs. Once HanoiSolver has
received the message, it begins the solution. After it has
finished solving the problem, it returns to the 'ready' position
and waits for you to thread some more discs onto post #1
and send another message telling it how many are there.
|
| LEGO®
and RCX are trademarks of the LEGO Group of companies which does not sponsor, authorize
or endorse this site. Read the full heavy
latin from LEGO for more details.
Text, graphics and downloads from http://jpbrown.i8.com copyright © JP
Brown, 2001-2006. All rights reserved.
1165 |
|