Revert "raylib: 20 FPS onroad (#36208)"

This reverts commit 8de8c3eb00.
This commit is contained in:
Shane Smiskol
2025-09-26 21:41:12 -07:00
parent 8de8c3eb00
commit 5cbfc7705b
6 changed files with 15 additions and 40 deletions
-10
View File
@@ -1,7 +1,6 @@
import pyray as rl
from enum import IntEnum
import cereal.messaging as messaging
from openpilot.system.ui.lib.application import gui_app
from openpilot.selfdrive.ui.layouts.sidebar import Sidebar, SIDEBAR_WIDTH
from openpilot.selfdrive.ui.layouts.home import HomeLayout
from openpilot.selfdrive.ui.layouts.settings.settings import SettingsLayout, PanelType
@@ -10,10 +9,6 @@ from openpilot.selfdrive.ui.ui_state import device, ui_state
from openpilot.system.ui.widgets import Widget
ONROAD_FPS = 20
OFFROAD_FPS = 60
class MainState(IntEnum):
HOME = 0
SETTINGS = 1
@@ -30,8 +25,6 @@ class MainLayout(Widget):
self._current_mode = MainState.HOME
self._prev_onroad = False
gui_app.set_target_fps(OFFROAD_FPS)
# Initialize layouts
self._layouts = {MainState.HOME: HomeLayout(), MainState.SETTINGS: SettingsLayout(), MainState.ONROAD: AugmentedRoadView()}
@@ -81,9 +74,6 @@ class MainLayout(Widget):
self._current_mode = layout
self._layouts[self._current_mode].show_event()
# No need to draw onroad faster than source (model at 20Hz) and prevents screen tearing
gui_app.set_target_fps(ONROAD_FPS if self._current_mode == MainState.ONROAD else OFFROAD_FPS)
def open_settings(self, panel_type: PanelType):
self._layouts[MainState.SETTINGS].set_current_panel(panel_type)
self._set_current_layout(MainState.SETTINGS)
+2 -3
View File
@@ -7,7 +7,7 @@ from openpilot.common.filter_simple import FirstOrderFilter
from openpilot.common.params import Params
from openpilot.selfdrive.locationd.calibrationd import HEIGHT_INIT
from openpilot.selfdrive.ui.ui_state import ui_state
from openpilot.system.ui.lib.application import gui_app
from openpilot.system.ui.lib.application import DEFAULT_FPS
from openpilot.system.ui.lib.shader_polygon import draw_polygon
from openpilot.system.ui.widgets import Widget
@@ -48,7 +48,7 @@ class ModelRenderer(Widget):
super().__init__()
self._longitudinal_control = False
self._experimental_mode = False
self._blend_filter = FirstOrderFilter(1.0, 0.25, 1 / gui_app.target_fps)
self._blend_filter = FirstOrderFilter(1.0, 0.25, 1 / DEFAULT_FPS)
self._prev_allow_throttle = True
self._lane_line_probs = np.zeros(4, dtype=np.float32)
self._road_edge_stds = np.zeros(2, dtype=np.float32)
@@ -277,7 +277,6 @@ class ModelRenderer(Widget):
return
allow_throttle = sm['longitudinalPlan'].allowThrottle or not self._longitudinal_control
self._blend_filter.update_dt(1 / gui_app.target_fps)
self._blend_filter.update(int(allow_throttle))
if self._experimental_mode:
+2 -2
View File
@@ -9,6 +9,7 @@ from openpilot.common.filter_simple import FirstOrderFilter
from openpilot.common.params import Params, UnknownKeyName
from openpilot.common.swaglog import cloudlog
from openpilot.selfdrive.ui.lib.prime_state import PrimeState
from openpilot.system.ui.lib.application import DEFAULT_FPS
from openpilot.system.hardware import HARDWARE
from openpilot.system.ui.lib.application import gui_app
@@ -152,7 +153,7 @@ class Device:
self._offroad_brightness: int = BACKLIGHT_OFFROAD
self._last_brightness: int = 0
self._brightness_filter = FirstOrderFilter(BACKLIGHT_OFFROAD, 10.00, 1 / gui_app.target_fps)
self._brightness_filter = FirstOrderFilter(BACKLIGHT_OFFROAD, 10.00, 1 / DEFAULT_FPS)
self._brightness_thread: threading.Thread | None = None
def reset_interactive_timeout(self, timeout: int = -1) -> None:
@@ -189,7 +190,6 @@ class Device:
clipped_brightness = float(np.clip(100 * clipped_brightness, 10, 100))
self._brightness_filter.update_dt(1 / gui_app.target_fps)
brightness = round(self._brightness_filter.update(clipped_brightness))
if not self._awake:
brightness = 0