lowpass - Low-pass filter
loadrt lowpass [count=N|names=name1[,name2...]] |
lowpass.N (requires a floating-point thread)
lowpass.N.in
float in
lowpass.N.out float out
out += (in - out) * gain
lowpass.N.load bit in
When TRUE, copy in to out instead of applying the filter equation.
lowpass.N.gain float rw
gain pin setting
The digital filter implemented is equivalent to a unity-gain continuous-time single-pole low-pass filter that is preceded by a zero-order-hold and sampled at a fixed period. For a pole at -a (radians/seconds) the corresponding continuous-time lowpass filter LaPlace transfer function is:
H(s) = a/(s + a)
For a sampling period T (seconds), the gain for this HAL lowpass component is:
gain = 1 - e^(-a * T)
e = 2.71828 https://en.wikipedia.org/wiki/E_(mathematical_constant)
Examples:
T = 0.001 seconds (typical servo thread period)
a = (2*pi*100) (100Hz bandwidth single pole)
gain = 0.466
T = 0.001
seconds (typical servo thread period)
a = (2*pi*10) ( 10Hz bandwidth single pole)
gain = 0.0609
T = 0.001
seconds (typical servo thread period)
a = (2*pi*1) ( 1Hz bandwidth single pole)
gain = 0.0063
Jeff Epler
GPL