Thread: i2c gyro
View Single Post
  #5   Spotlight this post!  
Unread 08-02-2011, 12:03
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: i2c gyro

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...clib/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...lib.nxt/gyro.h
__________________

Last edited by mikets : 08-02-2011 at 12:18.
Reply With Quote