Re: Java non-analog gyroscope support
Hi Gus,
As you have alluded to, the hardware accumulator will only work with the hardware analog inputs (on channels 0 and/or 1) and cannot be used with a software level implementation like an I2C or SPI gyro.
On the bright side, the roboRIO should have plenty of processing power to implement an accumulator function in software without substantially affecting your robot program.
I took a look at the datasheet for the sensor and the one thing I couldn't seem to put my finger on was the behavior of the DATARDY interrupt functionality. If that interrupt does what the naming suggests it might (assert whenever there is any data available to read) I would probably go down the approach of using that (connected to a Digital Input) to trigger an interrupt on the roboRIO, read the data then accumulate it (using either the fixed dT of the sensor if you are consistently reading all samples or using a measured dT if you find you are deviating substantially from the fixed timing window). You can see a similar approach that someone has written for a different gyro part in the code here: https://gist.github.com/lopsided98/ef6c0f8cacacad9d398b
Another possibility is to configure the sensor in Bypass mode (where it only keeps the latest data in the buffer, though this may be the mode you'd use for the approach above as well) and read it on a fixed timing on the roboRIO side using some of the timing functionality (a Notifier would probably work best). You can see an example of a similar approach (though this is C++ and uses Timers as opposed to a Notifier) described in this ChiefDelphi thread and associated code:
http://www.chiefdelphi.com/forums/sh...highlight=gyro
https://github.com/FRC1296/RHSRobot2.../ADXRS453Z.cpp
Hopefully at least one of those two options makes some sense and helps you get started. If you have questions, or come up with some as you dive further into this project, feel free to ask!
FIRST®
FRC Robotics Engineer