View Single Post
  #2   Spotlight this post!  
Unread 13-11-2013, 13:22
GuyM142's Avatar
GuyM142 GuyM142 is offline
Registered User
AKA: Guy
FRC #3339 (BumbleBee)
Team Role: Mentor
 
Join Date: Jul 2013
Rookie Year: 2012
Location: Israel
Posts: 158
GuyM142 is just really niceGuyM142 is just really niceGuyM142 is just really niceGuyM142 is just really niceGuyM142 is just really nice
Re: Gyro angle in simulation vs reality?

Quote:
Originally Posted by Ether View Post

Here's a possible implementation of Joe's suggestion.

Code:
// initialization:
alpha=Go=getGyroReading();  // range -180 to +180

// iteration:
G=getGyroReading();
d=G-Go;
Go=G;
if (d>180) d-=360;
else if (d<-180) d+=360;
alpha+=d; // alpha is the continuous angle reading you've been asking for

Thank you! that's what I was looking for.
My goal was to make the simulated gyro work like a real FRC gyro for new programmers training.
I've attached my implementation (this is in periodic tasks)
Attached Thumbnails
Click image for larger version

Name:	gyro.png
Views:	42
Size:	32.6 KB
ID:	15410  
Reply With Quote