Quote:
Originally Posted by Ether
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)
