Enhance playback speed control and performance optimizations#122
Conversation
- Added playback speed options to the GUI for user selection. - Implemented caching for timestamp deduplication in signal providers. - Improved performance by using binary search for timestamp lookups. - Adjusted thread sleep logic to avoid redundant updates in the meshcat provider. - Increased meshcat provider's thread period for better performance.
There was a problem hiding this comment.
Pull request overview
This PR enhances offline playback controls and optimizes UI/visualization performance by adding playback speed selection, reducing redundant updates, and improving timestamp lookup efficiency.
Changes:
- Add a playback speed selector to the GUI and propagate speed to the signal provider.
- Improve timestamp-related performance via binary search and timestamp-array deduplication caching.
- Reduce rendering/update overhead (plot vline updates, meshcat update skipping, pyqtgraph downsampling/tuning) and adjust thread periods.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
robot_log_visualizer/ui/misc/visualizer.ui |
Adds a QComboBox for playback speed and expands layout column span. |
robot_log_visualizer/ui/gui.py |
Wires playback speed control; defers heavy work during slider drag; binary-search text log indexing; reduces per-tick work. |
robot_log_visualizer/signal_provider/signal_provider.py |
Adds thread-safe playback_speed; adds timestamp dedup cache; replaces argmin with binary-search nearest index. |
robot_log_visualizer/signal_provider/matfile_signal_provider.py |
Adds timestamp dedup cache; uses wall-clock elapsed time * playback speed; replaces linear index advance with binary search. |
robot_log_visualizer/robot_visualizer/meshcat_provider.py |
Skips meshcat updates when the signal index hasn’t advanced. |
robot_log_visualizer/plotter/pyqtgraph_viewer_canvas.py |
Applies pyqtgraph performance options and pre-downsamples curves; adds a direct vline update method. |
robot_log_visualizer/__main__.py |
Increases meshcat provider thread period to reduce load. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Pre-downsample for fast rendering (207k → ~4000 points) | ||
| x_ds, y_ds = self._downsample_peak(x, y) | ||
|
|
||
| self._curves[key] = self._plot.plot( | ||
| x, | ||
| y, | ||
| x_ds, | ||
| y_ds, | ||
| pen=pen, | ||
| name="/".join(legend[1:]), | ||
| symbol=None, | ||
| clipToView=True, | ||
| ) | ||
| self._curve_fulldata[key] = (x, y) |
There was a problem hiding this comment.
Curves are now plotted with pre-downsampled (x_ds, y_ds), but point selection (_on_mouse_click) uses curve.getData(), so selections/annotations will snap to the downsampled points rather than the true underlying signal. Since you also store full-res data in _curve_fulldata, consider using that full data for hit-testing/selection (or remove selection support when downsampled) so the displayed coordinates and picked points remain accurate.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Introduce playback speed options in the GUI, implement caching for timestamp deduplication, and improve performance with binary search for timestamp lookups. Adjust thread sleep logic and increase the meshcat provider's thread period for better efficiency.