Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Sensors (http://www.chiefdelphi.com/forums/forumdisplay.php?f=173)
-   -   FRC Java Implementation of the SparkFun 6 Degrees of Freedom IMU Digital Combo Board (http://www.chiefdelphi.com/forums/showthread.php?t=133806)

bussell 31-01-2015 19:54

FRC Java Implementation of the SparkFun 6 Degrees of Freedom IMU Digital Combo Board
 
SERT Team 2521 has been experimenting with the new SparkFun 6 Degrees of Freedom IMU Digital Combo Board. Following an excellent article at http://bildr.org/2012/03/stable-orie...-6dof-arduino/ and sample code from here: http://wiki.oz9aec.net/index.php/6DOF_Digital_IMU we are now able to obtain both Gyro and Accelerometer data from this board.

The classes can be found here:
https://github.com/bussell/SparkFun6Dof

The big lesson learned was "correct addresses are key". The code in WPILIB for the ADXL345 had a hard-coded address that was not correct for this combo board. The only change I made to this file was the address. The gyro took some more care as it uses partial bytes for control data. My hack of a method for setting up the masks is nothing to be excited about, but it works.

Many thanks to the author of the original work published 7/31/2011 by Jeff Rowberg <jeff at rowberg dot net>. https://github.com/jrowberg/i2cdevli...rduino/ITG3200

- Joe Bussell
- Mentor Team 2521

bussell 31-01-2015 20:01

Re: FRC Java Implementation of the SparkFun 6 Degrees of Freedom IMU Digital Combo Bo
 
Usage:

In our Sensors class:
private ADXL345_I2C_SparkFun m_accel;
private GyroITG3200 m_gyro;

In our Sensors() constructor:
m_accel = new ADXL345_I2C_SparkFun(I2C.Port.kOnboard, Accelerometer.Range.k16G);

m_gyro = new GyroITG3200(I2C.Port.kOnboard);
m_gyro.initialize();
Methods to get Gyro data:
public double getAngleX() {
return m_gyro.getRotationX();
}

public double getAngleY() {
return m_gyro.getRotationY();
}

public double getAngleZ() {
return m_gyro.getRotationZ();
}

Ben Wolsieffer 31-01-2015 21:10

Re: FRC Java Implementation of the SparkFun 6 Degrees of Freedom IMU Digital Combo Bo
 
Were you able to get the gyro to work and return an angle?

From what I understand from your code, its seems like you are just getting the rate of rotation. According to the datasheet, the GYRO_*OUT_* registers contain the rate of rotation. The gyro rate needs to be converted to degrees per second and then integrated to get the angle.

I also worked on a driver for this gyro, but it seemed to be filtering out a lot of the readings, so I ended up with a lot of drift. This is how I did it: https://gist.github.com/lopsided98/ef6c0f8cacacad9d398b

bussell 01-02-2015 00:48

Re: FRC Java Implementation of the SparkFun 6 Degrees of Freedom IMU Digital Combo Bo
 
We are still pretty early in our progress with this. What we do have is raw values from the registers for all three gyro orientations and all three acceleration vectors from this combo board showing up on our Smart Dashboard. When I change the orientation of the device I see a '~reasonable' change in the data. We still need to perform some test runs, gather data, and make sense of what we have.

I really appreciate your link. There are several concepts in your code that we will review and likely adopt. On one hand I wish I had your source three days ago. On the other hand it was a fun tour through an engineering problem with our students.


All times are GMT -5. The time now is 08:03.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi