All Control Hubs feature an internal IMU. If your Expansion Hub was purchased BEFORE December 2021, it has an internal IMU installed.
There are a few options that will work for giving your Hub Gyro/IMU function.
navX2 Sensor Bundle - Also supported in the FTC programming environment. Code examples are listed on AndyMark's page, and this product includes the correct cables to use within FTC.
Adafruit 9-DOF Absolute Orientation IMU - This is the same IMU as in Control Hubs from before 2022, but will require you to either create an adapter cable or solder a cut sensor cable to the board. Plugging this in and configuring the IMU on I2C port zero will allow you to use and program the same as an internal IMU.
Integrating Gyro with our Logic Level Converter and Sensor Cable Adapter - This is supported in the FTC Programing environment but is just a single-axis gyro, not a full IMU.
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.
During the initialization process the following can be used to define the Hub's orientation:
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.
For the most accurate readings from the Bosch BHI260AP IMU, it is recommended to have the Control Hub mounted flat on a horizontal plane.
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.
Each REV Robotics Control Hub (REV-31-1595), and Expansion Hubs (REV-31-1153) purchased before December 2021, has a built in IMU, or inertial measurement unit. The IMU combines measurements from multiple internal sensors to compute its current orientation. It can also provide the angular velocity (how fast the IMU is rotating along each axis).
Expansion Hubs shipped AFTER December 1st, 2021 no longer include an internal IMU
The data used by the IMU to track the orientation includes the rotation along each axis, and the forces of acceleration along each axis. Using the acceleration forces allows the IMU to detect the direction of gravity, preventing drift in the pitch and roll readings. Only the heading will drift slowly, as small inaccuracies build up over time.
I2C Address: 0x28
Port: 0
Originally, Control Hubs and Expansion Hubs shipped with the Bosch BNO055 IMU. However, as of September 2022, the Control Hub's IMU was replaced with the Bosch BHI260AP IMU.
To see which IMU your Control Hub has, navigate to the Manage page within the Program & Manage menu, either from the Driver Hub, REV Hardware Client, or web interface.
When you create a new configuration file, the correct IMU type should be automatically detected for I2C port 0, and added to the configuration.
Version 8.1 of the FTC Robot Controller app adds a new universal IMU interface for Blocks and Java programming, which supports both the BNO055 IMU and the BHI260AP IMU. The BNO055 IMU can also be used from the legacy BNO055IMU
interface.
IMU
interfaceThe universal IMU
interface added in version 8.1 of the FTC Robot Controller app provides robot-centric orientation and angular velocity values. You can specify the exact orientation of the Control or Expansion Hub on your robot, and the interface will convert the raw values from the IMU into robot-centric values. This simplifies how you use the IMU's values, and prevents problems when the hub is not mounted with the REV Robotics logo facing upwards.
All values from the IMU
interface are in the Robot Coordinate System, in which the origin is inside your robot, the Z axis points towards the ceiling, the Y axis points straight ahead through the front of your robot (whatever you define the front to be), and the X axis points out the right side of your robot. This coordinate system is right-handed, which means that if you point a typical right thumb in the same direction as the axis, rotation in the same direction that the fingers curl is considered positive.
The IMU.getRobotYawPitchRollAngles()
method on the IMU
interface provides the robot's orientation in a simplified format of yaw, pitch, and roll angles. Most teams should use this method to get the robot's orientation.
Yaw (also known as heading) is the measure of rotation along the robot's Z axis, or the side-to-side lateral rotation of the robot.
Pitch is the measure of rotation along the robot's X axis, or the front-to-back rotation of the robot.
Roll is the measure along the robot's Y axis, or the side-to-side tilt of the robot.
BNO055IMU
interfaceThe BNO055IMU
interface has several disadvantages compared to the universal IMU
interface.
It can only be used with Control Hubs and Expansion Hubs that contain the original BNO055 IMU.
It only works reliably when the Hub is mounted flat, with the REV Robotics logo pointed upwards.
The values it provides are relative to the Hub, not the Robot.
You have to manually specify the axes order for the orientation angles (ZXY is recommended for typical use cases).
The coordinate system used for the BNO055IMU
interface is defined like this:
The X axis runs from the bottom of the hub, near the servo ports, to the top of the hub, where the USB ports are.
The Y axis runs from the sensor ports on the right to the motor ports on the left.
The Z axis points upwards through the REV Robotics logo.
To learn more on how to configure the IMU check out the I2C introduction page.
During the 2023-24 FTC season, FIRST and REV Robotics received reports of teams experiencing an unexpected reset of their IMU after an electrostatic discharge (ESD) event. A new version of the Control Hub's Operating System (1.1.4) has been released, which introduces an update to reduce the frequency of these resets on Control Hubs with a BHI260AP IMU.
Below are additional tips for reducing the effects of ESD or conflicts with the internal IMU that may prevent similarly:
Prepare your robot with ESD Mitigation Techniques - FIRST has a guide on Managing Electrostatic Discharge with additional tips and tricks for you to try, including installing a Resistive Grounding Strap (REV-31-1269) on your robot.
Ask what measures your Event Hosts have taken to mitigate ESD at your event - Contact your event’s host in advance to see if they plan to treat the playing fields with Staticide.
Ensure all of your team’s code references the IMU correctly
Check that your battery has a secure connection to your robot and is fully charged - We have found that Unexpected IMU Resets have also occurred due to poor battery connection or low voltage.
Have a plan to reset your IMU – Teams who rely on the IMU can add human-triggered actions, like pressing a button to reinitialize the IMU, to their Driver-Controlled robot code. Teams may find it beneficial to align their robots with the playing field tile seams (to ensure alignment) prior to starting the reinitialization action.
I2C is a common electronic communication standard that allows a host (the Hub) to communicate with multiple devices on the same I2C bus.
Each I2C port on a Hub is its own I2C bus. Every I2C device has a unique address, a number that is normally fixed by the manufacturer. All of the devices on an individual I2C bus must have a unique address so that the host can communicate with one device at a time. If two devices have the same address, such as when using two of the same kind of sensors, they must be used on different I2C buses otherwise the communication channels conflict.
While I2C is technically a digital communication protocol, it is more advanced than the simple on/off style of basic digital sensors. I2C sensors require software drivers for the information from a follower (sensor) to be interpreted by the leader (Hub).
Logic Level represents the voltage difference between the signal and ground of the Control and Expansion Hub's sensor ports. Both Hubs and REV Sensors operate on a 3.3V logic level.
Therefore, to use a digital sensor it needs an operating voltage of 3.3V for use with the Hub. If you are looking to use a 5V I2C sensor you will need a Logic Level Converter.
Sensor feedback to the Hub works differently for the I2C sensor than it does for Analog or Digital sensors. With the Analog and Digital Sensors, only one communication channel needs to be used by an individual sensor. In contrast, an I2C sensor sends different kinds of information over the SDA (white) and SCL (blue) wires. Since the I2C is transferring more complex data to the Hub then Analog or Digital sensors, there has to be a component of harmonization, or consistency, as the data moves from the sensor to the Hub. The SCL (Serial Clock) channel provides consistency by acting as a clock line and time-stamping the data provided by the SDA (Serial Data) channel.
While it is possible to host more than one I2C sensor on the same bus, there are a couple of factors to take into account. The Hub keeps track of the information from different sensors by considering the sensor's address in relation to the data being sent. When two sensors have the same address, like the REV Color Sensor V3 and the 2m Distance Sensor, they cannot be hosted on the same bus. Check the sensor datasheets for all I2C sensors to determine what sensors can and cannot be hosted on the same bus.
Currently, REV Robotics does not produce a cable or breakout board to connect two sensors to one I2C port on the Hub. A custom cable will need to be made in order to wire more than one I2C to the Hub.
The internal IMU is hosted on I2C bus 0. See the configuration section below to learn more about configuring a secondary sensor on bus 0.
Before a sensor can be programmed it must be added to the Robot Configuration. The configuration file stores all configured devices in the Control Hub's "hardwareMap," which can be called to in the code to establish the line of communication between devices.
In order to function, all FTC legal I2C devices have drivers installed into the SDK. With regards to configuration, this means that the device has to be set to the drop-down menu item that corresponds with its drivers. Visit the datasheet for the sensor you are trying to configure to see how to configure it.
While in the configuration select the I2C Bus 0 option. This will open a screen that shows the IMU. Press the Add button to add the Color Sensor to this bus.
Select "REV Color Sensor V3" from the dropdown menu and name the device.
When you have finished configuring the sensor hit Done. The app will return to the previous screen.
How do I2C sensors help a robot navigate the world around it? The answer to this question is a bit more diverse than it is for Analog or Digital sensors.
All three Color Sensors (V1-V3) sense color within a 2cm distance from the sensor. When mounted on the robot this can help in autonomous period tasks where robots have to decide between several different colored objects.
While the Color Sensors have some proximity sensing capabilities, the 2m Distance Sensor is able to detect proximity with higher accuracy and reliability. When combined with odometry, the 2m Distance Sensor can help the robot navigate obstacles on the field during autonomous!
The IMU has a built-in accelerometer, gyroscope, and magnetometer. There are a multitude of applications for the IMU within autonomous op modes:
Use the Gyroscope to drive in the straight lines and turn during autonomous
Use the Accelerometer in conjunction with the gyroscope to avoid drift and give an approximation of position/travel
Use the IMU with motor encoders to track and determine robot placement on a field
For more information on the I2C sensor specifications, coding examples, and more; click one of the links below to head to the sensor datasheets
There are three I2C sensors within the REV system: the Inertial Measurement Unit (IMU), Color Sensor (), and 2m Distance Sensor ().
There is an IMU built into the Control Hub (), which is connected to I2C bus 0. Expansion Hubs shipped BEFORE 12/01/2021 also feature a built in IMU.
See for more information or check out our .
I2C sensors connect to the Control Hub (), or Expansion Hub (), via a JST PH 4-Pin Sensor Cable and the I2C buses, shown in the image above. The color-coding of the I2C buses in the image corresponds with each wire in the JST PH 4-Pin Sensor Cable. As a convention, the black wire is ground and the red wire is power. The blue (SCLn) wire and white (SDAn) wire are the communication signals for each I2C bus on the Hubs.
The steps below shows a basic configuration for I2C devices. The I2C Bus 0 hosts the internal sensor within the Hubs. In this example, the Color Sensor V3 is being added to Bus 0 as well.