Skip to main content

Lesson 1: The Eye Sensor and the Disk Maze Problem

Using Eye Sensor Data with the Disk Maze Problem

The Eye Sensors on the VR Robot can be used in many ways. Note that the Down Eye Sensor does not detect the floor of a Playground as an object. Other items, such as disks, will register as objects. The Front Eye Sensor does detect walls in the Playgrounds, as well as raised objects, like disks or castles.

The Eye Sensors can detect the color of an object near the sensor, such as the colored disks in the Disk Maze Playground. This is useful if you want the VR Robot to sort differently colored objects, drive up to a specifically colored object, or perform different behaviors based on the color of an object detected.

For instance, in this project, the VR Robot will drive to the first green disk in the Disk Maze, then turn to face the next disk. 

def main():
    while not front_eye.detect(GREEN):
        drivetrain.drive(FORWARD)
        wait(5, MSEC)

    drivetrain.turn_for(RIGHT, 90, DEGREES)

Watch the video here to see the VR Robot  drive forward while the Front Eye Sensor does not detect a green object. Once a green object is detected, the VR Robot turns right.

Video file

The data from the Front Eye Sensor and Down Eye Sensor is reported in the Dashboard in real time, as the project is running. Notice that the Front Eye Sensor detects both the object (the disk) and the color (green) when it approaches the disk.

VEXcode VR project described above on the left with the Playground window on the right. A callout box highlights the words, Front Eye Object True and Color Green. This aligns with the image of the robot on the Playground which is stopped in front of a green Disk.

The Down Eye Sensor detects the color of the floor (green), but as there is not an object on the floor of the Playground, that value is reported as False. 

The same image of the project and Playground window as before, but this time the callout box highlights the text Down Eye Object False Color Green. This indicates that the down eye detects the color of the square on the playground floor but does not report that square as an object.

You can use the data reported in the Dashboard at any time to help visualize the data that the Eye Sensors are reporting in real time. 

Questions

Please select a link below to access the lesson quiz.

Google Doc / .docx / .pdf