September 27th, 2025 Update

This commit is contained in:
James
2025-09-27 12:00:00 -07:00
parent 73821d9482
commit a759abb082
1166 changed files with 228204 additions and 267090 deletions
+28 -41
View File
@@ -10,8 +10,8 @@ from cereal import messaging
from openpilot.common.realtime import DT_MDL, Priority, Ratekeeper, config_realtime_process
from openpilot.common.time import system_time_valid
from openpilot.frogpilot.assets.model_manager import ModelManager, MODEL_DOWNLOAD_ALL_PARAM, MODEL_DOWNLOAD_PARAM
from openpilot.frogpilot.assets.theme_manager import ThemeManager
from openpilot.frogpilot.assets.model_manager import MODEL_DOWNLOAD_ALL_PARAM, MODEL_DOWNLOAD_PARAM, ModelManager
from openpilot.frogpilot.assets.theme_manager import THEME_COMPONENT_PARAMS, ThemeManager
from openpilot.frogpilot.common.frogpilot_functions import backup_toggles
from openpilot.frogpilot.common.frogpilot_utilities import flash_panda, is_url_pingable, lock_doors, run_thread_with_lock, update_maps, update_openpilot
from openpilot.frogpilot.common.frogpilot_variables import ERROR_LOGS_PATH, FrogPilotVariables, get_frogpilot_toggles, params, params_cache, params_memory
@@ -21,9 +21,11 @@ from openpilot.frogpilot.system.frogpilot_stats import send_stats
ASSET_CHECK_RATE = (1 / DT_MDL)
def assets_checks(model_manager, theme_manager):
def assets_checks(model_manager, theme_manager, frogpilot_toggles):
if params_memory.get_bool(MODEL_DOWNLOAD_ALL_PARAM):
run_thread_with_lock("download_all_models", model_manager.download_all_models)
elif params_memory.get_bool("UpdateTinygrad"):
run_thread_with_lock("update_tinygrad", model_manager.update_tinygrad)
else:
model_to_download = params_memory.get(MODEL_DOWNLOAD_PARAM, encoding="utf-8")
if model_to_download:
@@ -34,24 +36,15 @@ def assets_checks(model_manager, theme_manager):
report_data = json.loads(params_memory.get("IssueReported", encoding="utf-8") or "{}")
if report_data:
sentry.capture_report(report_data["DiscordUser"], report_data["Issue"], vars(get_frogpilot_toggles()))
sentry.capture_report(report_data["DiscordUser"], report_data["Issue"], vars(frogpilot_toggles))
params_memory.remove("IssueReported")
assets = [
("ColorToDownload", "colors"),
("DistanceIconToDownload", "distance_icons"),
("IconToDownload", "icons"),
("SignalToDownload", "signals"),
("SoundToDownload", "sounds"),
("WheelToDownload", "steering_wheels")
]
for param, asset_type in assets:
asset_to_download = params_memory.get(param, encoding="utf-8")
for asset_type, asset_param in THEME_COMPONENT_PARAMS.items():
asset_to_download = params_memory.get(asset_param, encoding="utf-8")
if asset_to_download:
run_thread_with_lock("download_theme", theme_manager.download_theme, (asset_type, asset_to_download, param))
run_thread_with_lock("download_theme", theme_manager.download_theme, (asset_type, asset_to_download, asset_param, frogpilot_toggles))
def update_checks(manually_updated, model_manager, now, theme_manager, frogpilot_toggles, boot_run=False):
def update_checks(model_manager, now, theme_manager, frogpilot_toggles, boot_run=False):
while not (is_url_pingable("https://github.com") or is_url_pingable("https://gitlab.com")):
time.sleep(60)
@@ -60,7 +53,7 @@ def update_checks(manually_updated, model_manager, now, theme_manager, frogpilot
run_thread_with_lock("update_maps", update_maps, (now,))
if frogpilot_toggles.automatic_updates and not manually_updated:
if frogpilot_toggles.automatic_updates:
run_thread_with_lock("update_openpilot", update_openpilot)
time.sleep(1)
@@ -80,14 +73,14 @@ def frogpilot_thread():
model_manager = ModelManager()
theme_manager = ThemeManager()
toggles_last_updated = datetime.datetime.now()
toggles_last_updated = datetime.datetime.now(datetime.timezone.utc)
pm = messaging.PubMaster(["frogpilotPlan"])
sm = messaging.SubMaster(["carControl", "carState", "controlsState", "deviceState", "driverMonitoringState",
"liveLocationKalman", "liveParameters", "managerState", "modelV2",
"pandaStates", "radarState", "frogpilotCarState",
"frogpilotNavigation"],
poll="modelV2", ignore_avg_freq=["radarState"])
"liveLocationKalman", "liveParameters", "managerState", "modelV2", "onroadEvents",
"pandaStates", "radarState", "frogpilotCarState", "frogpilotControlsState",
"frogpilotModelV2", "frogpilotNavigation", "frogpilotOnroadEvents"],
poll="modelV2", ignore_avg_freq=["frogpilotRadarState"])
run_update_checks = False
started_previously = False
@@ -97,7 +90,7 @@ def frogpilot_thread():
while True:
sm.update()
now = datetime.datetime.now()
now = datetime.datetime.now(datetime.timezone.utc)
started = sm["deviceState"].started
@@ -116,32 +109,28 @@ def frogpilot_thread():
if time_validated and is_url_pingable(os.environ.get("STATS_URL", "")):
send_stats()
params_memory.put_bool("IsOnroad", False)
elif started and not started_previously:
frogpilot_planner = FrogPilotPlanner()
frogpilot_tracking = FrogPilotTracking()
if error_log.is_file():
error_log.unlink()
params_memory.put_bool("IsOnroad", True)
frogpilot_planner = FrogPilotPlanner(error_log, theme_manager)
frogpilot_tracking = FrogPilotTracking(frogpilot_planner, frogpilot_toggles)
if started and sm.updated["modelV2"]:
frogpilot_planner.update(sm, frogpilot_toggles)
frogpilot_planner.publish(sm, pm, theme_manager.theme_updated, toggles_updated)
frogpilot_planner.update(now, time_validated, sm, frogpilot_toggles)
frogpilot_planner.publish(theme_manager.theme_updated, toggles_updated, sm, pm, frogpilot_toggles)
frogpilot_tracking.update(sm)
elif not started and toggles_updated:
frogpilot_tracking.update(now, time_validated, sm, frogpilot_toggles)
elif not started:
frogpilot_plan_send = messaging.new_message("frogpilotPlan")
frogpilot_plan_send.frogpilotPlan.themeUpdated = theme_manager.theme_updated
frogpilot_plan_send.frogpilotPlan.themeUpdated = theme_manager.theme_updated or params_memory.get_bool("UseActiveTheme")
frogpilot_plan_send.frogpilotPlan.togglesUpdated = toggles_updated
pm.send("frogpilotPlan", frogpilot_plan_send)
started_previously = started
if rate_keeper.frame % ASSET_CHECK_RATE == 0:
assets_checks(model_manager, theme_manager)
assets_checks(model_manager, theme_manager, frogpilot_toggles)
if params_memory.get_bool("FrogPilotTogglesUpdated") or theme_manager.theme_updated:
previous_holiday_themes = frogpilot_toggles.holiday_themes
@@ -163,15 +152,13 @@ def frogpilot_thread():
toggles_updated = (now - toggles_last_updated).total_seconds() <= 1
manually_updated = params_memory.get_bool("ManualUpdateInitiated")
run_update_checks |= manually_updated
run_update_checks |= params_memory.get_bool("ManualUpdateInitiated")
run_update_checks |= now.second == 0 and (now.minute % 60 == 0 or (now.minute % 5 == 0 and frogpilot_toggles.frogs_go_moo))
run_update_checks &= time_validated
if run_update_checks:
theme_manager.update_active_theme(time_validated, frogpilot_toggles)
run_thread_with_lock("update_checks", update_checks, (manually_updated, model_manager, now, theme_manager, frogpilot_toggles))
run_thread_with_lock("update_checks", update_checks, (model_manager, now, theme_manager, frogpilot_toggles))
run_update_checks = False
elif not time_validated:
@@ -180,7 +167,7 @@ def frogpilot_thread():
continue
theme_manager.update_active_theme(time_validated, frogpilot_toggles)
run_thread_with_lock("update_checks", update_checks, (manually_updated, model_manager, now, theme_manager, frogpilot_toggles, True))
run_thread_with_lock("update_checks", update_checks, (model_manager, now, theme_manager, frogpilot_toggles, True))
rate_keeper.keep_time()