VEXcode IQ C++ Unofficial documentation for version 3.0.4.1
Loading...
Searching...
No Matches
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 class  detectionMode { objectDetect = kVisionModeNormal , mixedDetect = kVisionModeMixed , lineDetect = kVisionModeLineDetect , test = kVisionTypeTest }
 
enum class  whiteBalanceMode { automatic = kVisionWBNormal , start = kVisionWBStart , manual = kVisionWBManual }
 
enum class  ledMode { automatic = kVisionLedModeAuto , manual = kVisionLedModeManual }
 
enum class  wifiMode { off = kVisionWifiModeOff , on = kVisionWifiModeOn }
 

Public Member Functions

 vision (int32_t index)
 Creates a new vision object on the port specified.
 
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.
 
bool installed ()
 
int32_t value ()
 
int32_t takeSnapshot (uint32_t id)
 Takes a data sample from the vision sensor.
 
int32_t takeSnapshot (code &cc)
 Takes a data sample from the vision sensor.
 
int32_t takeSnapshot (signature &sig)
 Takes a data sample from the vision sensor.
 
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.
 
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.
 
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.
 
bool setSignature (IQ_VisionDetectionSettings *settings)
 
bool getSignature (IQ_VisionDetectionSettings *settings)
 
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.
 
ledMode getLedMode (void)
 Gets the mode of the LED 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.
 
uint8_t getLedBrightness (void)
 Gets the brightness of the LED 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.
 
bool getLedColor (uint8_t *red, uint8_t *green, uint8_t *blue)
 Gets the color of the LED from the vision sensor.
 
bool setWifiMode (wifiMode mode)
 
wifiMode getWifiMode (void)
 
- Public Member Functions inherited from vex::device
 device (int32_t index)
 
IQ_DeviceType type ()
 
int32_t index ()
 
void init (int32_t index)
 
int32_t readDigitalPin ()
 
int32_t readAnalogPin ()
 

Public Attributes

int32_t objectCount
 The amount of objects found in the data sample.
 
object largestObject
 The largest object found in the data sample.
 
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]}.
 

Additional Inherited Members

- Protected Member Functions inherited from vex::device
void setPollInterval (int32_t value)
 
bool pollValid (bool bSave)
 
- Protected Attributes inherited from vex::device
int16_t _index
 

Detailed Description

Use this class when programming the vision sensor.

Definition at line 29 of file vex_vision.h.

Member Enumeration Documentation

◆ detectionMode

enum class vex::vision::detectionMode
strong

Definition at line 66 of file vex_vision.h.

◆ ledMode

enum class vex::vision::ledMode
strong

Definition at line 79 of file vex_vision.h.

◆ whiteBalanceMode

enum class vex::vision::whiteBalanceMode
strong

Definition at line 73 of file vex_vision.h.

◆ wifiMode

enum class vex::vision::wifiMode
strong

Definition at line 84 of file vex_vision.h.

Constructor & Destructor Documentation

◆ vision() [1/2]

vex::vision::vision ( int32_t index)

Creates a new vision object on the port specified.

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.

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.

Definition at line 58 of file vex_vision.h.

Member Function Documentation

◆ getLedBrightness()

uint8_t vex::vision::getLedBrightness ( void )

Gets the brightness of the LED from the vision sensor.

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.

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.

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

◆ installed()

bool vex::vision::installed ( )
virtual

Reimplemented from vex::device.

◆ 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.

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.

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.

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.

Returns
Returns the number of objects found from the code signature passed in the parameter.
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.

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.

Returns
Returns a number of objects found from the signature passed in the parameter.
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.

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.

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.

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.

◆ value()

int32_t vex::vision::value ( )
virtual

Reimplemented from vex::device.

Member Data Documentation

◆ largestObject

object vex::vision::largestObject

The largest object found in the data sample.

@block_sig{Vision.largestObject}

Definition at line 313 of file vex_vision.h.

◆ objectCount

int32_t vex::vision::objectCount

The amount of objects found in the data sample.

@block_sig{Vision.objectCount}

Definition at line 307 of file vex_vision.h.

◆ 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]}.

Definition at line 320 of file vex_vision.h.


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