TeamCode / org.firstinspires.ftc.teamcode.sensing / Gyro

Gyro

interface Gyro

Public interface representing the set of methods every single gyro sensor is guaranteed to implement. This makes it useful for creating op modes that work for any gyro sensors other than the IMUGyro.

For the uninitiated, a gyro sensor measures the orientation of a robot. That's it. That's all it does.

You do not construct instances of Gyro directly; instead, you use a subclass such as IMUGyro.

Properties

isCalibrated

abstract val isCalibrated: Boolean

Whether the gyro has been successfully calibrated. See GyroTestOpMode for a demonstration of how to wait for a gyro to calibrate.

Functions

calibrate

abstract fun calibrate(): Unit

Calibrates the gyro, or begins the calibration process. Usually called immediately after initialize. Implementation details vary by specific gyro sensor. In some cases, you may have to wait a few seconds before the gyro is calibrated. See isCalibrated.

getAbsoluteAngle

abstract fun getAbsoluteAngle(): Double

Returns the angle that the robot is facing.

initialize

abstract fun initialize(): Unit

Initializes the gyro. Usually called in an op mode's init phase. Implementation details vary by specific gyro sensor.

Inheritors

IMUGyro

class IMUGyro : Gyro

A Gyro instance that uses the REV Robotic Expansion's built-in gyro sensor (IMU) to obtain measurements.