Class FtcMRGyro

All Implemented Interfaces:
TrcOdometrySensor

public class FtcMRGyro extends TrcGyro
This class implements the Modern Robotics gyro extending TrcGyro. It provides implementation of the abstract methods in TrcGyro. The Modern Robotics gyro supports 3 axes: x, y and z. It provides rotation rate data for all 3 axes. However, it only provides heading data for the z-axis and the heading data is wrap-around.
  • Field Details

    • gyro

      private final com.qualcomm.hardware.modernrobotics.ModernRoboticsI2cGyro gyro
  • Constructor Details

    • FtcMRGyro

      public FtcMRGyro(com.qualcomm.robotcore.hardware.HardwareMap hardwareMap, String instanceName, TrcFilter[] filters)
      Constructor: Creates an instance of the object.
      Parameters:
      hardwareMap - specifies the global hardware map.
      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.
    • FtcMRGyro

      public FtcMRGyro(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.
    • FtcMRGyro

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

    • calibrate

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

      public void resetXIntegrator()
      This method overrides the TrcGyro class. It doesn't have an x-integrator.
      Overrides:
      resetXIntegrator in class TrcGyro
    • resetYIntegrator

      public void resetYIntegrator()
      This method overrides the TrcGyro class. It doesn't have an y-integrator.
      Overrides:
      resetYIntegrator in class TrcGyro
    • resetZIntegrator

      public void resetZIntegrator()
      This method overrides the TrcGyro class and calls its own.
      Overrides:
      resetZIntegrator in class TrcGyro
    • 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.