VEXcode Doxygen
Classes | Public Types | Public Member Functions | Public Attributes | List of all members
vex::vision Class Reference

Use this class when programming the vision sensor. More...

#include <vex_vision.h>

Inheritance diagram for vex::vision:
vex::device

Classes

class  code
 Use this class when programming the vision sensor. More...
 
class  object
 The object class represents an object that the vision sensor detects. More...
 
class  signature
 Use this class when programming the vision sensor. More...
 

Public Types

enum  detectionMode { objectDetect = kVisionModeNormal, mixedDetect = kVisionModeMixed, lineDetect = kVisionModeLineDetect, test = kVisionTypeTest }
 
enum  whiteBalanceMode { automatic = kVisionWBNormal, start = kVisionWBStart, manual = kVisionWBManual }
 
enum  ledMode { automatic = kVisionLedModeAuto, manual = kVisionLedModeManual }
 
enum  wifiMode { off = kVisionWifiModeOff, on = kVisionWifiModeOn }
 

Public Member Functions

 vision (int32_t index)
 Creates a new vision object on the port specified. More...
 
template<typename... Args>
 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 objects settings. More...
 
bool installed ()
 
int32_t value ()
 
int32_t takeSnapshot (uint32_t id)
 Takes a data sample from the vision sensor. More...
 
int32_t takeSnapshot (code &cc)
 Takes a data sample from the vision sensor. More...
 
int32_t takeSnapshot (signature &sig)
 Takes a data sample from the vision sensor. More...
 
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 amount. More...
 
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 amount. More...
 
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 amount. More...
 
bool setSignature (V5_DeviceVisionSignature *pSignature)
 
bool getSignature (uint32_t id, V5_DeviceVisionSignature *pSignature)
 
bool setSignature (signature &sig)
 
bool getSignature (uint32_t id, signature &sig)
 
bool setMode (detectionMode mode)
 
detectionMode getMode (void)
 
bool setBrightness (uint8_t value)
 
uint8_t getBrightness (void)
 
bool setWhiteBalanceMode (whiteBalanceMode mode)
 
whiteBalanceMode getWhiteBalanceMode (void)
 
bool setWhiteBalanceValues (uint8_t red, uint8_t green, uint8_t blue)
 
bool getWhiteBalanceValues (uint8_t *red, uint8_t *green, uint8_t *blue)
 
bool setLedMode (ledMode mode)
 Changes the mode of the LED on the vision sensor. More...
 
ledMode getLedMode (void)
 Gets the mode of the LED from the vision sensor. More...
 
bool setLedBrightness (uint8_t percent)
 Changes the brightness of the LED on the vision sensor when LED is set to manual mode. More...
 
uint8_t getLedBrightness (void)
 Gets the brightness of the LED from the vision sensor. More...
 
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. More...
 
bool getLedColor (uint8_t *red, uint8_t *green, uint8_t *blue)
 Gets the color of the LED from the vision sensor. More...
 
bool setWifiMode (wifiMode mode)
 
wifiMode getWifiMode (void)
 
- Public Member Functions inherited from vex::device
 device (int32_t index)
 
V5_DeviceType type ()
 
int32_t index ()
 
void init (int32_t index)
 
uint32_t timestamp ()
 

Public Attributes

int32_t objectCount
 The amount of objects found in the data sample. More...
 
object largestObject
 The largest object found in the data sample. More...
 
safearray< object, VISION_MAX_OBJECTS > objects
 An array containing the largest object(s) found in the data sample. @type_override{object} @identifier_override{objects[12]}. More...
 

Additional Inherited Members

- Protected Attributes inherited from vex::device
int32_t _index
 
int32_t _threadID
 

Detailed Description

Use this class when programming the vision sensor.

@prog_lang{block|cpp|pro}

Constructor & Destructor Documentation

◆ vision() [1/2]

vex::vision::vision ( int32_t  index)

Creates a new vision object on the port specified.

@prog_lang{cpp|pro} @drawer_cat{constructor} @block_sig{vex::vision Vision = vex::vision(vex::PORT1);}

Parameters
indexThe port index for this vision. The index is zero-based.

◆ vision() [2/2]

template<typename... Args>
vex::vision::vision ( int32_t  index,
uint8_t  bright,
Args &...  sigs 
)
inline

Creates a new vision object on the port specified. Sets the brightness setting and all of the vision objects settings.

@prog_lang{cpp|pro} @drawer_cat{constructor} @block_sig{vex::vision Vision = vex::vision(vex::PORT1, 60, sigObj1, sigObj2, sigObj3, sigObj4, sigObj5, sigObj6, sigObj7);}

Parameters
indexThe port index for this vision. The index is zero-based.
brightThe vision sensor brightness setting. Values are 0 to 255
sigsList of signature objects used to setup the detection signatures for this sensor.

Member Function Documentation

◆ getLedBrightness()

uint8_t vex::vision::getLedBrightness ( void  )

Gets the brightness of the LED from the vision sensor.

@prog_lang{cpp|pro} @drawer_cat{sensing} @block_sig{Vision.getLedBrightness()}

Returns
Returns a value between 0 and 100 that represents the current brightness of the vision sensor LED.

◆ getLedColor()

bool vex::vision::getLedColor ( uint8_t *  red,
uint8_t *  green,
uint8_t *  blue 
)

Gets the color of the LED from the vision sensor.

@prog_lang{cpp|pro} @drawer_cat{sensing} @block_sig{Vision.getLedColor(0, 255, 0)}

