Chapter 4: Boe-Bot Navigation · Page 131
It will probably take several tries to get the right value. Let’s say that your first guess is
that
PULSOUT 12,663 will do the trick, but it turns out not to be enough because the Boe-
Bot is still turning slightly to the left. So try
PULSOUT 12,670. Maybe that
overcorrects, and it turns out that
PULSOUT 12,665 gets it exactly right. This is called an
iterative process, meaning a process that takes repeated tries and refinements to get to the
right value.
If your Boe-Bot curved to the right instead of the left, it means you need to slow down
the left wheel by reducing the Duration of 850 in the PULSOUT 13,850 command.
Again, the closer this value gets to 750, the slower the servo will turn.
√ Modify BoeBotForwardTenSeconds.bs2 so that it makes your Boe-Bot go
straight forward.
√ Use masking tape or a sticker to label each servo with the best
PULSOUT values.
√ If your Boe-Bot already travels straight forward, try the modifications just
discussed to see the effect. It should cause the Boe-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-
Bot to roll backward.
√ Modify BoeBotForwardTenSeconds.bs2 so that it makes the Boe-Bot roll
backward for ten seconds.
√ Repeat the test for straight line.
√ Repeat the steps for correcting the
PULSOUT command’s Duration argument to
straighten the Boe-Bot’s backward travel.
Tuning the Turns
Software adjustments can also be made to get the Boe-Bot to turn to a desired angle, such
as 90°. The amount of time the Boe-Bot spends rotating in place determines how far it
turns. Because the
FOR…NEXT loop controls run time, you can adjust the FOR…NEXT loop’s
EndValue argument to get very close to the turning angle you want.
Here’s the left turn routine from ForwardLeftRightBackward.bs2.
FOR counter = 1 TO 24 ' Rotate left - about 1/4 turn
PULSOUT 13, 650