Required Knowledge:
Conditional statements, Logical operators, Line Tracking
Application:
Line tracking robots are currently used to deliver mails in some office buildings, move items through factory assembly lines, find and collect products in warehouses and deliver medications in hospitals. These are only a few examples of the many usages of such robots in today's world.
Make a function/module that tracks a line using the following line tracking algorithm. Now, anytime you need to track a line, you will be able to reuse this function/module!
Snap: Make a block that only includes the if-else statements and turns that you use to track the line. It should not contain a loop. To test your block, write a program that uses your block in a loop.
Snap!:
1. Create a block named FinchLineTrack.
2. Within the block editor, add an if-else block, and another if-else block within the first else block.
3. Use the following algorithm for the line tracking block:
4. Place the FinchLineTrack block into a forever loop block to loop infinitely, or place it in a repeat until block that stops when a button is pressed.
Python:
1. Use 'def linetrack():' to define the line tracking function.
2. Within the function, use an if-elif-else statement to move the Finch depending on what the line tracking sensors detect.
3. Use the code below to test out your function!
Use black electrical tape to create a path on a large sheet of white paper. The path should be about 2.5 cm wide. Avoid sharp turns; it is easier for the Finch to follow gradual curves.