[FTC] Interfacing with the Adafruit BNO055 breakout

I have no idea how to code to setup and interface with the Adafruit BNO055 gyro breakout (link).

We are running Android Studio on version 9.0 to program the bot and we have plugged the gyro into our control hub at the i2c port 0. It’s correctly wired for gnd, power, sda, and scl on the breakout.

We can not use our control hub’s integrated IMU since it is too big to fit in the space we need the gyro to be in. Also, the IMU in the control hub resets to 0 when driving which is not a code issue but it’s not helpful.

How do you code for the breakout and how would I return the y-axis using that code?

The IMU can go pretty much anywhere. All parts of the robot experience the same angular velocity and accelleration.

Agreed, but the internal IMU resetting during driving is not doing us any favors. That’s why I need to get that external gyro working.

We’ve had pretty good luck using NavX2 on our FTC robot.
The main benefit with NavX is the example code they provide which makes integration relatively simple. I imagine a non-FIRST tailored IMU will be more difficult to set up, since I think you basically have to program the I2C interface yourself (we’ve abandoned a few different sensor projects for reasons like this).

Totally agree about the issues with the internal IMU. Ours was cutting out constantly, breaking field-oriented drive, set up the NavX and no more gyro issues.

I mean, a BNO055 is literally what the control hubs have in them and just communicates over an internal I2C bus

Sure, but the control hubs also have libraries to support that natively. As far as I know, there’s nothing like that for a standalone I2C IMU.

I’m not a programmer so I don’t know the details, other than that interfacing with any I2C device without the appropriate libraries for that specific device can be quite a challenge.

We used an external BNO055 last year as our control hubs were mounted on a turret and we still wanted tracking for our chassis. IIRC you just have to name the external gyro what the internal gyro defaults to in the hardware map.

Would you mind sharing that bit of code where you set up the BNO055 so I have an example to go off of?

We admittedly don’t have the best naming structures and I can’t seem to get the kids to remember to comment most of what they do.

Drivey_stuff_with_gyro.java (14.1 KB)

2 Likes

First off, I’d suggest plugging it into port 1 so that it doesn’t conflict with the IMU already in port 0.

Secondly, I believe there is actually an AdafruitBNO055IMU class in the hardwaremap and SDK that you can use to interface with it. Its actually just a wrapper around the BNO055IMU class, so plugging it into port 1 and indicating there is a “Rev Internal IMU (BNO055)” in that port should work as well.

Fun fact: The SDK BNO055 IMU driver is loosely inspired by the Adafruit BNO055 IMU driver they provide as an example :slight_smile:

So once its plugged into port 1, you can follow the instructions here Universal IMU Interface — FIRST Tech Challenge Docs 0.2 documentation

Just be sure that, instead of using the default port 0 IMU named “imu”, you add a new device to port 1, name it something different (like “adafruitIMU”), and use that name everywhere else.

3 Likes

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.