Line Detection

Connect

Make sure that you can answer the following questions:
– Can autonomous cars react to different traffic light signals?
– What can happen if a driver falls asleep while driving?
– How can we detect when a driver is falling asleep?

Think about what you have learned, then document it. Describe the problem in your own words. Creatively record your ideas and findings.

car-road-line

Construct

Build
Start by constructing this model.

Program
Autonomous cars need to recognize and respond to traffic lights automatically.
Create a program that will make your robot stop at red lights.
Refine your program by making it stop at an appropriate distance from the traffic lights.
Make sure your robot is only responding to the color red.
Once you have succeeded, program your robot to drive forward again when the light changes from red to green.

ev3-robot-color-sensor-down

Use the Color Sensor and the Switch Block to make decisions (Boolean logic). These two blocks will allow the robot to make choices based on the colors it sees.

Think about what you have learned, then document it. Describe your pseudocode for this task. Creatively record your ideas and findings.

Consider using these blocks in your solution:

layout-ex-cbs-05

Contemplate

To simulate what could happen if a driver falls asleep while driving, your robot could sound an alarm signal when it crosses the line. This feature is often available in new cars.
Program your robot to perform this function.

Think about what you have learned, then document it. Describe your pseudocode for this task. Creatively record your ideas, and findings.

Differentiation
Program your robot to drive on “autopilot” along a given route. You will need to create a program that recognizes and responds to a dark line (or white line). You will create a line-following program and your robot will need to travel along the line without losing contact with it.
You will need to constantly debug your program in order to make your robot travel as smoothly as possible along the line.

Share
Consider the following questions:
What challenged you? Where there any surprises? How could you improve your program?
Could your program have been more streamlined? Have you used too many blocks?
Is there a more efficient way of building your program?
How could your program be used in real-world scenarios?
Think about what you have learned, then document it. Creatively record and present your ideas, creations, and findings.

Consider using these blocks in your solution:

switch-color-sensor-compare-reflected-light-intensity

Continue

Explore text-based programming solutions for this activity and compare these solutions using different programming languages.