Package ftclib.sensor

Class FtcAnalogGyro

All Implemented Interfaces:
TrcOdometrySensor

public class FtcAnalogGyro extends TrcGyro
This class implements an Analog gyro extending TrcGyro. It provides implementation of the abstract methods in TrcGyro. It supports only the z axis. The hardware provides rotation rate data but not heading and it does not support built-in calibration.
  • Field Details

    • voltPerDegPerSec

      private final double voltPerDegPerSec
    • gyro

      private final com.qualcomm.robotcore.hardware.AnalogInput gyro
  • Constructor Details

    • FtcAnalogGyro

      public FtcAnalogGyro(com.qualcomm.robotcore.hardware.HardwareMap hardwareMap, String instanceName, double voltPerDegPerSec, TrcFilter[] filters)
      Constructor: Creates an instance of the object.
      Parameters:
      hardwareMap - specifies the global hardware map.
      instanceName - specifies the instance name.
      voltPerDegPerSec - specifies the rotation rate scale.
      filters - specifies an array of filters to use for filtering sensor noise, one for each axis. Since we only have 1 axis, the array should have 1 element. If no filters are used, it can be set to null.
    • FtcAnalogGyro

      public FtcAnalogGyro(String instanceName, double voltPerDegPerSec, TrcFilter[] filters)
      Constructor: Creates an instance of the object.
      Parameters:
      instanceName - specifies the instance name.
      voltPerDegPerSec - specifies the rotation rate scale.
      filters - specifies an array of filters to use for filtering sensor noise, one for each axis. Since we only have 1 axis, the array should have 1 element. If no filters are used, it can be set to null.
    • FtcAnalogGyro

      public FtcAnalogGyro(String instanceName, double voltPerDegPerSec)
      Constructor: Creates an instance of the object.
      Parameters:
      instanceName - specifies the instance name.
      voltPerDegPerSec - specifies the rotation rate scale.
  • Method Details

    • calibrate

      public void calibrate()
      This method calibrates the sensor.
    • getRawXData

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

      public TrcSensor.SensorData<Double> getRawYData(TrcGyro.DataType dataType)
      This method returns the raw data of the specified type for the y-axis which is not supported.
      Specified by:
      getRawYData in class TrcGyro
      Parameters:
      dataType - specifies the data type.
      Returns:
      throws UnsupportedOperation exception.
    • 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 in degrees per second.