Datasheet

Chapter 4 • BOE Shield-Bot Navigation
112Robotics with the BOE Shield-Bot
The smallest change that actually makes a difference is 20. Servo control pulses are sent every
20 ms, so adjust your delay function call’s ms parameter in multiples of 20.
If you find yourself with one value slightly overshooting 90° and the other slightly
undershooting, choose the value that makes it turn a little too far, then slow down the servos
slightly. In the case of rotating left, both
writeMicroseconds us parameters should be
changed from 1300 to something closer to 1500. Start with 1400 and then gradually
increase the values to slow both servos. For rotating right, start by changing the
us
parameters from 1700 to 1600, and then experiment with reducing in increments of 10 from
there.
Your Turn 90° Rotating Turns and Sketch Updates
Modify ForwardLeftRightBackward so that it makes precise 90° rotating turns.
Update the label on each servo with a notation about the appropriate delay
function
ms parameter for a 90° turn.
Update the
delay function ms parameters in ForwardLeftRightBackward with
the values that you determined for straight forward and backward travel.
Carpeting can cause navigation errors. If you are running your BOE Shield-Bot on carpeting, don’t
expect perfect results! The way the carpet pile is laying can affect the way your BOE Shield-Bot
travels, especially over long distances. For more precise maneuvers, use a smooth surface.
Activity 3: Calculating Distances
In many robotics contests, more precise robot navigation means better scores. One popular
entry-level robotics contest is called dead reckoning. The entire goal of this contest is to
make your robot go to one or more locations and then return to exactly where it started.
You might remember asking your parents this question, over and over again, while on your
way to a vacation destination or relatives’ house: “Are we there yet?”
Perhaps when you got a little older, and learned division in school, you started watching the
road signs to see how far it was to the destination city. Next, you checked the car’s
speedometer. By dividing the speed into the distance, you got a pretty good estimate of the
time it would take to get there. You may not have been thinking in these exact terms, but
here is the equation you were using:
speed
distance
time =