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

Use the distance class to control the distance sensor. More...

Inherits vex.Device.

Public Member Functions

def __init__ (self, index)
 Creates a new distance sensor object on the port specified. More...
 
def object_distance (self, distanceUnits=DistanceUnits.MM)
 Gets the detected object distance. More...
 
def object_size (self)
 Gets an estimate of the detected object size. More...
 
def object_raw_size (self)
 Gets an estimate of the detected object size. More...
 
def object_velocity (self)
 Gets an estimate of the detected object velocity. More...
 
def is_object_detected (self)
 Check for object in range of the distance sensor. More...
 
def type (self)
 Get the device type. More...
 
def installed (self)
 Gets the status of what is installed. More...
 
def value (self)
 

Detailed Description

Use the distance class to control the distance sensor.

Constructor & Destructor Documentation

◆ __init__()

def vex.Distance.__init__ (   self,
  index 
)

Creates a new distance sensor object on the port specified.

Parameters
indexThe port index for this sensor. The index is zero based.

Reimplemented from vex.Device.

Member Function Documentation

◆ object_distance()

def vex.Distance.object_distance (   self,
  distanceUnits = DistanceUnits.MM 
)

Gets the detected object distance.

Parameters
distanceUnitsThe measurement unit for the distance sensor.
Returns
a double that represents the unit value specified by the parameter of the distance sensor.

◆ object_size()

def vex.Distance.object_size (   self)

Gets an estimate of the detected object size.

Returns
the estimated object size as a vex.SizeType enum value

◆ object_raw_size()

def vex.Distance.object_raw_size (   self)

Gets an estimate of the detected object size.

Returns
an integer that represent a relative object size, 0 to 400

◆ object_velocity()

def vex.Distance.object_velocity (   self)

Gets an estimate of the detected object velocity.

Returns
a double with object velocity in m/s

◆ is_object_detected()

def vex.Distance.is_object_detected (   self)

Check for object in range of the distance sensor.

Returns
True if an object is detected

◆ 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