diff --git a/selfdrive/controls/controlsd.py b/selfdrive/controls/controlsd.py index 1319e503a..716288a15 100644 --- a/selfdrive/controls/controlsd.py +++ b/selfdrive/controls/controlsd.py @@ -665,7 +665,7 @@ class Controls: good_speed = CS.vEgo > 5 max_torque = abs(self.sm['carOutput'].actuatorsOutput.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 7a2d4ab83..1b604487f 100755 --- a/selfdrive/controls/lib/events.py +++ b/selfdrive/controls/lib/events.py @@ -994,6 +994,14 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = { Priority.MID, VisualAlert.none, AudibleAlert.prompt, 1.), }, + 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 000000000..d46dd9eb6 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 000000000..795aa530e 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 000000000..e6f3c2c13 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 000000000..4cb158641 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 000000000..4e5b747cb 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 000000000..ef69b98e9 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 000000000..ee9b71114 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 000000000..81dcc4bd9 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 000000000..108f7cf19 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 000000000..c8b61322c 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 000000000..f038f1316 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 000000000..d02180baa 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 e96d2cc5d..5843c5645 100644 --- a/selfdrive/ui/soundd.py +++ b/selfdrive/ui/soundd.py @@ -40,6 +40,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): @@ -54,8 +57,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 @@ -67,6 +68,8 @@ class Soundd: # FrogPilot variables self.frogpilot_toggles = FrogPilotVariables.toggles + self.previous_sound_directory = None + self.update_toggles = False self.update_frogpilot_sounds() @@ -78,7 +81,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 @@ -190,8 +198,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()