mici training guide tuneups (#36652)

* bump up size

* lil more

* rm param

* 5m timeout and 100% brightness

* set parasm:
This commit is contained in:
Adeeb Shihadeh
2025-11-19 15:03:28 -08:00
committed by GitHub
parent 3a001dd71c
commit f0d8ebd851
8 changed files with 48 additions and 34 deletions

View File

@@ -113,8 +113,6 @@ inline static std::unordered_map<std::string, ParamKeyAttributes> keys = {
{"RouteCount", {PERSISTENT, INT, "0"}},
{"SnoozeUpdate", {CLEAR_ON_MANAGER_START | CLEAR_ON_OFFROAD_TRANSITION, BOOL}},
{"SshEnabled", {PERSISTENT, BOOL}},
{"TermsVersion", {PERSISTENT, STRING}},
{"TrainingVersion", {PERSISTENT, STRING}},
{"UbloxAvailable", {PERSISTENT, BOOL}},
{"UpdateAvailable", {CLEAR_ON_MANAGER_START | CLEAR_ON_ONROAD_TRANSITION, BOOL}},
{"UpdateFailedCount", {CLEAR_ON_MANAGER_START, INT}},

View File

@@ -11,6 +11,7 @@ from openpilot.system.ui.widgets import Widget
from openpilot.system.ui.widgets.button import Button, ButtonStyle
from openpilot.system.ui.widgets.label import Label
from openpilot.selfdrive.ui.ui_state import ui_state
from openpilot.system.version import terms_version, training_version
DEBUG = False
@@ -169,10 +170,8 @@ class DeclinePage(Widget):
class OnboardingWindow(Widget):
def __init__(self):
super().__init__()
self._current_terms_version = ui_state.params.get("TermsVersion")
self._current_training_version = ui_state.params.get("TrainingVersion")
self._accepted_terms: bool = ui_state.params.get("HasAcceptedTerms") == self._current_terms_version
self._training_done: bool = ui_state.params.get("CompletedTrainingVersion") == self._current_training_version
self._accepted_terms: bool = ui_state.params.get("HasAcceptedTerms") == terms_version
self._training_done: bool = ui_state.params.get("CompletedTrainingVersion") == training_version
self._state = OnboardingState.TERMS if not self._accepted_terms else OnboardingState.ONBOARDING
@@ -192,13 +191,13 @@ class OnboardingWindow(Widget):
self._state = OnboardingState.TERMS
def _on_terms_accepted(self):
ui_state.params.put("HasAcceptedTerms", self._current_terms_version)
ui_state.params.put("HasAcceptedTerms", terms_version)
self._state = OnboardingState.ONBOARDING
if self._training_done:
gui_app.set_modal_overlay(None)
def _on_completed_training(self):
ui_state.params.put("CompletedTrainingVersion", self._current_training_version)
ui_state.params.put("CompletedTrainingVersion", training_version)
gui_app.set_modal_overlay(None)
def _render(self, _):

View File

@@ -15,6 +15,7 @@ from openpilot.selfdrive.ui.mici.onroad.driver_state import DriverStateRenderer
from openpilot.selfdrive.ui.mici.onroad.driver_camera_dialog import DriverCameraDialog
from openpilot.system.ui.widgets.label import gui_label
from openpilot.system.ui.lib.multilang import tr
from openpilot.system.version import terms_version, training_version
class OnboardingState(IntEnum):
@@ -60,7 +61,7 @@ class TrainingGuideIntro(SetupTermsPage):
self._title_header = TermsHeader("welcome to openpilot", gui_app.texture("icons_mici/offroad_alerts/green_wheel.png", 60, 60))
self._dm_label = UnifiedLabel("Before we get on the road, let's review the " +
"functionality and limitations of openpilot.", 36,
"functionality and limitations of openpilot.", 42,
FontWeight.ROMAN)
@property
@@ -90,7 +91,7 @@ class TrainingGuidePreDMTutorial(SetupTermsPage):
self._dm_label = UnifiedLabel("Next, we'll ensure comma four is mounted properly.\n\nIf it does not have a clear view of the driver, " +
"simply unplug and remount before continuing.\n\n" +
"NOTE: the driver camera will have a purple tint due to the IR illumination used for seeing at night.", 36,
"NOTE: the driver camera will have a purple tint due to the IR illumination used for seeing at night.", 42,
FontWeight.ROMAN)
def show_event(self):
@@ -123,7 +124,14 @@ class TrainingGuideDMTutorial(Widget):
super().__init__()
self._title_header = TermsHeader("fill the circle to continue", gui_app.texture("icons_mici/setup/green_dm.png", 60, 60))
self._dialog = DriverCameraSetupDialog(continue_callback)
self._original_continue_callback = continue_callback
# Wrap the continue callback to restore settings
def wrapped_continue_callback():
self._restore_settings()
continue_callback()
self._dialog = DriverCameraSetupDialog(wrapped_continue_callback)
# Disable driver monitoring model when device times out for inactivity
def inactivity_callback():
@@ -135,6 +143,13 @@ class TrainingGuideDMTutorial(Widget):
super().show_event()
self._dialog.show_event()
device.set_offroad_brightness(100)
device.reset_interactive_timeout(300) # 5 minutes
def _restore_settings(self):
device.set_offroad_brightness(None)
device.reset_interactive_timeout()
def _update_state(self):
super()._update_state()
if device.awake:
@@ -168,7 +183,7 @@ class TrainingGuideRecordFront(SetupTermsPage):
self._title_header = TermsHeader("improve driver monitoring", gui_app.texture("icons_mici/setup/green_dm.png", 60, 60))
self._dm_label = UnifiedLabel("Help improve driver monitoring by including your driving data in the training data set. " +
"Your preference can be changed at any time in Settings. Would you like to share your data?", 36,
"Your preference can be changed at any time in Settings. Would you like to share your data?", 42,
FontWeight.ROMAN)
def show_event(self):
@@ -200,7 +215,7 @@ class TrainingGuideAttentionNotice1(SetupTermsPage):
def __init__(self, continue_callback):
super().__init__(continue_callback, continue_text="continue")
self._title_header = TermsHeader("not a self driving car", gui_app.texture("icons_mici/setup/warning.png", 60, 60))
self._warning_label = UnifiedLabel("THIS IS A DRIVER ASSISTANCE SYSTEM. A DRIVER ASSISTANCE SYSTEM IS NOT A SELF DRIVING CAR.", 36,
self._warning_label = UnifiedLabel("THIS IS A DRIVER ASSISTANCE SYSTEM. A DRIVER ASSISTANCE SYSTEM IS NOT A SELF-DRIVING CAR.", 42,
FontWeight.ROMAN)
@property
@@ -227,7 +242,8 @@ class TrainingGuideAttentionNotice2(SetupTermsPage):
def __init__(self, continue_callback):
super().__init__(continue_callback, continue_text="continue")
self._title_header = TermsHeader("attention is required", gui_app.texture("icons_mici/setup/warning.png", 60, 60))
self._warning_label = UnifiedLabel("YOU MUST PAY ATTENTION AT ALL TIMES. YOU ARE FULLY RESPONSIBLE FOR DRIVING THE CAR.", 36,
self._warning_label = UnifiedLabel("1. You must pay attention at all times.\n\n2. You must be ready to take over at any time."+
"\n\n3. You are fully responsible for driving the car.", 42,
FontWeight.ROMAN)
@property
@@ -255,7 +271,7 @@ class TrainingGuideDisengaging(SetupTermsPage):
super().__init__(continue_callback, continue_text="continue")
self._title_header = TermsHeader("disengaging openpilot", gui_app.texture("icons_mici/setup/green_pedal.png", 60, 60))
self._warning_label = UnifiedLabel("You can disengage openpilot by either pressing the brake pedal or " +
"the cancel button on your steering wheel.", 36,
"the cancel button on your steering wheel.", 42,
FontWeight.ROMAN)
@property
@@ -288,7 +304,7 @@ class TrainingGuideConfidenceBall(SetupTermsPage):
self._title_header = TermsHeader("confidence ball", gui_app.texture("icons_mici/setup/green_car.png", 60, 60))
self._warning_label = UnifiedLabel("The ball on the right communicates how confident openpilot " +
"is about the road scene at any given time.", 36,
"is about the road scene at any given time.", 42,
FontWeight.ROMAN)
def show_event(self):
@@ -343,7 +359,7 @@ class TrainingGuideSteeringArc(SetupTermsPage):
self._title_header = TermsHeader("steering arc", gui_app.texture("icons_mici/offroad_alerts/green_wheel.png", 60, 60))
self._warning_label = UnifiedLabel("All cars limit the amount of steering that openpilot is able to apply. While driving, the " +
"steering arc shows the current amount of force being applied in relation to the maximum available to openpilot. " +
"You may need to assist if you see the arc nearing its orange state.", 36,
"You may need to assist if you see the arc nearing its orange state.", 42,
FontWeight.ROMAN)
def show_event(self):
@@ -506,10 +522,8 @@ class TermsPage(SetupTermsPage):
class OnboardingWindow(Widget):
def __init__(self):
super().__init__()
self._current_terms_version = ui_state.params.get("TermsVersion")
self._current_training_version = ui_state.params.get("TrainingVersion")
self._accepted_terms: bool = ui_state.params.get("HasAcceptedTerms") == self._current_terms_version
self._training_done: bool = ui_state.params.get("CompletedTrainingVersion") == self._current_training_version
self._accepted_terms: bool = ui_state.params.get("HasAcceptedTerms") == terms_version
self._training_done: bool = ui_state.params.get("CompletedTrainingVersion") == training_version
self._state = OnboardingState.TERMS if not self._accepted_terms else OnboardingState.ONBOARDING
@@ -535,11 +549,11 @@ class OnboardingWindow(Widget):
gui_app.set_modal_overlay(None)
def _on_terms_accepted(self):
ui_state.params.put("HasAcceptedTerms", self._current_terms_version)
ui_state.params.put("HasAcceptedTerms", terms_version)
self._state = OnboardingState.ONBOARDING
def _on_completed_training(self):
ui_state.params.put("CompletedTrainingVersion", self._current_training_version)
ui_state.params.put("CompletedTrainingVersion", training_version)
self.close()
def _render(self, _):

View File

@@ -18,6 +18,7 @@ from openpilot.common.prefix import OpenpilotPrefix
from openpilot.selfdrive.test.helpers import with_processes
from openpilot.selfdrive.selfdrived.alertmanager import set_offroad_alert
from openpilot.system.updated.updated import parse_release_notes
from openpilot.system.version import terms_version, training_version
AlertSize = log.SelfdriveState.AlertSize
AlertStatus = log.SelfdriveState.AlertStatus
@@ -298,6 +299,10 @@ def create_screenshots():
params.put("UpdaterCurrentDescription", VERSION)
params.put("UpdaterNewDescription", VERSION)
# Set terms and training version (to skip onboarding)
params.put("HasAcceptedTerms", terms_version)
params.put("CompletedTrainingVersion", training_version)
if name == "homescreen_paired":
params.put("PrimeType", 0) # NONE
elif name == "homescreen_prime":

View File

@@ -217,8 +217,9 @@ class Device:
self._update_brightness()
self._update_wakefulness()
def set_offroad_brightness(self, brightness: int):
# TODO: not yet used, should be used in prime widget for QR code, etc.
def set_offroad_brightness(self, brightness: int | None):
if brightness is None:
brightness = BACKLIGHT_OFFROAD
self._offroad_brightness = min(max(brightness, 0), 100)
def _update_brightness(self):

View File

@@ -17,7 +17,7 @@ from openpilot.system.manager.process import ensure_running
from openpilot.system.manager.process_config import managed_processes
from openpilot.system.athena.registration import register, UNREGISTERED_DONGLE_ID
from openpilot.common.swaglog import cloudlog, add_file_handler
from openpilot.system.version import get_build_metadata, terms_version, training_version
from openpilot.system.version import get_build_metadata
from openpilot.system.hardware.hw import Paths
@@ -54,8 +54,6 @@ def manager_init() -> None:
# set params
serial = HARDWARE.get_serial()
params.put("Version", build_metadata.openpilot.version)
params.put("TermsVersion", terms_version)
params.put("TrainingVersion", training_version)
params.put("GitCommit", build_metadata.openpilot.git_commit)
params.put("GitCommitDate", build_metadata.openpilot.git_commit_date)
params.put("GitBranch", build_metadata.channel)

View File

@@ -18,6 +18,7 @@ from openpilot.common.utils import run_cmd
from openpilot.system.hardware import HARDWARE
from openpilot.system.ui.lib.application import gui_app, FontWeight
from openpilot.system.ui.lib.wifi_manager import WifiManager
from openpilot.selfdrive.ui.ui_state import device
from openpilot.system.ui.lib.scroll_panel2 import GuiScrollPanel2
from openpilot.system.ui.widgets import Widget, DialogResult
from openpilot.system.ui.widgets.button import (IconButton, SmallButton, WideRoundedButton, SmallerRoundedButton,
@@ -225,6 +226,10 @@ class TermsPage(Widget):
self._back_button.set_opacity(0.0)
self._scroll_down_indicator.set_opacity(1.0)
def show_event(self):
super().show_event()
device.reset_interactive_timeout(300)
@property
@abstractmethod
def _content_height(self):

View File

@@ -157,10 +157,4 @@ def get_build_metadata(path: str = BASEDIR) -> BuildMetadata:
if __name__ == "__main__":
from openpilot.common.params import Params
params = Params()
params.put("TermsVersion", terms_version)
params.put("TrainingVersion", training_version)
print(get_build_metadata())