ROS2 package to filter generic time series (e.g. IMU data) using DSP (Digital Signal Processing) tools.
Example of a lowpass-filtered signal consisting of three white noised sines with different amplitudes, frequencies and phase shifts.
And the associated example Fourier plots.
The repository consists of two standalone ROS2 packages:
sample_signal: This package allows you to create different signals consisting of various periodic elements enriched by white noise and/or a base signal to test thefilter_signalpackage.filter_signal: This package applies an FFT transform to any specified ROS2 topic (which should be analyzed first) and displays the data in the frequency domain. Based on this analysis, the user can choose a suitable filter and apply it to the live topic to get a filtered result with a small delay.
Both packages are documented with their own README files. It is advised to start with the sample_signal package if you are not very familiar with DSP. We also highly recommend using PlotJuggler for data visualization purposes. Why wouldn't you!?
The current repository tree looks like
ros2_dsp_filters
├── README.md
├── docs
├── filter_signal
│ ├── CMakeLists.txt
│ ├── config
│ ├── filter_config
│ ├── filter_signal
│ ├── fourier_config
│ ├── include
│ ├── launch
│ ├── package.xml
│ ├── README.md
│ └── src
└── sample_signal
├── CMakeLists.txt
├── config
├── include
├── launch
├── LICENSE
├── package.xml
├── README.md
├── sample_signal
└── srcTo get started, please read filter_signal/README.md and sample_signal/README.md.
This repository depends on python3-scipy and python3-numpy, hence please install
sudo apt-get install python3-scipy python3-numpy
or run rosdep install --from-paths src -y --ignore-src within your workspace.
Create ros2 workspace and source folder, if needed:
mkdir -p ros2_ws/srcClone the package into the src of your ros2 workspace, source and build:
cd ros2_ws/src
git clone [email protected]:LEM-RPTU/ros2_dsp_filter.git
cd ..
source /opt/ros/humble/setup.bash
colcon buildTo check the default setup run in two different terminals:
source /opt/ros/humble/setup.bash
source install/setup.bash
ros2 launch sample_signal launch.pyand
source /opt/ros/humble/setup.bash
source install/setup.bash
ros2 launch filter_signal filter.launch.pyUse Plotjuggler and you should see a result similar to the example as the beginning of this README.
The workflow is
- Generate a signal using
sample_signal-package or find another source of a ROS2-message you want to FFT-analyse and/or filter. - Analyse the ROS2 message which you are publishing using
filter_signal'sanalysefunctionality - Plot the Fourier-Transform of the ROS2 message's components of your choice using
filter_signal'sfourierfunctionality - Design a digital filter for the ROS2 message's components of your choice using
filter_signal'sfilterfunctionality - (optional) Plot the Fourier-Transform of both the filtered and the raw ROS2 message using
filter_signal'sfourierfunctionality again - (non-optional) Enjoy a filtered ROS2 message


