Robot Config: Vision Sensor - VEXcode
Step 1: Open a Project
- Open a project in VEXcode.
Step 2: Include New File
- Right click on the ‘include’ dropdown and select “New File”.
Step 3: Add Vision Sensor Configuration File
- 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.
Step 4: Launch the Vision Utility
- Click on the newly created Vision Sensor File to open the file.
- Click on the Configure button to launch the vision utility.
Step 5: Place an Object in View
- 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.
Step 6: Select the Object's Color
- 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.
Step 7: Assign the Color
- Click on one of the seven 'Set' checkboxes to assign that color to a signature slot.
Step 8: Calibrate the Color Signature
- 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.
Step 9: Name the Signature
- 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.
- The color signatures can also be changed in the text editor via the Vision Sensor Configuration file.
NOTE: 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.
Step 10: Open main.cpp
- Click main.ccp to open the file.
Step 11: Modify main.cpp
- Type out
#include [name of Vision Sensor file].h.