View Single Post
  #8   Spotlight this post!  
Unread 22-12-2014, 16:57
seg9585's Avatar
seg9585 seg9585 is offline
Registered User
AKA: Eric
FRC #4276 (Surf City Vikings)
Team Role: Engineer
 
Join Date: Feb 2006
Rookie Year: 2001
Location: Boeing (Seal Beach, CA)
Posts: 520
seg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond repute
Re: Best gyro for frc.

Quote:
Originally Posted by Ether View Post
Could you please provide a bit more detail?

It sounds like you were sampling the rate at 1KHz, keeping the 50 most recent rate samples in a ring buffer, and using the average of those 50 samples every 20ms to calculate a new heading. Is that correct?


Correct -- I accumulated the last 50 samples, averaged the value (divide by 50), and calculated the new heading (this means the heading is updated at 20Hz, not every 20ms).

The reason I had to do this is because the most accurate Timer I could find in the Arduino was only accurate to the nearest 1ms and this introduced significant heading error when calculating time delta, particularly at high rates.

Happy to post my code if interested.
__________________
My FIRST legacy:

Team 204 Student 2001, 2002 (Voorhees, NJ)
Team 1493 College Mentor 2006 - 2008 (Troy, NY)
Team 2150 Intern/Professional Mentor 2007, 2009 (Palos Verdes)
Team 4123 Lead Engineering Mentor 2012 (Bellflower, CA)
Team 4276 Engineering Mentor 2012-2016 (Huntington Beach, CA)

Last edited by seg9585 : 22-12-2014 at 17:04.