This project contains a ROS2-based ultrasonic data acquisition and processing system with real-time visualization and parameter control capabilities.
The following README is for Evo devices which may use a different set of parameters. The logics should be identical though.
The system consists of three main ROS2 nodes that work together:
- Publisher Node (
publisher.py) - Interfaces with Evo hardware to acquire ultrasonic A-scan data - Processor Node (
processor.py) - Processes raw A-scan data and displays real-time visualizations - Controller Node (
controller.py) - Provides a GUI for monitoring and controlling system parameters
┌─────────────────┐ Ascan Message ┌─────────────────┐
│ │ ──────────────────────> │ │
│ Publisher │ │ Processor │
│ (Hardware I/O) │ │ (Visualization) │
└─────────────────┘ └─────────────────┘
↑ ↑
│ │
│ ROS2 Parameters │
└───────────────────┬───────────────────────┘
│
┌────────────────┐
│ Controller │
│ (GUI) │
└────────────────┘
Purpose: Interfaces with Evo ultrasonic hardware to acquire A-scan waveform data from up to 2 channels.
The publisher does not include code on temperature gathering. You should implement your own temperature aquisition code, and there is a segment in the code where you can do this.
Parameters:
numAverages(int, 1-1000): Number of waveform averages for noise reductionnumChannels(int, 1-2): Number of active channelsnumCycles(int, 1-3): Number of excitation cycles (read-only)numSamples(int): Number of samples to record (read-only)signalFrequency(int): EMAT signal frequency in Hz
Published Topics:
/ascan(interfaces/msg/Ascan): Contains active channels, encoded waveform data, and temperature
Purpose: Processes raw A-scan data and provides real-time visualization with automatic peak detection.
Key Features:
- Real-time matplotlib-based visualization for active channels
- Automatic subplot arrangement based on number of active channels
- Peak detection and thickness calculation
- Multiple processing modes (first peak, multi-echo, zero crossing)
- Temperature-corrected measurements
Parameters (per channel, ch1-ch2):
ch{N}_sampling_freq(int): Sampling frequency in Hzch{N}_lowbound_time(int): Lower bound time in microsecondsch{N}_minimum_thickness(float): Minimum detectable thickness in mmch{N}_wave_velocity(float): Wave velocity in m/sch{N}_num_cycles(float): Number of cycles for processingch{N}_signal_frequency(int): Signal frequency in Hzch{N}_threshold_snr(float): SNR threshold in dBch{N}_noise_width(int): Noise calculation window widthch{N}_calibration_index(int): Calibration reference indexch{N}_firstPeak(bool): Enable first peak detection modech{N}_multiEcho(bool): Enable multi-echo modech{N}_zeroCrossing(bool): Enable zero crossing detectionch{N}_temperatureCorrected(bool): Enable temperature correction
Subscribed Topics:
/ascan(interfaces/msg/Ascan): Receives waveform data from publisher
Purpose: Provides a PyQt5-based GUI for real-time parameter monitoring and control.
Key Features:
- Automatic discovery of ROS2 nodes and their parameters
- Tabbed interface with separate tabs for each active channel
- Parameter filtering based on configuration file
- Support for various parameter types (sliders, spinboxes, checkboxes)
- Real-time parameter updates with visual feedback
- Configurable display names and parameter bounds
Configuration (config.json):
multipleTabs: Enable/disable tabbed interfacewhitelist: Enable parameter whitelistinghideReadOnlyParameters: Hide read-only parameterswhitelistNodes: List of nodes to displaywhitelistParameters: Parameters to show per nodeparameterDisplayNames: Custom display names for parametersparameter_bounds: Min/max bounds for numeric parameters
The system uses 1-based channel numbering (1-2) for user-facing interfaces:
- Channel parameters are named
ch1_*throughch2_* - Display shows "Channel 1" through "Channel 2"
- The
channelsOnReceiveparameter uses array indices 0-1 internally but presents channels as 1-2 to users
int32[] active_channels # List of active channel numbers (1-2)
string[] ascan_data # Base64-encoded waveform data for each active channel
float32 temperature # Current temperature reading
int32 signal_frequency # EMAT pulser frequency
- ROS2 Humble or later (tested on Jazzy) (Desktop Variant is required for processor and controller)
- Evo ultrasonic system (for publisher)
- Under the project root folder, run
cd drivers
sudo ./sonobotics_runtime_<version&architecture>.deb
sudo ./sonobotics_waveforms_<version&architecture>.deb
tar -xvf pololu-jrk-g2-1.4.0-linux-x86.tar.xz
cd pololu-jrk-g2-1.4.0-linux-x86
sudo ./install.sh- Once drivers have been installed, run
colcon buildto build all the packages.
- Launch the publisher node (requires Evo hardware):
ros2 run ros_parameter_demo publisher- Launch the processor node for visualization:
ros2 run ros_parameter_demo processor- Launch the controller GUI:
ros2 run ros_parameter_demo controllerTo enable specific receive channels, modify the numChannels parameter in the publisher file.
Each channel can operate in different processing modes:
- First Peak: Detects the first significant peak in the waveform
- Multi-Echo: Processes multiple reflections
- Zero Crossing: Uses zero-crossing detection for improved accuracy
- Temperature Corrected: Applies temperature compensation to measurements
Note: First Peak and Multi-Echo modes are mutually exclusive.
If you set both in the controller, the processor falls back to which none of the four parameters are set.
config.json: Controller GUI configuration- Channel parameters can be saved/loaded via ROS2 parameter services
- No visualization appears: Ensure at least one channel is enabled in
numChannels - Controller doesn't show parameters: Controller won't show anything until the publishing node is on. Check that nodes are running and
config.jsonwhitelist is correct. - Hardware errors: Verify Evo device is connected and permissions are set correctly.