i2c gyro

the electrical team got a shiny new i2c gyro, just one problem… i need the angular displacement and not the angular rate that it provides.
I understand the concept of integrating it with respect to time to get the angular displacement but this creates another problem.
The KOP gyro does this in the code is through an accumulator hooked up to analog channel one and i can’t find a way to hook up an i2c input to the same kind of accumulator.
Is there a relatively easy way to do this to an i2c gyro or should I start working out a different way to do this?

There isn’t any way to get the data from the i2c gyro to the FPGA accumulators. You’ll have to write your own integration routine. It may be easier to convince the electrical team that an analog gyro is better.

Especially considering the fact that one came in the Kit of Parts.

i have code written for this gyro, was wondering if there was an easier way to go about it. we’ve had issues with the KOP gyro and turn rates as well as drift so something a bit nicer was needed, they thought they give us a challenge i guess.
thanks for the advice

Last year just for the fun of it, we have written a TrcGyro class subclassing the WPILib gyro so that we can add GetAngularVelocity and GetAngularAcceleration, not that we really need them. Strange that the WPILib used the accumulater to integrate for the angular displacement but never give you the raw angular velocity. So I wrote the class to differentiate the angular displacement to get back angular velocity. If you take this code, change the differentiator to integrator, create a member variable to remember the previous angular velocity and change the algorithm from dividing to multiplying, then you have an integrator.
http://proj.titanrobotics.net/hg/Frc/2011/code/file/ea68beef9fd9/trclib/TrcGyro.h

If you really want to see how to do the integration, we have written a gyro module for the FTC using RobotC. Look at the GyroTask function. You can find it here. As a bonus, this code does gyro calibration to determine the bias as well as the noise level.
http://proj.titanrobotics.net/hg/Frc/2011/code/file/ea68beef9fd9/trclib.nxt/gyro.h

thanks for the source, the gyro calibration was something that i had thought about doing but not gotten to thinking about the specifics. having an example to look at helps a lot!

Just thought of one more example. We also have an accelerometer class that does the integration (in fact double integration) to get velocity and displacement. This may be a better example because it’s for WindRiver and it also contains the calibration code.
http://proj.titanrobotics.net/hg/Frc/2011/code/file/ea68beef9fd9/trclib/TrcAccel.h