Datasheet

BOE Shield-Bot Navigation • Chapter 4
Robotics with the BOE Shield-Bot 111
Let’s say that your BOE Shield-Bot gradually turns left. That means the right wheel is turning
faster than the left. Since the left wheel is already going as fast as it possibly can, the right
wheel needs to be slowed down to straighten out the robot’s path. To slow it down, change
the
us parameter in servoRight.writeMicroseconds(us) to a value closer to 1500. First,
try 1400. Is it still going too fast? Raise it 1410. Keep raising the parameter by 10 until the
BOE Shield-Bot no longer curves to the left. If any adjustment overshoots ‘straight’ and your
BOE Shield-Bot starts curving to the right instead, start decreasing the
us parameter by
smaller amounts. Keep refining that
us parameter until your BOE Shield-Bot goes straight
forward. This is called an iterative process, meaning that it takes repeated tries and
refinements to get to the right value.
If your BOE Shield-Bot curved to the right instead of the left, it means you need to slow down the
left wheel. You’re starting with servoLeft.writeMicroseconds(1700) so the us
parameter needs to decrease. Try 1600, then reduce by increments of 10 until it either goes
straight or starts turning the other direction, and increase by 2 if you overshoot.
Modify ForwardTenSeconds so that it makes your BOE Shield-Bot go straight
forward.
Use masking tape or a sticker to label each servo with the best
us parameters for
your
writeMicroseconds(us) function calls.
If your BOE Shield-Bot already travels straight forward, try the modifications just
discussed anyway, to see the effect. It should cause the BOE Shield-Bot to travel
in a curve instead of a straight line.
You might find that there’s an entirely different situation when you program your BOE
Shield-Bot to roll backward.
Modify ForwardTenSeconds so that it makes the BOE Shield-Bot roll backward
for ten seconds.
Repeat the test for a straight line.
Repeat the steps for correcting the
us parameter for the writeMicroseconds
function call to straighten the BOE Shield-Bot’s backward travel.
Tuning the Turns
The amount of time the BOE Shield-Bot spends rotating in place determines how far it turns.
So, to tune a turn, all you need to do is adjust the
delay function’s ms parameter to make it
turn for a different amount of time.
Let’s say that the BOE Shield-Bot turns just a bit more than 90° (1/4 of a full circle).
Try
delay(580), or maybe even delay(560). If it doesn’t turn far enough, make it run
longer by increasing the
delay function’s ms parameter 20 ms at a time.