Model switcher
Added model selector to swap between several different models on the fly.
This commit is contained in:
@@ -12,6 +12,7 @@ from typing import List, Tuple, Union
|
||||
from cereal import log
|
||||
import cereal.messaging as messaging
|
||||
import openpilot.selfdrive.sentry as sentry
|
||||
from openpilot.common.basedir import BASEDIR
|
||||
from openpilot.common.params import Params, ParamKeyType
|
||||
from openpilot.common.text_window import TextWindow
|
||||
from openpilot.system.hardware import HARDWARE, PC
|
||||
@@ -24,6 +25,7 @@ from openpilot.system.version import is_dirty, get_commit, get_version, get_orig
|
||||
get_normalized_origin, terms_version, training_version, \
|
||||
is_tested_branch, is_release_branch, get_commit_date
|
||||
|
||||
from openpilot.selfdrive.frogpilot.functions.frogpilot_functions import DEFAULT_MODEL
|
||||
|
||||
|
||||
def manager_init() -> None:
|
||||
@@ -62,6 +64,16 @@ def manager_init() -> None:
|
||||
|
||||
#######################################################################
|
||||
|
||||
# Check if the currently selected model still exists
|
||||
current_model = params.get("Model", encoding='utf-8')
|
||||
|
||||
if current_model != DEFAULT_MODEL:
|
||||
models_folder = os.path.join(BASEDIR, 'selfdrive/modeld/models/models')
|
||||
model_exists = current_model in [os.path.splitext(file)[0] for file in os.listdir(models_folder)]
|
||||
|
||||
if not model_exists:
|
||||
params.remove("Model")
|
||||
|
||||
default_params: List[Tuple[str, Union[str, bytes]]] = [
|
||||
("CompletedTrainingVersion", "0"),
|
||||
("DisengageOnAccelerator", "0"),
|
||||
|
||||
Reference in New Issue
Block a user