The Vision Sensor allows your robot to detect and respond to colors in its environment. Using a built-in camera and onboard processing, the Vision Sensor can identify and track Color Signatures, which are specific colors that you configure for your project.
Once Color Signatures are configured, the sensor can report information such as the location, size, and count of matching objects within its field of view.
Important: The Vision Sensor can only be configured if you have an internet connection.
Connect to the Vision Utility
To begin configuring your Vision Sensor, first, add it as a device in the Devices Window.
Select Open Utility to begin configuring Color Signatures.
Select the camera icon in the top-left corner of the window to connect your Vision Sensor.
Connect the Vision Sensor to your computer using its micro-USB port.
Using your device's dialog, select the Vision Sensor. A Windows interface is shown here for reference.
Note: The Vision Sensor cannot be configured with the Vision Utility while it is connected to the V5 Brain.
Once connected, the Vision Sensor will display a picture taken when it was connected and the camera icon in the top right will turn green.
Configuring a Color Signature
To update the image shown in the Vision Utility, select the green camera icon.
Low brightness
High brightness
To change the brightness of the pictures taken by the Vision Sensor, use the Brightness slider at the top of the Vision Utility.
Position your mouse cursor over the solid-colored object, then select and drag across the desired color to configure it.
Note: Make sure to stay within the confines of the color you want to select. Otherwise, you may accidentally grab colors from the background that can throw off the Vision Sensor’s detection.
The Set button will turn green. Select it to save the color.
When a Color Signature is set, a bounding box will appear around any colors matching that signature. For more information about an object's properties and how to code with them, go to the V5 API Reference Site.
You can also rename the Color Signature by clicking the name (by default the first name is SIG_1). Selecting outside of the text field will save the name.
Select the arrows icon next to a Color Signature to adjust its tolerance.
Increasing the tolerance allows a wider range of similar shades to be recognized as the same Color Signature, which is useful in situations with inconsistent lighting—such as shadows or glare. Lowering the tolerance makes the sensor more selective, recognizing only colors very close to the original signature.
Configuring a Color Code
A color code is a combination of color signatures that form a horizontal pattern. Once you have the color signatures configured, select the Codes tab to begin configuring color codes.
In the right text box, enter the names of the color signatures to include in the color code, in order and separated by commas.
For example, to create a pattern of Red followed by Blue, enter RED_BOX,BLUE_BOX
. To create a pattern of Blue followed by Red, enter BLUE_BOX,RED_BOX
.
Rename the Color Signature by clicking inside the left text field.
Once a name is saved for the new color code, it will show on the screen.
Color Codes have a unique property that can be used with their objects called Angle. For more information about this property, visit the V5 API Reference Site.
Save the Vision Sensor's Configuration
Once all color signatures and color codes have been set, select Copy Config and return to VEXcode.
Inside VEXcode, select Paste Config.
Then select Done to save the Vision Sensor configuration and begin using it to code in VEXcode V5.