diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index b1049ce..5d59041 100644 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -673,7 +673,7 @@ class Controls: good_speed = CS.vEgo > 5 max_torque = abs(self.last_actuators.steer) > 0.99 if undershooting and turning and good_speed and max_torque: - lac_log.active and self.events.add(EventName.steerSaturated) + lac_log.active and self.events.add(EventName.goatSteerSaturated if self.frogpilot_toggles.goat_scream else EventName.steerSaturated) elif lac_log.saturated: # TODO probably should not use dpath_points but curvature dpath_points = model_v2.position.y diff --git a/selfdrive/controls/lib/events.py b/selfdrive/controls/lib/events.py index c27f144..b472759 100755 --- a/selfdrive/controls/lib/events.py +++ b/selfdrive/controls/lib/events.py @@ -990,6 +990,14 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = { ET.NO_ENTRY: NoEntryAlert("Please don't use the 'Development' branch!"), }, + EventName.goatSteerSaturated: { + ET.WARNING: Alert( + "Turn Exceeds Steering Limit", + "JESUS TAKE THE WHEEL!!", + AlertStatus.userPrompt, AlertSize.mid, + Priority.LOW, VisualAlert.steerRequired, AudibleAlert.goat, 2.), + }, + EventName.greenLight: { ET.PERMANENT: Alert( "Light turned green", diff --git a/selfdrive/frogpilot/assets/custom_themes/frog_theme/sounds/disengage.wav b/selfdrive/frogpilot/assets/custom_themes/frog_theme/sounds/disengage.wav new file mode 100644 index 0000000..d46dd9e Binary files /dev/null and b/selfdrive/frogpilot/assets/custom_themes/frog_theme/sounds/disengage.wav differ diff --git a/selfdrive/frogpilot/assets/custom_themes/frog_theme/sounds/engage.wav b/selfdrive/frogpilot/assets/custom_themes/frog_theme/sounds/engage.wav new file mode 100644 index 0000000..795aa53 Binary files /dev/null and b/selfdrive/frogpilot/assets/custom_themes/frog_theme/sounds/engage.wav differ diff --git a/selfdrive/frogpilot/assets/custom_themes/frog_theme/sounds/goat.wav b/selfdrive/frogpilot/assets/custom_themes/frog_theme/sounds/goat.wav new file mode 100644 index 0000000..e6f3c2c Binary files /dev/null and b/selfdrive/frogpilot/assets/custom_themes/frog_theme/sounds/goat.wav differ diff --git a/selfdrive/frogpilot/assets/custom_themes/stalin_theme/sounds/disengage.wav b/selfdrive/frogpilot/assets/custom_themes/stalin_theme/sounds/disengage.wav new file mode 100644 index 0000000..4cb1586 Binary files /dev/null and b/selfdrive/frogpilot/assets/custom_themes/stalin_theme/sounds/disengage.wav differ diff --git a/selfdrive/frogpilot/assets/custom_themes/stalin_theme/sounds/engage.wav b/selfdrive/frogpilot/assets/custom_themes/stalin_theme/sounds/engage.wav new file mode 100644 index 0000000..4e5b747 Binary files /dev/null and b/selfdrive/frogpilot/assets/custom_themes/stalin_theme/sounds/engage.wav differ diff --git a/selfdrive/frogpilot/assets/custom_themes/stalin_theme/sounds/refuse.wav b/selfdrive/frogpilot/assets/custom_themes/stalin_theme/sounds/refuse.wav new file mode 100644 index 0000000..ef69b98 Binary files /dev/null and b/selfdrive/frogpilot/assets/custom_themes/stalin_theme/sounds/refuse.wav differ diff --git a/selfdrive/frogpilot/assets/custom_themes/stalin_theme/sounds/warning_soft.wav b/selfdrive/frogpilot/assets/custom_themes/stalin_theme/sounds/warning_soft.wav new file mode 100644 index 0000000..ee9b711 Binary files /dev/null and b/selfdrive/frogpilot/assets/custom_themes/stalin_theme/sounds/warning_soft.wav differ diff --git a/selfdrive/frogpilot/assets/custom_themes/tesla_theme/sounds/disengage.wav b/selfdrive/frogpilot/assets/custom_themes/tesla_theme/sounds/disengage.wav new file mode 100644 index 0000000..81dcc4b Binary files /dev/null and b/selfdrive/frogpilot/assets/custom_themes/tesla_theme/sounds/disengage.wav differ diff --git a/selfdrive/frogpilot/assets/custom_themes/tesla_theme/sounds/engage.wav b/selfdrive/frogpilot/assets/custom_themes/tesla_theme/sounds/engage.wav new file mode 100644 index 0000000..108f7cf Binary files /dev/null and b/selfdrive/frogpilot/assets/custom_themes/tesla_theme/sounds/engage.wav differ diff --git a/selfdrive/frogpilot/assets/custom_themes/tesla_theme/sounds/prompt_distracted.wav b/selfdrive/frogpilot/assets/custom_themes/tesla_theme/sounds/prompt_distracted.wav new file mode 100644 index 0000000..c8b6132 Binary files /dev/null and b/selfdrive/frogpilot/assets/custom_themes/tesla_theme/sounds/prompt_distracted.wav differ diff --git a/selfdrive/frogpilot/assets/custom_themes/tesla_theme/sounds/warning_immediate.wav b/selfdrive/frogpilot/assets/custom_themes/tesla_theme/sounds/warning_immediate.wav new file mode 100644 index 0000000..f038f13 Binary files /dev/null and b/selfdrive/frogpilot/assets/custom_themes/tesla_theme/sounds/warning_immediate.wav differ diff --git a/selfdrive/frogpilot/assets/custom_themes/tesla_theme/sounds/warning_soft.wav b/selfdrive/frogpilot/assets/custom_themes/tesla_theme/sounds/warning_soft.wav new file mode 100644 index 0000000..d02180b Binary files /dev/null and b/selfdrive/frogpilot/assets/custom_themes/tesla_theme/sounds/warning_soft.wav differ diff --git a/selfdrive/ui/soundd.py b/selfdrive/ui/soundd.py index 7dccc9c..c2ea160 100644 --- a/selfdrive/ui/soundd.py +++ b/selfdrive/ui/soundd.py @@ -41,6 +41,9 @@ sound_list: dict[int, tuple[str, int | None, float]] = { AudibleAlert.warningSoft: ("warning_soft.wav", None, MAX_VOLUME), AudibleAlert.warningImmediate: ("warning_immediate.wav", None, MAX_VOLUME), + + # Other + AudibleAlert.goat: ("goat.wav", None, MAX_VOLUME), } def check_controls_timeout_alert(sm): @@ -55,8 +58,6 @@ def check_controls_timeout_alert(sm): class Soundd: def __init__(self): - self.load_sounds() - self.current_alert = AudibleAlert.none self.current_volume = MIN_VOLUME self.current_sound_frame = 0 @@ -68,6 +69,8 @@ class Soundd: # FrogPilot variables self.frogpilot_toggles = FrogPilotVariables.toggles + self.previous_sound_directory = None + self.update_frogpilot_sounds() def load_sounds(self): @@ -77,7 +80,12 @@ class Soundd: for sound in sound_list: filename, play_count, volume = sound_list[sound] - wavefile = wave.open(BASEDIR + "/selfdrive/assets/sounds/" + filename, 'r') + try: + if sound == AudibleAlert.goat and not self.frogpilot_toggles.goat_scream: + continue + wavefile = wave.open(self.sound_directory + filename, 'r') + except FileNotFoundError: + wavefile = wave.open(BASEDIR + "/selfdrive/assets/sounds/" + filename, 'r') assert wavefile.getnchannels() == 1 assert wavefile.getsampwidth() == 2 @@ -186,8 +194,25 @@ class Soundd: AudibleAlert.warningSoft: self.frogpilot_toggles.warningSoft_volume, AudibleAlert.warningImmediate: self.frogpilot_toggles.warningImmediate_volume, + + AudibleAlert.goat: self.frogpilot_toggles.prompt_volume, } + theme_configuration = { + 0: "stock_theme", + 1: "frog_theme", + 2: "tesla_theme", + 3: "stalin_theme" + } + + theme_name = theme_configuration.get(self.frogpilot_toggles.custom_sounds) + self.sound_directory = BASEDIR + ("/selfdrive/frogpilot/assets/custom_themes/" + theme_name + "/sounds/" if theme_name != "stock_theme" else "/selfdrive/assets/sounds/") + + if self.sound_directory != self.previous_sound_directory: + self.load_sounds() + + self.previous_sound_directory = self.sound_directory + def main(): s = Soundd() s.soundd_thread()