Non-VEX Gyro interfacing the Cortex?

  1. 5 months ago

    OscarMNOVA12

    Jan 12 Event Partner, V5 Beta Tester Northern VA and Pittsburgh 12

    So I have a different gyro I'm planning on interfacing with my Cortex.

    It's this one: http://modernroboticsinc.com/rate-gyro

    Because the specs are different, I know the sensorGyro is invalid to use.

    I have a feeling I'll have to do some calculation based on the ADC value I get back from the sensor, but I'm not sure how to translate that into the angular rotation, and from that the current angle. Any tips on where to start?

  2. kypyro

    Jan 12 V5 Beta Tester Central Kentucky
    Edited 5 months ago by kypyro

    That's a nice enough rate gyro if you happen to have one already. There are cheaper solutions that also aren't official VEX parts, many of which integrate the movements for you so you get position/orientation information directly.

    Still, it's a great exercise to make a different sensor work. To transform instantaneous "rate of turn" measurements into heading information, you have to integrate the rate into a heading. It's fairly easy; you just set up a task to repeatedly read the rate of turn. Then, you optionally average the rate with one or more previous readings. Since you take note of the elapsed time between readings, you calculate how far it turned since the previous measurement, and accumulate those changes into a heading variable.

    Here's a frequently referenced Vamfun blog post where he did exactly that with the standard VEX gyro. He treated the VEX gyro as a standard analog sensor and did all the integration stuff in his own code.

    https://vamfun.wordpress.com/2011/05/09/note-vex-gyro/

    That's the sort of thing you need to do with the rate gyro you referenced in order to derive heading information from its output.

  3. jpearman

    Jan 12 Moderator, ROBOTC Tech Support, V5 Beta Moderator Los Angeles 8888

    And here's an old simulation of the internal ROBOTC algorithm... written in ROBOTC.

    https://github.com/jpearman/RobotCLibs/blob/master/gyroLib/gyroSim.c

  4. kypyro

    Jan 12 V5 Beta Tester Central Kentucky

    @jpearman And here's an old simulation of the internal ROBOTC algorithm... written in ROBOTC.

    I don't remember looking at that before; it's a very clean implantation of rate integration. You know where all the treasures are. Of course, I think you crafted most of them yourself...

 

or Sign Up to reply!