|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||||
|
||||||
|
Re: i2c gyro
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.
|
|
#2
|
|||||
|
|||||
|
Re: i2c gyro
Especially considering the fact that one came in the Kit of Parts.
|
|
#3
|
|||
|
|||
|
Re: i2c gyro
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 |
|
#4
|
||||
|
||||
|
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. |
|
#5
|
|||
|
|||
|
Re: i2c gyro
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!
|
|
#6
|
||||
|
||||
|
Re: i2c gyro
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...lib/TrcAccel.h |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|