Visuals - Custom Themes - Sound Pack
Switch out the standard openpilot sounds with a set of themed sounds. Want to submit your own sound pack? Post it in the 'feature-request' channel in the FrogPilot Discord!
This commit is contained in:
parent
bed50071a9
commit
d507acf585
@ -673,7 +673,7 @@ class Controls:
|
|||||||
good_speed = CS.vEgo > 5
|
good_speed = CS.vEgo > 5
|
||||||
max_torque = abs(self.last_actuators.steer) > 0.99
|
max_torque = abs(self.last_actuators.steer) > 0.99
|
||||||
if undershooting and turning and good_speed and max_torque:
|
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:
|
elif lac_log.saturated:
|
||||||
# TODO probably should not use dpath_points but curvature
|
# TODO probably should not use dpath_points but curvature
|
||||||
dpath_points = model_v2.position.y
|
dpath_points = model_v2.position.y
|
||||||
|
@ -990,6 +990,14 @@ EVENTS: dict[int, dict[str, Alert | AlertCallbackType]] = {
|
|||||||
ET.NO_ENTRY: NoEntryAlert("Please don't use the 'Development' branch!"),
|
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: {
|
EventName.greenLight: {
|
||||||
ET.PERMANENT: Alert(
|
ET.PERMANENT: Alert(
|
||||||
"Light turned green",
|
"Light turned green",
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -41,6 +41,9 @@ sound_list: dict[int, tuple[str, int | None, float]] = {
|
|||||||
|
|
||||||
AudibleAlert.warningSoft: ("warning_soft.wav", None, MAX_VOLUME),
|
AudibleAlert.warningSoft: ("warning_soft.wav", None, MAX_VOLUME),
|
||||||
AudibleAlert.warningImmediate: ("warning_immediate.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):
|
def check_controls_timeout_alert(sm):
|
||||||
@ -55,8 +58,6 @@ def check_controls_timeout_alert(sm):
|
|||||||
|
|
||||||
class Soundd:
|
class Soundd:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
self.load_sounds()
|
|
||||||
|
|
||||||
self.current_alert = AudibleAlert.none
|
self.current_alert = AudibleAlert.none
|
||||||
self.current_volume = MIN_VOLUME
|
self.current_volume = MIN_VOLUME
|
||||||
self.current_sound_frame = 0
|
self.current_sound_frame = 0
|
||||||
@ -68,6 +69,8 @@ class Soundd:
|
|||||||
# FrogPilot variables
|
# FrogPilot variables
|
||||||
self.frogpilot_toggles = FrogPilotVariables.toggles
|
self.frogpilot_toggles = FrogPilotVariables.toggles
|
||||||
|
|
||||||
|
self.previous_sound_directory = None
|
||||||
|
|
||||||
self.update_frogpilot_sounds()
|
self.update_frogpilot_sounds()
|
||||||
|
|
||||||
def load_sounds(self):
|
def load_sounds(self):
|
||||||
@ -77,7 +80,12 @@ class Soundd:
|
|||||||
for sound in sound_list:
|
for sound in sound_list:
|
||||||
filename, play_count, volume = sound_list[sound]
|
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.getnchannels() == 1
|
||||||
assert wavefile.getsampwidth() == 2
|
assert wavefile.getsampwidth() == 2
|
||||||
@ -186,8 +194,25 @@ class Soundd:
|
|||||||
|
|
||||||
AudibleAlert.warningSoft: self.frogpilot_toggles.warningSoft_volume,
|
AudibleAlert.warningSoft: self.frogpilot_toggles.warningSoft_volume,
|
||||||
AudibleAlert.warningImmediate: self.frogpilot_toggles.warningImmediate_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():
|
def main():
|
||||||
s = Soundd()
|
s = Soundd()
|
||||||
s.soundd_thread()
|
s.soundd_thread()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user