Go to Post Just the fact we were selected to compete in the eliminations energized the kids more than anything I had seen - Taylor [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 08-02-2011, 07:31
Zme Zme is offline
Registered User
FRC #2619
 
Join Date: Jan 2009
Location: Michigan
Posts: 83
Zme is on a distinguished road
i2c gyro

the electrical team got a shiny new i2c gyro, just one problem.... i need the angular displacement and not the angular rate that it provides.
I understand the concept of integrating it with respect to time to get the angular displacement but this creates another problem.
The KOP gyro does this in the code is through an accumulator hooked up to analog channel one and i can't find a way to hook up an i2c input to the same kind of accumulator.
Is there a relatively easy way to do this to an i2c gyro or should I start working out a different way to do this?
Reply With Quote
  #2   Spotlight this post!  
Unread 08-02-2011, 10:25
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,590
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
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.
Reply With Quote
  #3   Spotlight this post!  
Unread 08-02-2011, 11:08
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: i2c gyro

Quote:
Originally Posted by Joe Ross View Post
It may be easier to convince the electrical team that an analog gyro is better.
Especially considering the fact that one came in the Kit of Parts.
Reply With Quote
  #4   Spotlight this post!  
Unread 08-02-2011, 11:44
Zme Zme is offline
Registered User
FRC #2619
 
Join Date: Jan 2009
Location: Michigan
Posts: 83
Zme is on a distinguished road
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
Reply With Quote
  #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: 674
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
  #6   Spotlight this post!  
Unread 08-02-2011, 15:25
Zme Zme is offline
Registered User
FRC #2619
 
Join Date: Jan 2009
Location: Michigan
Posts: 83
Zme is on a distinguished road
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!
Reply With Quote
  #7   Spotlight this post!  
Unread 08-02-2011, 15:34
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: 674
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

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
__________________
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 13:55.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi