Skip to content

Enhance playback speed control and performance optimizations#122

Merged
GiulioRomualdi merged 2 commits into
mainfrom
performances
Apr 30, 2026
Merged

Enhance playback speed control and performance optimizations#122
GiulioRomualdi merged 2 commits into
mainfrom
performances

Conversation

@GiulioRomualdi
Copy link
Copy Markdown
Collaborator

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.

- 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.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread robot_log_visualizer/ui/gui.py Outdated
Comment on lines +210 to +221
# 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)
Copy link

Copilot AI Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment thread robot_log_visualizer/signal_provider/signal_provider.py
Comment thread robot_log_visualizer/signal_provider/matfile_signal_provider.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@GiulioRomualdi GiulioRomualdi merged commit e78b75f into main Apr 30, 2026
7 checks passed
@GiulioRomualdi GiulioRomualdi deleted the performances branch April 30, 2026 10:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants