Learn to program

 
  Finch assignments ::

Learning Goal: Understand how to write a program to control a robot, using loops, conditionals and subroutines where appropriate.

 

 
 

Finch Assignment 12 - Obstacle detection

 

finch hardware

 Obstacle Detection. The Finch has two Infrared sensors. These sensors can detect obstacles in front of the Finch.  
The sensors are digital and so act as virtual bumpers - they do not provide information on the distance to an obstacle,
but simply register whether an obstacle exists.  The sensor detection range is between 3 and 12 inches.  Due to the
limitations of this type of sensor very narrow objects or objects made of certain black plastics may not register as obstacles.

The obstacle sensors detect whiteboard surfaces better than anything else, so ask me for some small whiteboards.

 

The Finch has a left obstacle sensor and a right obstacle sensor. The command given in the instructions are:

Left_obstacle, right_obstacle = finch.obstacle()


The robot returns False if there is no obstacle, and True if it detects an obstacle.
This is a Boolean value (only two possibilities).

You can test the detectors by running the program. 

Play with this program and the whiteboards for a while, to get a sense of how well the
IR detectors work.

 

Assignment 12:

 

Program the Finch to move around, but avoid the whiteboards.
You will need to use conditional (if) statements and while loops.

To turn it in, look at the instructions below:

  • Go to Google Drive
  • Open the Class Program folder in 'Shared with me'
  • Open your class folder and assignment folder
  • Click on the "New" button on the top left
  • Upload the program from your computer

 

 

Write a Reflection on what you have learned.