From 07b6ac141f45c8e16d01e9212ad6736369a1fe7a Mon Sep 17 00:00:00 2001 From: FrogAi <91348155+FrogAi@users.noreply.github.com> Date: Sun, 3 Nov 2024 13:28:29 -0700 Subject: [PATCH] November 10th, 2024 Patch --- README.md | 2 +- selfdrive/car/card.py | 17 +- selfdrive/controls/controlsd.py | 6 +- selfdrive/controls/lib/desire_helper.py | 2 +- selfdrive/controls/lib/drive_helpers.py | 1 - selfdrive/controls/lib/latcontrol_torque.py | 1 + selfdrive/controls/lib/longcontrol.py | 2 +- selfdrive/controls/plannerd.py | 2 +- selfdrive/frogpilot/assets/model_manager.py | 6 +- selfdrive/frogpilot/frogpilot_functions.py | 10 +- selfdrive/frogpilot/frogpilot_utilities.py | 23 +- selfdrive/frogpilot/frogpilot_variables.py | 745 ++++++++++---------- selfdrive/locationd/torqued.py | 10 +- selfdrive/navd/navd.py | 8 +- system/loggerd/uploader.py | 14 +- system/manager/manager.py | 10 +- system/manager/process_config.py | 3 +- system/sentry.py | 3 +- system/updated/updated.py | 2 +- 19 files changed, 436 insertions(+), 431 deletions(-) diff --git a/README.md b/README.md index 596db65b15a94f..bdd695bd3c2a3b 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,7 @@ FrogPilot is a fully open-sourced fork of openpilot, featuring clear and concise ------ FrogPilot was last updated on: -**November 1st, 2024** +**November 10th, 2024** Features ------ diff --git a/selfdrive/car/card.py b/selfdrive/car/card.py index 1369007eb6bd82..d66165474a1514 100755 --- a/selfdrive/car/card.py +++ b/selfdrive/car/card.py @@ -49,11 +49,17 @@ def __init__(self, CI=None): num_pandas = len(messaging.recv_one_retry(self.sm.sock['pandaStates']).pandaStates) disable_openpilot_long = self.params.get_bool("DisableOpenpilotLongitudinal") - experimental_long_allowed = not disable_openpilot_long and self.params.get_bool("ExperimentalLongitudinalEnabled") + experimental_long_allowed = self.params.get_bool("ExperimentalLongitudinalEnabled") self.CI, self.CP = get_car(self.can_sock, self.pm.sock['sendcan'], disable_openpilot_long, experimental_long_allowed, self.params, num_pandas) else: self.CI, self.CP = CI, CI.CP + # set alternative experiences from parameters + self.disengage_on_accelerator = self.params.get_bool("DisengageOnAccelerator") + self.CP.alternativeExperience = 0 + if not self.disengage_on_accelerator: + self.CP.alternativeExperience |= ALTERNATIVE_EXPERIENCE.DISABLE_DISENGAGE_ON_GAS + openpilot_enabled_toggle = self.params.get_bool("OpenpilotEnabledToggle") controller_available = self.CI.CC is not None and openpilot_enabled_toggle and not self.CP.dashcamOnly @@ -77,16 +83,11 @@ def __init__(self, CI=None): # FrogPilot variables self.frogpilot_toggles = get_frogpilot_toggles(True) - # set alternative experiences from parameters - self.disengage_on_accelerator = self.params.get_bool("DisengageOnAccelerator") - self.CP.alternativeExperience = 0 - if not self.disengage_on_accelerator: - self.CP.alternativeExperience |= ALTERNATIVE_EXPERIENCE.DISABLE_DISENGAGE_ON_GAS - if self.params.get_bool("AlwaysOnLateral"): self.CP.alternativeExperience |= ALTERNATIVE_EXPERIENCE.ALWAYS_ON_LATERAL + self.CP.alternativeExperience |= ALTERNATIVE_EXPERIENCE.DISABLE_DISENGAGE_ON_GAS - if self.params.get_int("AccelerationProfile") == 3: + if self.frogpilot_toggles.acceleration_profile == 3: self.CP.alternativeExperience |= ALTERNATIVE_EXPERIENCE.RAISE_LONGITUDINAL_LIMITS_TO_ISO_MAX # Write CarParams for controls and radard diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index 46253e45f1726b..4b803b6bdeaa9f 100644 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -32,7 +32,7 @@ from openpilot.system.hardware import HARDWARE from openpilot.selfdrive.frogpilot.controls.lib.frogpilot_acceleration import get_max_allowed_accel -from openpilot.selfdrive.frogpilot.frogpilot_variables import CRUISING_SPEED, NON_DRIVING_GEARS, get_frogpilot_toggles +from openpilot.selfdrive.frogpilot.frogpilot_variables import NON_DRIVING_GEARS, get_frogpilot_toggles SOFT_DISABLE_TIME = 3 # seconds LDW_MIN_SPEED = 31 * CV.MPH_TO_MS @@ -569,7 +569,7 @@ def state_control(self, CS): # Update VehicleModel lp = self.sm['liveParameters'] x = max(lp.stiffnessFactor, 0.1) - sr = max(self.frogpilot_toggles.steer_ratio, 0.1) if self.frogpilot_toggles.use_custom_steer_ratio else max(lp.steerRatio, 0.1) + sr = max(self.frogpilot_toggles.steer_ratio if self.frogpilot_toggles.use_custom_steer_ratio else lp.steerRatio, 0.1) self.VM.update_params(x, sr) # Update Torque Params @@ -624,7 +624,7 @@ def state_control(self, CS): t_since_plan = (self.sm.frame - self.sm.recv_frame['longitudinalPlan']) * DT_CTRL actuators.accel = self.LoC.update_old_long(CC.longActive, CS, long_plan, pid_accel_limits, t_since_plan) else: - actuators.accel = self.LoC.update(CC.longActive, CS, long_plan.aTarget, long_plan.shouldStop or self.sm['frogpilotPlan'].forcingStopLength <= 0, pid_accel_limits) + actuators.accel = self.LoC.update(CC.longActive, CS, long_plan.aTarget, long_plan.shouldStop or self.sm['frogpilotPlan'].forcingStopLength == 0, pid_accel_limits) if len(long_plan.speeds): actuators.speed = long_plan.speeds[-1] diff --git a/selfdrive/controls/lib/desire_helper.py b/selfdrive/controls/lib/desire_helper.py index 0f3afa95ec64c8..0a669e85ebb985 100644 --- a/selfdrive/controls/lib/desire_helper.py +++ b/selfdrive/controls/lib/desire_helper.py @@ -49,7 +49,7 @@ def __init__(self): # FrogPilot variables self.lane_change_completed = False - self.lane_change_wait_timer = 0.0 + self.lane_change_wait_timer = 0 self.turn_direction = TurnDirection.none diff --git a/selfdrive/controls/lib/drive_helpers.py b/selfdrive/controls/lib/drive_helpers.py index 7fcf99a16e01b1..d39bd5d6c8f044 100644 --- a/selfdrive/controls/lib/drive_helpers.py +++ b/selfdrive/controls/lib/drive_helpers.py @@ -3,7 +3,6 @@ from cereal import car, log from openpilot.common.conversions import Conversions as CV from openpilot.common.numpy_fast import clip, interp -from openpilot.common.params import Params from openpilot.common.realtime import DT_CTRL # WARNING: this value was determined based on the model's training distribution, diff --git a/selfdrive/controls/lib/latcontrol_torque.py b/selfdrive/controls/lib/latcontrol_torque.py index 315dc2bf7cc4d9..096a8dcd584645 100644 --- a/selfdrive/controls/lib/latcontrol_torque.py +++ b/selfdrive/controls/lib/latcontrol_torque.py @@ -1,4 +1,5 @@ from collections import deque + import math import numpy as np diff --git a/selfdrive/controls/lib/longcontrol.py b/selfdrive/controls/lib/longcontrol.py index 7e4a780263c449..dc1d9267af6532 100644 --- a/selfdrive/controls/lib/longcontrol.py +++ b/selfdrive/controls/lib/longcontrol.py @@ -89,7 +89,7 @@ def long_control_state_trans_old_long(CP, active, long_control_state, v_ego, v_t class LongControl: def __init__(self, CP): self.CP = CP - self.long_control_state = LongCtrlState.off # initialized to off + self.long_control_state = LongCtrlState.off self.pid = PIDController((CP.longitudinalTuning.kpBP, CP.longitudinalTuning.kpV), (CP.longitudinalTuning.kiBP, CP.longitudinalTuning.kiV), k_f=CP.longitudinalTuning.kf, rate=1 / DT_CTRL) diff --git a/selfdrive/controls/plannerd.py b/selfdrive/controls/plannerd.py index 3c8f51ab253eb0..4d306d4762b85f 100644 --- a/selfdrive/controls/plannerd.py +++ b/selfdrive/controls/plannerd.py @@ -31,7 +31,7 @@ def plannerd_thread(): longitudinal_planner = LongitudinalPlanner(CP) pm = messaging.PubMaster(['longitudinalPlan', 'uiPlan']) sm = messaging.SubMaster(['carControl', 'carState', 'controlsState', 'liveParameters', 'radarState', 'modelV2', - 'frogpilotCarControl', 'frogpilotCarState', 'frogpilotPlan'], + 'frogpilotCarState', 'frogpilotPlan'], poll='modelV2', ignore_avg_freq=['radarState']) # FrogPilot variables diff --git a/selfdrive/frogpilot/assets/model_manager.py b/selfdrive/frogpilot/assets/model_manager.py index aad46c2e5f0de4..d85b1fa3373363 100644 --- a/selfdrive/frogpilot/assets/model_manager.py +++ b/selfdrive/frogpilot/assets/model_manager.py @@ -54,7 +54,7 @@ def fetch_all_model_sizes(repo_url): elif "gitlab" in repo_url: api_url = f"https://gitlab.com/api/v4/projects/{urllib.parse.quote_plus(project_path)}/repository/tree?ref={branch}" else: - raise ValueError(f"Unsupported repository URL format: {repo_url}. Supported formats are GitHub and GitLab URLs.") + return {} try: response = requests.get(api_url) @@ -72,8 +72,8 @@ def fetch_all_model_sizes(repo_url): return model_sizes else: return {file['name'].replace('.thneed', ''): file['size'] for file in thneed_files if 'size' in file} - - except: + except Exception as e: + raise ConnectionError(f"Failed to fetch model sizes from {'GitHub' if 'github' in repo_url else 'GitLab'}: {e}") return {} @staticmethod diff --git a/selfdrive/frogpilot/frogpilot_functions.py b/selfdrive/frogpilot/frogpilot_functions.py index fae07c24cf97cd..1e1baac4a7d6f9 100644 --- a/selfdrive/frogpilot/frogpilot_functions.py +++ b/selfdrive/frogpilot/frogpilot_functions.py @@ -198,8 +198,7 @@ def frogpilot_boot_functions(build_metadata, params, params_storage): def setup_frogpilot(build_metadata, params): remount_persist = ["sudo", "mount", "-o", "remount,rw", "/persist"] - if not run_cmd(remount_persist, "Successfully remounted /persist as read-write.", "Failed to remount /persist."): - HARDWARE.reboot() + run_cmd(remount_persist, "Successfully remounted /persist as read-write.", "Failed to remount /persist.") os.makedirs("/persist/params", exist_ok=True) os.makedirs(MODELS_PATH, exist_ok=True) @@ -248,14 +247,14 @@ def setup_frogpilot(build_metadata, params): copy_if_exists(frog_steering_wheel_source, frog_steering_wheel_destination, single_file_name="frog.png") remount_root = ["sudo", "mount", "-o", "remount,rw", "/"] - if not run_cmd(remount_root, "File system remounted as read-write.", "Failed to remount file system."): - HARDWARE.reboot() + run_cmd(remount_root, "File system remounted as read-write.", "Failed to remount file system.") boot_logo_location = "/usr/comma/bg.jpg" boot_logo_save_location = os.path.join(BASEDIR, "selfdrive", "frogpilot", "assets", "other_images", "original_bg.jpg") frogpilot_boot_logo = os.path.join(BASEDIR, "selfdrive", "frogpilot", "assets", "other_images", "frogpilot_boot_logo.png") if not filecmp.cmp(frogpilot_boot_logo, boot_logo_location, shallow=False): + run_cmd(["sudo", "cp", boot_logo_location, boot_logo_save_location], "Successfully backed up original bg.jpg.", "Failed to back up original boot logo.") run_cmd(["sudo", "cp", frogpilot_boot_logo, boot_logo_location], "Successfully replaced bg.jpg with frogpilot_boot_logo.png.", "Failed to replace boot logo.") if build_metadata.channel == "FrogPilot-Development": @@ -267,7 +266,6 @@ def uninstall_frogpilot(): boot_logo_restore_location = os.path.join(BASEDIR, "selfdrive", "frogpilot", "assets", "other_images", "original_bg.jpg") copy_cmd = ["sudo", "cp", boot_logo_restore_location, boot_logo_location] - if not run_cmd(copy_cmd, "Successfully restored the original boot logo.", "Failed to restore the original boot logo."): - HARDWARE.reboot() + run_cmd(copy_cmd, "Successfully restored the original boot logo.", "Failed to restore the original boot logo.") HARDWARE.uninstall() diff --git a/selfdrive/frogpilot/frogpilot_utilities.py b/selfdrive/frogpilot/frogpilot_utilities.py index 4f666d3099f574..92797bc2009e42 100644 --- a/selfdrive/frogpilot/frogpilot_utilities.py +++ b/selfdrive/frogpilot/frogpilot_utilities.py @@ -37,7 +37,7 @@ def calculate_road_curvature(modelData, v_ego): orientation_rate = np.abs(modelData.orientationRate.z) velocity = modelData.velocity.x max_pred_lat_acc = np.amax(orientation_rate * velocity) - return max_pred_lat_acc / v_ego**2 + return max_pred_lat_acc / max(v_ego, 1)**2 def copy_if_exists(source, destination, single_file_name=None): if not os.path.exists(source): @@ -71,18 +71,15 @@ def is_url_pingable(url, timeout=5): print(f"Failed to ping {url}: {e}") return False -def run_cmd(cmd, success_message, fail_message, retries=5, delay=1): - for attempt in range(retries): - try: - subprocess.check_call(cmd) - print(success_message) - return True - except Exception as e: - print(f"Unexpected error occurred (attempt {attempt + 1} of {retries}): {e}") - time.sleep(delay) - - print(fail_message) - return False +def run_cmd(cmd, success_message, fail_message): + try: + subprocess.check_call(cmd) + print(success_message) + return True + except Exception as e: + print(f"Unexpected error occurred: {e}") + print(fail_message) + return False class MovingAverageCalculator: def __init__(self): diff --git a/selfdrive/frogpilot/frogpilot_variables.py b/selfdrive/frogpilot/frogpilot_variables.py index 36cb5b5c25c692..18110d4f6467e0 100644 --- a/selfdrive/frogpilot/frogpilot_variables.py +++ b/selfdrive/frogpilot/frogpilot_variables.py @@ -547,7 +547,8 @@ def update(self, started): toggle.increase_thermal_limits = toggle.device_management and self.params.get_bool("IncreaseThermalLimits") toggle.low_voltage_shutdown = clip(self.params.get_float("LowVoltageShutdown"), VBATT_PAUSE_CHARGING, 12.5) if toggle.device_management else VBATT_PAUSE_CHARGING toggle.no_logging = toggle.device_management and self.params.get_bool("NoLogging") - toggle.no_uploads = toggle.device_management and self.params.get_bool("NoUploads") and not self.params.get_bool("DisableOnroadUploads") + toggle.no_uploads = toggle.device_management and self.params.get_bool("NoUploads") + toggle.no_onroad_uploads = toggle.no_uploads and self.params.get_bool("DisableOnroadUploads") toggle.offline_mode = toggle.device_management and self.params.get_bool("OfflineMode") toggle.experimental_gm_tune = openpilot_longitudinal and car_make == "gm" and self.params.get_bool("ExperimentalGMTune") @@ -563,7 +564,7 @@ def update(self, started): toggle.lane_change_delay = self.params.get_float("LaneChangeTime") if toggle.lane_change_customizations else 0 toggle.lane_detection_width = self.params.get_float("LaneDetectionWidth") * distance_conversion if toggle.lane_change_customizations else 0 toggle.lane_detection = toggle.lane_detection_width != 0 - toggle.minimum_lane_change_speed = self.params.get_int("MinimumLaneChangeSpeed") * speed_conversion if toggle.lane_change_customizations else LANE_CHANGE_SPEED_MIN + toggle.minimum_lane_change_speed = self.params.get_float("MinimumLaneChangeSpeed") * speed_conversion if toggle.lane_change_customizations else LANE_CHANGE_SPEED_MIN toggle.nudgeless = toggle.lane_change_customizations and self.params.get_bool("NudgelessLaneChange") toggle.one_lane_change = toggle.lane_change_customizations and self.params.get_bool("OneLaneChange") @@ -714,448 +715,448 @@ def update(self, started): toggle.volt_sng = car_model == "CHEVROLET_VOLT" and self.params.get_bool("VoltSNG") - customization_level = 2 #self.params.get_int("CustomizationLevel") if self.params.get_bool("CustomizationLevelConfirmed") else 2 + customization_level = self.params.get_int("CustomizationLevel") if self.params.get_bool("CustomizationLevelConfirmed") else 2 if customization_level == 0: - toggle.advanced_custom_onroad_ui = self.default_frogpilot_toggles.AdvancedCustomUI - toggle.hide_lead_marker = toggle.advanced_custom_onroad_ui and self.default_frogpilot_toggles.HideLeadMarker - toggle.hide_speed = toggle.advanced_custom_onroad_ui and self.default_frogpilot_toggles.HideSpeed - toggle.hide_map_icon = toggle.advanced_custom_onroad_ui and self.default_frogpilot_toggles.HideMapIcon - toggle.hide_max_speed = toggle.advanced_custom_onroad_ui and self.default_frogpilot_toggles.HideMaxSpeed - toggle.hide_alerts = toggle.advanced_custom_onroad_ui and self.default_frogpilot_toggles.HideAlerts - toggle.use_wheel_speed = toggle.advanced_custom_onroad_ui and self.default_frogpilot_toggles.WheelSpeed - - toggle.advanced_lateral_tuning = self.default_frogpilot_toggles.AdvancedLateralTune + toggle.advanced_custom_onroad_ui = bool(self.default_frogpilot_toggles.AdvancedCustomUI) + toggle.hide_lead_marker = bool(toggle.advanced_custom_onroad_ui and self.default_frogpilot_toggles.HideLeadMarker) + toggle.hide_speed = bool(toggle.advanced_custom_onroad_ui and self.default_frogpilot_toggles.HideSpeed) + toggle.hide_map_icon = bool(toggle.advanced_custom_onroad_ui and self.default_frogpilot_toggles.HideMapIcon) + toggle.hide_max_speed = bool(toggle.advanced_custom_onroad_ui and self.default_frogpilot_toggles.HideMaxSpeed) + toggle.hide_alerts = bool(toggle.advanced_custom_onroad_ui and self.default_frogpilot_toggles.HideAlerts) + toggle.use_wheel_speed = bool(toggle.advanced_custom_onroad_ui and self.default_frogpilot_toggles.WheelSpeed) + + toggle.advanced_lateral_tuning = bool(self.default_frogpilot_toggles.AdvancedLateralTune) toggle.use_custom_steer_friction = False toggle.use_custom_kp = False toggle.use_custom_lat_accel_factor = False toggle.use_custom_steer_ratio = False - toggle.force_auto_tune = toggle.advanced_lateral_tuning and not has_auto_tune and not is_pid_car and self.default_frogpilot_toggles.ForceAutoTune - toggle.force_auto_tune_off = toggle.advanced_lateral_tuning and has_auto_tune and not is_pid_car and self.default_frogpilot_toggles.ForceAutoTuneOff - - toggle.alert_volume_control = self.default_frogpilot_toggles.AlertVolumeControl - toggle.disengage_volume = self.default_frogpilot_toggles.DisengageVolume if toggle.alert_volume_control else 101 - toggle.engage_volume = self.default_frogpilot_toggles.EngageVolume if toggle.alert_volume_control else 101 - toggle.prompt_volume = self.default_frogpilot_toggles.PromptVolume if toggle.alert_volume_control else 101 - toggle.promptDistracted_volume = self.default_frogpilot_toggles.PromptDistractedVolume if toggle.alert_volume_control else 101 - toggle.refuse_volume = self.default_frogpilot_toggles.RefuseVolume if toggle.alert_volume_control else 101 - toggle.warningSoft_volume = self.default_frogpilot_toggles.WarningSoftVolume if toggle.alert_volume_control else 101 - toggle.warningImmediate_volume = self.default_frogpilot_toggles.WarningImmediateVolume if toggle.alert_volume_control else 101 - - toggle.always_on_lateral = always_on_lateral_set and self.default_frogpilot_toggles.AlwaysOnLateral - toggle.always_on_lateral_lkas = toggle.always_on_lateral and car_make != "subaru" and self.default_frogpilot_toggles.AlwaysOnLateralLKAS - toggle.always_on_lateral_main = toggle.always_on_lateral and self.default_frogpilot_toggles.AlwaysOnLateralMain - toggle.always_on_lateral_pause_speed = self.default_frogpilot_toggles.PauseAOLOnBrake if toggle.always_on_lateral else 0 - toggle.always_on_lateral_status_bar = toggle.always_on_lateral and not self.default_frogpilot_toggles.HideAOLStatusBar - - toggle.cluster_offset = self.default_frogpilot_toggles.ClusterOffset if car_make == "toyota" else 1 - - toggle.conditional_experimental_mode = openpilot_longitudinal and self.default_frogpilot_toggles.ConditionalExperimental - toggle.conditional_curves = toggle.conditional_experimental_mode and self.default_frogpilot_toggles.CECurves - toggle.conditional_curves_lead = toggle.conditional_curves and self.default_frogpilot_toggles.CECurvesLead - toggle.conditional_lead = toggle.conditional_experimental_mode and self.default_frogpilot_toggles.CELead - toggle.conditional_slower_lead = toggle.conditional_lead and self.default_frogpilot_toggles.CESlowerLead - toggle.conditional_stopped_lead = toggle.conditional_lead and self.default_frogpilot_toggles.CEStoppedLead - toggle.conditional_limit = float(self.default_frogpilot_toggles.CESpeed) * speed_conversion if toggle.conditional_experimental_mode else 0 - toggle.conditional_limit_lead = float(self.default_frogpilot_toggles.CESpeedLead) * speed_conversion if toggle.conditional_experimental_mode else 0 - toggle.conditional_navigation = toggle.conditional_experimental_mode and self.default_frogpilot_toggles.CENavigation - toggle.conditional_navigation_intersections = toggle.conditional_navigation and self.default_frogpilot_toggles.CENavigationIntersections - toggle.conditional_navigation_lead = toggle.conditional_navigation and self.default_frogpilot_toggles.CENavigationLead - toggle.conditional_navigation_turns = toggle.conditional_navigation and self.default_frogpilot_toggles.CENavigationTurns - toggle.conditional_model_stop_time = self.default_frogpilot_toggles.CEModelStopTime if toggle.conditional_experimental_mode else 0 - toggle.conditional_signal = self.default_frogpilot_toggles.CESignalSpeed if toggle.conditional_experimental_mode else 0 - toggle.conditional_signal_lane_detection = toggle.conditional_signal != 0 and self.default_frogpilot_toggles.CESignalLaneDetection - toggle.conditional_status_bar = toggle.conditional_experimental_mode and not self.default_frogpilot_toggles.HideCEMStatusBar + toggle.force_auto_tune = bool(toggle.advanced_lateral_tuning and not has_auto_tune and not is_pid_car and self.default_frogpilot_toggles.ForceAutoTune) + toggle.force_auto_tune_off = bool(toggle.advanced_lateral_tuning and has_auto_tune and not is_pid_car and self.default_frogpilot_toggles.ForceAutoTuneOff) + + toggle.alert_volume_control = bool(self.default_frogpilot_toggles.AlertVolumeControl) + toggle.disengage_volume = int(self.default_frogpilot_toggles.DisengageVolume if toggle.alert_volume_control else 101) + toggle.engage_volume = int(self.default_frogpilot_toggles.EngageVolume if toggle.alert_volume_control else 101) + toggle.prompt_volume = int(self.default_frogpilot_toggles.PromptVolume if toggle.alert_volume_control else 101) + toggle.promptDistracted_volume = int(self.default_frogpilot_toggles.PromptDistractedVolume if toggle.alert_volume_control else 101) + toggle.refuse_volume = int(self.default_frogpilot_toggles.RefuseVolume if toggle.alert_volume_control else 101) + toggle.warningSoft_volume = int(self.default_frogpilot_toggles.WarningSoftVolume if toggle.alert_volume_control else 101) + toggle.warningImmediate_volume = int(self.default_frogpilot_toggles.WarningImmediateVolume if toggle.alert_volume_control else 101) + + toggle.always_on_lateral = bool(always_on_lateral_set and self.default_frogpilot_toggles.AlwaysOnLateral) + toggle.always_on_lateral_lkas = bool(toggle.always_on_lateral and car_make != "subaru" and self.default_frogpilot_toggles.AlwaysOnLateralLKAS) + toggle.always_on_lateral_main = bool(toggle.always_on_lateral and self.default_frogpilot_toggles.AlwaysOnLateralMain) + toggle.always_on_lateral_pause_speed = int(self.default_frogpilot_toggles.PauseAOLOnBrake if toggle.always_on_lateral else 0) + toggle.always_on_lateral_status_bar = bool(toggle.always_on_lateral and not self.default_frogpilot_toggles.HideAOLStatusBar) + + toggle.cluster_offset = float(self.default_frogpilot_toggles.ClusterOffset if car_make == "toyota" else 1) + + toggle.conditional_experimental_mode = bool(openpilot_longitudinal and self.default_frogpilot_toggles.ConditionalExperimental) + toggle.conditional_curves = bool(toggle.conditional_experimental_mode and self.default_frogpilot_toggles.CECurves) + toggle.conditional_curves_lead = bool(toggle.conditional_curves and self.default_frogpilot_toggles.CECurvesLead) + toggle.conditional_lead = bool(toggle.conditional_experimental_mode and self.default_frogpilot_toggles.CELead) + toggle.conditional_slower_lead = bool(toggle.conditional_lead and self.default_frogpilot_toggles.CESlowerLead) + toggle.conditional_stopped_lead = bool(toggle.conditional_lead and self.default_frogpilot_toggles.CEStoppedLead) + toggle.conditional_limit = int(self.default_frogpilot_toggles.CESpeed) * speed_conversion if toggle.conditional_experimental_mode else 0 + toggle.conditional_limit_lead = int(self.default_frogpilot_toggles.CESpeedLead) * speed_conversion if toggle.conditional_experimental_mode else 0 + toggle.conditional_navigation = bool(toggle.conditional_experimental_mode and self.default_frogpilot_toggles.CENavigation) + toggle.conditional_navigation_intersections = bool(toggle.conditional_navigation and self.default_frogpilot_toggles.CENavigationIntersections) + toggle.conditional_navigation_lead = bool(toggle.conditional_navigation and self.default_frogpilot_toggles.CENavigationLead) + toggle.conditional_navigation_turns = bool(toggle.conditional_navigation and self.default_frogpilot_toggles.CENavigationTurns) + toggle.conditional_model_stop_time = int(self.default_frogpilot_toggles.CEModelStopTime if toggle.conditional_experimental_mode else 0) + toggle.conditional_signal = int(self.default_frogpilot_toggles.CESignalSpeed if toggle.conditional_experimental_mode else 0) + toggle.conditional_signal_lane_detection = bool(toggle.conditional_signal != 0 and self.default_frogpilot_toggles.CESignalLaneDetection) + toggle.conditional_status_bar = bool(toggle.conditional_experimental_mode and not self.default_frogpilot_toggles.HideCEMStatusBar) if toggle.conditional_experimental_mode: self.params.put_bool("ExperimentalMode", True) - toggle.crosstrek_torque = car_model == "SUBARU_IMPREZA" and self.default_frogpilot_toggles.CrosstrekTorque - - toggle.curve_speed_controller = openpilot_longitudinal and self.default_frogpilot_toggles.CurveSpeedControl - toggle.curve_sensitivity = float(self.default_frogpilot_toggles.CurveSensitivity) / 100 if toggle.curve_speed_controller else 1 - toggle.turn_aggressiveness = float(self.default_frogpilot_toggles.TurnAggressiveness) / 100 if toggle.curve_speed_controller else 1 - toggle.disable_curve_speed_smoothing = toggle.curve_speed_controller and self.default_frogpilot_toggles.DisableCurveSpeedSmoothing - toggle.map_turn_speed_controller = toggle.curve_speed_controller and self.default_frogpilot_toggles.MTSCEnabled - toggle.mtsc_curvature_check = toggle.map_turn_speed_controller and self.default_frogpilot_toggles.MTSCCurvatureCheck - toggle.vision_turn_controller = toggle.curve_speed_controller and self.default_frogpilot_toggles.VisionTurnControl - - toggle.custom_personalities = openpilot_longitudinal and self.default_frogpilot_toggles.CustomPersonalities - toggle.aggressive_profile = toggle.custom_personalities and self.default_frogpilot_toggles.AggressivePersonalityProfile - toggle.aggressive_jerk_deceleration = float(self.default_frogpilot_toggles.AggressiveJerkDeceleration) / 100 if toggle.aggressive_profile else 0.5 - toggle.aggressive_jerk_danger = float(self.default_frogpilot_toggles.AggressiveJerkDanger) / 100 if toggle.aggressive_profile else 1.0 - toggle.aggressive_jerk_speed = float(self.default_frogpilot_toggles.AggressiveJerkSpeed) / 100 if toggle.aggressive_profile else 0.5 - toggle.aggressive_jerk_speed_decrease = float(self.default_frogpilot_toggles.AggressiveJerkSpeedDecrease) / 100 if toggle.aggressive_profile else 0.5 + toggle.crosstrek_torque = bool(car_model == "SUBARU_IMPREZA" and self.default_frogpilot_toggles.CrosstrekTorque) + + toggle.curve_speed_controller = bool(openpilot_longitudinal and self.default_frogpilot_toggles.CurveSpeedControl) + toggle.curve_sensitivity = int(self.default_frogpilot_toggles.CurveSensitivity) / 100 if toggle.curve_speed_controller else 1 + toggle.turn_aggressiveness = int(self.default_frogpilot_toggles.TurnAggressiveness) / 100 if toggle.curve_speed_controller else 1 + toggle.disable_curve_speed_smoothing = bool(toggle.curve_speed_controller and self.default_frogpilot_toggles.DisableCurveSpeedSmoothing) + toggle.map_turn_speed_controller = bool(toggle.curve_speed_controller and self.default_frogpilot_toggles.MTSCEnabled) + toggle.mtsc_curvature_check = bool(toggle.map_turn_speed_controller and self.default_frogpilot_toggles.MTSCCurvatureCheck) + toggle.vision_turn_controller = bool(toggle.curve_speed_controller and self.default_frogpilot_toggles.VisionTurnControl) + + toggle.custom_personalities = bool(openpilot_longitudinal and self.default_frogpilot_toggles.CustomPersonalities) + toggle.aggressive_profile = bool(toggle.custom_personalities and self.default_frogpilot_toggles.AggressivePersonalityProfile) + toggle.aggressive_jerk_deceleration = int(self.default_frogpilot_toggles.AggressiveJerkDeceleration) / 100 if toggle.aggressive_profile else 0.5 + toggle.aggressive_jerk_danger = int(self.default_frogpilot_toggles.AggressiveJerkDanger) / 100 if toggle.aggressive_profile else 1.0 + toggle.aggressive_jerk_speed = int(self.default_frogpilot_toggles.AggressiveJerkSpeed) / 100 if toggle.aggressive_profile else 0.5 + toggle.aggressive_jerk_speed_decrease = int(self.default_frogpilot_toggles.AggressiveJerkSpeedDecrease) / 100 if toggle.aggressive_profile else 0.5 toggle.aggressive_follow = float(self.default_frogpilot_toggles.AggressiveFollow) if toggle.aggressive_profile else 1.25 - toggle.standard_profile = toggle.custom_personalities and self.default_frogpilot_toggles.StandardPersonalityProfile - toggle.standard_jerk_acceleration = float(self.default_frogpilot_toggles.StandardJerkAcceleration) / 100 if toggle.standard_profile else 1.0 - toggle.standard_jerk_deceleration = float(self.default_frogpilot_toggles.StandardJerkDeceleration) / 100 if toggle.standard_profile else 1.0 - toggle.standard_jerk_danger = float(self.default_frogpilot_toggles.StandardJerkDanger) / 100 if toggle.standard_profile else 1.0 - toggle.standard_jerk_speed = float(self.default_frogpilot_toggles.StandardJerkSpeed) / 100 if toggle.standard_profile else 1.0 - toggle.standard_jerk_speed_decrease = float(self.default_frogpilot_toggles.StandardJerkSpeedDecrease) / 100 if toggle.standard_profile else 1.0 + toggle.standard_profile = bool(toggle.custom_personalities and self.default_frogpilot_toggles.StandardPersonalityProfile) + toggle.standard_jerk_acceleration = int(self.default_frogpilot_toggles.StandardJerkAcceleration) / 100 if toggle.standard_profile else 1.0 + toggle.standard_jerk_deceleration = int(self.default_frogpilot_toggles.StandardJerkDeceleration) / 100 if toggle.standard_profile else 1.0 + toggle.standard_jerk_danger = int(self.default_frogpilot_toggles.StandardJerkDanger) / 100 if toggle.standard_profile else 1.0 + toggle.standard_jerk_speed = int(self.default_frogpilot_toggles.StandardJerkSpeed) / 100 if toggle.standard_profile else 1.0 + toggle.standard_jerk_speed_decrease = int(self.default_frogpilot_toggles.StandardJerkSpeedDecrease) / 100 if toggle.standard_profile else 1.0 toggle.standard_follow = float(self.default_frogpilot_toggles.StandardFollow) if toggle.standard_profile else 1.45 - toggle.relaxed_profile = toggle.custom_personalities and self.default_frogpilot_toggles.RelaxedPersonalityProfile - toggle.relaxed_jerk_acceleration = float(self.default_frogpilot_toggles.RelaxedJerkAcceleration) / 100 if toggle.relaxed_profile else 1.0 - toggle.relaxed_jerk_deceleration = float(self.default_frogpilot_toggles.RelaxedJerkDeceleration) / 100 if toggle.relaxed_profile else 1.0 - toggle.relaxed_jerk_danger = float(self.default_frogpilot_toggles.RelaxedJerkDanger) / 100 if toggle.relaxed_profile else 1.0 - toggle.relaxed_jerk_speed = float(self.default_frogpilot_toggles.RelaxedJerkSpeed) / 100 if toggle.relaxed_profile else 1.0 - toggle.relaxed_jerk_speed_decrease = float(self.default_frogpilot_toggles.RelaxedJerkSpeedDecrease) / 100 if toggle.relaxed_profile else 1.0 + toggle.relaxed_profile = bool(toggle.custom_personalities and self.default_frogpilot_toggles.RelaxedPersonalityProfile) + toggle.relaxed_jerk_acceleration = int(self.default_frogpilot_toggles.RelaxedJerkAcceleration) / 100 if toggle.relaxed_profile else 1.0 + toggle.relaxed_jerk_deceleration = int(self.default_frogpilot_toggles.RelaxedJerkDeceleration) / 100 if toggle.relaxed_profile else 1.0 + toggle.relaxed_jerk_danger = int(self.default_frogpilot_toggles.RelaxedJerkDanger) / 100 if toggle.relaxed_profile else 1.0 + toggle.relaxed_jerk_speed = int(self.default_frogpilot_toggles.RelaxedJerkSpeed) / 100 if toggle.relaxed_profile else 1.0 + toggle.relaxed_jerk_speed_decrease = int(self.default_frogpilot_toggles.RelaxedJerkSpeedDecrease) / 100 if toggle.relaxed_profile else 1.0 toggle.relaxed_follow = float(self.default_frogpilot_toggles.RelaxedFollow) if toggle.relaxed_profile else 1.75 - toggle.traffic_profile = toggle.custom_personalities and self.default_frogpilot_toggles.TrafficPersonalityProfile - toggle.traffic_mode_jerk_acceleration = [float(self.default_frogpilot_toggles.TrafficJerkAcceleration) / 100, toggle.aggressive_jerk_acceleration] if toggle.traffic_profile else [0.5, 0.5] - toggle.traffic_mode_jerk_deceleration = [float(self.default_frogpilot_toggles.TrafficJerkDeceleration) / 100, toggle.aggressive_jerk_deceleration] if toggle.traffic_profile else [0.5, 0.5] - toggle.traffic_mode_jerk_danger = [float(self.default_frogpilot_toggles.TrafficJerkDanger) / 100, toggle.aggressive_jerk_danger] if toggle.traffic_profile else [1.0, 1.0] - toggle.traffic_mode_jerk_speed = [float(self.default_frogpilot_toggles.TrafficJerkSpeed) / 100, toggle.aggressive_jerk_speed] if toggle.traffic_profile else [0.5, 0.5] - toggle.traffic_mode_jerk_speed_decrease = [float(self.default_frogpilot_toggles.TrafficJerkSpeedDecrease) / 100, toggle.aggressive_jerk_speed_decrease] if toggle.traffic_profile else [0.5, 0.5] + toggle.traffic_profile = bool(toggle.custom_personalities and self.default_frogpilot_toggles.TrafficPersonalityProfile) + toggle.traffic_mode_jerk_acceleration = [int(self.default_frogpilot_toggles.TrafficJerkAcceleration) / 100, toggle.aggressive_jerk_acceleration] if toggle.traffic_profile else [0.5, 0.5] + toggle.traffic_mode_jerk_deceleration = [int(self.default_frogpilot_toggles.TrafficJerkDeceleration) / 100, toggle.aggressive_jerk_deceleration] if toggle.traffic_profile else [0.5, 0.5] + toggle.traffic_mode_jerk_danger = [int(self.default_frogpilot_toggles.TrafficJerkDanger) / 100, toggle.aggressive_jerk_danger] if toggle.traffic_profile else [1.0, 1.0] + toggle.traffic_mode_jerk_speed = [int(self.default_frogpilot_toggles.TrafficJerkSpeed) / 100, toggle.aggressive_jerk_speed] if toggle.traffic_profile else [0.5, 0.5] + toggle.traffic_mode_jerk_speed_decrease = [int(self.default_frogpilot_toggles.TrafficJerkSpeedDecrease) / 100, toggle.aggressive_jerk_speed_decrease] if toggle.traffic_profile else [0.5, 0.5] toggle.traffic_mode_t_follow = [float(self.default_frogpilot_toggles.TrafficFollow), toggle.aggressive_follow] if toggle.traffic_profile else [0.5, 1.0] - toggle.custom_ui = self.default_frogpilot_toggles.CustomUI - toggle.acceleration_path = toggle.custom_ui and self.default_frogpilot_toggles.AccelerationPath - toggle.adjacent_paths = toggle.custom_ui and self.default_frogpilot_toggles.AdjacentPath - toggle.blind_spot_path = has_bsm and toggle.custom_ui and self.default_frogpilot_toggles.BlindSpotPath - toggle.compass = toggle.custom_ui and self.default_frogpilot_toggles.Compass - toggle.pedals_on_ui = toggle.custom_ui and self.default_frogpilot_toggles.PedalsOnUI - toggle.dynamic_pedals_on_ui = toggle.pedals_on_ui and self.default_frogpilot_toggles.DynamicPedalsOnUI - toggle.static_pedals_on_ui = toggle.pedals_on_ui and self.default_frogpilot_toggles.StaticPedalsOnUI - toggle.rotating_wheel = toggle.custom_ui and self.default_frogpilot_toggles.RotatingWheel - - toggle.developer_ui = self.default_frogpilot_toggles.DeveloperUI - toggle.border_metrics = toggle.developer_ui and self.default_frogpilot_toggles.BorderMetrics - toggle.blind_spot_metrics = has_bsm and toggle.border_metrics and self.default_frogpilot_toggles.BlindSpotMetrics - toggle.signal_metrics = toggle.border_metrics and self.default_frogpilot_toggles.SignalMetrics - toggle.steering_metrics = toggle.border_metrics and self.default_frogpilot_toggles.ShowSteering - toggle.show_fps = toggle.developer_ui and self.default_frogpilot_toggles.FPSCounter - toggle.lateral_metrics = toggle.developer_ui and self.default_frogpilot_toggles.LateralMetrics - toggle.adjacent_path_metrics = toggle.lateral_metrics and self.default_frogpilot_toggles.AdjacentPathMetrics - toggle.lateral_tuning_metrics = toggle.lateral_metrics and self.default_frogpilot_toggles.TuningInfo - toggle.longitudinal_metrics = toggle.developer_ui and self.default_frogpilot_toggles.LongitudinalMetrics - toggle.adjacent_lead_tracking = has_radar and toggle.longitudinal_metrics and self.default_frogpilot_toggles.AdjacentLeadsUI - toggle.lead_metrics = toggle.longitudinal_metrics and self.default_frogpilot_toggles.LeadInfo - toggle.jerk_metrics = toggle.longitudinal_metrics and self.default_frogpilot_toggles.JerkInfo - toggle.numerical_temp = toggle.developer_ui and self.default_frogpilot_toggles.NumericalTemp - toggle.fahrenheit = toggle.numerical_temp and self.default_frogpilot_toggles.Fahrenheit - toggle.sidebar_metrics = toggle.developer_ui and self.default_frogpilot_toggles.SidebarMetrics - toggle.cpu_metrics = toggle.sidebar_metrics and self.default_frogpilot_toggles.ShowCPU - toggle.gpu_metrics = toggle.sidebar_metrics and self.default_frogpilot_toggles.ShowGPU - toggle.ip_metrics = toggle.sidebar_metrics and self.default_frogpilot_toggles.ShowIP - toggle.memory_metrics = toggle.sidebar_metrics and self.default_frogpilot_toggles.ShowMemoryUsage - toggle.storage_left_metrics = toggle.sidebar_metrics and self.default_frogpilot_toggles.ShowStorageLeft - toggle.storage_used_metrics = toggle.sidebar_metrics and self.default_frogpilot_toggles.ShowStorageUsed - toggle.use_si_metrics = toggle.developer_ui and self.default_frogpilot_toggles.UseSI - - toggle.device_management = self.default_frogpilot_toggles.DeviceManagement - device_shutdown_setting = float(self.default_frogpilot_toggles.DeviceShutdown) if toggle.device_management else 33 + toggle.custom_ui = bool(self.default_frogpilot_toggles.CustomUI) + toggle.acceleration_path = bool(toggle.custom_ui and self.default_frogpilot_toggles.AccelerationPath) + toggle.adjacent_paths = bool(toggle.custom_ui and self.default_frogpilot_toggles.AdjacentPath) + toggle.blind_spot_path = bool(has_bsm and toggle.custom_ui and self.default_frogpilot_toggles.BlindSpotPath) + toggle.compass = bool(toggle.custom_ui and self.default_frogpilot_toggles.Compass) + toggle.pedals_on_ui = bool(toggle.custom_ui and self.default_frogpilot_toggles.PedalsOnUI) + toggle.dynamic_pedals_on_ui = bool(toggle.pedals_on_ui and self.default_frogpilot_toggles.DynamicPedalsOnUI) + toggle.static_pedals_on_ui = bool(toggle.pedals_on_ui and self.default_frogpilot_toggles.StaticPedalsOnUI) + toggle.rotating_wheel = bool(toggle.custom_ui and self.default_frogpilot_toggles.RotatingWheel) + + toggle.developer_ui = bool(self.default_frogpilot_toggles.DeveloperUI) + toggle.border_metrics = bool(toggle.developer_ui and self.default_frogpilot_toggles.BorderMetrics) + toggle.blind_spot_metrics = bool(has_bsm and toggle.border_metrics and self.default_frogpilot_toggles.BlindSpotMetrics) + toggle.signal_metrics = bool(toggle.border_metrics and self.default_frogpilot_toggles.SignalMetrics) + toggle.steering_metrics = bool(toggle.border_metrics and self.default_frogpilot_toggles.ShowSteering) + toggle.show_fps = bool(toggle.developer_ui and self.default_frogpilot_toggles.FPSCounter) + toggle.lateral_metrics = bool(toggle.developer_ui and self.default_frogpilot_toggles.LateralMetrics) + toggle.adjacent_path_metrics = bool(toggle.lateral_metrics and self.default_frogpilot_toggles.AdjacentPathMetrics) + toggle.lateral_tuning_metrics = bool(toggle.lateral_metrics and self.default_frogpilot_toggles.TuningInfo) + toggle.longitudinal_metrics = bool(toggle.developer_ui and self.default_frogpilot_toggles.LongitudinalMetrics) + toggle.adjacent_lead_tracking = bool(has_radar and toggle.longitudinal_metrics and self.default_frogpilot_toggles.AdjacentLeadsUI) + toggle.lead_metrics = bool(toggle.longitudinal_metrics and self.default_frogpilot_toggles.LeadInfo) + toggle.jerk_metrics = bool(toggle.longitudinal_metrics and self.default_frogpilot_toggles.JerkInfo) + toggle.numerical_temp = bool(toggle.developer_ui and self.default_frogpilot_toggles.NumericalTemp) + toggle.fahrenheit = bool(toggle.numerical_temp and self.default_frogpilot_toggles.Fahrenheit) + toggle.sidebar_metrics = bool(toggle.developer_ui and self.default_frogpilot_toggles.SidebarMetrics) + toggle.cpu_metrics = bool(toggle.sidebar_metrics and self.default_frogpilot_toggles.ShowCPU) + toggle.gpu_metrics = bool(toggle.sidebar_metrics and self.default_frogpilot_toggles.ShowGPU) + toggle.ip_metrics = bool(toggle.sidebar_metrics and self.default_frogpilot_toggles.ShowIP) + toggle.memory_metrics = bool(toggle.sidebar_metrics and self.default_frogpilot_toggles.ShowMemoryUsage) + toggle.storage_left_metrics = bool(toggle.sidebar_metrics and self.default_frogpilot_toggles.ShowStorageLeft) + toggle.storage_used_metrics = bool(toggle.sidebar_metrics and self.default_frogpilot_toggles.ShowStorageUsed) + toggle.use_si_metrics = bool(toggle.developer_ui and self.default_frogpilot_toggles.UseSI) + + toggle.device_management = bool(self.default_frogpilot_toggles.DeviceManagement) + device_shutdown_setting = int(self.default_frogpilot_toggles.DeviceShutdown) if toggle.device_management else 33 toggle.device_shutdown_time = (device_shutdown_setting - 3) * 3600 if device_shutdown_setting >= 4 else device_shutdown_setting * (60 * 15) - toggle.increase_thermal_limits = toggle.device_management and self.default_frogpilot_toggles.IncreaseThermalLimits + toggle.increase_thermal_limits = bool(toggle.device_management and self.default_frogpilot_toggles.IncreaseThermalLimits) toggle.low_voltage_shutdown = clip(float(self.default_frogpilot_toggles.LowVoltageShutdown), VBATT_PAUSE_CHARGING, 12.5) if toggle.device_management else VBATT_PAUSE_CHARGING - toggle.no_logging = toggle.device_management and self.default_frogpilot_toggles.NoLogging - toggle.no_uploads = toggle.device_management and self.default_frogpilot_toggles.NoUploads - toggle.offline_mode = toggle.device_management and self.default_frogpilot_toggles.OfflineMode + toggle.no_logging = bool(toggle.device_management and self.default_frogpilot_toggles.NoLogging) + toggle.no_uploads = bool(toggle.device_management and self.default_frogpilot_toggles.NoUploads) + toggle.no_onroad_uploads = bool(toggle.no_uploads and self.default_frogpilot_toggles.DisableOnroadUploads) + toggle.offline_mode = bool(toggle.device_management and self.default_frogpilot_toggles.OfflineMode) - toggle.experimental_gm_tune = openpilot_longitudinal and car_make == "gm" and self.default_frogpilot_toggles.ExperimentalGMTune + toggle.experimental_gm_tune = bool(openpilot_longitudinal and car_make == "gm" and self.default_frogpilot_toggles.ExperimentalGMTune) - toggle.experimental_mode_via_press = openpilot_longitudinal and self.default_frogpilot_toggles.ExperimentalModeActivation - toggle.experimental_mode_via_distance = toggle.experimental_mode_via_press and self.default_frogpilot_toggles.ExperimentalModeViaDistance - toggle.experimental_mode_via_lkas = not toggle.always_on_lateral_lkas and toggle.experimental_mode_via_press and car_make != "subaru" and self.default_frogpilot_toggles.ExperimentalModeViaLKAS - toggle.experimental_mode_via_tap = toggle.experimental_mode_via_press and self.default_frogpilot_toggles.ExperimentalModeViaTap + toggle.experimental_mode_via_press = bool(openpilot_longitudinal and self.default_frogpilot_toggles.ExperimentalModeActivation) + toggle.experimental_mode_via_distance = bool(toggle.experimental_mode_via_press and self.default_frogpilot_toggles.ExperimentalModeViaDistance) + toggle.experimental_mode_via_lkas = bool(not toggle.always_on_lateral_lkas and toggle.experimental_mode_via_press and car_make != "subaru" and self.default_frogpilot_toggles.ExperimentalModeViaLKAS) + toggle.experimental_mode_via_tap = bool(toggle.experimental_mode_via_press and self.default_frogpilot_toggles.ExperimentalModeViaTap) - toggle.frogsgomoo_tweak = openpilot_longitudinal and car_make == "toyota" and self.default_frogpilot_toggles.FrogsGoMoosTweak + toggle.frogsgomoo_tweak = bool(openpilot_longitudinal and car_make == "toyota" and self.default_frogpilot_toggles.FrogsGoMoosTweak) - toggle.lane_change_customizations = self.default_frogpilot_toggles.LaneChangeCustomizations - toggle.lane_change_delay = self.default_frogpilot_toggles.LaneChangeTime if toggle.lane_change_customizations else 0 + toggle.lane_change_customizations = bool(self.default_frogpilot_toggles.LaneChangeCustomizations) + toggle.lane_change_delay = float(self.default_frogpilot_toggles.LaneChangeTime) if toggle.lane_change_customizations else 0 toggle.lane_detection_width = float(self.default_frogpilot_toggles.LaneDetectionWidth) * distance_conversion if toggle.lane_change_customizations else 0 - toggle.lane_detection = toggle.lane_detection_width != 0 + toggle.lane_detection = bool(toggle.lane_detection_width != 0) toggle.minimum_lane_change_speed = float(self.default_frogpilot_toggles.MinimumLaneChangeSpeed) * speed_conversion if toggle.lane_change_customizations else LANE_CHANGE_SPEED_MIN - toggle.nudgeless = toggle.lane_change_customizations and self.default_frogpilot_toggles.NudgelessLaneChange - toggle.one_lane_change = toggle.lane_change_customizations and self.default_frogpilot_toggles.OneLaneChange + toggle.nudgeless = bool(toggle.lane_change_customizations and self.default_frogpilot_toggles.NudgelessLaneChange) + toggle.one_lane_change = bool(toggle.lane_change_customizations and self.default_frogpilot_toggles.OneLaneChange) - toggle.lateral_tuning = self.default_frogpilot_toggles.LateralTune - toggle.nnff = toggle.lateral_tuning and self.default_frogpilot_toggles.NNFF - toggle.nnff_lite = toggle.lateral_tuning and self.default_frogpilot_toggles.NNFFLite - toggle.taco_tune = toggle.lateral_tuning and self.default_frogpilot_toggles.TacoTune - toggle.use_turn_desires = toggle.lateral_tuning and self.default_frogpilot_toggles.TurnDesires + toggle.lateral_tuning = bool(self.default_frogpilot_toggles.LateralTune) + toggle.nnff = bool(toggle.lateral_tuning and self.default_frogpilot_toggles.NNFF) + toggle.nnff_lite = bool(toggle.lateral_tuning and self.default_frogpilot_toggles.NNFFLite) + toggle.taco_tune = bool(toggle.lateral_tuning and self.default_frogpilot_toggles.TacoTune) + toggle.use_turn_desires = bool(toggle.lateral_tuning and self.default_frogpilot_toggles.TurnDesires) - toggle.long_pitch = openpilot_longitudinal and car_make == "gm" and self.default_frogpilot_toggles.LongPitch + toggle.long_pitch = bool(openpilot_longitudinal and car_make == "gm" and self.default_frogpilot_toggles.LongPitch) - toggle.human_acceleration = toggle.longitudinal_tuning and self.default_frogpilot_toggles.HumanAcceleration - toggle.human_following = toggle.longitudinal_tuning and self.default_frogpilot_toggles.HumanFollowing - toggle.increased_stopped_distance = float(self.default_frogpilot_toggles.IncreasedStoppedDistance) * distance_conversion if toggle.longitudinal_tuning else 0 + toggle.human_acceleration = bool(toggle.longitudinal_tuning and self.default_frogpilot_toggles.HumanAcceleration) + toggle.human_following = bool(toggle.longitudinal_tuning and self.default_frogpilot_toggles.HumanFollowing) + toggle.increased_stopped_distance = int(self.default_frogpilot_toggles.IncreasedStoppedDistance) * distance_conversion if toggle.longitudinal_tuning else 0 toggle.lead_detection_probability = clip(float(self.default_frogpilot_toggles.LeadDetectionThreshold) / 100, 0.01, 0.99) if toggle.longitudinal_tuning else 0.5 toggle.max_desired_acceleration = clip(float(self.default_frogpilot_toggles.MaxDesiredAcceleration), 0.1, 4.0) if toggle.longitudinal_tuning else 4.0 toggle.model = DEFAULT_MODEL toggle.part_model_param = "" - toggle.classic_model = classic_models and toggle.model in classic_models.split(',') - toggle.navigationless_model = navigation_models and toggle.model not in navigation_models.split(',') - toggle.radarless_model = radarless_models and toggle.model in radarless_models.split(',') - - toggle.model_ui = self.default_frogpilot_toggles.ModelUI - toggle.dynamic_path_width = toggle.model_ui and self.default_frogpilot_toggles.DynamicPathWidth - toggle.lane_line_width = float(self.default_frogpilot_toggles.LaneLinesWidth) * small_distance_conversion / 200 if toggle.model_ui else 0.025 - toggle.path_edge_width = float(self.default_frogpilot_toggles.PathEdgeWidth) if toggle.model_ui else 20 + toggle.classic_model = bool(classic_models and toggle.model in classic_models.split(',')) + toggle.navigationless_model = bool(navigation_models and toggle.model not in navigation_models.split(',')) + toggle.radarless_model = bool(radarless_models and toggle.model in radarless_models.split(',')) + + toggle.model_ui = bool(self.default_frogpilot_toggles.ModelUI) + toggle.dynamic_path_width = bool(toggle.model_ui and self.default_frogpilot_toggles.DynamicPathWidth) + toggle.lane_line_width = int(self.default_frogpilot_toggles.LaneLinesWidth) * small_distance_conversion / 200 if toggle.model_ui else 0.025 + toggle.path_edge_width = int(self.default_frogpilot_toggles.PathEdgeWidth) if toggle.model_ui else 20 toggle.path_width = float(self.default_frogpilot_toggles.PathWidth) * distance_conversion / 2 if toggle.model_ui else 0.9 - toggle.road_edge_width = float(self.default_frogpilot_toggles.RoadEdgesWidth) * small_distance_conversion / 200 if toggle.model_ui else 0.025 - toggle.show_stopping_point = toggle.model_ui and self.default_frogpilot_toggles.ShowStoppingPoint - toggle.show_stopping_point_metrics = toggle.show_stopping_point and self.default_frogpilot_toggles.ShowStoppingPointMetrics - toggle.unlimited_road_ui_length = toggle.model_ui and self.default_frogpilot_toggles.UnlimitedLength - - toggle.navigation_ui = self.default_frogpilot_toggles.NavigationUI - toggle.big_map = toggle.navigation_ui and self.params.get_bool("BigMap") - toggle.full_map = toggle.big_map and self.default_frogpilot_toggles.FullMap - toggle.map_style = self.default_frogpilot_toggles.MapStyle if toggle.navigation_ui else 0 - toggle.road_name_ui = toggle.navigation_ui and self.default_frogpilot_toggles.RoadNameUI - toggle.show_speed_limit_offset = toggle.navigation_ui and self.default_frogpilot_toggles.ShowSLCOffset - toggle.speed_limit_vienna = toggle.navigation_ui and self.default_frogpilot_toggles.UseVienna - - toggle.old_long_api = openpilot_longitudinal and car_make == "gm" and not self.default_frogpilot_toggles.NewLongAPIGM - toggle.old_long_api |= openpilot_longitudinal and car_make == "hyundai" and not self.default_frogpilot_toggles.NewLongAPI - - toggle.new_toyota_tune = openpilot_longitudinal and car_make == "toyota" and self.default_frogpilot_toggles.NewToyotaTune - - toggle.quality_of_life_lateral = self.default_frogpilot_toggles.QOLLateral - toggle.pause_lateral_below_speed = float(self.default_frogpilot_toggles.PauseLateralSpeed) * speed_conversion if toggle.quality_of_life_lateral else 0 - - toggle.quality_of_life_longitudinal = self.default_frogpilot_toggles.QOLLongitudinal - toggle.custom_cruise_increase = float(self.default_frogpilot_toggles.CustomCruise) if toggle.quality_of_life_longitudinal and not pcm_cruise else 1 - toggle.custom_cruise_increase_long = float(self.default_frogpilot_toggles.CustomCruiseLong) if toggle.quality_of_life_longitudinal and not pcm_cruise else 5 - toggle.force_standstill = toggle.quality_of_life_longitudinal and self.default_frogpilot_toggles.ForceStandstill - toggle.force_stops = toggle.quality_of_life_longitudinal and self.default_frogpilot_toggles.ForceStops - toggle.map_gears = toggle.quality_of_life_longitudinal and self.default_frogpilot_toggles.MapGears - toggle.map_acceleration = toggle.map_gears and self.default_frogpilot_toggles.MapAcceleration - toggle.map_deceleration = toggle.map_gears and self.default_frogpilot_toggles.MapDeceleration - toggle.pause_lateral_below_signal = toggle.pause_lateral_below_speed != 0 and self.default_frogpilot_toggles.PauseLateralOnSignal - toggle.reverse_cruise_increase = toggle.quality_of_life_longitudinal and pcm_cruise and self.default_frogpilot_toggles.ReverseCruise - toggle.set_speed_offset = float(self.default_frogpilot_toggles.SetSpeedOffset) * (1 if toggle.is_metric else CV.MPH_TO_KPH) if toggle.quality_of_life_longitudinal and not pcm_cruise else 0 - - toggle.camera_view = self.default_frogpilot_toggles.CameraView if toggle.quality_of_life_visuals else 0 - toggle.driver_camera_in_reverse = toggle.quality_of_life_visuals and self.default_frogpilot_toggles.DriverCamera - toggle.standby_mode = toggle.quality_of_life_visuals and self.default_frogpilot_toggles.StandbyMode - toggle.stopped_timer = toggle.quality_of_life_visuals and self.default_frogpilot_toggles.StoppedTimer - - toggle.random_events = self.default_frogpilot_toggles.RandomEvents - - toggle.screen_management = self.default_frogpilot_toggles.ScreenManagement - toggle.screen_brightness = float(self.default_frogpilot_toggles.ScreenBrightness) if toggle.screen_management else 101 - toggle.screen_brightness_onroad = float(self.default_frogpilot_toggles.ScreenBrightnessOnroad) if toggle.screen_management else 101 - toggle.screen_recorder = toggle.screen_management and self.default_frogpilot_toggles.ScreenRecorder - toggle.screen_timeout = float(self.default_frogpilot_toggles.ScreenTimeout) if toggle.screen_management else 30 - toggle.screen_timeout_onroad = float(self.default_frogpilot_toggles.ScreenTimeoutOnroad) if toggle.screen_management else 10 - - toggle.sng_hack = openpilot_longitudinal and car_make == "toyota" and self.default_frogpilot_toggles.SNGHack - - toggle.force_mph_dashboard = toggle.speed_limit_controller and self.default_frogpilot_toggles.ForceMPHDashboard - toggle.map_speed_lookahead_higher = float(self.default_frogpilot_toggles.SLCLookaheadHigher) if toggle.speed_limit_controller else 0 - toggle.map_speed_lookahead_lower = float(self.default_frogpilot_toggles.SLCLookaheadLower) if toggle.speed_limit_controller else 0 - toggle.set_speed_limit = toggle.speed_limit_controller and self.default_frogpilot_toggles.SetSpeedLimit - slc_fallback_method = self.default_frogpilot_toggles.SLCFallback if toggle.speed_limit_controller else 0 - toggle.slc_fallback_experimental_mode = toggle.speed_limit_controller and slc_fallback_method == 1 - toggle.slc_fallback_previous_speed_limit = toggle.speed_limit_controller and slc_fallback_method == 2 - toggle.slc_fallback_set_speed = toggle.speed_limit_controller and slc_fallback_method == 0 - toggle.speed_limit_controller_override = self.default_frogpilot_toggles.SLCOverride if toggle.speed_limit_controller else 0 - toggle.speed_limit_controller_override_manual = toggle.speed_limit_controller_override == 1 - toggle.speed_limit_controller_override_set_speed = toggle.speed_limit_controller_override == 2 + toggle.road_edge_width = int(self.default_frogpilot_toggles.RoadEdgesWidth) * small_distance_conversion / 200 if toggle.model_ui else 0.025 + toggle.show_stopping_point = bool(toggle.model_ui and self.default_frogpilot_toggles.ShowStoppingPoint) + toggle.show_stopping_point_metrics = bool(toggle.show_stopping_point and self.default_frogpilot_toggles.ShowStoppingPointMetrics) + toggle.unlimited_road_ui_length = bool(toggle.model_ui and self.default_frogpilot_toggles.UnlimitedLength) + + toggle.navigation_ui = bool(self.default_frogpilot_toggles.NavigationUI) + toggle.big_map = bool(toggle.navigation_ui and self.params.get_bool("BigMap")) + toggle.full_map = bool(toggle.big_map and self.default_frogpilot_toggles.FullMap) + toggle.map_style = int(self.default_frogpilot_toggles.MapStyle) if toggle.navigation_ui else 0 + toggle.road_name_ui = bool(toggle.navigation_ui and self.default_frogpilot_toggles.RoadNameUI) + toggle.show_speed_limit_offset = bool(toggle.navigation_ui and self.default_frogpilot_toggles.ShowSLCOffset) + toggle.speed_limit_vienna = bool(toggle.navigation_ui and self.default_frogpilot_toggles.UseVienna) + + toggle.old_long_api = bool(openpilot_longitudinal and car_make == "gm" and not self.default_frogpilot_toggles.NewLongAPIGM) + toggle.old_long_api |= bool(openpilot_longitudinal and car_make == "hyundai" and not self.default_frogpilot_toggles.NewLongAPI) + + toggle.new_toyota_tune = bool(openpilot_longitudinal and car_make == "toyota" and self.default_frogpilot_toggles.NewToyotaTune) + + toggle.quality_of_life_lateral = bool(self.default_frogpilot_toggles.QOLLateral) + toggle.pause_lateral_below_speed = int(self.default_frogpilot_toggles.PauseLateralSpeed) * speed_conversion if toggle.quality_of_life_lateral else 0 + toggle.pause_lateral_below_signal = bool(toggle.pause_lateral_below_speed != 0 and self.default_frogpilot_toggles.PauseLateralOnSignal) + + toggle.quality_of_life_longitudinal = bool(self.default_frogpilot_toggles.QOLLongitudinal) + toggle.custom_cruise_increase = int(self.default_frogpilot_toggles.CustomCruise) if toggle.quality_of_life_longitudinal and not pcm_cruise else 1 + toggle.custom_cruise_increase_long = int(self.default_frogpilot_toggles.CustomCruiseLong) if toggle.quality_of_life_longitudinal and not pcm_cruise else 5 + toggle.force_standstill = bool(toggle.quality_of_life_longitudinal and self.default_frogpilot_toggles.ForceStandstill) + toggle.force_stops = bool(toggle.quality_of_life_longitudinal and self.default_frogpilot_toggles.ForceStops) + toggle.map_gears = bool(toggle.quality_of_life_longitudinal and self.default_frogpilot_toggles.MapGears) + toggle.map_acceleration = bool(toggle.map_gears and self.default_frogpilot_toggles.MapAcceleration) + toggle.map_deceleration = bool(toggle.map_gears and self.default_frogpilot_toggles.MapDeceleration) + toggle.reverse_cruise_increase = bool(toggle.quality_of_life_longitudinal and pcm_cruise and self.default_frogpilot_toggles.ReverseCruise) + toggle.set_speed_offset = int(self.default_frogpilot_toggles.SetSpeedOffset) * (1 if toggle.is_metric else CV.MPH_TO_KPH) if toggle.quality_of_life_longitudinal and not pcm_cruise else 0 + + toggle.camera_view = int(self.default_frogpilot_toggles.CameraView) if toggle.quality_of_life_visuals else 0 + toggle.driver_camera_in_reverse = bool(toggle.quality_of_life_visuals and self.default_frogpilot_toggles.DriverCamera) + toggle.standby_mode = bool(toggle.quality_of_life_visuals and self.default_frogpilot_toggles.StandbyMode) + toggle.stopped_timer = bool(toggle.quality_of_life_visuals and self.default_frogpilot_toggles.StoppedTimer) + + toggle.random_events = bool(self.default_frogpilot_toggles.RandomEvents) + + toggle.screen_management = bool(self.default_frogpilot_toggles.ScreenManagement) + toggle.screen_brightness = int(self.default_frogpilot_toggles.ScreenBrightness) if toggle.screen_management else 101 + toggle.screen_brightness_onroad = int(self.default_frogpilot_toggles.ScreenBrightnessOnroad) if toggle.screen_management else 101 + toggle.screen_recorder = bool(toggle.screen_management and self.default_frogpilot_toggles.ScreenRecorder) + toggle.screen_timeout = int(self.default_frogpilot_toggles.ScreenTimeout) if toggle.screen_management else 30 + toggle.screen_timeout_onroad = int(self.default_frogpilot_toggles.ScreenTimeoutOnroad) if toggle.screen_management else 10 + + toggle.sng_hack = bool(openpilot_longitudinal and car_make == "toyota" and self.default_frogpilot_toggles.SNGHack) + + toggle.force_mph_dashboard = bool(toggle.speed_limit_controller and self.default_frogpilot_toggles.ForceMPHDashboard) + toggle.map_speed_lookahead_higher = int(self.default_frogpilot_toggles.SLCLookaheadHigher) if toggle.speed_limit_controller else 0 + toggle.map_speed_lookahead_lower = int(self.default_frogpilot_toggles.SLCLookaheadLower) if toggle.speed_limit_controller else 0 + toggle.set_speed_limit = bool(toggle.speed_limit_controller and self.default_frogpilot_toggles.SetSpeedLimit) + slc_fallback_method = int(self.default_frogpilot_toggles.SLCFallback) if toggle.speed_limit_controller else 0 + toggle.slc_fallback_experimental_mode = bool(toggle.speed_limit_controller and slc_fallback_method == 1) + toggle.slc_fallback_previous_speed_limit = bool(toggle.speed_limit_controller and slc_fallback_method == 2) + toggle.slc_fallback_set_speed = bool(toggle.speed_limit_controller and slc_fallback_method == 0) + toggle.speed_limit_controller_override = int(self.default_frogpilot_toggles.SLCOverride) if toggle.speed_limit_controller else 0 + toggle.speed_limit_controller_override_manual = bool(toggle.speed_limit_controller_override == 1) + toggle.speed_limit_controller_override_set_speed = bool(toggle.speed_limit_controller_override == 2) toggle.speed_limit_priority1 = self.default_frogpilot_toggles.SLCPriority1 if toggle.speed_limit_controller else None toggle.speed_limit_priority2 = self.default_frogpilot_toggles.SLCPriority2 if toggle.speed_limit_controller else None toggle.speed_limit_priority3 = self.default_frogpilot_toggles.SLCPriority3 if toggle.speed_limit_controller else None - toggle.speed_limit_priority_highest = toggle.speed_limit_priority1 == "Highest" - toggle.speed_limit_priority_lowest = toggle.speed_limit_priority1 == "Lowest" - toggle.speed_limit_vienna = toggle.speed_limit_controller and self.default_frogpilot_toggles.UseVienna + toggle.speed_limit_priority_highest = bool(toggle.speed_limit_priority1 == "Highest") + toggle.speed_limit_priority_lowest = bool(toggle.speed_limit_priority1 == "Lowest") + toggle.speed_limit_vienna = bool(toggle.speed_limit_controller and self.default_frogpilot_toggles.UseVienna) - toggle.startup_alert_top = self.default_frogpilot_toggles.StartupMessageTop - toggle.startup_alert_bottom = self.default_frogpilot_toggles.StartupMessageBottom + toggle.startup_alert_top = str(self.default_frogpilot_toggles.StartupMessageTop) + toggle.startup_alert_bottom = str(self.default_frogpilot_toggles.StartupMessageBottom) - toggle.volt_sng = car_model == "CHEVROLET_VOLT" and self.default_frogpilot_toggles.VoltSNG + toggle.volt_sng = bool(car_model == "CHEVROLET_VOLT" and self.default_frogpilot_toggles.VoltSNG) elif customization_level != 2: - toggle.advanced_custom_onroad_ui = self.default_frogpilot_toggles.AdvancedCustomUI - toggle.hide_lead_marker = toggle.advanced_custom_onroad_ui and self.default_frogpilot_toggles.HideLeadMarker - toggle.hide_speed = toggle.advanced_custom_onroad_ui and self.default_frogpilot_toggles.HideSpeed - toggle.hide_map_icon = toggle.advanced_custom_onroad_ui and self.default_frogpilot_toggles.HideMapIcon - toggle.hide_max_speed = toggle.advanced_custom_onroad_ui and self.default_frogpilot_toggles.HideMaxSpeed - toggle.hide_alerts = toggle.advanced_custom_onroad_ui and self.default_frogpilot_toggles.HideAlerts - toggle.use_wheel_speed = toggle.advanced_custom_onroad_ui and self.default_frogpilot_toggles.WheelSpeed - - toggle.advanced_lateral_tuning = self.default_frogpilot_toggles.AdvancedLateralTune + toggle.advanced_custom_onroad_ui = bool(self.default_frogpilot_toggles.AdvancedCustomUI) + toggle.hide_lead_marker = bool(toggle.advanced_custom_onroad_ui and self.default_frogpilot_toggles.HideLeadMarker) + toggle.hide_speed = bool(toggle.advanced_custom_onroad_ui and self.default_frogpilot_toggles.HideSpeed) + toggle.hide_map_icon = bool(toggle.advanced_custom_onroad_ui and self.default_frogpilot_toggles.HideMapIcon) + toggle.hide_max_speed = bool(toggle.advanced_custom_onroad_ui and self.default_frogpilot_toggles.HideMaxSpeed) + toggle.hide_alerts = bool(toggle.advanced_custom_onroad_ui and self.default_frogpilot_toggles.HideAlerts) + toggle.use_wheel_speed = bool(toggle.advanced_custom_onroad_ui and self.default_frogpilot_toggles.WheelSpeed) + + toggle.advanced_lateral_tuning = bool(self.default_frogpilot_toggles.AdvancedLateralTune) toggle.use_custom_steer_friction = False toggle.use_custom_kp = False toggle.use_custom_lat_accel_factor = False toggle.use_custom_steer_ratio = False - toggle.force_auto_tune = toggle.advanced_lateral_tuning and not has_auto_tune and not is_pid_car and self.default_frogpilot_toggles.ForceAutoTune - toggle.force_auto_tune_off = toggle.advanced_lateral_tuning and has_auto_tune and not is_pid_car and self.default_frogpilot_toggles.ForceAutoTuneOff - - toggle.alert_volume_control = self.default_frogpilot_toggles.AlertVolumeControl - toggle.disengage_volume = self.default_frogpilot_toggles.DisengageVolume if toggle.alert_volume_control else 101 - toggle.engage_volume = self.default_frogpilot_toggles.EngageVolume if toggle.alert_volume_control else 101 - toggle.prompt_volume = self.default_frogpilot_toggles.PromptVolume if toggle.alert_volume_control else 101 - toggle.promptDistracted_volume = self.default_frogpilot_toggles.PromptDistractedVolume if toggle.alert_volume_control else 101 - toggle.refuse_volume = self.default_frogpilot_toggles.RefuseVolume if toggle.alert_volume_control else 101 - toggle.warningSoft_volume = self.default_frogpilot_toggles.WarningSoftVolume if toggle.alert_volume_control else 101 - toggle.warningImmediate_volume = self.default_frogpilot_toggles.WarningImmediateVolume if toggle.alert_volume_control else 101 - - toggle.always_on_lateral_status_bar = toggle.always_on_lateral and not self.default_frogpilot_toggles.HideAOLStatusBar - - toggle.cluster_offset = self.default_frogpilot_toggles.ClusterOffset if car_make == "toyota" else 1 - - toggle.conditional_navigation = toggle.conditional_experimental_mode and self.default_frogpilot_toggles.CENavigation - toggle.conditional_navigation_intersections = toggle.conditional_navigation and self.default_frogpilot_toggles.CENavigationIntersections - toggle.conditional_navigation_lead = toggle.conditional_navigation and self.default_frogpilot_toggles.CENavigationLead - toggle.conditional_navigation_turns = toggle.conditional_navigation and self.default_frogpilot_toggles.CENavigationTurns - toggle.conditional_signal = self.default_frogpilot_toggles.CESignalSpeed if toggle.conditional_experimental_mode else 0 - toggle.conditional_signal_lane_detection = toggle.conditional_signal != 0 and self.default_frogpilot_toggles.CESignalLaneDetection - toggle.conditional_status_bar = toggle.conditional_experimental_mode and not self.default_frogpilot_toggles.HideCEMStatusBar + toggle.force_auto_tune = bool(toggle.advanced_lateral_tuning and not has_auto_tune and not is_pid_car and self.default_frogpilot_toggles.ForceAutoTune) + toggle.force_auto_tune_off = bool(toggle.advanced_lateral_tuning and has_auto_tune and not is_pid_car and self.default_frogpilot_toggles.ForceAutoTuneOff) + + toggle.alert_volume_control = bool(self.default_frogpilot_toggles.AlertVolumeControl) + toggle.disengage_volume = int(self.default_frogpilot_toggles.DisengageVolume if toggle.alert_volume_control else 101) + toggle.engage_volume = int(self.default_frogpilot_toggles.EngageVolume if toggle.alert_volume_control else 101) + toggle.prompt_volume = int(self.default_frogpilot_toggles.PromptVolume if toggle.alert_volume_control else 101) + toggle.promptDistracted_volume = int(self.default_frogpilot_toggles.PromptDistractedVolume if toggle.alert_volume_control else 101) + toggle.refuse_volume = int(self.default_frogpilot_toggles.RefuseVolume if toggle.alert_volume_control else 101) + toggle.warningSoft_volume = int(self.default_frogpilot_toggles.WarningSoftVolume if toggle.alert_volume_control else 101) + toggle.warningImmediate_volume = int(self.default_frogpilot_toggles.WarningImmediateVolume if toggle.alert_volume_control else 101) + + toggle.always_on_lateral_status_bar = bool(toggle.always_on_lateral and not self.default_frogpilot_toggles.HideAOLStatusBar) + + toggle.cluster_offset = float(self.default_frogpilot_toggles.ClusterOffset if car_make == "toyota" else 1) + + toggle.conditional_navigation = bool(toggle.conditional_experimental_mode and self.default_frogpilot_toggles.CENavigation) + toggle.conditional_navigation_intersections = bool(toggle.conditional_navigation and self.default_frogpilot_toggles.CENavigationIntersections) + toggle.conditional_navigation_lead = bool(toggle.conditional_navigation and self.default_frogpilot_toggles.CENavigationLead) + toggle.conditional_navigation_turns = bool(toggle.conditional_navigation and self.default_frogpilot_toggles.CENavigationTurns) + toggle.conditional_signal = int(self.default_frogpilot_toggles.CESignalSpeed if toggle.conditional_experimental_mode else 0) + toggle.conditional_signal_lane_detection = bool(toggle.conditional_signal != 0 and self.default_frogpilot_toggles.CESignalLaneDetection) + toggle.conditional_status_bar = bool(toggle.conditional_experimental_mode and not self.default_frogpilot_toggles.HideCEMStatusBar) if toggle.conditional_experimental_mode: self.params.put_bool("ExperimentalMode", True) - toggle.crosstrek_torque = car_model == "SUBARU_IMPREZA" and self.default_frogpilot_toggles.CrosstrekTorque + toggle.crosstrek_torque = bool(car_model == "SUBARU_IMPREZA" and self.default_frogpilot_toggles.CrosstrekTorque) - toggle.curve_sensitivity = float(self.default_frogpilot_toggles.CurveSensitivity) / 100 if toggle.curve_speed_controller else 1 - toggle.turn_aggressiveness = float(self.default_frogpilot_toggles.TurnAggressiveness) / 100 if toggle.curve_speed_controller else 1 - toggle.mtsc_curvature_check = toggle.map_turn_speed_controller and self.default_frogpilot_toggles.MTSCCurvatureCheck + toggle.curve_sensitivity = int(self.default_frogpilot_toggles.CurveSensitivity) / 100 if toggle.curve_speed_controller else 1 + toggle.turn_aggressiveness = int(self.default_frogpilot_toggles.TurnAggressiveness) / 100 if toggle.curve_speed_controller else 1 + toggle.mtsc_curvature_check = bool(toggle.map_turn_speed_controller and self.default_frogpilot_toggles.MTSCCurvatureCheck) - toggle.custom_personalities = openpilot_longitudinal and self.default_frogpilot_toggles.CustomPersonalities - toggle.aggressive_profile = toggle.custom_personalities and self.default_frogpilot_toggles.AggressivePersonalityProfile - toggle.aggressive_jerk_deceleration = float(self.default_frogpilot_toggles.AggressiveJerkDeceleration) / 100 if toggle.aggressive_profile else 0.5 - toggle.aggressive_jerk_danger = float(self.default_frogpilot_toggles.AggressiveJerkDanger) / 100 if toggle.aggressive_profile else 1.0 - toggle.aggressive_jerk_speed = float(self.default_frogpilot_toggles.AggressiveJerkSpeed) / 100 if toggle.aggressive_profile else 0.5 - toggle.aggressive_jerk_speed_decrease = float(self.default_frogpilot_toggles.AggressiveJerkSpeedDecrease) / 100 if toggle.aggressive_profile else 0.5 + toggle.custom_personalities = bool(openpilot_longitudinal and self.default_frogpilot_toggles.CustomPersonalities) + toggle.aggressive_profile = bool(toggle.custom_personalities and self.default_frogpilot_toggles.AggressivePersonalityProfile) + toggle.aggressive_jerk_deceleration = int(self.default_frogpilot_toggles.AggressiveJerkDeceleration) / 100 if toggle.aggressive_profile else 0.5 + toggle.aggressive_jerk_danger = int(self.default_frogpilot_toggles.AggressiveJerkDanger) / 100 if toggle.aggressive_profile else 1.0 + toggle.aggressive_jerk_speed = int(self.default_frogpilot_toggles.AggressiveJerkSpeed) / 100 if toggle.aggressive_profile else 0.5 + toggle.aggressive_jerk_speed_decrease = int(self.default_frogpilot_toggles.AggressiveJerkSpeedDecrease) / 100 if toggle.aggressive_profile else 0.5 toggle.aggressive_follow = float(self.default_frogpilot_toggles.AggressiveFollow) if toggle.aggressive_profile else 1.25 - toggle.standard_profile = toggle.custom_personalities and self.default_frogpilot_toggles.StandardPersonalityProfile - toggle.standard_jerk_acceleration = float(self.default_frogpilot_toggles.StandardJerkAcceleration) / 100 if toggle.standard_profile else 1.0 - toggle.standard_jerk_deceleration = float(self.default_frogpilot_toggles.StandardJerkDeceleration) / 100 if toggle.standard_profile else 1.0 - toggle.standard_jerk_danger = float(self.default_frogpilot_toggles.StandardJerkDanger) / 100 if toggle.standard_profile else 1.0 - toggle.standard_jerk_speed = float(self.default_frogpilot_toggles.StandardJerkSpeed) / 100 if toggle.standard_profile else 1.0 - toggle.standard_jerk_speed_decrease = float(self.default_frogpilot_toggles.StandardJerkSpeedDecrease) / 100 if toggle.standard_profile else 1.0 + toggle.standard_profile = bool(toggle.custom_personalities and self.default_frogpilot_toggles.StandardPersonalityProfile) + toggle.standard_jerk_acceleration = int(self.default_frogpilot_toggles.StandardJerkAcceleration) / 100 if toggle.standard_profile else 1.0 + toggle.standard_jerk_deceleration = int(self.default_frogpilot_toggles.StandardJerkDeceleration) / 100 if toggle.standard_profile else 1.0 + toggle.standard_jerk_danger = int(self.default_frogpilot_toggles.StandardJerkDanger) / 100 if toggle.standard_profile else 1.0 + toggle.standard_jerk_speed = int(self.default_frogpilot_toggles.StandardJerkSpeed) / 100 if toggle.standard_profile else 1.0 + toggle.standard_jerk_speed_decrease = int(self.default_frogpilot_toggles.StandardJerkSpeedDecrease) / 100 if toggle.standard_profile else 1.0 toggle.standard_follow = float(self.default_frogpilot_toggles.StandardFollow) if toggle.standard_profile else 1.45 - toggle.relaxed_profile = toggle.custom_personalities and self.default_frogpilot_toggles.RelaxedPersonalityProfile - toggle.relaxed_jerk_acceleration = float(self.default_frogpilot_toggles.RelaxedJerkAcceleration) / 100 if toggle.relaxed_profile else 1.0 - toggle.relaxed_jerk_deceleration = float(self.default_frogpilot_toggles.RelaxedJerkDeceleration) / 100 if toggle.relaxed_profile else 1.0 - toggle.relaxed_jerk_danger = float(self.default_frogpilot_toggles.RelaxedJerkDanger) / 100 if toggle.relaxed_profile else 1.0 - toggle.relaxed_jerk_speed = float(self.default_frogpilot_toggles.RelaxedJerkSpeed) / 100 if toggle.relaxed_profile else 1.0 - toggle.relaxed_jerk_speed_decrease = float(self.default_frogpilot_toggles.RelaxedJerkSpeedDecrease) / 100 if toggle.relaxed_profile else 1.0 + toggle.relaxed_profile = bool(toggle.custom_personalities and self.default_frogpilot_toggles.RelaxedPersonalityProfile) + toggle.relaxed_jerk_acceleration = int(self.default_frogpilot_toggles.RelaxedJerkAcceleration) / 100 if toggle.relaxed_profile else 1.0 + toggle.relaxed_jerk_deceleration = int(self.default_frogpilot_toggles.RelaxedJerkDeceleration) / 100 if toggle.relaxed_profile else 1.0 + toggle.relaxed_jerk_danger = int(self.default_frogpilot_toggles.RelaxedJerkDanger) / 100 if toggle.relaxed_profile else 1.0 + toggle.relaxed_jerk_speed = int(self.default_frogpilot_toggles.RelaxedJerkSpeed) / 100 if toggle.relaxed_profile else 1.0 + toggle.relaxed_jerk_speed_decrease = int(self.default_frogpilot_toggles.RelaxedJerkSpeedDecrease) / 100 if toggle.relaxed_profile else 1.0 toggle.relaxed_follow = float(self.default_frogpilot_toggles.RelaxedFollow) if toggle.relaxed_profile else 1.75 - toggle.traffic_profile = toggle.custom_personalities and self.default_frogpilot_toggles.TrafficPersonalityProfile - toggle.traffic_mode_jerk_acceleration = [float(self.default_frogpilot_toggles.TrafficJerkAcceleration) / 100, toggle.aggressive_jerk_acceleration] if toggle.traffic_profile else [0.5, 0.5] - toggle.traffic_mode_jerk_deceleration = [float(self.default_frogpilot_toggles.TrafficJerkDeceleration) / 100, toggle.aggressive_jerk_deceleration] if toggle.traffic_profile else [0.5, 0.5] - toggle.traffic_mode_jerk_danger = [float(self.default_frogpilot_toggles.TrafficJerkDanger) / 100, toggle.aggressive_jerk_danger] if toggle.traffic_profile else [1.0, 1.0] - toggle.traffic_mode_jerk_speed = [float(self.default_frogpilot_toggles.TrafficJerkSpeed) / 100, toggle.aggressive_jerk_speed] if toggle.traffic_profile else [0.5, 0.5] - toggle.traffic_mode_jerk_speed_decrease = [float(self.default_frogpilot_toggles.TrafficJerkSpeedDecrease) / 100, toggle.aggressive_jerk_speed_decrease] if toggle.traffic_profile else [0.5, 0.5] + toggle.traffic_profile = bool(toggle.custom_personalities and self.default_frogpilot_toggles.TrafficPersonalityProfile) + toggle.traffic_mode_jerk_acceleration = [int(self.default_frogpilot_toggles.TrafficJerkAcceleration) / 100, toggle.aggressive_jerk_acceleration] if toggle.traffic_profile else [0.5, 0.5] + toggle.traffic_mode_jerk_deceleration = [int(self.default_frogpilot_toggles.TrafficJerkDeceleration) / 100, toggle.aggressive_jerk_deceleration] if toggle.traffic_profile else [0.5, 0.5] + toggle.traffic_mode_jerk_danger = [int(self.default_frogpilot_toggles.TrafficJerkDanger) / 100, toggle.aggressive_jerk_danger] if toggle.traffic_profile else [1.0, 1.0] + toggle.traffic_mode_jerk_speed = [int(self.default_frogpilot_toggles.TrafficJerkSpeed) / 100, toggle.aggressive_jerk_speed] if toggle.traffic_profile else [0.5, 0.5] + toggle.traffic_mode_jerk_speed_decrease = [int(self.default_frogpilot_toggles.TrafficJerkSpeedDecrease) / 100, toggle.aggressive_jerk_speed_decrease] if toggle.traffic_profile else [0.5, 0.5] toggle.traffic_mode_t_follow = [float(self.default_frogpilot_toggles.TrafficFollow), toggle.aggressive_follow] if toggle.traffic_profile else [0.5, 1.0] - toggle.adjacent_paths = toggle.custom_ui and self.default_frogpilot_toggles.AdjacentPath - - toggle.developer_ui = self.default_frogpilot_toggles.DeveloperUI - toggle.border_metrics = toggle.developer_ui and self.default_frogpilot_toggles.BorderMetrics - toggle.blind_spot_metrics = has_bsm and toggle.border_metrics and self.default_frogpilot_toggles.BlindSpotMetrics - toggle.signal_metrics = toggle.border_metrics and self.default_frogpilot_toggles.SignalMetrics - toggle.steering_metrics = toggle.border_metrics and self.default_frogpilot_toggles.ShowSteering - toggle.show_fps = toggle.developer_ui and self.default_frogpilot_toggles.FPSCounter - toggle.lateral_metrics = toggle.developer_ui and self.default_frogpilot_toggles.LateralMetrics - toggle.adjacent_path_metrics = toggle.lateral_metrics and self.default_frogpilot_toggles.AdjacentPathMetrics - toggle.lateral_tuning_metrics = toggle.lateral_metrics and self.default_frogpilot_toggles.TuningInfo - toggle.longitudinal_metrics = toggle.developer_ui and self.default_frogpilot_toggles.LongitudinalMetrics - toggle.adjacent_lead_tracking = has_radar and toggle.longitudinal_metrics and self.default_frogpilot_toggles.AdjacentLeadsUI - toggle.lead_metrics = toggle.longitudinal_metrics and self.default_frogpilot_toggles.LeadInfo - toggle.jerk_metrics = toggle.longitudinal_metrics and self.default_frogpilot_toggles.JerkInfo - toggle.numerical_temp = toggle.developer_ui and self.default_frogpilot_toggles.NumericalTemp - toggle.fahrenheit = toggle.numerical_temp and self.default_frogpilot_toggles.Fahrenheit - toggle.sidebar_metrics = toggle.developer_ui and self.default_frogpilot_toggles.SidebarMetrics - toggle.cpu_metrics = toggle.sidebar_metrics and self.default_frogpilot_toggles.ShowCPU - toggle.gpu_metrics = toggle.sidebar_metrics and self.default_frogpilot_toggles.ShowGPU - toggle.ip_metrics = toggle.sidebar_metrics and self.default_frogpilot_toggles.ShowIP - toggle.memory_metrics = toggle.sidebar_metrics and self.default_frogpilot_toggles.ShowMemoryUsage - toggle.storage_left_metrics = toggle.sidebar_metrics and self.default_frogpilot_toggles.ShowStorageLeft - toggle.storage_used_metrics = toggle.sidebar_metrics and self.default_frogpilot_toggles.ShowStorageUsed - toggle.use_si_metrics = toggle.developer_ui and self.default_frogpilot_toggles.UseSI - - toggle.device_management = self.default_frogpilot_toggles.DeviceManagement - toggle.increase_thermal_limits = toggle.device_management and self.default_frogpilot_toggles.IncreaseThermalLimits + toggle.adjacent_paths = bool(toggle.custom_ui and self.default_frogpilot_toggles.AdjacentPath) + + toggle.developer_ui = bool(self.default_frogpilot_toggles.DeveloperUI) + toggle.border_metrics = bool(toggle.developer_ui and self.default_frogpilot_toggles.BorderMetrics) + toggle.blind_spot_metrics = bool(has_bsm and toggle.border_metrics and self.default_frogpilot_toggles.BlindSpotMetrics) + toggle.signal_metrics = bool(toggle.border_metrics and self.default_frogpilot_toggles.SignalMetrics) + toggle.steering_metrics = bool(toggle.border_metrics and self.default_frogpilot_toggles.ShowSteering) + toggle.show_fps = bool(toggle.developer_ui and self.default_frogpilot_toggles.FPSCounter) + toggle.lateral_metrics = bool(toggle.developer_ui and self.default_frogpilot_toggles.LateralMetrics) + toggle.adjacent_path_metrics = bool(toggle.lateral_metrics and self.default_frogpilot_toggles.AdjacentPathMetrics) + toggle.lateral_tuning_metrics = bool(toggle.lateral_metrics and self.default_frogpilot_toggles.TuningInfo) + toggle.longitudinal_metrics = bool(toggle.developer_ui and self.default_frogpilot_toggles.LongitudinalMetrics) + toggle.adjacent_lead_tracking = bool(has_radar and toggle.longitudinal_metrics and self.default_frogpilot_toggles.AdjacentLeadsUI) + toggle.lead_metrics = bool(toggle.longitudinal_metrics and self.default_frogpilot_toggles.LeadInfo) + toggle.jerk_metrics = bool(toggle.longitudinal_metrics and self.default_frogpilot_toggles.JerkInfo) + toggle.numerical_temp = bool(toggle.developer_ui and self.default_frogpilot_toggles.NumericalTemp) + toggle.fahrenheit = bool(toggle.numerical_temp and self.default_frogpilot_toggles.Fahrenheit) + toggle.sidebar_metrics = bool(toggle.developer_ui and self.default_frogpilot_toggles.SidebarMetrics) + toggle.cpu_metrics = bool(toggle.sidebar_metrics and self.default_frogpilot_toggles.ShowCPU) + toggle.gpu_metrics = bool(toggle.sidebar_metrics and self.default_frogpilot_toggles.ShowGPU) + toggle.ip_metrics = bool(toggle.sidebar_metrics and self.default_frogpilot_toggles.ShowIP) + toggle.memory_metrics = bool(toggle.sidebar_metrics and self.default_frogpilot_toggles.ShowMemoryUsage) + toggle.storage_left_metrics = bool(toggle.sidebar_metrics and self.default_frogpilot_toggles.ShowStorageLeft) + toggle.storage_used_metrics = bool(toggle.sidebar_metrics and self.default_frogpilot_toggles.ShowStorageUsed) + toggle.use_si_metrics = bool(toggle.developer_ui and self.default_frogpilot_toggles.UseSI) + + toggle.device_management = bool(self.default_frogpilot_toggles.DeviceManagement) + toggle.increase_thermal_limits = bool(toggle.device_management and self.default_frogpilot_toggles.IncreaseThermalLimits) toggle.low_voltage_shutdown = clip(float(self.default_frogpilot_toggles.LowVoltageShutdown), VBATT_PAUSE_CHARGING, 12.5) if toggle.device_management else VBATT_PAUSE_CHARGING - toggle.no_logging = toggle.device_management and self.default_frogpilot_toggles.NoLogging - toggle.no_uploads = toggle.device_management and self.default_frogpilot_toggles.NoUploads - toggle.offline_mode = toggle.device_management and self.default_frogpilot_toggles.OfflineMode + toggle.no_logging = bool(toggle.device_management and self.default_frogpilot_toggles.NoLogging) + toggle.no_uploads = bool(toggle.device_management and self.default_frogpilot_toggles.NoUploads) + toggle.offline_mode = bool(toggle.device_management and self.default_frogpilot_toggles.OfflineMode) - toggle.experimental_gm_tune = openpilot_longitudinal and car_make == "gm" and self.default_frogpilot_toggles.ExperimentalGMTune + toggle.experimental_gm_tune = bool(openpilot_longitudinal and car_make == "gm" and self.default_frogpilot_toggles.ExperimentalGMTune) - toggle.frogsgomoo_tweak = openpilot_longitudinal and car_make == "toyota" and self.default_frogpilot_toggles.FrogsGoMoosTweak + toggle.frogsgomoo_tweak = bool(openpilot_longitudinal and car_make == "toyota" and self.default_frogpilot_toggles.FrogsGoMoosTweak) toggle.lane_detection_width = float(self.default_frogpilot_toggles.LaneDetectionWidth) * distance_conversion if toggle.lane_change_customizations else 0 - toggle.lane_detection = toggle.lane_detection_width != 0 + toggle.lane_detection = bool(toggle.lane_detection_width != 0) toggle.minimum_lane_change_speed = float(self.default_frogpilot_toggles.MinimumLaneChangeSpeed) * speed_conversion if toggle.lane_change_customizations else LANE_CHANGE_SPEED_MIN - toggle.lateral_tuning = self.default_frogpilot_toggles.LateralTune - toggle.nnff_lite = toggle.lateral_tuning and self.default_frogpilot_toggles.NNFFLite - toggle.taco_tune = toggle.lateral_tuning and self.default_frogpilot_toggles.TacoTune - toggle.use_turn_desires = toggle.lateral_tuning and self.default_frogpilot_toggles.TurnDesires + toggle.lateral_tuning = bool(self.default_frogpilot_toggles.LateralTune) + toggle.nnff_lite = bool(toggle.lateral_tuning and self.default_frogpilot_toggles.NNFFLite) + toggle.taco_tune = bool(toggle.lateral_tuning and self.default_frogpilot_toggles.TacoTune) + toggle.use_turn_desires = bool(toggle.lateral_tuning and self.default_frogpilot_toggles.TurnDesires) - toggle.long_pitch = openpilot_longitudinal and car_make == "gm" and self.default_frogpilot_toggles.LongPitch + toggle.long_pitch = bool(openpilot_longitudinal and car_make == "gm" and self.default_frogpilot_toggles.LongPitch) toggle.lead_detection_probability = clip(float(self.default_frogpilot_toggles.LeadDetectionThreshold) / 100, 0.01, 0.99) if toggle.longitudinal_tuning else 0.5 toggle.max_desired_acceleration = clip(float(self.default_frogpilot_toggles.MaxDesiredAcceleration), 0.1, 4.0) if toggle.longitudinal_tuning else 4.0 toggle.model = DEFAULT_MODEL toggle.part_model_param = "" - toggle.classic_model = classic_models and toggle.model in classic_models.split(',') - toggle.navigationless_model = navigation_models and toggle.model not in navigation_models.split(',') - toggle.radarless_model = radarless_models and toggle.model in radarless_models.split(',') - - toggle.model_ui = self.default_frogpilot_toggles.ModelUI - toggle.dynamic_path_width = toggle.model_ui and self.default_frogpilot_toggles.DynamicPathWidth - toggle.lane_line_width = float(self.default_frogpilot_toggles.LaneLinesWidth) * small_distance_conversion / 200 if toggle.model_ui else 0.025 - toggle.path_edge_width = float(self.default_frogpilot_toggles.PathEdgeWidth) if toggle.model_ui else 20 + toggle.classic_model = bool(classic_models and toggle.model in classic_models.split(',')) + toggle.navigationless_model = bool(navigation_models and toggle.model not in navigation_models.split(',')) + toggle.radarless_model = bool(radarless_models and toggle.model in radarless_models.split(',')) + + toggle.model_ui = bool(self.default_frogpilot_toggles.ModelUI) + toggle.dynamic_path_width = bool(toggle.model_ui and self.default_frogpilot_toggles.DynamicPathWidth) + toggle.lane_line_width = int(self.default_frogpilot_toggles.LaneLinesWidth) * small_distance_conversion / 200 if toggle.model_ui else 0.025 + toggle.path_edge_width = int(self.default_frogpilot_toggles.PathEdgeWidth) if toggle.model_ui else 20 toggle.path_width = float(self.default_frogpilot_toggles.PathWidth) * distance_conversion / 2 if toggle.model_ui else 0.9 - toggle.road_edge_width = float(self.default_frogpilot_toggles.RoadEdgesWidth) * small_distance_conversion / 200 if toggle.model_ui else 0.025 - toggle.show_stopping_point = toggle.model_ui and self.default_frogpilot_toggles.ShowStoppingPoint - toggle.show_stopping_point_metrics = toggle.show_stopping_point and self.default_frogpilot_toggles.ShowStoppingPointMetrics - toggle.unlimited_road_ui_length = toggle.model_ui and self.default_frogpilot_toggles.UnlimitedLength - - toggle.map_style = self.default_frogpilot_toggles.MapStyle if toggle.navigation_ui else 0 - toggle.road_name_ui = toggle.navigation_ui and self.default_frogpilot_toggles.RoadNameUI - toggle.show_speed_limit_offset = toggle.navigation_ui and self.default_frogpilot_toggles.ShowSLCOffset - toggle.speed_limit_vienna = toggle.navigation_ui and self.default_frogpilot_toggles.UseVienna - - toggle.old_long_api = openpilot_longitudinal and car_make == "gm" and not self.default_frogpilot_toggles.NewLongAPIGM - toggle.old_long_api |= openpilot_longitudinal and car_make == "hyundai" and not self.default_frogpilot_toggles.NewLongAPI - - toggle.new_toyota_tune = openpilot_longitudinal and car_make == "toyota" and self.default_frogpilot_toggles.NewToyotaTune - - toggle.quality_of_life_lateral = self.default_frogpilot_toggles.QOLLateral - toggle.pause_lateral_below_speed = float(self.default_frogpilot_toggles.PauseLateralSpeed) * speed_conversion if toggle.quality_of_life_lateral else 0 - - toggle.custom_cruise_increase = float(self.default_frogpilot_toggles.CustomCruise) if toggle.quality_of_life_longitudinal and not pcm_cruise else 1 - toggle.custom_cruise_increase_long = float(self.default_frogpilot_toggles.CustomCruiseLong) if toggle.quality_of_life_longitudinal and not pcm_cruise else 5 - toggle.force_standstill = toggle.quality_of_life_longitudinal and self.default_frogpilot_toggles.ForceStandstill - toggle.force_stops = toggle.quality_of_life_longitudinal and self.default_frogpilot_toggles.ForceStops - toggle.pause_lateral_below_signal = toggle.pause_lateral_below_speed != 0 and self.default_frogpilot_toggles.PauseLateralOnSignal - toggle.reverse_cruise_increase = toggle.quality_of_life_longitudinal and pcm_cruise and self.default_frogpilot_toggles.ReverseCruise - toggle.set_speed_offset = float(self.default_frogpilot_toggles.SetSpeedOffset) * (1 if toggle.is_metric else CV.MPH_TO_KPH) if toggle.quality_of_life_longitudinal and not pcm_cruise else 0 - - toggle.quality_of_life_visuals = self.default_frogpilot_toggles.QOLVisuals - toggle.camera_view = self.default_frogpilot_toggles.CameraView if toggle.quality_of_life_visuals else 0 - toggle.standby_mode = toggle.quality_of_life_visuals and self.default_frogpilot_toggles.StandbyMode - - toggle.screen_management = self.default_frogpilot_toggles.ScreenManagement - toggle.screen_brightness = float(self.default_frogpilot_toggles.ScreenBrightness) if toggle.screen_management else 101 - toggle.screen_brightness_onroad = float(self.default_frogpilot_toggles.ScreenBrightnessOnroad) if toggle.screen_management else 101 - toggle.screen_recorder = toggle.screen_management and self.default_frogpilot_toggles.ScreenRecorder - toggle.screen_timeout = float(self.default_frogpilot_toggles.ScreenTimeout) if toggle.screen_management else 30 - toggle.screen_timeout_onroad = float(self.default_frogpilot_toggles.ScreenTimeoutOnroad) if toggle.screen_management else 10 - - toggle.sng_hack = openpilot_longitudinal and car_make == "toyota" and self.default_frogpilot_toggles.SNGHack - - toggle.force_mph_dashboard = toggle.speed_limit_controller and self.default_frogpilot_toggles.ForceMPHDashboard - toggle.map_speed_lookahead_higher = float(self.default_frogpilot_toggles.SLCLookaheadHigher) if toggle.speed_limit_controller else 0 - toggle.map_speed_lookahead_lower = float(self.default_frogpilot_toggles.SLCLookaheadLower) if toggle.speed_limit_controller else 0 - toggle.set_speed_limit = toggle.speed_limit_controller and self.default_frogpilot_toggles.SetSpeedLimit + toggle.road_edge_width = int(self.default_frogpilot_toggles.RoadEdgesWidth) * small_distance_conversion / 200 if toggle.model_ui else 0.025 + toggle.show_stopping_point = bool(toggle.model_ui and self.default_frogpilot_toggles.ShowStoppingPoint) + toggle.show_stopping_point_metrics = bool(toggle.show_stopping_point and self.default_frogpilot_toggles.ShowStoppingPointMetrics) + toggle.unlimited_road_ui_length = bool(toggle.model_ui and self.default_frogpilot_toggles.UnlimitedLength) + + toggle.map_style = int(self.default_frogpilot_toggles.MapStyle) if toggle.navigation_ui else 0 + toggle.road_name_ui = bool(toggle.navigation_ui and self.default_frogpilot_toggles.RoadNameUI) + toggle.show_speed_limit_offset = bool(toggle.navigation_ui and self.default_frogpilot_toggles.ShowSLCOffset) + toggle.speed_limit_vienna = bool(toggle.navigation_ui and self.default_frogpilot_toggles.UseVienna) + + toggle.old_long_api = bool(openpilot_longitudinal and car_make == "gm" and not self.default_frogpilot_toggles.NewLongAPIGM) + toggle.old_long_api |= bool(openpilot_longitudinal and car_make == "hyundai" and not self.default_frogpilot_toggles.NewLongAPI) + + toggle.new_toyota_tune = bool(openpilot_longitudinal and car_make == "toyota" and self.default_frogpilot_toggles.NewToyotaTune) + + toggle.quality_of_life_lateral = bool(self.default_frogpilot_toggles.QOLLateral) + toggle.pause_lateral_below_speed = int(self.default_frogpilot_toggles.PauseLateralSpeed) * speed_conversion if toggle.quality_of_life_lateral else 0 + toggle.pause_lateral_below_signal = bool(toggle.pause_lateral_below_speed != 0 and self.default_frogpilot_toggles.PauseLateralOnSignal) + + toggle.custom_cruise_increase = int(self.default_frogpilot_toggles.CustomCruise) if toggle.quality_of_life_longitudinal and not pcm_cruise else 1 + toggle.custom_cruise_increase_long = int(self.default_frogpilot_toggles.CustomCruiseLong) if toggle.quality_of_life_longitudinal and not pcm_cruise else 5 + toggle.force_standstill = bool(toggle.quality_of_life_longitudinal and self.default_frogpilot_toggles.ForceStandstill) + toggle.force_stops = bool(toggle.quality_of_life_longitudinal and self.default_frogpilot_toggles.ForceStops) + toggle.reverse_cruise_increase = bool(toggle.quality_of_life_longitudinal and pcm_cruise and self.default_frogpilot_toggles.ReverseCruise) + toggle.set_speed_offset = int(self.default_frogpilot_toggles.SetSpeedOffset) * (1 if toggle.is_metric else CV.MPH_TO_KPH) if toggle.quality_of_life_longitudinal and not pcm_cruise else 0 + + toggle.camera_view = int(self.default_frogpilot_toggles.CameraView) if toggle.quality_of_life_visuals else 0 + toggle.standby_mode = bool(toggle.quality_of_life_visuals and self.default_frogpilot_toggles.StandbyMode) + + toggle.screen_management = bool(self.default_frogpilot_toggles.ScreenManagement) + toggle.screen_brightness = int(self.default_frogpilot_toggles.ScreenBrightness) if toggle.screen_management else 101 + toggle.screen_brightness_onroad = int(self.default_frogpilot_toggles.ScreenBrightnessOnroad) if toggle.screen_management else 101 + toggle.screen_recorder = bool(toggle.screen_management and self.default_frogpilot_toggles.ScreenRecorder) + toggle.screen_timeout = int(self.default_frogpilot_toggles.ScreenTimeout) if toggle.screen_management else 30 + toggle.screen_timeout_onroad = int(self.default_frogpilot_toggles.ScreenTimeoutOnroad) if toggle.screen_management else 10 + + toggle.sng_hack = bool(openpilot_longitudinal and car_make == "toyota" and self.default_frogpilot_toggles.SNGHack) + + toggle.force_mph_dashboard = bool(toggle.speed_limit_controller and self.default_frogpilot_toggles.ForceMPHDashboard) + toggle.map_speed_lookahead_higher = int(self.default_frogpilot_toggles.SLCLookaheadHigher) if toggle.speed_limit_controller else 0 + toggle.map_speed_lookahead_lower = int(self.default_frogpilot_toggles.SLCLookaheadLower) if toggle.speed_limit_controller else 0 + toggle.set_speed_limit = bool(toggle.speed_limit_controller and self.default_frogpilot_toggles.SetSpeedLimit) toggle.speed_limit_priority1 = self.default_frogpilot_toggles.SLCPriority1 if toggle.speed_limit_controller else None toggle.speed_limit_priority2 = self.default_frogpilot_toggles.SLCPriority2 if toggle.speed_limit_controller else None toggle.speed_limit_priority3 = self.default_frogpilot_toggles.SLCPriority3 if toggle.speed_limit_controller else None - toggle.speed_limit_priority_highest = toggle.speed_limit_priority1 == "Highest" - toggle.speed_limit_priority_lowest = toggle.speed_limit_priority1 == "Lowest" - toggle.speed_limit_vienna = toggle.speed_limit_controller and self.default_frogpilot_toggles.UseVienna + toggle.speed_limit_priority_highest = bool(toggle.speed_limit_priority1 == "Highest") + toggle.speed_limit_priority_lowest = bool(toggle.speed_limit_priority1 == "Lowest") + toggle.speed_limit_vienna = bool(toggle.speed_limit_controller and self.default_frogpilot_toggles.UseVienna) - toggle.startup_alert_top = self.default_frogpilot_toggles.StartupMessageTop - toggle.startup_alert_bottom = self.default_frogpilot_toggles.StartupMessageBottom + toggle.startup_alert_top = str(self.default_frogpilot_toggles.StartupMessageTop) + toggle.startup_alert_bottom = str(self.default_frogpilot_toggles.StartupMessageBottom) - toggle.volt_sng = car_model == "CHEVROLET_VOLT" and self.default_frogpilot_toggles.VoltSNG + toggle.volt_sng = bool(car_model == "CHEVROLET_VOLT" and self.default_frogpilot_toggles.VoltSNG) self.params.put("FrogPilotToggles", json.dumps(toggle.__dict__)) self.params_memory.remove("FrogPilotTogglesUpdated") diff --git a/selfdrive/locationd/torqued.py b/selfdrive/locationd/torqued.py index 29a5eff220366e..4783cef61e45b4 100755 --- a/selfdrive/locationd/torqued.py +++ b/selfdrive/locationd/torqued.py @@ -52,7 +52,7 @@ def add_point(self, x, y): class TorqueEstimator(ParameterEstimator): - def __init__(self, CP, torque_cache, decimated=False): + def __init__(self, CP, torque_key, decimated=False): self.hist_len = int(HISTORY / DT_MDL) self.lag = CP.steerActuatorDelay + .2 # from controlsd if decimated: @@ -95,6 +95,7 @@ def __init__(self, CP, torque_cache, decimated=False): # try to restore cached params params = Params() params_cache = params.get("CarParamsPrevRoute") + torque_cache = params.get(torque_key) if params_cache is not None and torque_cache is not None: try: with log.Event.from_bytes(torque_cache) as log_evt: @@ -114,7 +115,7 @@ def __init__(self, CP, torque_cache, decimated=False): cloudlog.info("restored torque params from cache") except Exception: cloudlog.exception("failed to restore cached torque params") - params.remove(self.torque_key) + params.remove(torque_key) self.filtered_params = {} for param in initial_params: @@ -224,11 +225,12 @@ def main(demo=False): sm = messaging.SubMaster(['carControl', 'carOutput', 'carState', 'liveLocationKalman'], poll='liveLocationKalman') params = Params() + + # FrogPilot variables torque_key = get_frogpilot_toggles(True).part_model_param + "LiveTorqueParameters" - torque_cache = params.get(torque_key) with car.CarParams.from_bytes(params.get("CarParams", block=True)) as CP: - estimator = TorqueEstimator(CP, torque_cache) + estimator = TorqueEstimator(CP, torque_key) while True: sm.update() diff --git a/selfdrive/navd/navd.py b/selfdrive/navd/navd.py index 1387f8239811a6..83a40a6cfbc0d7 100755 --- a/selfdrive/navd/navd.py +++ b/selfdrive/navd/navd.py @@ -62,19 +62,19 @@ def __init__(self, sm, pm): self.mapbox_host = "https://api.mapbox.com" else: self.api = Api(self.params.get("DongleId", encoding='utf8')) - self.mapbox_host = os.getenv('MAPS_HOST', 'https://maps.comma.ai') + self.mapbox_host = "https://maps.comma.ai" # FrogPilot variables self.frogpilot_toggles = get_frogpilot_toggles(True) - self.stop_coord = [] - self.stop_signal = [] - self.approaching_intersection = False self.approaching_turn = False self.nav_speed_limit = 0 + self.stop_coord = [] + self.stop_signal = [] + def update(self): self.sm.update(0) diff --git a/system/loggerd/uploader.py b/system/loggerd/uploader.py index e73a7b45a1b2fc..59ccadab55c5f6 100755 --- a/system/loggerd/uploader.py +++ b/system/loggerd/uploader.py @@ -21,6 +21,8 @@ from openpilot.system.loggerd.xattr_cache import getxattr, setxattr from openpilot.common.swaglog import cloudlog +from openpilot.selfdrive.frogpilot.frogpilot_variables import get_frogpilot_toggles + NetworkType = log.DeviceState.NetworkType UPLOAD_ATTR_NAME = 'user.upload' UPLOAD_ATTR_VALUE = b'1' @@ -242,16 +244,19 @@ def main(exit_event: threading.Event = None) -> None: cloudlog.info("uploader missing dongle_id") raise Exception("uploader can't start without dongle id") - sm = messaging.SubMaster(['deviceState']) + sm = messaging.SubMaster(['deviceState', 'frogpilotPlan']) uploader = Uploader(dongle_id, Paths.log_root()) backoff = 0.1 + + # FrogPilot variables + frogpilot_toggles = get_frogpilot_toggles(True) + while not exit_event.is_set(): sm.update(0) - disable_onroad_uploads = params.get_bool("DeviceManagement") and params.get_bool("NoUploads") and params.get_bool("DisableOnroadUploads") offroad = params.get_bool("IsOffroad") network_type = sm['deviceState'].networkType if not force_wifi else NetworkType.wifi - at_home = not disable_onroad_uploads or offroad and network_type in (NetworkType.ethernet, NetworkType.wifi) + at_home = not frogpilot_toggles.no_onroad_uploads or offroad and network_type in {NetworkType.ethernet, NetworkType.wifi} if network_type == NetworkType.none or not at_home: if allow_sleep: time.sleep(60 if offroad else 5) @@ -268,6 +273,9 @@ def main(exit_event: threading.Event = None) -> None: if allow_sleep: time.sleep(backoff + random.uniform(0, backoff)) + # Update FrogPilot parameters + if sm['frogpilotPlan'].togglesUpdated: + frogpilot_toggles = get_frogpilot_toggles() if __name__ == "__main__": main() diff --git a/system/manager/manager.py b/system/manager/manager.py index c2e79fed29b2d8..71264bc57f5869 100755 --- a/system/manager/manager.py +++ b/system/manager/manager.py @@ -11,12 +11,9 @@ from cereal import log import cereal.messaging as messaging import openpilot.system.sentry as sentry -from openpilot.common.conversions import Conversions as CV from openpilot.common.params import Params, ParamKeyType from openpilot.common.text_window import TextWindow -from openpilot.selfdrive.controls.lib.desire_helper import LANE_CHANGE_SPEED_MIN from openpilot.system.hardware import HARDWARE, PC -from openpilot.system.hardware.power_monitoring import VBATT_PAUSE_CHARGING from openpilot.system.manager.helpers import unblock_stdout, write_onroad_params, save_bootlog from openpilot.system.manager.process import ensure_running from openpilot.system.manager.process_config import managed_processes @@ -70,7 +67,7 @@ def manager_init() -> None: ("RecordFront", "0"), ("SshEnabled", "0"), ("TetheringEnabled", "0"), - ("LongitudinalPersonality", str(log.LongitudinalPersonality.standard)) + ("LongitudinalPersonality", str(log.LongitudinalPersonality.standard)), ] if not PC: default_params.append(("LastUpdateTime", datetime.datetime.utcnow().isoformat().encode('utf8'))) @@ -88,7 +85,7 @@ def manager_init() -> None: else: params_storage.put(k, params.get(k)) - params.put_bool_nonblocking("DoToggleReset", False) + params.remove("DoToggleReset") # Create folders needed for msgq try: @@ -157,7 +154,6 @@ def manager_thread() -> None: cloudlog.info({"environ": os.environ}) params = Params() - params_memory = Params("/dev/shm/params") ignore: list[str] = [] if params.get("DongleId", encoding='utf8') in (None, UNREGISTERED_DONGLE_ID): @@ -175,6 +171,8 @@ def manager_thread() -> None: started_prev = False # FrogPilot variables + params_memory = Params("/dev/shm/params") + FrogPilotVariables().update(False) frogpilot_toggles = get_frogpilot_toggles(True) classic_model = frogpilot_toggles.classic_model diff --git a/system/manager/process_config.py b/system/manager/process_config.py index 4a41aba92899f8..0d4a2b394e372a 100644 --- a/system/manager/process_config.py +++ b/system/manager/process_config.py @@ -46,7 +46,8 @@ def allow_logging(started, params, CP: car.CarParams, classic_model, frogpilot_t return not getattr(frogpilot_toggles, 'no_logging', False) and logging(started, params, CP, classic_model, frogpilot_toggles) def allow_uploads(started, params, CP: car.CarParams, classic_model, frogpilot_toggles) -> bool: - return not getattr(frogpilot_toggles, 'no_uploads', False) + allow_uploads = not (getattr(frogpilot_toggles, 'no_uploads', False) and not getattr(frogpilot_toggles, 'no_onroad_uploads', False)) + return allow_uploads def run_classic_modeld(started, params, CP: car.CarParams, classic_model, frogpilot_toggles) -> bool: return started and classic_model diff --git a/system/sentry.py b/system/sentry.py index 0cbcc946080be4..ea710c20492707 100644 --- a/system/sentry.py +++ b/system/sentry.py @@ -9,7 +9,7 @@ from openpilot.common.params import Params, ParamKeyType from openpilot.system.athena.registration import is_registered_device -from openpilot.system.hardware import PC +from openpilot.system.hardware import HARDWARE, PC from openpilot.common.swaglog import cloudlog from openpilot.system.version import get_build_metadata, get_version @@ -36,7 +36,6 @@ def capture_exception(*args, **kwargs) -> None: exc_text = traceback.format_exc() phrases_to_check = [ - "To overwrite it, set 'overwrite' to True.", ] if any(phrase in exc_text for phrase in phrases_to_check): diff --git a/system/updated/updated.py b/system/updated/updated.py index 9e4f8f5fcd5c93..03826f70fb453a 100755 --- a/system/updated/updated.py +++ b/system/updated/updated.py @@ -310,7 +310,7 @@ def get_description(basedir: str) -> str: with open(os.path.join(basedir, "common", "version.h")) as f: version = f.read().split('"')[1] - commit_unix_ts = run(["git", "show", "-s", "--format=%ct", "HEAD"], basedir).split()[0] + commit_unix_ts = run(["git", "show", "-s", "--format=%ct", "HEAD"], basedir).rstrip() dt = datetime.datetime.fromtimestamp(int(commit_unix_ts)) commit_date = dt.strftime("%b %d") except Exception: