VEX V5 Python API
Public Member Functions | Public Attributes | List of all members
vex.Vision Class Reference

Class representing Vision Sensor device. More...

Inherits vex.Device.

Public Member Functions

def __init__ (self, index, brightness=None, signatures=None)
 Creates a new vision object on the port specified. More...
 
def take_snapshot (self, id_or_sig_or_code, count=None)
 Takes a data sample from the vision sensor. More...
 
def set_signature (self, signature)
 
def set_mode (self, mode)
 
def get_mode (self)
 
def set_brightness (self, value)
 
def get_brightness (self)
 
def set_white_balance_mode (self, mode)
 
def get_white_balance_mode (self)
 
def set_white_balance_values (self, color)
 set a 0xRRGGBB color More...
 
def get_white_balance_values (self)
 
def set_led_mode (self, mode)
 Changes the mode of the LED on the vision sensor. More...
 
def get_led_mode (self)
 Gets the mode of the LED from the vision sensor. More...
 
def set_led_brightness (self, percent)
 Changes the brightness of the LED on the vision sensor when LED is set to manual mode. More...
 
def get_led_brightness (self)
 Gets the brightness of the LED from the vision sensor. More...
 
def set_led_color (self, red, green, blue)
 Changes the color of the LED on the vision sensor when LED is set to manual mode. More...
 
def get_led_color (self)
 Gets the color of the LED from the vision sensor. More...
 
def set_wifi_mode (self, mode)
 
def get_wifi_mode (self)
 
def type (self)
 Get the device type. More...
 
def installed (self)
 Gets the status of what is installed. More...
 
def value (self)
 

Public Attributes

 object_count
 Number of objects found in the data sample. More...
 
 largest_object
 The largest object found in the data sample. More...
 
 objects
 List of the largest objects found in the data sample. More...
 

Detailed Description

Class representing Vision Sensor device.

The vision sensor has a resolution of 316x212 pixels

Constructor & Destructor Documentation

◆ __init__()

def vex.Vision.__init__ (   self,
  index,
  brightness = None,
  signatures = None 
)

Creates a new vision object on the port specified.

The vision sensor has a resolution of 316x212 pixels

Parameters
indexThe port index for this vision. The index is zero based.
brightnessThe vision sensor brightness seting. Values are 0 to 255
signaturesList of signature objects used to setup the detection signatures for this sensor.

Member Function Documentation

◆ take_snapshot()

def vex.Vision.take_snapshot (   self,
  id_or_sig_or_code,
  count = None 
)

Takes a data sample from the vision sensor.

Parameters
id_or_sig_or_codeThe ID or VisionCode or VisionSignature of the object to look for.
countthe amount of objects to look for. The largest of the object will be returned. Optional.
Returns
The number of objects found from the ID passed in the parameter.

◆ set_signature()

def vex.Vision.set_signature (   self,
  signature 
)

◆ set_mode()

def vex.Vision.set_mode (   self,
  mode 
)

◆ get_mode()

def vex.Vision.get_mode (   self)

◆ set_brightness()

def vex.Vision.set_brightness (   self,
  value 
)

◆ get_brightness()

def vex.Vision.get_brightness (   self)

◆ set_white_balance_mode()

def vex.Vision.set_white_balance_mode (   self,
  mode 
)

◆ get_white_balance_mode()

def vex.Vision.get_white_balance_mode (   self)

◆ set_white_balance_values()

def vex.Vision.set_white_balance_values (   self,
  color 
)

set a 0xRRGGBB color

◆ get_white_balance_values()

def vex.Vision.get_white_balance_values (   self)

◆ set_led_mode()

def vex.Vision.set_led_mode (   self,
  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.

◆ get_led_mode()

def vex.Vision.get_led_mode (   self)

Gets the mode of the LED from the vision sensor.

Returns
Returns a VisionLedMode enum value that represents the current mode of the vision sensor LED.

◆ set_led_brightness()

def vex.Vision.set_led_brightness (   self,
  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.

◆ get_led_brightness()

def vex.Vision.get_led_brightness (   self)

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.

◆ set_led_color()

def vex.Vision.set_led_color (   self,
  red,
  green,
  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.

◆ get_led_color()

def vex.Vision.get_led_color (   self)

Gets the color of the LED from the vision sensor.

Returns
a 0xRRGGBB number representing the color

◆ set_wifi_mode()

def vex.Vision.set_wifi_mode (   self,
  mode 
)

◆ get_wifi_mode()

def vex.Vision.get_wifi_mode (   self)

◆ type()

def vex.Device.type (   self)
inherited

Get the device type.

Returns
V5DeviceType enum value

◆ installed()

def vex.Device.installed (   self)
inherited

Gets the status of what is installed.

Returns
Returns a true Boolean if the triport is installed. Returns a false Boolean if the triport is not installed.

◆ value()

def vex.Device.value (   self)
inherited

Member Data Documentation

◆ object_count

vex.Vision.object_count

Number of objects found in the data sample.

◆ largest_object

vex.Vision.largest_object

The largest object found in the data sample.

@type vex.VisionObject

◆ objects

vex.Vision.objects

List of the largest objects found in the data sample.

@type vex.VisionObject[]