Class IMUDevice
java.lang.Object
com.cdarobotics.cdalib.devices.Device
com.cdarobotics.cdalib.devices.sensors.IMUDevice
A
Device wrapping the universal IMU. The orientation is read once per
update() and cached, so reading yaw/pitch/roll multiple times in a loop costs a single
hardware read.
The IMU must be initialized (via imu.initialize(...) with your hub's orientation on the
robot) before it is used — this wrapper does not initialize it. Getters reflect the value from the
most recent update(), and return 0 before the first update.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncom.qualcomm.robotcore.hardware.IMUgetImu()doublegetPitch(org.firstinspires.ftc.robotcore.external.navigation.AngleUnit unit) doublegetRoll(org.firstinspires.ftc.robotcore.external.navigation.AngleUnit unit) doublegetYaw(org.firstinspires.ftc.robotcore.external.navigation.AngleUnit unit) voidresetYaw()Resets the yaw so the current heading reads as zero.voidupdate()Flush pending writes to, or refresh cached reads from, the underlying hardware.
-
Constructor Details
-
IMUDevice
public IMUDevice(com.qualcomm.robotcore.hardware.IMU imu) Wraps an already-initialized IMU. -
IMUDevice
Resolves the IMU from the hardware map by configured name. It must still be initialized separately.
-
-
Method Details
-
resetYaw
public void resetYaw()Resets the yaw so the current heading reads as zero. -
getImu
public com.qualcomm.robotcore.hardware.IMU getImu()- Returns:
- the wrapped SDK IMU, for operations not exposed here.
-
update
public void update()Description copied from class:DeviceFlush pending writes to, or refresh cached reads from, the underlying hardware.