Thread: Gyro stability?
View Single Post
  #13   Spotlight this post!  
Unread 15-02-2011, 09:42
Chris Hibner's Avatar Unsung FIRST Hero
Chris Hibner Chris Hibner is offline
Eschewing Obfuscation Since 1990
AKA: Lars Kamen's Roadie
FRC #0051 (Wings of Fire)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1997
Location: Canton, MI
Posts: 1,488
Chris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond repute
Re: Gyro stability?

Quote:
Originally Posted by sheleski View Post
Chris,
Would you be willing to post in Labview example using a HPF and a gyro?

Steven
See attached image.

The equation for a high pass filter is:

Output = Input - Input_previous_sample + FilterConstant * Output_previous_sample


FilterConstant = exp(-SamplePeriod / TimeConstant)

In the attached vi, I have FilterConstant being calculated every sample, which is very inefficient if you are running the filter in a loop with a constant sample period (like TimedTasks.vi). If you are running it in a constant-time loop, replace the entire part inside the frame "Filter Constant calculation" with a simple constant.

Example filter constant calculation: if you're running in the 10 ms loop (SamplePeriod = 0.01 since 10 ms is 0.01 seconds) and you want your time constant to be 30 seconds, then the filter constant is:

FilterConstant = exp(-0.01 / 30) = 0.9996667222

Edit: I forgot to initialize one of the feedback nodes to zero. It should be zero by default, but I like to be explicit.
Attached Thumbnails
Click image for larger version

Name:	HPF.jpg
Views:	37
Size:	45.9 KB
ID:	10125  
__________________
-
An ounce of perception is worth a pound of obscure.
Reply With Quote