📄 ilowpass.comp
字号:
component ilowpass "Low-pass filter with integer inputs and outputs";description """While it may find other applications, this component was writtento create smoother motion while jogging with an MPG.In a machine with high acceleration, a short jog can behave almost like a stepfunction. By putting the \\fBilowpass\\fR component between the MPGencoder \\fBcounts\\fR output and the axis \\fRjog-counts\\fR input,this can be smoothed.Choose \\fBscale\\fR conservatively so that during a single sessionthere will never be more than about 2e9/\\fBscale\\fR pulses seenon the MPG. Choose \\fBgain\\fR according to the smoothing leveldesired. Divide the \\fRaxis.\\fIN\\fR.jog-scale\\fR values by\\fBscale\\fR.""";pin in s32 in;pin out s32 out """\\fBout\\fR tracks \\fBin\\fR*\\fBscale\\fR through a low-passfilter of \\fBgain\\fR per period.""";param rw float scale = 1024 """A scale factor applied to the outputvalue of the low-pass filter.""";param rw float gain = .5 """Together with the period, sets the rate atwhich the output changes. Useful range is between 0 and 1, with highervalues causing the input value to be tracked more quickly. Forinstance, a setting of 0.9 causes the output value to go 90% of the waytowards the input value in each period""";variable double value;function _ "Update the output based on the input and parameters";license "GPL";// author "Jeff Epler <jepler@unpythonic.net>";;;value += (in - value) * gain;out = value * scale;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -