Navigation down a straight run may appear simple enough but has many
pitfalls for the unwary.

Consider first that left to itself, it is actually quite unlikely that
you mouse will be able to travel in a perfectly straight line anyway.
If you use stepper motors, can you be sure that the tyres are exactly
the same diameter? With DC motors are you sure you have all the motor
control loops properly set up?

OK, so you can do all that and you have a mouse that does not drift off
course in free space. What if it hits some dust on the maze or a wheel
skids or hits a bump. What will that do to the path of your mouse? Don’t
be surprised to see competitors cleaning wheels and sweeping mazes before
their run.

Sooner or later you will need to correct the position of the mouse. There
are three basic positional errors to worry about:

Forward Error is where your mouse is too close to or too
far from the wall ahead. The mouse in the picture may think it is
in the middle of the cell but is too far back. This should be easy
enough to correct. Assuming you are sensing the posts for positional
information, you are likely to get a transition before too long and
can use that and your current position to recalibrate. Remember that
there is nothing absolute about this kind of update. Each post may
cause a sensor transition at a different time because of things like
its reflectivity, the direction and intensity of the ambient light
or because of a coincident heading or offset error. To guard against
this you can look for leading and trailing edges where those are available
– such as at a post with no walls. Large forward errors might mean
that you start looking for posts too soon or too late so allow a goodly
margin here. The only absolute available is encountering a wall ahead
of you (or behind if you can do that). An accurate but time consuming
method of calibration is to have a microswitch or short range IR sensor
mounted at the forward (or rear) edge and drive carefully up to the
wall. Then you will have a pretty good idea of your forward error
and can do something about it. Watch out for accumulating forward
errors. These may be caused, for example, by rounding errors in DC
motor control loops. Worst case, a forward error of about 2cm over
a 15 cell straight represents an error of 0.7% and may be enough to
cause a crash when you turn. Even if it does not cause a crash, you
will be left with an offset error of 2cm after a 90 degree turn. A
half-stepped stepper motor might have an error of, say plus or minus
1 step representing an forward error of about 0.4mm. Accumulate this
error over 15 cells and you will be less than 6mm out at the end of
the run. This should be correctable. Really though, a forward error
that requires major correction is simply a sign that something is
badly wrong. But you knew that already didn’t you.
Offset Error is a question of being too far to the left or
right as you pass through a cell. You will get offset errors after
a turn if there was a forward error before the turn. A heading error
may temporarily cause an offset error while it is being corrected.
When you correct an offset error you must automatically create a heading
error to do so. Bear in mind your sensor resolution. Accuracy beyond
that is somewhat pointless. However, say you change your sensor scheme
and get more resolution? How much reprogramming do you want to do?
Heading Error amounts to pointing at the walls rather than
down the middle of the cell. Left uncorrected it will almost certainly
cause a crash. After a turn it will still be there. If it was caused
by sloppy turning, it will probably be worse. Correction means slowing
down one wheel. In general, don’t assume you can correct by speeding
up a wheel as they may already be at full speed. If you are going
so slowly that you cannot slow down a wheel, you are not moving. In
this case a partial turn in-place is called for. The degree of correction
depends upon things like how fast you are going, where you are in
the cell, how bad the error is and how far in front of you the sensors
are. You can write down transfer functions to describe all this and
calculate a correction. Alternatively, you could try some experiments
and make a small table of corrective actions to get you out of foreseeable
problems. This will be a computationally cheaper but less flexible
solution.
Naturally, these errors can occur in combinations although that
will only normally happen when it is most inconvenient for your
software..
If the mouse is stationary, it can align itself with a series of
turn and shuffle moves. Drive systems with DC motors will soon show
up any backlash in the gear trains when you try this. Stepper driven
mice should be able to position themselves to within a millimetre.

Heading and offset errors can be corrected continuously only as long
as your mouse has reliable adjacent walls. Since there may be sections
of the maze where there are no such walls, it would be foolish to rely
too much on them. What you can rely on is the presence of the posts. The
rules stipulate that there must be a post at each wall intersection. Use
these to measure you errors and you will always have some data to work
on.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.