IMUs
NextIMU is a wrapper for the Control Hub or an IMU that uses lazy initialization.
Creating a NextIMU
Section titled “Creating a NextIMU”// Defaults to the configuration name "imu"val imu = NextIMU()
// Using a custom configuration nameval imu = NextIMU("imu")// Defaults to the configuration name "imu"NextIMU imu = new NextIMU();
// Using a custom configuration nameNextIMU imu = new NextIMU("imu");initialize(parameters)
Section titled “initialize(parameters)”Initializes the IMU with the given IMU.Parameters, such as the hub’s mounting orientation.
imu.initialize(IMU.Parameters(RevHubOrientationOnRobot(LogoFacingDirection.UP, UsbFacingDirection.FORWARD)))imu.initialize(new IMU.Parameters(new RevHubOrientationOnRobot(LogoFacingDirection.UP, UsbFacingDirection.FORWARD)));resetYaw()
Section titled “resetYaw()”Resets the yaw angle to zero.
imu.resetYaw()imu.resetYaw();angularVelocity
Section titled “angularVelocity”AngularVelocity the robot’s current angular velocity, in radians per second.
val turnRate = imu.angularVelocityAngularVelocity turnRate = imu.getAngularVelocity();
