Skip to content

IMUs

NextIMU is a wrapper for the Control Hub or an IMU that uses lazy initialization.

// Defaults to the configuration name "imu"
val imu = NextIMU()
// Using a custom configuration name
val imu = NextIMU("imu")

Initializes the IMU with the given IMU.Parameters, such as the hub’s mounting orientation.

imu.initialize(IMU.Parameters(RevHubOrientationOnRobot(LogoFacingDirection.UP, UsbFacingDirection.FORWARD)))

Resets the yaw angle to zero.

imu.resetYaw()

AngularVelocity the robot’s current angular velocity, in radians per second.

val turnRate = imu.angularVelocity