Chapter 4 - Boe-Bot Navigation

Outcomes:

By the time you complete this section you will be able to:

  1. Program the Boe-Bot to perform the basic maneuvers: forward, backward, rotate left, rotate right, and pivoting turns.
  2. Tune the maneuvers so that they are more precise with understanding of what direction the wheels must turn and length of time required.
  3. Use math to calculate the number of pulses to deliver to make the Boe-Bot travel a predetermined distance.
  4. Write programs that correct the Boe-Bot when it veers to the left or right.
  5. Write programs that make the Boe-Bot gradually accelerate into and decelerate out of maneuver.
  6. Understand what subroutines are and why they are used.
  7. Write subroutines to perform the basic maneuvers so that each subroutine can be used over and over again in a program.
  8. Use commands to retrieve a value stored in EEPROM memory and place it in a variable.
  9. Record complex maneuvers in the BASIC Stamp module's unused program memory and write programs that play back these maneuvers.
  10. Write DO…LOOP commands for different conditions.
  11. Understand and use the SELECT command and how it differs from the IF command.

Assignments:

  • View the videos in the video section of this lesson.
  • Read and follow the instructions in Robotics with the Boe-Bot  Chapter 4
  • Complete the Boe-Bot activities assigned by your instructor. If self-study, do all the “Your Turn” parts for each activity in the chapter.  Fill out the Observations section in this lesson for each Activity. (Note: It is only by typing in the commands that you truly begin to understand programming. So don’t short change yourself.)
  • Chapter 4 Vocabulary List - (PDF)
  • Review the Key Points or FAQs below.
  • Use the Observations again to Answer the questions at the end of the chapter.
  • Check your answers.
  • When complete, turn in the Observations Word Doc to your instructor (print, email or other method defined by your instructor). Self-study students can optionally send to a parent, mentor or friend.


Videos and Simulations

Chapter 4 Overview Video

Activity Videos:

  • No Simulaiton videos in this Chapter

Example Program Code

Activity #1 :

Activity #2 :

Activity #4 :

Activity #5 :

Activity #6 :

 

Key Points or FAQs:

How can I center the Boe bot to make it drive a straight line?

Making the Boe-Bot drive in a straight line consists of a lot of trial and error.  Run the Boe-Bot as it is to determine which way the bot is moving off course.  Then adjust the pulse duration command sent to the servos to increase or decrease the number of  pulses sent to the servo.  The faster the right servo turns the more left it will correct while the slower the right servo turns, the more it will move to the right.  Repeat this process until the robot drives straight.

What is the formula to calculate distance?

Time = distance/speed

For example:

Time = 20 inches / 9 inches per second.

Or if time is known

5 Seconds = X inches / 9 inches per second

The distance X inches = 45 inches

How do you determine the number of pulses to send to the servo when you know the amount of time to travel?

Use the known number of pulses that the BOE board sends to the servos each second (40.65 pulses / sec)  and multiply it by the number of seconds to travel

For Example:

40.65 pulses / sec X 12 seconds = 478 pulses

What is the ramping process?

Ramping is the process of gradually increasing the speed until full speed is achieved.  Rather than going from a stop position to full speed in one command, the speed is slowly increased until the speed desired is reached.  This prevents jerkiness and results in more precise movements.

What is a subroutine and why are they useful?

Subroutines allow you to create modular, reusable code sections that can be called multiple times.  Different values can be sent to the subroutines, and they provide different results without having to rewrite a separate group of code for each scenario.

What is the EEPROM on the BOE?  Why would you use it over RAM?

EEPROM stands for erasable programmable read only memory.  Writing to EEPROM is slower than RAM, holds less information, and can only be written to a limited number of times.  Typically use EEPROM to store programs that you can access over and over again, even after the power is turned off and back on.

What is the Command to store information into EEPROM?

The DATA Directive command is used to store information in the EEPROM.

How is a Select statement different that an IF Statement?

The case statement is different in that there can be several different conditions in a case statement.  If you were using an IF statements to see if a values was 5,6,7,8 or 9, you would have to use several different IF statements.  With the Select Case statement, you can use one command and have a different line for each potential value.

For Example:

Select MyVAR

 

Case 5: …

Case 6: …

Case 7: …

Case 8: …

Case 9: …

 

ENDSELECT

What is the command to access a subroutine?

Gosub is used to call an existing subroutine.

For Example:

GOSUB MyRoutine