AI Vision Investigation
Explore AI Vision with an example project! Can you answer all the questions correctly?
Step by Step
Diagram Description: A visual representation of a VEX AIM activity field. It shows a grid with a VEX AIM Coding Robot positioned in the center. Around the robot are various objects: a sports ball (yellow), an orange barrel, a blue barrel, an AprilTag with ID 1, and a small red classroom object (like a pom pom). The layout is designed to test the robot's AI vision capabilities.
- Place the VEX AIM Coding Robot in the center of the field. Place a sports ball, an orange barrel, a blue barrel, AprilTag ID 1, and one small red classroom object (like a pom pom) around the field, as shown in the diagram above.
- Open this VEXcode AIM project, or recreate the project shown on the next page in VEXcode AIM, and download it to the robot.
- Read the project, and predict what you think the robot will do when the project is run.
- Run the project and observe the robot's behavior. Then, think more about the blocks in the project. Answer the following questions in your journal:
- What does the AI Vision viewer block do when the project is run?
- If the robot isn't responding to the red pom-pom, how can you use the viewer to help debug the problem?
- Which parameter should you select in the
get datablock to get the sports ball data from the AI Vision sensor? - Why do you need to use the
get datablock before theAl Vision object exists?block? - Why is the
get datablock inside aforeverloop? What happens if it is outside the loop? - What does the bearing value from the
Al Vision object propertyblock tell the robot?
'LEVEL UP'
- Aim at the Cargo – Select a cargo object to detect. Remix the project to code the robot to turn toward a barrel or sports ball.
- Detect the Pom Pom - Remix the project so your robot can turn until the red pom pom (or classroom object) is detected.
Pro Tips
- View the VEXcode API Reference to learn more about Al Vision commands. [VEXcode API Reference]
- For more information about the Data in the AI Vision Utility, see this VEX Library article. [VEX Library Article]
Project Code Description
The VEXcode AIM project uses a block-based programming interface. The sequence of blocks is as follows:
When Started Block:
AI Vision show viewer on screen: Activates the AI Vision viewer.Turn to find the AprilTag ID 1: Commands the robot to orient itself towards AprilTag ID 1.Set turn velocity to 20 %: Sets the robot's turning speed.Turn right: Initiates a right turn.
Forever Loop:
Get AprilTag ID 1 data from AI Vision: Continuously attempts to retrieve data for AprilTag ID 1 from the AI Vision sensor.- If Block: Checks if
AI Vision object exists?is true. - If true, the robot executes:
Turn to heading (heading in degrees) + AI Vision object bearing degrees. This block turns the robot to face the detected object. Break: Exits the current loop (the 'if' block's execution).Wait 0.02 seconds: Pauses the robot's execution briefly.
Standards
CSTA 1B-CS-02: Model how computer hardware and software work together as a system to accomplish tasks.
Copyright Information
Copyright 2025 Innovation First, Inc. (dba VEX Robotics). All rights reserved. See full Copyright terms at [copyright.vex.com].