Twin Tweaks ...
SCRIBBLER VS. SCRIBBLER: A FORMIDABLE OPPONENT.
DEBUGGING THE PROGRAM.
NAVIGATING THE MAZE.
74 SERVO 07.2010
physics. Any member of the Nation can understand that
the encoder can calculate distance by sensing the
difference between when it sees a fin and when it
doesn’t. If they are encouraged to draw things out (an
invaluable skill that should be instilled in all engineers
early), even the math averse will see that the wheel has
traveled the arc length of a piece of pie. Some simple
geometry will convert the tasty pie into some less
delectable but more useful linear distance, and before
they know it, novice programmers will have almost
solved their problem.
Because the relationship between the sensor data
and the linear distance is fairly intuitive (a reading from
the sensor that the encoder wheel has changed positions
corresponds to a unit of linear distance), the last step is
to translate that into the logic of a program. Our solution
was to use the logical operator XOR to determine if the
previous reading of the encoder was the same as the
current reading, If they were the same, the encoder
wheel had not yet changed positions. If they were
different and the XOR returned true, then that meant
that the encoder had changed positions. In turn, this
meant that the Scribbler had traveled the previously
calculated unit of linear distance.
A handy and wonderfully educational tool in the
BASIC Stamp Editor is the debugging tool. Debugging is
an essential part of programming, and the Scribbler
documentation encourages it thoroughly. Using
debugging to keep track of the encoder readings is a
great way to check the efficacy of your wiring and your
coding, and watching the encoder count climb on the
little blue debugging screen carries a sense of
accomplishment.
Being able to accurately calculate distance seemed
like the perfect fit for a dead reckoning program. We
think a dead reckoning program would also be an ideal
project for a beginning programmer because it is simple
(albeit a bit repetitive and tedious) to program. With the
chunk of code for reading the encoder finished, we just
needed to chart the course that we wanted our Scribbler
to reckon.
Scribbler vs. Scribbler:
A Formidable Opponent
We put together a simple maze using some
casebooks, complete with a giant star at the end as
motivation to finish (though the track did resemble a big
W, we thought the star would be a bit safer than
$350,000). We were sure a dead reckoning Scribbler
could tackle the maze no problem, but doing so solo
seemed a bit anticlimactic. We determined that a fine
illustration of the advantages and disadvantages of a
dead reckoning program would be to compare it to an
obstacle avoidance program that took advantage of
Scribbler’s numerous sensors. Besides, we couldn’t think
of a more formidable opponent than the Scribbler itself.