View Single Post
  Spotlight this post!  
Unread 27-01-2008, 20:17
Kevin Watson's Avatar
Kevin Watson Kevin Watson is offline
La Caņada High School
FRC #2429
Team Role: Mentor
 
Join Date: Jan 2002
Rookie Year: 2001
Location: La Caņada, California
Posts: 1,335
Kevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond reputeKevin Watson has a reputation beyond repute
Re: New C18 3.0+ Compatible FRC Code

Quote:
Originally Posted by billbo911 View Post
Is there a problem with the Get_Gyro_Rate() function? We will be depending on it heavily this year, and need it to function correctly.
Yes, Phil caught an error that would cause the function to overflow if you rotated your gyro fast enough. This is what the fixed code currently looks like:

return((int)(((((long)gyro_rate * GYRO_SENSITIVITY * 5L) / ADC_RANGE)) * GYRO_CAL_FACTOR));

-Kevin
__________________
Kevin Watson
Engineer at stealth-mode startup
http://kevin.org