jcorcoran / bno055_frc Goto Github PK
View Code? Open in Web Editor NEWA test project to illustrate how to use the BNO055 sensor with the FRC control system.
License: MIT License
A test project to illustrate how to use the BNO055 sensor with the FRC control system.
License: MIT License
I seem to be having a wired null pointer bouncing around after trying to get the sensor's state in auto for testing purposes. assuming the .getInstance is the correct way to instantiate the object, my code seems fine other than the obvious null pointer. i have put the code in a gist. I am trying to get the BNO working for one of our team's side projects. any help you can give would be greatly appreciated.
Thanks,
Cole
Team 4145
electrical and programming
https://gist.github.com/coalman321/e7923d4dcd3adaf0e875b79ca422cca7
Code ported from the adafruit arduino library uses lots of time delays during initialization.
Revise code so that any required time delays occur within a separate thread in the sensor class.
The use of the ItterativeRobot project was just to help make the port from the arduino code easier, once #1 is complete, migrate to CommandBased robot project, as that's what we're going to use in season (as well as what's used by most Java/C++ teams).
One for each sensor, as well as a summary method that returns true when all required sensors are calibrated (mode dependent).
Revise source to keep track of multiple rotations.
For example if the robot spins around twice the current X value should read 720 degrees vs providing the position % 360 as it does now.
Make this a configuration option that can be toggled on/off.
While moving the board sensor around, the X position will reset to 270 degrees. This only appears to happen when there's roll and/or yaw on the board, so it shouldn't affect tracking heading on the field, unless of course the field has bumps that need to be traversed.
Seems like it might be related to fluctuating calibration statuses (see logs below - mag calibration value changes - affecting x posiiton). Relatively repeatable with -Z and and +Y values.
There may be some active re-calibration enabled which is causing a new zero to be established. IF this is the case, look into disabling this in software after initial cal is completed..
Also need to read up on what the calibration values are for and what they should be equal to prior to considering the sensor 'calibrated'.
Sample data:
X: 0359.375 Y: 0000.062 Z: 0000.875 CALIBRATION: Sys=0 Gyro=3 Accel=0 Mag=1
X: 0359.375 Y: 0000.062 Z: 0000.875 CALIBRATION: Sys=0 Gyro=3 Accel=0 Mag=1
X: 0359.375 Y: 0000.062 Z: 0000.875 CALIBRATION: Sys=0 Gyro=3 Accel=0 Mag=1
X: 0359.375 Y: 0000.062 Z: 0000.875 CALIBRATION: Sys=0 Gyro=3 Accel=0 Mag=1
X: 0359.375 Y: 0000.062 Z: 0000.875 CALIBRATION: Sys=0 Gyro=3 Accel=0 Mag=1
X: 0359.375 Y: 0000.062 Z: 0000.875 CALIBRATION: Sys=0 Gyro=3 Accel=0 Mag=1
X: 0359.375 Y: 0000.062 Z: 0000.875 CALIBRATION: Sys=0 Gyro=3 Accel=0 Mag=1
X: 0359.375 Y: 0000.062 Z: 0000.875 CALIBRATION: Sys=0 Gyro=3 Accel=0 Mag=1
X: 0359.375 Y: 0000.062 Z: 0000.750 CALIBRATION: Sys=0 Gyro=3 Accel=0 Mag=1
X: 0359.500 Y: 0000.062 Z: 0000.625 CALIBRATION: Sys=0 Gyro=3 Accel=0 Mag=1
X: 0359.438 Y: -0000.125 Z: -0001.938 CALIBRATION: Sys=0 Gyro=3 Accel=0 Mag=1
X: 0358.062 Y: 0001.812 Z: -0011.312 CALIBRATION: Sys=0 Gyro=3 Accel=0 Mag=1
X: 0359.312 Y: 0004.000 Z: -0024.750 CALIBRATION: Sys=0 Gyro=3 Accel=0 Mag=1
X: 0245.562 Y: 0002.812 Z: -0041.500 CALIBRATION: Sys=0 Gyro=3 Accel=0 Mag=2
X: 0245.000 Y: 0003.250 Z: -0059.062 CALIBRATION: Sys=0 Gyro=3 Accel=0 Mag=2
X: 0243.938 Y: -0003.062 Z: -0000.062 CALIBRATION: Sys=0 Gyro=3 Accel=0 Mag=2
X: 0244.062 Y: 0014.000 Z: -0086.375 CALIBRATION: Sys=0 Gyro=3 Accel=0 Mag=3
X: 0245.375 Y: 0014.438 Z: -0086.875 CALIBRATION: Sys=0 Gyro=3 Accel=0 Mag=3
X: 0246.625 Y: 0013.625 Z: -0077.062 CALIBRATION: Sys=1 Gyro=3 Accel=0 Mag=3
X: 0247.562 Y: 0012.562 Z: -0053.188 CALIBRATION: Sys=0 Gyro=3 Accel=0 Mag=3
X: 0246.375 Y: 0011.938 Z: -0030.750 CALIBRATION: Sys=0 Gyro=3 Accel=0 Mag=3
X: 0243.188 Y: 0012.375 Z: -0012.188 CALIBRATION: Sys=0 Gyro=3 Accel=0 Mag=3
X: 0243.750 Y: 0007.000 Z: -0001.500 CALIBRATION: Sys=0 Gyro=3 Accel=0 Mag=3
X: 0242.875 Y: 0002.438 Z: 0000.000 CALIBRATION: Sys=0 Gyro=3 Accel=0 Mag=3
X: 0243.375 Y: 0000.125 Z: -0000.938 CALIBRATION: Sys=0 Gyro=3 Accel=0 Mag=3
X: 0243.312 Y: 0000.125 Z: 0000.750 CALIBRATION: Sys=0 Gyro=3 Accel=0 Mag=3
X: 0243.312 Y: 0000.125 Z: 0000.750 CALIBRATION: Sys=0 Gyro=3 Accel=0 Mag=3
X: 0243.312 Y: 0000.125 Z: 0000.750 CALIBRATION: Sys=0 Gyro=3 Accel=0 Mag=3
X: +353.438 Y: -000.438 Z: +021.625 CALIBRATION: Sys=0 Gyro=3 Accel=1 Mag=1
X: +353.438 Y: -000.438 Z: +024.250 CALIBRATION: Sys=0 Gyro=3 Accel=1 Mag=1
X: +353.438 Y: -000.438 Z: +026.812 CALIBRATION: Sys=0 Gyro=3 Accel=1 Mag=1
X: +353.438 Y: -000.438 Z: +029.938 CALIBRATION: Sys=0 Gyro=3 Accel=1 Mag=1
X: +353.438 Y: -000.438 Z: +032.125 CALIBRATION: Sys=0 Gyro=3 Accel=1 Mag=1
X: +353.375 Y: -000.438 Z: +034.250 CALIBRATION: Sys=0 Gyro=3 Accel=1 Mag=1
X: +260.062 Y: -000.438 Z: +035.312 CALIBRATION: Sys=0 Gyro=3 Accel=1 Mag=2
X: +259.938 Y: -000.438 Z: +030.812 CALIBRATION: Sys=0 Gyro=3 Accel=1 Mag=2
X: +259.750 Y: -000.438 Z: +023.188 CALIBRATION: Sys=0 Gyro=3 Accel=1 Mag=2
X: +259.625 Y: -000.375 Z: +014.812 CALIBRATION: Sys=0 Gyro=3 Accel=1 Mag=2
X: +259.375 Y: -000.312 Z: +004.000 CALIBRATION: Sys=1 Gyro=3 Accel=1 Mag=2
X: +259.250 Y: -000.250 Z: +001.750 CALIBRATION: Sys=3 Gyro=3 Accel=1 Mag=2
Read up on storing out the calibration data set, and how to re-load it.
See if this can be stored out to a file and conditionally loaded (if present automatically load?).
See section 3.10.4 (Reuse of Calibration Profile) of the BNO055 manual.
Values roll over to 4096 instead of 360. X appears to be working correctly.
Modify comment to provide usage example.
Explain threaded operation
Explain the comms/init/calibration sequence and statuses
Explain calibration sequence(s) that need to be performed by the user.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.