Parameters
redA reference to a value to store the intensity of the red color of the LED.
greenA reference to a value to store the intensity of the green color of the LED.
blueA reference to a value to store the intensity of the blue color of the LED.
Returns
Returns true if values were sucessfully recived.

◆ getLedMode()

ledMode vex::vision::getLedMode ( void  )

Gets the mode of the LED from the vision sensor.

@prog_lang{cpp|pro} @drawer_cat{sensing} @block_sig{Vision.getLedMode()}

Returns
Returns a tLedMode that represents the current mode of the vision sensor LED.

◆ setLedBrightness()

bool vex::vision::setLedBrightness ( uint8_t  percent)

Changes the brightness of the LED on the vision sensor when LED is set to manual mode.

@prog_lang{cpp|pro} @drawer_cat{setting} @block_sig{Vision.setLedBrightness(50);}

Parameters
percentA percentage of total brightness of the vision sensor LED when in manual mode. Values are 0 to 100. 0 = LED off
Returns
Returns true if setting was successfully saved.

◆ setLedColor()

bool vex::vision::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.

@prog_lang{cpp|pro} @drawer_cat{setting} @block_sig{Vision.setLedColor(0, 255, 0);}

Parameters
redA value from 0 to 255 the represents the intensity of the red color of the LED.
greenA value from 0 to 255 the represents the intensity of the green color of the LED.
blueA value from 0 to 255 the represents the intensity of the blue color of the LED.
Returns
Returns true if setting was successfully saved.

◆ setLedMode()

bool vex::vision::setLedMode ( ledMode  mode)

Changes the mode of the LED on the vision sensor.

@prog_lang{cpp|pro} @drawer_cat{setting} @block_sig{Vision.setLedMode(vex::tLedMode::manual);}

Parameters
modeThe LED mode. Automatic mode will cause the LED color to be controlled by the vision sensor firmware. Manual mode allows the LED color to be controlled by the user program.
Returns
Returns true if setting was successfully saved.

◆ takeSnapshot() [1/6]

int32_t vex::vision::takeSnapshot ( code cc)

Takes a data sample from the vision sensor.

@prog_lang{block|cpp|pro} @drawer_cat{action} @block_sig{Vision.takeSnapshot(codeSig);}

Returns
Returns the number of objects found from the code signature passed in the parameter. @return_type_override{void}
Parameters
ccThe code signature of the object to look for.

◆ takeSnapshot() [2/6]

int32_t vex::vision::takeSnapshot ( code cc,
uint32_t  count 
)

Takes a data sample from the vision sensor, and only stores the largest samples of the specified amount.

@prog_lang{cpp|pro} @drawer_cat{action} @block_sig{Vision.takeSnapshot(sigCode,5);}

Returns
Returns a limited number of objects found from the code signature passed in the parameter.
Parameters
ccThe code signature of the object to look for.
countthe amount of objects to look for. The largest of the object will be returned.

◆ takeSnapshot() [3/6]

int32_t vex::vision::takeSnapshot ( signature sig)

Takes a data sample from the vision sensor.

@prog_lang{block|cpp|pro} @drawer_cat{action} @block_sig{Vision.takeSnapshot(SIG1);}

Returns
Returns a number of objects found from the signature passed in the parameter. @return_type_override{void}
Parameters
sigThe signature of the object to look for.

◆ takeSnapshot() [4/6]

int32_t vex::vision::takeSnapshot ( signature sig,
uint32_t  count 
)

Takes a data sample from the vision sensor, and only stores the largest samples of the specified amount.

@prog_lang{cpp|pro} @drawer_cat{action} @block_sig{Vision.takeSnapshot(SIG1,5);}

Returns
Returns a limited number of objects found from the signature passed in the parameter.
Parameters
sigThe signature of the object to look for.
countthe amount of objects to look for. The largest of the object will be returned.

◆ takeSnapshot() [5/6]

int32_t vex::vision::takeSnapshot ( uint32_t  id)

Takes a data sample from the vision sensor.

@prog_lang{cpp|pro} @drawer_cat{action} @block_sig{Vision.takeSnapshot(1);}

Returns
Returns the number of objects found from the ID passed in the parameter.
Parameters
idThe ID of the object to look for.

◆ takeSnapshot() [6/6]

int32_t vex::vision::takeSnapshot ( uint32_t  id,
uint32_t  count 
)

Takes a data sample from the vision sensor, and only stores the largest samples of the specified amount.

@prog_lang{cpp|pro} @drawer_cat{action} @block_sig{Vision.takeSnapshot(1,5);}

Returns
Returns a limited number of objects found from the ID passed in the parameter.
Parameters
idThe ID of the object to look for.
countthe amount of objects to look for. The largest of the object will be returned.

Member Data Documentation

◆ largestObject

object vex::vision::largestObject

The largest object found in the data sample.

@prog_lang{block|cpp|pro} @drawer_cat{instance} @block_sig{Vision.largestObject}

◆ objectCount

int32_t vex::vision::objectCount

The amount of objects found in the data sample.

@prog_lang{block|cpp|pro} @drawer_cat{sensing} @block_sig{Vision.objectCount}

◆ objects

safearray< object, VISION_MAX_OBJECTS > vex::vision::objects

An array containing the largest object(s) found in the data sample. @type_override{object} @identifier_override{objects[12]}.

@prog_lang{block|cpp|pro} @drawer_cat{instance} @block_sig{Vision.objects[0]}


The documentation for this class was generated from the following file: