Applying Low Pass Filter on Master Source
Applying Low Pass Filter on Master Source
This article explains how to add low-pass Butterworth filter [1] on the master-source signal.
Once the filter is active (MOT_LP_SET is called) it will filter any (POSITIONCOMMAND, POSITIONFEEDBACK,POSITIONEXTERNAL, TIMEPULSE,TORQUECOMMAND,TORQUEFEEDBACK,TORQUEADDITIVECOMMAND,TORQUEDRIVECOMMAND) master-source signal.
Setup
In PROTO.PRO file add the following line:
import_c MOT_LP_SET(byval as long, byval as long, byval as double) as long
Usage
Add the following line into your code:
tmp = MOT_LP_SET(<slave element id>,<number of stages>, <cut-off frequency in Hz>)
Example
MLeader_LPF is a simulated axis
MLeader is a real axis.
MLeader_LPF.opmode = TorqueMode
MLeader_LPF.MasterSource = MLeader.TDCMD
MLeader_LPF.Slave = GEAR
retVal = MOT_LP_SET(MLeader_LPF.ElementID, 1, g_Cutoff_Freq) ' (int Handle, int FilterStages, int CutOffFreq)