2
SKILL
LEVEL
Ringo Educational Guide Rev04.1 ~ Plum Geek
In this example, we call
NavigationBegin()
one time in the setup function. In the
main loop, we first tell Ringo to rotate 180 degress clockwise, at motor speed 200.
He will attempt to reach 180 degress for 1.5 seconds. If he cannot reach 180 in
this time, he will skip out of the
RotateSimple()
function and proceed to the next
line of code. Once he stops, he will wait 1/10th of a second to reach a complete
stop. These turn and skid times should be plenty to reach the target. The loop then
makes the same movement in reverse and continues in a loop.
Hint: When you experement on your own, if you see Ringo consistantly fails to
turn far enough, have a look at the
MaxExpectedTurnTime
argument
and make sure you’re allowing him enough time to complete the
maneuver.
some rotational inertia to Ringo and his motors, he won’t stop immediately. He
will skid on the surface for some period of time. Once the motors are turned off,
Ringo will continue to evaluate his gyroscope and wait for the readings to indicate
that he has in fact come to a complete stop. Similar to the
MaxExpectedTurnTime
,
the
MaxExpectedSkidTime
is the maximum time Ringo will remain looking for a
complete stop. This time can be fairly short as he will normally stop very quickly
and move ahead to the next instruction on his own.
Lets consider a working example:
#include “RingoHardware.h” //include Ringo background functions
void setup(){
HardwareBegin(); //initialize Ringo’s circuitry
PlayStartChirp(); //play startup chirp and blink eyes
delay(1000); //wait 1 second after restart before starting navigation
NavigationBegin();
//initialize navigation system
}
void loop(){
//rotation, left, right, turntime, skidtime
RotateSimple
(
180
,
200
,
200
,
1500
,
100
); // rotate clockwise @ speed 200
delay(1000);
// wait 1 second
//rotation, left, right, turntime, skidtime
RotateSimple
(
-180
,
200
,
200
,
1500
,
100
); // rotate counter-clock @ speed 200
delay(1000);
// wait 1 second
}
Using Ringo’s Navigation