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

Inherits vex.TriDevice.

Public Member Functions

def __init__ (self, triport_port)
 Use this class when programming with a gyro sensor. More...
 
def value (self, rotationUnits=RotationUnits.DEG)
 Gets the value of the gyro sensor. More...
 
def start_calibration (self, value=0)
 Starts recalibration of gyro. More...
 
def is_calibrating (self)
 Returns recalibration status of gyro. More...
 
def heading (self, rotationUnits=RotationUnits.DEG)
 Gets the heading (yaw angle as 0-360 deg) of the gyro sensor. More...
 
def rotation (self, rotationUnits=RotationUnits.DEG)
 Gets the absolute angle (yaw angle without limits) of the gyro sensor. More...
 
def set_heading (self, value, rotationUnits=RotationUnits.DEG)
 brief Set the gyro sensor heading to a new value More...
 
def reset_heading (self)
 Reset the gyro sensor angle to 0. More...
 
def set_rotation (self, value, rotationUnits=RotationUnits.DEG)
 
def reset_rotation (self)
 Reset the gyro sensor rotation to 0. More...
 

Constructor & Destructor Documentation

◆ __init__()

def vex.Gyro.__init__ (   self,
  triport_port 
)

Use this class when programming with a gyro sensor.

Member Function Documentation

◆ value()

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

Gets the value of the gyro sensor.

Parameters
rotationUnitsThe unit type of the value that is returned.
Returns
Returns an integer that represents the unit value specified by the parameter of the gyroscopic sensor.

◆ start_calibration()

def vex.Gyro.start_calibration (   self,
  value = 0 
)

Starts recalibration of gyro.

Note that the gyro is automatically calibrated when the constructor is called.

Parameters
valueThe level of calibration

◆ is_calibrating()

def vex.Gyro.is_calibrating (   self)

Returns recalibration status of gyro.

Returns
Returns True if gyro is still calibrating.

◆ heading()

def vex.Gyro.heading (   self,
  rotationUnits = RotationUnits.DEG 
)

Gets the heading (yaw angle as 0-360 deg) of the gyro sensor.

Returns
value (float number) specified by the unit.
Parameters
rotationUnitsThe measurement unit for the inertial sensor.

◆ rotation()

def vex.Gyro.rotation (   self,
  rotationUnits = RotationUnits.DEG 
)

Gets the absolute angle (yaw angle without limits) of the gyro sensor.

Returns
value (float number) specified by the unit.
Parameters
rotationUnitsThe measurement unit for the gyro sensor.

◆ set_heading()

def vex.Gyro.set_heading (   self,
  value,
  rotationUnits = RotationUnits.DEG 
)

brief Set the gyro sensor heading to a new value

Parameters
valueThe new heading for the gyro sensor
rotationUnitsThe rotation unit for the angle

◆ reset_heading()

def vex.Gyro.reset_heading (   self)

Reset the gyro sensor angle to 0.

◆ set_rotation()

def vex.Gyro.set_rotation (   self,
  value,
  rotationUnits = RotationUnits.DEG 
)

◆ reset_rotation()

def vex.Gyro.reset_rotation (   self)

Reset the gyro sensor rotation to 0.