View Single Post
  #23   Spotlight this post!  
Unread 15-04-2012, 02:38
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 675
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: High Speed Encoder Problem

We have a similar filter in our library but we called it MovingAverage filter. In a sense, it is averaging the last N points.
Code:
/*
 * MovingAverage of N points:
 *      MovingAverage = (MovingAverage*(N - 1) + CurrData)/N
 *                    = MovingAverage*(N - 1)/N + CurrData/N
 *                    = MovingAverage*(1 - Kf) + CurrData*Kf
 * where 1/N = Kf
 *        (N - 1)/N = 1 - 1/N = 1 - Kf
 */
__________________