00001 /* -*- mode: C++ -*- 00002 * 00003 * Digital filter functions 00004 * 00005 * Copyright (C) 2008 Austin Robot Technology 00006 * License: Modified BSD Software License Agreement 00007 * 00008 * $Id: filter.h 630 2010-09-25 16:20:42Z jack.oquin $ 00009 */ 00010 00011 #ifndef _FILTER_H 00012 #define _FILTER_H 00013 00032 static inline float EWMA_filter(float a, float xk, float yk1) 00033 { 00034 return a*xk + (1-a)*yk1; 00035 } 00036 00040 static inline float EWMA_smoothing(int N) 00041 { 00042 return 2.0/(N + 1.0); 00043 } 00044 00045 #endif /* _FILTER_H */