Class FtcAndroidGyro

All Implemented Interfaces:
TrcOdometrySensor

public class FtcAndroidGyro extends TrcGyro
This class implements the Android gyro extending TrcGyro. It provides implementation of the abstract methods in TrcGyro. It supports 3 axes: x, y and z. It provides rotation data for all 3 axes. However, it doesn't provide any heading data.
  • Field Details

  • Constructor Details

    • FtcAndroidGyro

      public FtcAndroidGyro(String instanceName, TrcFilter[] filters)
      Constructor: Creates an instance of the object.
      Parameters:
      instanceName - specifies the instance name.
      filters - specifies an array of filters to use for filtering sensor noise, one for each axis. Since we have 3 axes, the array should have 3 elements. If no filters are used, it can be set to null.
    • FtcAndroidGyro

      public FtcAndroidGyro(String instanceName)
      Constructor: Creates an instance of the object.
      Parameters:
      instanceName - specifies the instance name.
  • Method Details

    • setEnabled

      public void setEnabled(boolean enabled)
      This method enables/disables the sensor.
      Overrides:
      setEnabled in class TrcGyro
      Parameters:
      enabled - specifies true if enabling, false otherwise.
    • calibrate

      public void calibrate()
      This method calibrates the sensor. If the sensor is not enabled, it must enable it first before starting calibration. It will disable the sensor if it was disabled before calibration.
    • getRawXData

      public TrcSensor.SensorData<Double> getRawXData(TrcGyro.DataType dataType)
      This method returns the raw data of the specified type for the x-axis.
      Specified by:
      getRawXData in class TrcGyro
      Parameters:
      dataType - specifies the data type.
      Returns:
      raw data of the specified type for the x-axis.
    • getRawYData

      public TrcSensor.SensorData<Double> getRawYData(TrcGyro.DataType dataType)
      This method returns the raw data of the specified type for the y-axis.
      Specified by:
      getRawYData in class TrcGyro
      Parameters:
      dataType - specifies the data type.
      Returns:
      raw data of the specified type for the y-axis.
    • getRawZData

      public TrcSensor.SensorData<Double> getRawZData(TrcGyro.DataType dataType)
      This method returns the raw data of the specified type for the z-axis.
      Specified by:
      getRawZData in class TrcGyro
      Parameters:
      dataType - specifies the data type.
      Returns:
      raw data of the specified type for the z-axis.