Package ftclib.sensor
Class FtcImu
- All Implemented Interfaces:
TrcOdometrySensor
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.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class trclib.sensor.TrcGyro
TrcGyro.DataTypeNested classes/interfaces inherited from class trclib.sensor.TrcSensor
TrcSensor.DataSource<D>, TrcSensor.SensorData<T>Nested classes/interfaces inherited from interface trclib.sensor.TrcOdometrySensor
TrcOdometrySensor.Odometry -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final FtcImu.GyroDataprivate final TrcTaskMgr.TaskObjectfinal com.qualcomm.robotcore.hardware.IMUprivate booleanFields inherited from class trclib.sensor.TrcGyro
GYRO_HAS_X_AXIS, GYRO_HAS_Y_AXIS, GYRO_HAS_Z_AXIS, GYRO_INTEGRATEFields inherited from class trclib.sensor.TrcSensor
instanceName, tracer -
Constructor Summary
ConstructorsConstructorDescriptionFtcImu(com.qualcomm.robotcore.hardware.HardwareMap hardwareMap, String instanceName, double xRotation, double yRotation, double zRotation) Constructor: Creates an instance of the object.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.Constructor: Creates an instance of the object.FtcImu(String instanceName, com.qualcomm.hardware.rev.RevHubOrientationOnRobot.LogoFacingDirection logoDirection, com.qualcomm.hardware.rev.RevHubOrientationOnRobot.UsbFacingDirection usbDirection) Constructor: Creates an instance of the object. -
Method Summary
Modifier and TypeMethodDescriptiongetRawXData(TrcGyro.DataType dataType) This method returns the raw data of the specified type for the x-axis.getRawYData(TrcGyro.DataType dataType) This method returns the raw data of the specified type for the y-axis.getRawZData(TrcGyro.DataType dataType) This method returns the raw data of the specified type for the z-axis.private voidgyroTask(TrcTaskMgr.TaskType taskType, TrcRobot.RunMode runMode, boolean slowPeriodicLoop) This method is called periodically to read the gyro data.booleanThis method returns the state of the gyro task.voidThis method overrides the TrcGyro class and calls its own.voidsetEnabled(boolean enabled) This method enables/disables the gyro task that reads and caches the gyro data periodically.Methods inherited from class trclib.sensor.TrcGyro
getName, getOdometry, getRawData, getXHeading, getXRotationRate, getYHeading, getYRotationRate, getZHeading, getZRotationRate, printElapsedTime, resetOdometry, resetXIntegrator, resetXWrapValueConverter, resetYIntegrator, resetYWrapValueConverter, resetZWrapValueConverter, setElapsedTimerEnabled, setXInverted, setXScale, setXValueRange, setYInverted, setYScale, setYValueRange, setZInverted, setZScale, setZValueRange, toStringMethods inherited from class trclib.sensor.TrcSensor
calibrate, calibrate, getNumAxes, getProcessedData, isCalibrating, setInverted, setScale, setScaleAndOffsetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface trclib.sensor.TrcOdometrySensor
getOdometries, getOdometry
-
Field Details
-
gyroData
-
imu
public final com.qualcomm.robotcore.hardware.IMU imu -
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
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:
setEnabledin classTrcGyro- 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:
resetZIntegratorin classTrcGyro
-
getRawXData
This method returns the raw data of the specified type for the x-axis.- Specified by:
getRawXDatain classTrcGyro- Parameters:
dataType- specifies the data type.- Returns:
- raw data of the specified type for the x-axis.
-
getRawYData
This method returns the raw data of the specified type for the y-axis.- Specified by:
getRawYDatain classTrcGyro- Parameters:
dataType- specifies the data type.- Returns:
- raw data of the specified type for the y-axis.
-
getRawZData
This method returns the raw data of the specified type for the z-axis.- Specified by:
getRawZDatain classTrcGyro- 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.
-