Package ftclib.sensor

Class FtcImu

All Implemented Interfaces:
TrcOdometrySensor

public class FtcImu extends TrcGyro
This class implements the REV Control/Expansion Hub IMU which is either BNO055 or BHI260. It extends TrcGyro so it implements the standard gyro interface.
  • Field Details

    • gyroData

      private final FtcImu.GyroData gyroData
    • imu

      public final com.qualcomm.robotcore.hardware.IMU imu
    • gyroTaskObj

      private final TrcTaskMgr.TaskObject gyroTaskObj
    • taskEnabled

      private boolean taskEnabled
  • Constructor Details

    • FtcImu

      public FtcImu(com.qualcomm.robotcore.hardware.HardwareMap hardwareMap, String instanceName, com.qualcomm.hardware.rev.RevHubOrientationOnRobot.LogoFacingDirection logoDirection, com.qualcomm.hardware.rev.RevHubOrientationOnRobot.UsbFacingDirection usbDirection)
      Constructor: Creates an instance of the object.
      Parameters:
      hardwareMap - specifies the global hardware map.
      instanceName - specifies the instance name.
      logoDirection - specifies the orientation of the printed logo on the REV Control/Expansion Hub.
      usbDirection - specifies the orientation of the USB port on the REV Control/Expansion Hub.
    • FtcImu

      public FtcImu(String instanceName, com.qualcomm.hardware.rev.RevHubOrientationOnRobot.LogoFacingDirection logoDirection, com.qualcomm.hardware.rev.RevHubOrientationOnRobot.UsbFacingDirection usbDirection)
      Constructor: Creates an instance of the object.
      Parameters:
      instanceName - specifies the instance name.
      logoDirection - specifies the orientation of the printed logo on the REV Control/Expansion Hub.
      usbDirection - specifies the orientation of the USB port on the REV Control/Expansion Hub.
    • FtcImu

      public FtcImu(com.qualcomm.robotcore.hardware.HardwareMap hardwareMap, String instanceName, double xRotation, double yRotation, double zRotation)
      Constructor: Creates an instance of the object.
      Parameters:
      hardwareMap - specifies the global hardware map.
      instanceName - specifies the instance name.
      xRotation - specifies the X axis rotation of the REV hub.
      yRotation - specifies the Y axis rotation of the REV hub.
      zRotation - specifies the Z axis rotation of the REV hub.
    • FtcImu

      public FtcImu(String instanceName, double xRotation, double yRotation, double zRotation)
      Constructor: Creates an instance of the object.
      Parameters:
      instanceName - specifies the instance name.
      xRotation - specifies the X axis rotation of the REV hub.
      yRotation - specifies the Y axis rotation of the REV hub.
      zRotation - specifies the Z axis rotation of the REV hub.
  • Method Details

    • setEnabled

      public void setEnabled(boolean enabled)
      This method enables/disables the gyro task that reads and caches the gyro data periodically.
      Overrides:
      setEnabled in class TrcGyro
      Parameters:
      enabled - specifies true for enabling the gyro task, disabling it otherwise.
    • isEnabled

      public boolean isEnabled()
      This method returns the state of the gyro task.
      Returns:
      true if gyro task is enabled, false otherwise.
    • 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.
    • gyroTask

      private void gyroTask(TrcTaskMgr.TaskType taskType, TrcRobot.RunMode runMode, boolean slowPeriodicLoop)
      This method is called periodically to read the gyro data.
      Parameters:
      taskType - specifies the type of task being run.
      runMode - specifies the competition mode that is running.
      slowPeriodicLoop - specifies true if it is running the slow periodic loop on the main robot thread, false otherwise.