Results 1 to 2 of 2

Thread: Java non-analog gyroscope support

  1. #1
    Join Date
    Feb 2015
    Posts
    4

    Default Java non-analog gyroscope support

    Two of our old KoP analog gyros have died since the beginning of build season, leaving only the one installed on our bagged robot. We are really nervous about that one, and need to have a backup or alternative (fortunately we don't need the gyro for tele-op, just autonomous). The old KoP analog gyro is no longer available, and the other analog gyros we could find online didn't seem like good replacements, and very few of them were already in North America.
    We purchased two control systems and built a practice/test robot this year for the first time, and have a bit over three weeks to implement a replacement. We have already purchased and received several of I2C gyros from pololu. Our plan was to extend AnalogChannel and re-implement the methods to get values from the new gyroscope, and use this as a call to new Gyro(analogChannel). We learned today that the Gyro class won't work with an analogChannel that isn't really a roboRIO hardware analog input, because of its dependence on the internal FPGA for the integration. Does anyone have any experience or other help to offer in implementing an I2C or other non-analog gyroscope integrator?

    Thanks,
    Gus "GeeTwo" Michel
    Mentor, 3946 Tiger Robotics

  2. #2
    Join Date
    Oct 2011
    Posts
    523

    Default 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

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 2
    Last Post: 02-16-2015, 01:22 AM
  2. Replies: 1
    Last Post: 02-06-2015, 10:27 PM
  3. eclipse Java "Install Java" running in background
    By nathanzentner in forum Java
    Replies: 5
    Last Post: 01-05-2015, 06:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •