14#ifndef VEX_VISION_CLASS_H
15#define VEX_VISION_CLASS_H
31 #define VISION_MAX_OBJECTS 4
32 #define VISION_DEFAULT_SNAPSHOT_OBJECTS 4
36 template <
typename signature,
typename... Args>
37 void _setsig(
signature &sig, Args &... args ) {
57 template <
typename... Args>
58 vision( int32_t index, uint8_t bright, Args &... sigs ) :
vision( index ) {
59 setBrightness( bright );
58 vision( int32_t index, uint8_t bright, Args &... sigs ) :
vision( index ) {
…}
66 enum class detectionMode {
67 objectDetect = kVisionModeNormal,
68 mixedDetect = kVisionModeMixed,
69 lineDetect = kVisionModeLineDetect,
70 test = kVisionTypeTest
73 enum class whiteBalanceMode {
74 automatic = kVisionWBNormal,
75 start = kVisionWBStart,
76 manual = kVisionWBManual
80 automatic = kVisionLedModeAuto,
81 manual = kVisionLedModeManual
85 off = kVisionWifiModeOff,
86 on = kVisionWifiModeOn
115 void set( IQ_VisionDetectionObj obj );
127 object& operator=(
const object &obj );
128 object& operator=( int32_t signatureId );
190 static void setTypeColorCode() {};
191 template <
typename signature,
typename... Args>
192 static void setTypeColorCode(
signature &sig, Args &... args ) {
194 setTypeColorCode( args... );
213 signature( int32_t
id, int32_t uMin, int32_t uMax, int32_t uMean, int32_t vMin, int32_t vMax, int32_t vMean,
float range, int32_t type );
235 bool _flipped =
false;
238 code(int32_t sig1, int32_t sig2);
239 code(int32_t sig1, int32_t sig2, int32_t sig3);
240 code(int32_t sig1, int32_t sig2, int32_t sig3, int32_t sig4);
241 code(int32_t sig1, int32_t sig2, int32_t sig3, int32_t sig4, int32_t sig5 );
254 uint32_t getCode() {
return _code; }
255 bool isFlipped() {
return _flipped; }
323 bool setSignature( IQ_VisionDetectionSettings *settings );
324 bool getSignature( IQ_VisionDetectionSettings *settings );
326 bool getSignature( uint32_t
id,
signature &sig );
327 bool setMode( detectionMode mode );
328 detectionMode getMode(
void );
329 bool setBrightness( uint8_t value );
330 uint8_t getBrightness(
void );
331 bool setWhiteBalanceMode( whiteBalanceMode mode );
332 whiteBalanceMode getWhiteBalanceMode(
void );
333 bool setWhiteBalanceValues( uint8_t red, uint8_t green, uint8_t blue );
334 bool getWhiteBalanceValues( uint8_t *red, uint8_t *green, uint8_t *blue );
381 bool setWifiMode( wifiMode mode );
382 wifiMode getWifiMode(
void );
386 IQ_VisionDetectionObj _objects[ VISION_MAX_OBJECTS ];
388 void _clearObjects(
void );
Use this class when programming the vision sensor.
code(signature &s1, signature &s2)
Creates a new vision code object.
The object class represents an object that the vision sensor detects.
const float & angle
The angle of the object.
const int16_t & width
The width of the object.
const int16_t & height
The height of the object.
const bool & exists
If the vision sensor detects the object or not.
void flipAngle()
Inverts the angle for this object.
const int16_t & centerX
The center x position of the object.
const int16_t & id
The unique ID of the object.
object()
Creates a new vision object with all properties set to default values.
const int16_t & centerY
The center y position of the object.
const int16_t & originX
The top left x position of the object.
void set(IQ_VisionDetectionObj obj)
Copies all properties of the passed in object into this object.
void clear()
Sets all properties for this object to default values.
const int16_t & originY
The top left y position of the object.
Use this class when programming the vision sensor.
signature(int32_t id, int32_t uMin, int32_t uMax, int32_t uMean, int32_t vMin, int32_t vMax, int32_t vMean, float range, int32_t type)
Creates a new vision signature object.
Use this class when programming the vision sensor.
ledMode getLedMode(void)
Gets the mode of the LED from the vision sensor.
vision(int32_t index)
Creates a new vision object on the port specified.
uint8_t getLedBrightness(void)
Gets the brightness of the LED from the vision sensor.
int32_t takeSnapshot(code &cc, uint32_t count)
Takes a data sample from the vision sensor, and only stores the largest samples of the specified amou...
safearray< object, VISION_MAX_OBJECTS > objects
An array containing the largest object(s) found in the data sample. @type_override{object}...
bool setLedMode(ledMode mode)
Changes the mode of the LED on the vision sensor.
object largestObject
The largest object found in the data sample.
int32_t takeSnapshot(uint32_t id, uint32_t count)
Takes a data sample from the vision sensor, and only stores the largest samples of the specified amou...
int32_t takeSnapshot(signature &sig, uint32_t count)
Takes a data sample from the vision sensor, and only stores the largest samples of the specified amou...
int32_t takeSnapshot(uint32_t id)
Takes a data sample from the vision sensor.
bool setLedBrightness(uint8_t percent)
Changes the brightness of the LED on the vision sensor when LED is set to manual mode.
bool getLedColor(uint8_t *red, uint8_t *green, uint8_t *blue)
Gets the color of the LED from the vision sensor.
int32_t takeSnapshot(signature &sig)
Takes a data sample from the vision sensor.
bool setLedColor(uint8_t red, uint8_t green, uint8_t blue)
Changes the color of the LED on the vision sensor when LED is set to manual mode.
int32_t objectCount
The amount of objects found in the data sample.
vision(int32_t index, uint8_t bright, Args &... sigs)
Creates a new vision object on the port specified. Sets the brightness setting and all of the vision ...
int32_t takeSnapshot(code &cc)
Takes a data sample from the vision sensor.
Bumper switch device class