From 23a7fd7d81e36f7a0c08af117c7221568e4bea4d Mon Sep 17 00:00:00 2001 From: firestarsdog <229254897+firestarsdog@users.noreply.github.com> Date: Mon, 30 Mar 2026 22:46:34 -0400 Subject: [PATCH] Fix mici replay on tizi ui --- selfdrive/ui/mici/onroad/augmented_road_view.py | 7 +++++-- selfdrive/ui/onroad/augmented_road_view.py | 9 ++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/selfdrive/ui/mici/onroad/augmented_road_view.py b/selfdrive/ui/mici/onroad/augmented_road_view.py index da7324e2..857af856 100644 --- a/selfdrive/ui/mici/onroad/augmented_road_view.py +++ b/selfdrive/ui/mici/onroad/augmented_road_view.py @@ -517,10 +517,13 @@ class AugmentedRoadView(CameraView): w, h = self._content_rect.width, self._content_rect.height cx, cy = intrinsic[0, 2], intrinsic[1, 2] + # Ensure zoom views the whole area + zoom = max(zoom, w / (2 * cx), h / (2 * cy)) + # Calculate max allowed offsets with margins margin = 5 - max_x_offset = cx * zoom - w / 2 - margin - max_y_offset = cy * zoom - h / 2 - margin + max_x_offset = max(0.0, cx * zoom - w / 2 - margin) + max_y_offset = max(0.0, cy * zoom - h / 2 - margin) # Calculate and clamp offsets to prevent out-of-bounds issues try: diff --git a/selfdrive/ui/onroad/augmented_road_view.py b/selfdrive/ui/onroad/augmented_road_view.py index 2c6f5d1c..51959319 100644 --- a/selfdrive/ui/onroad/augmented_road_view.py +++ b/selfdrive/ui/onroad/augmented_road_view.py @@ -181,7 +181,7 @@ class AugmentedRoadView(CameraView): ) # Render the base camera view - super()._render(rect) + super()._render(self._content_rect) # Draw all UI overlays self.model_renderer.render(self._content_rect) @@ -286,10 +286,13 @@ class AugmentedRoadView(CameraView): w, h = self._content_rect.width, self._content_rect.height cx, cy = intrinsic[0, 2], intrinsic[1, 2] + # Ensure zoom views the whole area + zoom = max(zoom, w / (2 * cx), h / (2 * cy)) + # Calculate max allowed offsets with margins margin = 5 - max_x_offset = cx * zoom - w / 2 - margin - max_y_offset = cy * zoom - h / 2 - margin + max_x_offset = max(0.0, cx * zoom - w / 2 - margin) + max_y_offset = max(0.0, cy * zoom - h / 2 - margin) # Calculate and clamp offsets to prevent out-of-bounds issues try: