The VEX VR Robot has a multitude of sensors, including two Eye Sensors.


Eye Sensors on the VR Robot

front down eye

The VR Robot has two Eye Sensors, one that faces forward, and another that faces down. The sensors can detect if there is an object present as well as detect color (red, green, blue, none).

Eye sensor dashboard

The Eye Sensor values can be displayed on the Dashboard in VEXcode VR. To learn more about the Dashboard, view the Dashboard - Playground Features - VEXcode VR article.

Eye sensor monitor

The Eye Sensor values can be displayed on the Monitor Console in VEXcode VR. To learn more about the Monitor Console, see this article.

To monitor sensor values in VEXcode VR Python, the monitor_sensors command needs to be added to the project. For more information about monitoring sensors in VEXcode VR with Python, see this article.


VEXcode VR Blocks Used with the Eye Sensors

<Color near object> block

Color_near_object_block.png

The <Color near object> block reports if the Eye Sensor is close enough to an object to detect a color (red, green, blue, none).

Color_near_object_drop_down_menu.png

The Front or Down Eye Sensor can be selected from the drop-down menu on the block.

Monitor true zoom

The <Color near object> block is a Boolean block that reports true when the Eye Sensor is close to an object that has detectable colors, and reports false when it is not close enough to an object with detectable colors.

<Color sensing> block

Color sensing block

The Color sensing block reports if the Eye Sensor detects a specific color.

Color sensing block

The Front or Down Eye Sensor can be selected from the drop-down menu on the block.

Color sensing dropdown

The color that the Eye Sensor is looking for can be selected from the drop-down menu on the block.

Monitor detect green

The <Color sensing> block is a Boolean block that reports true when the Eye Sensor detects the selected color, and reports false when it does not detect the selected color.


VEXcode VR Python Commands Used With the Eye Sensor

near_object Command

Screen_Shot_2021-11-11_at_1.09.15_PM.png

The near_object command reports if the Eye Sensor is close enough to an object to detect a color (red, green, blue, none). The front or down Eye Sensor can be selected when dragging in a command from the Toolbox or when typing in the command.

Monitor true zoom

The near_object command is a Boolean that reports true when the Eye Sensor is close to an object that has detectable colors, and reports false when it is not close enough to an object with detectable colors.

To monitor sensor values in VEXcode VR Python, the monitor_sensors command needs to be added to the project. For more information about monitoring sensors in VEXcode VR with Python, see this article.

detect Command

Screen_Shot_2021-11-11_at_1.34.06_PM.png

The detect command reports if the Eye Sensor detects a specific color. The front or down Eye Sensor can be selected when dragging in a command from the Toolbox or when typing in the command.

Screen_Shot_2021-11-11_at_1.32.48_PM.png

The color that the Eye Sensor is looking for can be selected through the autocomplete feature when adding the command. For more information on using the autocomplete feature in VEXcode VR with Python, see this article.

Monitor detect green

The detects command is a Boolean that reports true when the Eye Sensor detects the selected color, and reports false when it does not detect the selected color.

To monitor sensor values in VEXcode VR Python, the monitor_sensors command needs to be added to the project. For more information about monitoring sensors in VEXcode VR with Python, see this article.


Using the Front Eye Sensor in a VEXcode VR Project

The VR Robot can use the Front Eye Sensor to initiate a sequence of behaviors when an object or color is detected. This can include driving until an object (like a wall, disk, or castle) is detected then stop driving to avoid a crash or driving and sensing a specific color and executing an action depending on the color detected. 

Wall Maze Playground

VEXcode VR Blocks

VEXcode VR Python

Eye_wall_maze_.png

Eye_wall_maze.png

Screen_Shot_2021-11-11_at_3.03.00_PM.png

In this example, using the Wall Maze Playground, the VR Robot will drive forward until it detects that it is near an object, in this case the wall, then stop driving.

Disk Maze Playground

VEXcode VR Blocks

VEXcode VR Python

Screen_Shot_2021-11-12_at_11.56.22_AM.png

Screen_Shot_2021-11-12_at_11.55.30_AM.png

Screen_Shot_2021-11-12_at_11.58.36_AM.png

In this example on the Disk Maze Playground, the VR Robot will drive forward until the Front Eye Sensor detects a green object, then it will stop and wait, before driving in reverse. Notice that in the Dashboard, the Front Eye Sensor values are reporting true that an object was detected, and the color of that object (disk) is green.


Using the Down Eye Sensor in a VEXcode VR Project

The Down Eye Sensor can be used on the Playgrounds to help detect the color of disks in the Disk Mover Playground, find the edge of the Castle Crasher Playground, and more. One thing to note about the Down Eye Sensor, is that it is tuned to not detect the floor of a Playground as an object. Other items, such as disks, will register as an object.

Disk Mover Playground

VEXcode VR Blocks

VEXcode VR Python

Eye_disk_mover.png

Eye_disk_mover-1.png

Screen_Shot_2021-11-11_at_2.42.01_PM.png

This project can be used with the Disk Mover Playground. In this project, the VR Robot will drive forward until the Down Eye Sensor detects blue, then stop driving and set the Electromagnet to 'boost' to pick up the disk.

Castle Crasher Playground

VEXcode VR Blocks

VEXcode VR Python

castel_crasher.jpg

Detect_red_down_eye.png

Screen_Shot_2021-11-12_at_11.14.10_AM.png

This project can be used with the Castle Crasher Playground. In this project, the VR Robot will drive forward, turn left, then drive forward until the Down Eye Sensor detects the red border and stops driving.

For more information, help, and tips, check out the many resources at VEX Professional Development Plus