How do I implement a Low Pass filter to reduce the noise coming from a topic that is publishing a WrenchStamped msg type using a Python script?
I was able to record the WrenchStamped data from the topic to a .bag file, export that data to a .csv file, and finally wrote a python script that uses scipy.signal.butter()
from here along with scipy.signal.lfilter()
from here to "post-process" the data and it worked fine (see image below).
The problem is that when I go to actually implement it in my source code (subscriber node) and run it with some hardware, I get the following error message:
Traceback (most recent call last):
File "extract_pandas1.py", line 36, in <module>
output_fx = signal.lfilter(b, a, fx,axis=1) #Forward filter
File "/usr/lib/python2.7/dist-packages/scipy/signal/signaltools.py", line 974, in lfilter
return sigtools._linear_filter(b, a, x, axis)
ValueError: selected axis is out of range
Does anyone know what I may be doing wrong? Do you have any suggestions for another option for filtering?
Thanks in advance!! -Cheers