The last Finch sensors are the obstacle sensors. In the center of the Finch’s beak, below the temperature sensor, there is a small device that emits infrared radiation. If there is an obstacle near the Finch, this radiation will bounce off the obstacle and be detected by one of the two infrared sensors that are the Finch’s “eyes.”
Resources available for teachers. Login/Get Access
Write a program that makes the Finch drive forward until it detects a wall or other obstacle.
Use the Finch as a security system! Place the Finch in front of a door. As long as the door is closed, the beak should blink red. When the door opens (obstacle gone), the Finch should go crazy with light, sounds, and movements.
Program your Finch to wander around a room. When it encounters an obstacle, it should back up and turn away from it randomly for two seconds – you can do this by generating two negative random values for the left and right wheel velocities. The Finch’s beak should glow green when it is moving forward. The beak should change to red when the Finch sees an obstacle and is moving away from it. Since Finches are diminutive and polite creatures, it should also apologize (or beep apologetically) when it sees an obstacle. The Finch should continue running this program until it is picked up and placed on its tail.
Start by setting up a simple maze (unless your teacher has already set up a maze). The picture below shows a sample cardboard maze created by teachers at Longwood University’s Institute for Teaching through Technology and Innovative Practices (ITTIP) program.
To complete the maze, you will create a “wall following” robot. To follow a wall, your robot should repeat these three steps:
This is a basic algorithm for following a wall, but you have some work to do to turn this algorithm into a program that works well for your robot. You will need to adjust your motor power and movement times until your program works correctly. Try to make your robot complete the maze as quickly as possible!
Another way to solve a maze would be to write a program with a specific sequence of moves and turns. What are the advantages of the wall-following algorithm?
Extension 1: Can your robot start at the end of the maze and move through the maze to the start? Do you need to modify your program?
Extension 2: Could your program solve a new maze? How much could the current maze change before your program would no longer work? What changes can you make to your program to enable it to solve different mazes?