
2
SKILL
LEVEL
Ringo Educational Guide Rev04.1 ~ Plum Geek
RotateAccurate()
This function is similar to the
RotateSimple()
function, except
that it moves a bit more slowly and if Ringo over-shoots the target rotation, he will
reverse direction and attempt to reach the target rotation more accurately. It is
prototyped as follows.
The
RotateAccurate()
function accepts two arguments:
Heading
and
MaxExpectedTurnTime
.
Heading
is the target rotation, and like the last example,
the
MaxExpectedTurnTime
is the max time Ringo will attempt to complete the
maneuver.
Movement:
MoveWithOptions()
This is the most basic function for movement. It accepts seven
arguments and is prototyped as follows.
char
RotateAccurate
(int
Heading
, int
MaxExpectedTurnTime
);
void
MoveWithOptions
(int
Direction
, int
Speed
, int
Distance
, \
int
MaxExpectedRunTime
, int
MaxExpectedSkidTime
, \
void
(*EdgeFunction)(char)
, char
Wiggle
);
The
MoveWithOptions()
function looks a bit intimidating, but it’s actually pretty
straighforward. Let’s discuss it. The first argument is
Direction
. Ringo will attempt
to turn to this direction as he begins driving.
Speed
is the average motor speed
he should try to maintain. This will be adjusted up or down slightly between the
two motors to produce the desired direction.
Distance
is the overall forward
or backward travel distance in millimeters. As with the previous functions,
MaxExpectedRunTime
is the maximum time Ringo will allow to carry out the
attempted maneuver, and
MaxExpectedSkidTime
is the maximum time Ringo will
wait to arrive at a complete stop once he arrives at the commanded destination.
The
(*EdgeFunction)(char)
term allows Ringo to call a certain function if he
reaches an edge during his travel. That’s a bit more advanced and
we’ll cover it later, but for now, just pass a
0
in this argument. The
Wiggle argument controls how much “buggy swagger” Ringo
Note: The gyroscope on each Ringo unit is slightly more or less sensitive and
thus, “RotateAccurate()” may over or under-shoot regularly. Open and load the
sketch “Ringo_CalibrateGyroscope_Rev01”. This sketch can be used to calibrate
the gyroscope on your individual Ringo unit so the navigation functions are much
more accurate.
Using Ringo’s Navigation