Chapter 8 - Robot Control with Distance Detection

Outcomes:

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

  1. Calculate distances detected with the IR sensor
  2. Program Boe-Bot to detect the distance to sensed objects
  3. Program a frequency sweep routine for the left and right sensors
  4. Understand and use the LOOKUP command
  5. Understand and use the FREQOUT command
  6. Program Boe-Bot to shadow (follow) another vehicle or a person
  7. Demonstrate understanding of closed loop control
  8. Demonstrate understanding of proportional control
  9. Read and follow the logic in a block diagram
  10. Demonstrate understanding of how math expressions are executed in PBasic
  11. Program Boe-Bot to follow a stripe
  12. Build a test course for Boe-Bot to follow a stripe

 

Assignments:

  • View the videos in the video section of this lesson.
  • Read and follow the instructions in Robotics with the Boe-Bot  Chapter 8
  • 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 8 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 8 Overview Video

Activity Videos:

Example Program Code

Activity #1 :

Activity #2 :

Activity #3 :

 

Key Points or FAQs:

What is Frequency sweep and how is it applied to distance detection?

Frequency Sweep is the technique of testing a circuit’s output using a variety of input frequencies.  By testing known distances from the Boe-Bot, at different intervals, you will establish a baseline and therefore be able to determine if an item is within a given distance and if it’s getting closer or father away.

What does the Lookup command do?

This command is the best approach for storing a short list of values that you want to retrieve and use in sequence. 

For Example, this set of code loops through 5 different frequencies (0 to 4).

The lookup command selects a number from a range of numbers contained within the brackets and then stores that number in the variable irFrequency in this example.

The FreqOut command sends that stored number in irFrequency to pin 8 and allows the BoeBot to detect objects at that frequency.

FOR freqSelect = 0 TO 4

  LOOKUP freqSelect,[37500,38250,39500,40500,41500],irFrequency

  FREQOUT 8,1, irFrequency

  irDETECT = IN9

  NEXT

What is Proportional control?

Proportional control in a closed-loop system is a process where the error is multiplied by a proportionality constant to determine the system’s output.  It allows us to track variances within the system.

For examples see the Wikipedia definition.