Orientating the IMU

Setting Orientation in Code:

Blocks:

The IMU Blocks can be found under the Sensors dropdown menu:

There are a few different ways to define the Hub's orientation. The easiest is by using the REV Robotics logo and USB ports to signify orientation:

However, if the Hub is not flat you may also define its location using an orientation perimeter block:

This method uses a perimeter object to specify the Hub's arbitrary orientation on the robot by describing the rotation that would need to be applied in order to rotate the Hub from its default to the actual orientation. A similar method using a Quaternion block is also available.

The default position assumes the logo is UP and USBs are FORWARD.

OnBot Java:

During the initialization process the following can be used to define the Hub's orientation:

RevHubOrientationOnRobot.LogoFacingDirection logoDirection = RevHubOrientationOnRobot.LogoFacingDirection.UP;
RevHubOrientationOnRobot.UsbFacingDirection  usbDirection  = RevHubOrientationOnRobot.UsbFacingDirection.FORWARD;

RevHubOrientationOnRobot orientationOnRobot = new RevHubOrientationOnRobot(logoDirection, usbDirection);

imu.initialize(new IMU.Parameters(orientationOnRobot));

This method sets the orientation based on the position of the REV Robotics and USBs while the Hub is sitting flat orthogonally.

It is also possible to define the orientation of a Hub in a nonorthogonal position by setting rotations along the X, Y, and Z axes. For more information on this process, please see the "SensorIMUNonOrthogonal" sample available in OnBot Java as part of the FTC SDK.

Control Hubs with the Bosch BHI260AP IMU:

For the most accurate readings from the Bosch BHI260AP IMU, it is recommended to have the Control Hub mounted flat on a horizontal plane.

Control and Expansion Hubs with the Bosch BNO055 IMU:

For the most accurate readings from the Bosch BNO055 IMU, it is recommend to have the Hub mounted flat on a horizontal OR vertical plane.

Last updated