Configuring the V5 Vision Sensor with the Expert Robot Configuration in VEXcode Pro V5

The VEX Visual Studio Code Extension has replaced VEXcode Pro V5, which is now end-of-life.

VEXcode Blocks and VEXcode Text remain actively developed and supported for all VEX platforms.

Open a Project

VEXcode Pro V5 interface with File menu open and Open option highlighted to open a project.

Enable Expert Robot Configuration

VEXcode Pro V5 project settings menu with ‘Enable Expert Robot Configuration’ option highlighted.

Accept Terms of Expert Robot Configuration

Warning dialog explaining Expert Robot Configuration with Yes button highlighted to confirm.

Include New File

VEXcode Pro V5 interface with include folder context menu open and New File option highlighted.

Right click on the ‘include’ dropdown and select “New File.”

Add Vision Sensor Configuration File

Create New File window showing Vision Sensor Configuration (.h) selected with name and port fields filled and Create button highlighted.

Select the ‘Vision Sensor Configuration(.h)’ C++ file.

Assign the Vision Sensor to a port.

Name the file [name of file].h

Click the Create button.

NOTE: The file name MUST contain the correct extension of “.h”, the file cannot be created without it.

Launch the Vision Utility

VEXcode Pro V5 code editor showing Vision Sensor configuration file open with Configure button highlighted.

Click on the newly created Vision Sensor File to open the file.

Click on the Configure button to launch the vision utility.

Place an Object in View

Vision Utility showing camera view of a blue object with Freeze button available and signature controls displayed.

Place an object in front of the Vision sensor so that it takes up most of the screen and click on the 'Freeze' button to lock the screen.

Select the Object's Color

Vision Utility showing bounding box drawn around a blue object.

Click and drag a bounding box on the color/object to be tracked. Make sure to have the bounding box contain mainly the color of the object and not little to none of the background.

Assign the Color

Vision Utility showing bounding box drawn around a blue object and signature slot selected using Set button.

Click on one of the seven 'Set' checkboxes to assign that color to a signature slot.

Calibrate the Color Signature

Vision Utility showing color signature calibration slider adjusted to better match the object.

Click on the double-sided arrow icon to the right of the 'Clear' button and use the slider to calibrate the Vision Sensor to best detect the color signature. For best results, drag the slider until most of the colored object is highlighted while the background and other objects are not.

Name the Signature

Vision Utility showing the color signature renamed to BLUE_CUBE.

Click on the SIG_1 text field in order to rename the color signature.

Press the Freeze button once more to allow the Vision Sensor to resume tracking. Move the colored object within the field of view of the Vision Sensor to ensure that it is being tracked. If the tracking is working as intended, close out of the Vision Utility.

VEXcode Pro V5 code editor showing Vision Sensor configuration file with the BLUE_CUBE signature defined in the code.

The color signatures can also be changed in the text editor via the Vision Sensor Configuration file.

To configure the Vision Sensor to detect more colors, repeat steps 5-9.

NOTE: The Vision Sensor is sensitive to different levels of light. The color signatures might need to be re-calibrated if the levels of light in the robot's environment change.

Open main.cpp

VEXcode Pro V5 file explorer with main.cpp file highlighted in the src folder.

Click main.ccp to open the file.

Modify main.cpp

VEXcode Pro V5 code editor showing the main.cpp file with an include statement added for Vision Sensor header file. The line reads #include VisionSensor.h.

Type out 
#include "[name of Vision Sensor file].h".

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

Last Updated: