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

Use the rotation class to control absolute encoder devices. More...

Inherits vex.Device.

Public Member Functions

def __init__ (self, index, is_reverse=False)
 Creates a new rotation object on the port specified. More...
 
def set_reversed (self, is_reverse)
 
def angle (self, rotationUnits=RotationUnits.DEG)
 Gets the angle of the absolute encoder. More...
 
def reset_position (self)
 Resets the value of the absolute encoder to zero. More...
 
def set_position (self, value, rotationUnits=RotationUnits.DEG)
 Sets the value of the absolute encoder to the value specified in the parameter. More...
 
def position (self, rotationUnits=RotationUnits.DEG)
 Gets the current position of the absolute encoder. More...
 
def velocity (self, velocityUnits=VelocityUnits.DPS)
 Gets the current velocity of the absolute encoder. 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 rotation class to control absolute encoder devices.

Constructor & Destructor Documentation

◆ __init__()

def vex.Rotation.__init__ (   self,
  index,
  is_reverse = False 
)

Creates a new rotation object on the port specified.

Parameters
indexThe port index for this sensor. The index is zero based.
is_reverse(optional) If set to true, the encoder counts in reverse.

Member Function Documentation

◆ set_reversed()

def vex.Rotation.set_reversed (   self,
  is_reverse 
)

◆ angle()

def vex.Rotation.angle (   self,
  rotationUnits = RotationUnits.DEG 
)

Gets the angle of the absolute encoder.

Parameters
rotationUnitsThe measurement unit for the encoder device.
Returns
a double that represents the unit value specified by the parameter of the encoder sensor.

◆ reset_position()

def vex.Rotation.reset_position (   self)

Resets the value of the absolute encoder to zero.

◆ set_position()

def vex.Rotation.set_position (   self,
  value,
  rotationUnits = RotationUnits.DEG 
)

Sets the value of the absolute encoder to the value specified in the parameter.

Parameters
valueSets the current position of the absolute encoder.
rotationUnitsthe measurement unit for the position value.

◆ position()

def vex.Rotation.position (   self,
  rotationUnits = RotationUnits.DEG 
)

Gets the current position of the absolute encoder.

Parameters
rotationUnitsThe measurement unit for the position.
Returns
a double that represents the current position of the encoder in the units defined in the parameter.

◆ velocity()

def vex.Rotation.velocity (   self,
  velocityUnits = VelocityUnits.DPS 
)

Gets the current velocity of the absolute encoder.

Parameters
velocityUnitsThe measurement unit for the velocity.
Returns
a double that represents the current velocity of the encoder in the units defined in the parameter.

◆ 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