Compare commits

..

1 Commits

Author SHA1 Message Date
whoisdomi 68429f5451 Engine Sound Pack 2026-11-24 10:01:02 -06:00
480 changed files with 6759 additions and 29058 deletions
-4
View File
@@ -49,7 +49,3 @@ The explicit StarPilot [jacobw Subaru adapter](opendbc_repo/opendbc/car/subaru/J
The previous optional StarPilot Controller, formerly in `openpilot/starpilot/car/ford/starpilot_tuning.py`, restored demand tuning from StarPilot `8da0c9d916^`, descended from BluePilot bp-7.0 `e1d051d7ba270261b4455068bd68f1a58db15a4a` through StarPilot `2efe6017bfe14cee4807833e05f9a7f6ba255cdb`. Contributors to that lineage include Alan Polk, John Christman, Jacob Neulight, tonesto7 and Haibin Wen. The current protocol adapter is maintained by StarPilot separately from the pinned BluePilot library; this attribution does not imply BluePilot maintains or endorses the adapted tune.
The current StarPilot Controller replaces that historical curvature-primary tune with a separately maintained adaptation of BluePilot v0.2.1's angle strategy (`2b9dc6cc784faac47a1885d0bda0561f7b76f74d`, `core/lateral_angle_ext.py`). Alan Polk is the principal controller author; John Christman contributed angle-mode anti-stall work, Jacob Neulight the pinion/shadow measurement, Nathan Ingraham and Praeuner high-speed damping, and other contributors are retained in the pinned library's `CREDITS.md`. StarPilot adds bounded small-signal conditioning ahead of the unchanged angle limit chain. This adaptation is not maintained or endorsed by BluePilot; the pinned library and its imported hooks are unchanged.
## Uniden radar detector link
The Uniden detector link builds on **inauner's** earlier Uniden R4/R8/R9 work in [inauner/StarPilot, uniden](https://github.com/inauner/StarPilot/tree/c4b694b2ac8742ddec44123d53f1f84d2990b47e) (`uniden_protocol.py`, `uniden_r4.py`, `uniden_radar_d.py`, the Galaxy Uniden panel and the radar alert banner), which established the detector's BLE alert flow and the Galaxy/UI integration approach. This branch's monitor, transport, widgets and tests are a separate implementation on the current StarPilot Bluetooth owner; the experimental settings and speed-limit slowdown logic are not included. The alert parser and command framing are based on AegisX86/UnidenR8wlink (see THIRD_PARTY_NOTICES.md).
-4
View File
@@ -154,7 +154,3 @@ The Subaru angle implementation includes work from Jacob Waller's `jul-angle-bas
The historical tuning formerly in `openpilot/starpilot/car/ford/starpilot_tuning.py` included the BluePilot bp-7.0-derived work identified in [CREDITS.md](CREDITS.md#starpilot-ford-demand-tuning). The published upstream license notices retained above and in the pinned BluePilot library remain applicable to the adapted source. StarPilot's separate protocol adapter does not modify those notices or resolve their scope.
The angle-primary adaptation in `openpilot/starpilot/car/ford/starpilot_controller.py` is derived from BluePilot v0.2.1. It retains the complete MIT copyright and permission notice in `opendbc_repo/opendbc/bluepilot_lateral/LICENSE`, including Comma.ai, BluePilot and StarPilot contributors. See the contributor attribution in `CREDITS.md`.
## Uniden detector protocol
The detector alert parser and command framing in `openpilot/starpilot/uniden/` are based on [AegisX86/UnidenR8wlink](https://github.com/AegisX86/UnidenR8wlink)'s MIT-licensed protocol documentation, copyright (c) 2026 Aegis "P.R Aigis". The complete notice is retained in [UPSTREAM-LICENSE](openpilot/starpilot/uniden/UPSTREAM-LICENSE).
+5 -1
View File
@@ -140,6 +140,7 @@ class CarState(CarStateBase):
self.dashboard_limit = LimitTracker()
self.dashboard_stop_sign = None
self.drive_mode = None
self.accelerator_pedal = None
self.ioniq6_bsm_sources = (Ioniq6BlindspotSources()
if CP.carFingerprint == CAR.HYUNDAI_IONIQ_6 and CP.openpilotLongitudinalControl else None)
self.ioniq6_bsm_now_ns = 0
@@ -435,7 +436,10 @@ class CarState(CarStateBase):
speed_factor = CV.KPH_TO_MS if self.is_metric else CV.MPH_TO_MS
if self.CP.flags & (HyundaiFlags.EV.value | HyundaiFlags.HYBRID.value):
ret.gasPressed = cp.vl[self.accelerator_msg_canfd]["ACCELERATOR_PEDAL"] > 1e-5
pedal = cp.vl[self.accelerator_msg_canfd]["ACCELERATOR_PEDAL"]
ret.gasPressed = pedal > 1e-5
stamp = cp.ts_nanos[self.accelerator_msg_canfd]["ACCELERATOR_PEDAL"]
self.accelerator_pedal = (float(pedal), stamp) if stamp > 0 else None
else:
ret.gasPressed = bool(cp.vl[self.accelerator_msg_canfd]["ACCELERATOR_PEDAL_PRESSED"])
+1
View File
@@ -223,6 +223,7 @@ struct StarPilotCarState @0xf35cc4560bbf6ec2 {
steeringLimitInfo @39 :StarPilotCarControl.SteeringLimitInfo;
toyotaCruise @38 :ToyotaCruise;
gmRegenGear @40 :Bool;
acceleratorPedal @41 :Float32; # driver pedal travel, 0..1; 0 when the platform doesn't publish it
struct ToyotaCruise {
version @0 :UInt16;
Binary file not shown.
Binary file not shown.
+3 -1
View File
@@ -136,7 +136,6 @@ inline static std::unordered_map<std::string, ParamKeyAttributes> keys = {
{"LaneCenterOffset", {PERSISTENT, FLOAT, "0.0"}},
{"LaneCenteringE2EAuthority", {PERSISTENT, FLOAT, "0.5"}},
{"LaneCenteringStrength", {PERSISTENT, FLOAT, "1.5"}},
{"UnidenConfig", {PERSISTENT | DONT_LOG, JSON}},
{"StarPortEnabled", {PERSISTENT | DONT_LOG, BOOL, "0"}},
{"AdvancedLateralTune", {PERSISTENT, BOOL}},
{"LateralControllerSelection", {PERSISTENT | DONT_LOG, JSON}},
@@ -164,6 +163,9 @@ inline static std::unordered_map<std::string, ParamKeyAttributes> keys = {
{"BlindSpotMetrics", {PERSISTENT, BOOL, "1"}},
{"GreenLightAlert", {PERSISTENT, BOOL, "0"}},
{"LeadDepartingAlert", {PERSISTENT, BOOL, "0"}},
{"EngineSound", {PERSISTENT, BOOL, "0"}},
{"EngineSoundProfile", {PERSISTENT, STRING, "lfa"}},
{"EngineSoundVolume", {PERSISTENT, INT, "60"}},
{"LoudBlindspotAlert", {PERSISTENT, BOOL, "0"}},
{"LoudBlindspotAlertWhenDisengaged", {PERSISTENT, BOOL, "0"}},
{"LoudBlindspotAlertMuteAtStandstill", {PERSISTENT, BOOL, "0"}},
@@ -1,8 +1,6 @@
Japanese, Korean and Simplified Chinese subsets expanded for the shared StarPilot
UI catalogs. Generated with fontTools.subset (default options), retaining the
union of each original font cmap and all characters in app_ja.po/app_ko.po/
app_zh-CHS.po. Original subset: Dom 1f1b1d5db9. Regenerate the Simplified Chinese
subset whenever app_zh-CHS.po gains characters.
Japanese and Korean subsets expanded for the shared StarPilot UI catalogs.
Generated with fontTools.subset, retaining the union of each original font cmap
and all characters in app_ja.po/app_ko.po. Original subset: Dom 1f1b1d5db9.
The official upstream source fonts are licensed under Noto-OFL.txt.
NotoSansCJKjp-Regular.otf
@@ -14,8 +12,3 @@ NotoSansCJKkr-Regular.otf
Source: https://raw.githubusercontent.com/notofonts/noto-cjk/main/Sans/OTF/Korean/NotoSansCJKkr-Regular.otf
Source SHA-256: 6bcb2a0703aa137e874fc2dffa85f6c21ba9a67fa329e81b8c801663af7e992a
Subset SHA-256: 846e22c2bf1afffc11718ee95e4acc258538cc528b20aab3aa122476e64533b8
NotoSansCJKsc-Regular.otf
Source: https://raw.githubusercontent.com/notofonts/noto-cjk/main/Sans/OTF/SimplifiedChinese/NotoSansCJKsc-Regular.otf
Source SHA-256: 2c76254f6fc379fddfce0a7e84fb5385bb135d3e399294f6eeb6680d0365b74b
Subset SHA-256: 159db5944e2e2d2fbeaea3dd6db56b95f57eff80036f93fb7ac612ef25f03e84
+7 -9
View File
@@ -633,13 +633,6 @@ class Controls:
new_desired_curvature = limit_curvature_to_plan(model_v2, new_desired_curvature, CS.vEgo, min_reach=4.0)
else:
self.subaru_twitch_guard_armed = update_twitch_guard(False, CS.vEgo, CS.standstill)
kona_tau = getattr(self, "kona_smoothing", 0.)
from openpilot.starpilot.car.subaru.smoothing import seconds as subaru_smooth_seconds, control_maximum
lat_delay = self.sm["lateralDelay"].lateralDelay + LAT_SMOOTH_SECONDS + subaru_smooth_seconds(CS.vEgo, control_maximum(self)) + kona_tau
if getattr(self, "volkswagen_smoothing", None) is not None:
lat_delay += self.volkswagen_smoothing.seconds(int(self.sm.logMonoTime["modelV2"]), time.monotonic_ns())
if self.highway_smoothing_supported:
preferences = getattr(self, "live_steering_preferences", None)
if preferences is not None:
@@ -663,13 +656,12 @@ class Controls:
or self.sm.valid['lateralManeuverPlan']
),
predicted=predicted,
steering_limited=self.steer_limited_by_safety,
actuator_delay_s=lat_delay,
)
lane_base_curvature = new_desired_curvature
self.lane_centering_applied = 0.0
self.lane_centering_inactive_reason = 'inactive'
self.last_lane_centering_result = None
kona_tau = getattr(self, "kona_smoothing", 0.)
lane_delay = None
if lane_centering is None and self.lane_centering_host is not None:
now_ns = int(self.sm.logMonoTime['carState']) if os.getenv('REPLAY') == '1' else time.monotonic_ns()
@@ -731,6 +723,12 @@ class Controls:
self.desired_curvature = guarded
curvature_limited = True
self.lane_centering_applied = self.desired_curvature - baseline_curvature
from openpilot.starpilot.car.subaru.smoothing import seconds as subaru_smooth_seconds, control_maximum
lat_delay = self.sm["lateralDelay"].lateralDelay + LAT_SMOOTH_SECONDS + subaru_smooth_seconds(CS.vEgo, control_maximum(self)) + kona_tau
if getattr(self, "volkswagen_smoothing", None) is not None:
lat_delay += self.volkswagen_smoothing.seconds(int(self.sm.logMonoTime["modelV2"]), time.monotonic_ns())
actuators.curvature = self.desired_curvature
if cycle_timing is not None:
cycle_timing.mark()
@@ -25,7 +25,6 @@ TIGHT_CURVE_OFF = 2.0 # m/s^2
ENVELOPE_HOLD = 2.0 # s
ENVELOPE_RELEASE_RATE = 0.3 # m/s^2 per second
BYPASS_FADE_RATE = 2.0 # per second
LIMIT_RECOVERY_RAMP = 0.4 # s
MIN_SETTING = 1.0
MAX_SETTING = 10.0
KEY = "HighwaySmoothingLevel"
@@ -84,11 +83,9 @@ class HighwayCorrectionGain:
self.prediction_envelope = _Envelope()
self.bypass_weight = 0.0
self.weight = 0.0
self.time_clear_of_limit: float | None = None
self.limit_recovery = 1.0
def update(self, curvature: float, v_ego: float, lat_active: bool, gain: float, bypass: bool,
predicted: tuple[float, ...] | None = None, *, steering_limited: bool = False, actuator_delay_s: float = 0.0) -> float:
predicted: tuple[float, ...] | None = None) -> float:
if not lat_active:
self.reset(curvature)
return curvature
@@ -120,19 +117,8 @@ class HighwayCorrectionGain:
step = BYPASS_FADE_RATE * DT_CTRL
self.bypass_weight += min(max((0.0 if bypass else 1.0) - self.bypass_weight, -step), step)
# Leave the original request intact while limited and let the delayed commands clear before blending back in.
if steering_limited:
self.time_clear_of_limit = self.limit_recovery = 0.0
elif self.time_clear_of_limit is not None:
if math.isfinite(actuator_delay_s) and actuator_delay_s >= 0.0:
target = max((self.time_clear_of_limit - actuator_delay_s) / LIMIT_RECOVERY_RAMP, 0.0)
self.limit_recovery = min(target, self.limit_recovery + DT_CTRL / LIMIT_RECOVERY_RAMP, 1.0)
self.time_clear_of_limit = None if self.limit_recovery == 1.0 else self.time_clear_of_limit + DT_CTRL
else:
self.time_clear_of_limit = self.limit_recovery = 0.0
gain = min(max(gain, MIN_SETTING / MAX_SETTING), 1.0)
self.weight = self.bypass_weight * _smoothstep(v_ego, SPEED_OFF, SPEED_ON) * gate * self.limit_recovery
self.weight = self.bypass_weight * _smoothstep(v_ego, SPEED_OFF, SPEED_ON) * gate
k = 1.0 - self.weight * (1.0 - gain)
if k >= 1.0:
return curvature
@@ -119,28 +119,6 @@ def test_bypass_fades_without_steps():
assert np.max(np.abs(np.diff(out))) < 1.5 * max_raw_step
def test_limit_pauses_smoothing_until_the_actuator_delay_clears():
hcg = HighwayCorrectionGain()
_run(hcg, _weave(seconds=5.0), gain=0.5)
assert hcg.weight == 1.0
raw = 0.04 / _V_HWY ** 2
delay = 0.3
assert hcg.update(raw, _V_HWY, True, 0.5, False, steering_limited=True, actuator_delay_s=delay) == raw
for _ in range(round(delay / DT_CTRL)):
assert hcg.update(raw, _V_HWY, True, 0.5, False, actuator_delay_s=delay) == raw
weights = []
for _ in range(41):
hcg.update(raw, _V_HWY, True, 0.5, False, actuator_delay_s=delay)
weights.append(hcg.weight)
assert 0.4 < weights[20] < 0.6
assert weights[-1] == 1.0
assert np.max(np.diff(weights)) < 0.026
assert hcg.update(raw, _V_HWY, True, 0.5, False, steering_limited=True, actuator_delay_s=delay) == raw
for _ in range(100):
assert hcg.update(raw, _V_HWY, True, 0.5, False, actuator_delay_s=math.nan) == raw
def test_active_from_40_mph():
v = 40.0 * 0.44704
raw = _weave(v_ego=v)
@@ -23505,4 +23505,82 @@ msgstr ""
#: openpilot/starpilot/galaxy/web/js/spotify.js
msgid "Storage & Account"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Plays a simulated engine on the car speakers that follows the accelerator pedal."
msgstr ""
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Engine Type"
msgstr ""
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Chooses which engine is simulated."
msgstr ""
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Engine Sound Volume"
msgstr ""
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Sets how loud the engine is before the car's own volume control."
msgstr ""
#: openpilot/starpilot/galaxy/setting_descriptions.py
msgid "Plays a simulated engine on the car speakers that follows the accelerator pedal, including revving in Park or Neutral. Uses the audio output chosen under Spotify and Phone Audio, and goes quiet while an alert sounds."
msgstr ""
#: openpilot/starpilot/engine_sound/profiles.py
msgid "BMW M3"
msgstr ""
#: openpilot/starpilot/engine_sound/profiles.py
msgid "BMW M3 Deep"
msgstr ""
#: openpilot/starpilot/engine_sound/profiles.py
msgid "F1 Car"
msgstr ""
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Ferrari F136"
msgstr ""
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Hellcat"
msgstr ""
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Ioniq 5N Ignition"
msgstr ""
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Jaguar F-Type"
msgstr ""
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Nissan Super GT1"
msgstr ""
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Nissan Super GT2"
msgstr ""
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Supra Turbo"
msgstr ""
#: openpilot/starpilot/engine_sound/profiles.py
msgid "LFA"
msgstr ""
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Engine Sounds"
msgstr ""
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Plays on the car speakers through the Spotify and Phone Audio output."
msgstr ""
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Choose an engine; it revs once so you can hear it."
msgstr ""
@@ -23517,3 +23517,82 @@ msgstr "Lenkung und Tasten"
msgid "Storage & Account"
msgstr "Speicher und Konto"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Plays a simulated engine on the car speakers that follows the accelerator pedal."
msgstr "Spielt über die Fahrzeuglautsprecher einen simulierten Motor ab, der dem Gaspedal folgt."
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Engine Type"
msgstr "Motortyp"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Chooses which engine is simulated."
msgstr "Wählt den simulierten Motor."
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Engine Sound Volume"
msgstr "Lautstärke des Motorsounds"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Sets how loud the engine is before the car's own volume control."
msgstr "Legt die Lautstärke des Motors vor der Lautstärkeregelung des Fahrzeugs fest."
#: openpilot/starpilot/galaxy/setting_descriptions.py
msgid "Plays a simulated engine on the car speakers that follows the accelerator pedal, including revving in Park or Neutral. Uses the audio output chosen under Spotify and Phone Audio, and goes quiet while an alert sounds."
msgstr "Spielt über die Fahrzeuglautsprecher einen simulierten Motor ab, der dem Gaspedal folgt, auch beim Hochdrehen in Parkstellung oder Neutral. Nutzt die unter Spotify und Telefon-Audio gewählte Audioausgabe und verstummt, solange ein Warnton ertönt."
#: openpilot/starpilot/engine_sound/profiles.py
msgid "BMW M3"
msgstr "BMW M3"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "BMW M3 Deep"
msgstr "BMW M3 Deep"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "F1 Car"
msgstr "F1 Car"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Ferrari F136"
msgstr "Ferrari F136"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Hellcat"
msgstr "Hellcat"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Ioniq 5N Ignition"
msgstr "Ioniq 5N Ignition"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Jaguar F-Type"
msgstr "Jaguar F-Type"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Nissan Super GT1"
msgstr "Nissan Super GT1"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Nissan Super GT2"
msgstr "Nissan Super GT2"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Supra Turbo"
msgstr "Supra Turbo"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "LFA"
msgstr "LFA"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Engine Sounds"
msgstr "Motorsounds"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Plays on the car speakers through the Spotify and Phone Audio output."
msgstr "Spielt über die Fahrzeuglautsprecher mit der unter Spotify und Telefon-Audio gewählten Ausgabe."
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Choose an engine; it revs once so you can hear it."
msgstr "Wähle einen Motor; er dreht einmal hoch, damit du ihn hörst."
@@ -23517,3 +23517,82 @@ msgstr "Dirección y botones"
msgid "Storage & Account"
msgstr "Almacenamiento y cuenta"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Plays a simulated engine on the car speakers that follows the accelerator pedal."
msgstr "Reproduce un motor simulado en los altavoces del coche que sigue el pedal del acelerador."
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Engine Type"
msgstr "Tipo de motor"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Chooses which engine is simulated."
msgstr "Elige qué motor se simula."
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Engine Sound Volume"
msgstr "Volumen del sonido del motor"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Sets how loud the engine is before the car's own volume control."
msgstr "Ajusta el volumen del motor antes del control de volumen del propio coche."
#: openpilot/starpilot/galaxy/setting_descriptions.py
msgid "Plays a simulated engine on the car speakers that follows the accelerator pedal, including revving in Park or Neutral. Uses the audio output chosen under Spotify and Phone Audio, and goes quiet while an alert sounds."
msgstr "Reproduce un motor simulado en los altavoces del coche que sigue el pedal del acelerador, incluso al acelerar en Estacionamiento o Punto muerto. Usa la salida de audio elegida en Spotify y audio del teléfono, y se silencia mientras suena una alerta."
#: openpilot/starpilot/engine_sound/profiles.py
msgid "BMW M3"
msgstr "BMW M3"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "BMW M3 Deep"
msgstr "BMW M3 Deep"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "F1 Car"
msgstr "F1 Car"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Ferrari F136"
msgstr "Ferrari F136"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Hellcat"
msgstr "Hellcat"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Ioniq 5N Ignition"
msgstr "Ioniq 5N Ignition"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Jaguar F-Type"
msgstr "Jaguar F-Type"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Nissan Super GT1"
msgstr "Nissan Super GT1"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Nissan Super GT2"
msgstr "Nissan Super GT2"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Supra Turbo"
msgstr "Supra Turbo"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "LFA"
msgstr "LFA"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Engine Sounds"
msgstr "Sonidos del motor"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Plays on the car speakers through the Spotify and Phone Audio output."
msgstr "Suena en los altavoces del coche a través de la salida de Spotify y audio del teléfono."
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Choose an engine; it revs once so you can hear it."
msgstr "Elige un motor; acelera una vez para que puedas oírlo."
@@ -23517,3 +23517,82 @@ msgstr "Direction et boutons"
msgid "Storage & Account"
msgstr "Stockage et compte"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Plays a simulated engine on the car speakers that follows the accelerator pedal."
msgstr "Diffuse un moteur simulé sur les haut-parleurs de la voiture qui suit la pédale d'accélérateur."
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Engine Type"
msgstr "Type de moteur"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Chooses which engine is simulated."
msgstr "Choisit le moteur simulé."
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Engine Sound Volume"
msgstr "Volume du son du moteur"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Sets how loud the engine is before the car's own volume control."
msgstr "Règle le volume du moteur avant le réglage de volume de la voiture."
#: openpilot/starpilot/galaxy/setting_descriptions.py
msgid "Plays a simulated engine on the car speakers that follows the accelerator pedal, including revving in Park or Neutral. Uses the audio output chosen under Spotify and Phone Audio, and goes quiet while an alert sounds."
msgstr "Diffuse un moteur simulé sur les haut-parleurs de la voiture qui suit la pédale d'accélérateur, y compris les montées en régime en Parking ou au Point mort. Utilise la sortie audio choisie dans Spotify et audio du téléphone, et se tait pendant une alerte."
#: openpilot/starpilot/engine_sound/profiles.py
msgid "BMW M3"
msgstr "BMW M3"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "BMW M3 Deep"
msgstr "BMW M3 Deep"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "F1 Car"
msgstr "F1 Car"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Ferrari F136"
msgstr "Ferrari F136"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Hellcat"
msgstr "Hellcat"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Ioniq 5N Ignition"
msgstr "Ioniq 5N Ignition"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Jaguar F-Type"
msgstr "Jaguar F-Type"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Nissan Super GT1"
msgstr "Nissan Super GT1"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Nissan Super GT2"
msgstr "Nissan Super GT2"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Supra Turbo"
msgstr "Supra Turbo"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "LFA"
msgstr "LFA"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Engine Sounds"
msgstr "Sons du moteur"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Plays on the car speakers through the Spotify and Phone Audio output."
msgstr "Diffusé sur les haut-parleurs de la voiture via la sortie Spotify et audio du téléphone."
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Choose an engine; it revs once so you can hear it."
msgstr "Choisissez un moteur ; il monte une fois en régime pour que vous l'entendiez."
@@ -23513,3 +23513,82 @@ msgstr "ステアリングとボタン"
msgid "Storage & Account"
msgstr "ストレージとアカウント"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Plays a simulated engine on the car speakers that follows the accelerator pedal."
msgstr "アクセルペダルに合わせて、車のスピーカーで疑似エンジン音を再生します。"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Engine Type"
msgstr "エンジンの種類"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Chooses which engine is simulated."
msgstr "再現するエンジンを選びます。"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Engine Sound Volume"
msgstr "エンジンサウンドの音量"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Sets how loud the engine is before the car's own volume control."
msgstr "車側の音量調整の前に、エンジン音の大きさを設定します。"
#: openpilot/starpilot/galaxy/setting_descriptions.py
msgid "Plays a simulated engine on the car speakers that follows the accelerator pedal, including revving in Park or Neutral. Uses the audio output chosen under Spotify and Phone Audio, and goes quiet while an alert sounds."
msgstr "アクセルペダルに合わせて、車のスピーカーで疑似エンジン音を再生します。パーキングやニュートラルでの空ぶかしにも対応します。「Spotifyとスマホ音声」で選んだ音声出力を使い、警告音が鳴っている間は消音します。"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "BMW M3"
msgstr "BMW M3"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "BMW M3 Deep"
msgstr "BMW M3 Deep"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "F1 Car"
msgstr "F1 Car"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Ferrari F136"
msgstr "Ferrari F136"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Hellcat"
msgstr "Hellcat"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Ioniq 5N Ignition"
msgstr "Ioniq 5N Ignition"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Jaguar F-Type"
msgstr "Jaguar F-Type"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Nissan Super GT1"
msgstr "Nissan Super GT1"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Nissan Super GT2"
msgstr "Nissan Super GT2"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Supra Turbo"
msgstr "Supra Turbo"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "LFA"
msgstr "LFA"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Engine Sounds"
msgstr "エンジンサウンド"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Plays on the car speakers through the Spotify and Phone Audio output."
msgstr "「Spotifyとスマホ音声」の出力から車のスピーカーで再生します。"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Choose an engine; it revs once so you can hear it."
msgstr "エンジンを選ぶと、一度空ぶかしして音を確認できます。"
@@ -23513,3 +23513,82 @@ msgstr "조향 및 버튼"
msgid "Storage & Account"
msgstr "저장 공간 및 계정"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Plays a simulated engine on the car speakers that follows the accelerator pedal."
msgstr "가속 페달에 맞춰 차량 스피커로 가상 엔진 소리를 재생합니다."
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Engine Type"
msgstr "엔진 종류"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Chooses which engine is simulated."
msgstr "재현할 엔진을 선택합니다."
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Engine Sound Volume"
msgstr "엔진 사운드 음량"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Sets how loud the engine is before the car's own volume control."
msgstr "차량 자체 음량 조절 전에 엔진 소리 크기를 설정합니다."
#: openpilot/starpilot/galaxy/setting_descriptions.py
msgid "Plays a simulated engine on the car speakers that follows the accelerator pedal, including revving in Park or Neutral. Uses the audio output chosen under Spotify and Phone Audio, and goes quiet while an alert sounds."
msgstr "가속 페달에 맞춰 차량 스피커로 가상 엔진 소리를 재생하며, P 또는 N에서 공회전 레브도 지원합니다. Spotify 및 휴대폰 오디오에서 선택한 오디오 출력을 사용하며, 경고음이 울리는 동안에는 소리가 꺼집니다."
#: openpilot/starpilot/engine_sound/profiles.py
msgid "BMW M3"
msgstr "BMW M3"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "BMW M3 Deep"
msgstr "BMW M3 Deep"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "F1 Car"
msgstr "F1 Car"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Ferrari F136"
msgstr "Ferrari F136"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Hellcat"
msgstr "Hellcat"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Ioniq 5N Ignition"
msgstr "Ioniq 5N Ignition"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Jaguar F-Type"
msgstr "Jaguar F-Type"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Nissan Super GT1"
msgstr "Nissan Super GT1"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Nissan Super GT2"
msgstr "Nissan Super GT2"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Supra Turbo"
msgstr "Supra Turbo"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "LFA"
msgstr "LFA"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Engine Sounds"
msgstr "엔진 사운드"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Plays on the car speakers through the Spotify and Phone Audio output."
msgstr "Spotify 및 휴대폰 오디오 출력을 통해 차량 스피커로 재생합니다."
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Choose an engine; it revs once so you can hear it."
msgstr "엔진을 선택하면 한 번 레브되어 소리를 들을 수 있습니다."
@@ -23513,3 +23513,82 @@ msgstr "Đánh lái và nút bấm"
msgid "Storage & Account"
msgstr "Bộ nhớ và tài khoản"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Plays a simulated engine on the car speakers that follows the accelerator pedal."
msgstr "Phát âm thanh động cơ mô phỏng trên loa xe, theo bàn đạp ga."
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Engine Type"
msgstr "Loại động cơ"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Chooses which engine is simulated."
msgstr "Chọn động cơ được mô phỏng."
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Engine Sound Volume"
msgstr "Âm lượng âm thanh động cơ"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Sets how loud the engine is before the car's own volume control."
msgstr "Đặt độ lớn của âm thanh động cơ trước núm âm lượng của xe."
#: openpilot/starpilot/galaxy/setting_descriptions.py
msgid "Plays a simulated engine on the car speakers that follows the accelerator pedal, including revving in Park or Neutral. Uses the audio output chosen under Spotify and Phone Audio, and goes quiet while an alert sounds."
msgstr "Phát âm thanh động cơ mô phỏng trên loa xe theo bàn đạp ga, kể cả khi rồ ga ở số P hoặc N. Dùng đầu ra âm thanh đã chọn trong Spotify và âm thanh điện thoại, và tắt tiếng khi có cảnh báo."
#: openpilot/starpilot/engine_sound/profiles.py
msgid "BMW M3"
msgstr "BMW M3"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "BMW M3 Deep"
msgstr "BMW M3 Deep"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "F1 Car"
msgstr "F1 Car"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Ferrari F136"
msgstr "Ferrari F136"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Hellcat"
msgstr "Hellcat"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Ioniq 5N Ignition"
msgstr "Ioniq 5N Ignition"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Jaguar F-Type"
msgstr "Jaguar F-Type"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Nissan Super GT1"
msgstr "Nissan Super GT1"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Nissan Super GT2"
msgstr "Nissan Super GT2"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Supra Turbo"
msgstr "Supra Turbo"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "LFA"
msgstr "LFA"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Engine Sounds"
msgstr "Âm thanh động cơ"
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Plays on the car speakers through the Spotify and Phone Audio output."
msgstr "Phát trên loa xe qua đầu ra Spotify và âm thanh điện thoại."
#: openpilot/starpilot/ui/sounds_owner.py
msgid "Choose an engine; it revs once so you can hear it."
msgstr "Chọn một động cơ; động cơ sẽ rồ ga một lần để bạn nghe thử."
File diff suppressed because it is too large Load Diff
-1
View File
@@ -29,7 +29,6 @@ def update_frame(preview=None, controllers=None, star=None, game_mode=None, arab
star._poll_projection_bookmark(time.monotonic_ns())
star._poll_projection_slc(time.monotonic_ns())
poll_screen_off_wheel(star, device.awake, time.monotonic_ns())
star._poll_detector()
if game_mode is not None:
game_mode()
if controllers is not None:
+2 -17
View File
@@ -45,9 +45,6 @@ def set_device_class(major: int, minor: int) -> bool:
BLUEZ = 'org.bluez'
ADAPTER = 'org.bluez.Adapter1'
DEVICE = 'org.bluez.Device1'
# BlueZ Connect failures that mean the device never answered.
UNREACHABLE_ERRORS = ('org.bluez.Error.Failed', 'org.bluez.Error.NotAvailable', 'org.bluez.Error.NotReady',
'org.bluez.Error.ConnectionAttemptFailed', 'org.bluez.Error.BREDR.ProfileUnavailable')
AGENT = 'org.bluez.Agent1'
AGENT_PATH = '/org/starpilot/bluetooth/pairing'
ADMISSION_LOCK = Path('/data/starpilot/bluetooth-owner.lock')
@@ -297,18 +294,8 @@ class BlueZ:
path = self._device_path(address)
if operation == 'forget':
self._call(adapter_path, ADAPTER, 'RemoveDevice', 'o', (path,))
elif operation == 'connect':
try:
self._call(path, DEVICE, 'Connect')
except TimeoutError:
raise BluetoothRejected('Device did not respond', code='unreachable') from None
except BluetoothRejected as error:
# Off, out of range or held by another phone/app; not a changed device.
if str(error) in UNREACHABLE_ERRORS:
raise BluetoothRejected(f'Device did not respond ({error})', code='unreachable') from None
raise
elif operation == 'disconnect':
self._call(path, DEVICE, 'Disconnect')
elif operation in ('connect', 'disconnect'):
self._call(path, DEVICE, operation.capitalize())
else:
raise ValueError('Unsupported Bluetooth operation')
@@ -596,7 +583,6 @@ class BluetoothOwner:
self.admission_lock = admission_lock
self.admission_file = None
self.power_change_active = False
self.uniden: Any = None
def _admission_enter(self) -> None:
if self.admission_file is not None:
@@ -965,7 +951,6 @@ class BluetoothOwner:
self._client().operation(operation, address)
if operation == 'forget':
assert address is not None
self.uniden = None
self._forget_starport_car(address)
if operation == 'power' and not enabled:
self.systemctl(['sudo', '-n', 'systemctl', 'stop', RADIO_UNIT], check=True, timeout=15)
@@ -838,32 +838,6 @@ class BluetoothOwnerTest(unittest.TestCase):
bluez.snapshot()
self.assertIn('Set', calls)
def test_connect_to_silent_device_reports_unreachable_not_changed(self):
bluez = BlueZ.__new__(BlueZ)
objects = {
'/org/bluez/hci0': {'org.bluez.Adapter1': {'Powered': ('b', True)}},
'/org/bluez/hci0/dev_AA_BB_CC_DD_EE_FF': {'org.bluez.Device1': {'Address': ('s', 'AA:BB:CC:DD:EE:FF'), 'Paired': ('b', True)}},
}
failure = []
def call(path, interface, member, signature=None, body=()):
if member == 'GetManagedObjects':
return (objects,)
raise failure[0]
self.enterContext(patch.object(bluez, '_call', call))
for error, code in [(BluetoothRejected('org.bluez.Error.Failed'), 'unreachable'), (TimeoutError(), 'unreachable'),
(BluetoothRejected('org.bluez.Error.NotAuthorized'), 'changed')]:
failure[:] = [error]
with self.assertRaises(BluetoothRejected) as raised:
bluez.operation('connect', 'AA:BB:CC:DD:EE:FF')
self.assertEqual(raised.exception.code, code)
failure[:] = [BluetoothRejected('org.bluez.Error.Failed')]
with self.assertRaises(BluetoothRejected) as raised:
bluez.operation('disconnect', 'AA:BB:CC:DD:EE:FF')
self.assertEqual(raised.exception.code, 'changed')
def test_each_bluez_close_releases_router_and_underlying_connection(self):
closed = []
+20 -7
View File
@@ -7,6 +7,7 @@ from openpilot.starpilot.car.mazda.dashboard import write_stop_sign
DRIVE_MODE_MAX_AGE_NS = 2_000_000_000
DRIVE_MODE_ECO = 4
DRIVE_MODE_SPORT = 5
ACCELERATOR_PEDAL_FULL = 254.0 # highest raw value seen at full travel on the Ioniq 6
def capable(cp):
@@ -17,16 +18,28 @@ def compose(cp, parsed, state, message, *, car_state_stamp):
if not capable(cp):
return message
message = write_stop_sign(parsed, state, message, car_state_stamp=car_state_stamp)
return write_drive_mode(parsed, state, message)
message = write_drive_mode(parsed, state, message)
return write_accelerator_pedal(parsed, state, message)
def _fresh(observation, state):
if type(observation) is not tuple or len(observation) != 2 or not state.canValid or state.canTimeout:
return None
value, stamp = observation
age = time.clock_gettime_ns(getattr(time, 'CLOCK_BOOTTIME', time.CLOCK_MONOTONIC)) - stamp
return value if 0 <= age <= DRIVE_MODE_MAX_AGE_NS else None
def write_accelerator_pedal(parsed, state, message):
pedal = _fresh(getattr(parsed, 'accelerator_pedal', None), state)
if pedal is not None:
message.starpilotCarState.acceleratorPedal = min(max(pedal / ACCELERATOR_PEDAL_FULL, 0.0), 1.0)
return message
def write_drive_mode(parsed, state, message):
observation = getattr(parsed, 'drive_mode', None)
if type(observation) is not tuple or len(observation) != 2 or not state.canValid or state.canTimeout:
return message
mode, stamp = observation
age = time.clock_gettime_ns(getattr(time, 'CLOCK_BOOTTIME', time.CLOCK_MONOTONIC)) - stamp
if 0 <= age <= DRIVE_MODE_MAX_AGE_NS:
mode = _fresh(getattr(parsed, 'drive_mode', None), state)
if mode is not None:
message.starpilotCarState.ecoGear = mode == DRIVE_MODE_ECO
message.starpilotCarState.sportGear = mode == DRIVE_MODE_SPORT
return message
@@ -4,7 +4,7 @@ from dataclasses import dataclass
from opendbc.car.gm.profiles import profiles_supported as gm_profiles_supported
import hashlib
from openpilot.starpilot.conditional_mode.manual import EXPERIMENTAL_MODE_ACTION, TRAFFIC_MODE_ACTION, ioniq6_media_eligible
from openpilot.starpilot.conditional_mode.manual import ACTION_COUNT, EXPERIMENTAL_MODE_ACTION, TRAFFIC_MODE_ACTION, ioniq6_media_eligible
from openpilot.starpilot.conditional_mode.preferences import MAX_DOCUMENT_BYTES, PreferenceError, decode_preferences
from openpilot.starpilot.saved_document import WriteResult, commit_exact
from openpilot.starpilot.saved_source import read_saved
@@ -22,7 +22,7 @@ SAFE_KEY = "SafeMode"
MAX_SCALAR_BYTES = 8
CHOICES = {"Off": b"0", "Cycle conditional mode": str(EXPERIMENTAL_MODE_ACTION).encode(),
"Toggle traffic mode": str(TRAFFIC_MODE_ACTION).encode(), "Switchback Mode": b"7"}
_CANONICAL_ACTIONS = frozenset(str(value).encode() for value in range(16))
_CANONICAL_ACTIONS = frozenset(str(value).encode() for value in range(ACTION_COUNT))
@dataclass(frozen=True)
@@ -23,6 +23,7 @@ from openpilot.starpilot.saved_source import read_saved
EXPERIMENTAL_MODE_ACTION = 5
TRAFFIC_MODE_ACTION = 6
ACTION_COUNT = 18
VERY_LONG_PRESS = 5 * CRUISE_LONG_PRESS
MEDIA_LONG_NS = CRUISE_LONG_PRESS * 10_000_000 # Convert 100 Hz ticks to source-packet nanoseconds.
MEDIA_VERY_LONG_NS = VERY_LONG_PRESS * 10_000_000
@@ -108,7 +109,7 @@ def _action(params, key: str) -> int | None:
if raw is None:
return 0
# Registered INT defaults and Params::put values are canonical decimal.
if raw not in tuple(str(value).encode() for value in range(16)):
if raw not in tuple(str(value).encode() for value in range(ACTION_COUNT)):
return None
return int(raw)
+7 -46
View File
@@ -7,7 +7,6 @@ from itertools import islice
import os
from pathlib import Path
import re
import secrets
import stat
import struct
import time
@@ -96,60 +95,22 @@ def _button_capable(sysfs: Path) -> bool:
any(ABS_HAT0X <= axis <= ABS_HAT3Y for axis in axes)
def _external(name: str) -> tuple[Path, re.Match[str]] | None:
"""The sysfs device and modalias of a USB or Bluetooth event node."""
if not EVENT_NAME.fullmatch(name):
return None
sysfs = SYS_ROOT / name / "device"
match = MODALIAS.match(_text(sysfs / "modalias"))
if match is None or int(match[1], 16) not in EXTERNAL_BUSES:
return None
return sysfs, match
def _inspect(path: Path) -> _Identity | None:
external = _external(path.name)
if external is None or not _button_capable(external[0]):
if not EVENT_NAME.fullmatch(path.name):
return None
sysfs = SYS_ROOT / path.name / "device"
match = MODALIAS.match(_text(sysfs / "modalias"))
if match is None:
return None
sysfs, match = external
bus, vendor, product, _version = (int(token, 16) for token in match.groups())
if bus not in EXTERNAL_BUSES or not _button_capable(sysfs):
return None
name = _text(sysfs / "name") or "External input"
uniq = _text(sysfs / "uniq")
identity = f"{bus:04x}:{vendor:04x}:{product:04x}:{name.casefold()}:{uniq.casefold()}"
return _Identity(path, hashlib.sha256(identity.encode()).hexdigest()[:20], name[:80], bus)
def controller_input_report() -> dict:
"""Snapshot external input interfaces, including ones omitted from Attached Controllers; names are masked."""
devices = []
groups: dict[str, list[str]] = {}
salt = secrets.token_bytes(8) # equal names match within one report only
truncated = False
for entry in sorted(SYS_ROOT.iterdir()):
if (external := _external(entry.name)) is None:
continue
if len(devices) == MAX_CANDIDATES:
truncated = True
break
device, match = external
identity = _inspect(DEV_ROOT / entry.name)
if identity is not None:
groups.setdefault(identity.device_id, []).append(entry.name)
name = _text(device / "name")
devices.append({
"event": entry.name, "name": f"masked-{hashlib.sha256(salt + name.encode()).hexdigest()[:8]}" if name else "", "inputId": match[0],
"properties": _text(device / "properties"),
"capabilities": {key: _text(device / "capabilities" / key) for key in ("ev", "key", "rel", "abs")},
"discovery": "eligible" if identity else "filtered",
"eventNodePresent": (DEV_ROOT / entry.name).exists(),
})
duplicates = {event: events for events in groups.values() if len(events) > 1 for event in events}
for row in devices:
if row["event"] in duplicates:
row.update(discovery="duplicate identity", matchingEvents=duplicates[row["event"]])
return {"externalInputInterfaces": devices, "truncated": truncated}
def _fresh(seconds: int, microseconds: int, now_ns: int) -> int | None:
if seconds < 0 or not 0 <= microseconds < 1_000_000:
return None
@@ -260,41 +260,3 @@ def test_device_and_scan_candidate_caps(kernel):
reader.poll(NOW + source.RESCAN_NS)
assert reader.devices() == []
reader.close()
def test_report_includes_filtered_and_duplicate_external_interfaces(monkeypatch, tmp_path):
kernel = Kernel(monkeypatch, tmp_path)
kernel.device(1, bus=5)
kernel.device(2, bus=5)
kernel.device(3, bus=5, keys=(115,), rel=(0, 1))
kernel.device(4, bus=5, name="Media", keys=(115,))
kernel.device(5, bus=1)
report = source.controller_input_report()
rows = report["externalInputInterfaces"]
assert [row["discovery"] for row in rows] == ["duplicate identity", "duplicate identity", "filtered", "eligible"]
assert rows[0]["matchingEvents"] == ["event1", "event2"]
assert rows[2]["capabilities"]["rel"] == "3"
assert not report["truncated"]
assert not kernel.path_by_fd
def test_report_masks_names(monkeypatch, tmp_path):
kernel = Kernel(monkeypatch, tmp_path)
kernel.device(1, bus=5, name="Danny's Pad")
kernel.device(2, bus=5, name="Danny's Pad", uniq="02")
kernel.device(3, bus=5, name="Media", keys=(115,))
report = source.controller_input_report()
names = [row["name"] for row in report["externalInputInterfaces"]]
assert all(name.startswith("masked-") for name in names)
assert names[0] == names[1] != names[2]
assert "Danny" not in str(report) and "Media" not in str(report)
assert source.controller_input_report()["externalInputInterfaces"][0]["name"] != names[0]
def test_report_is_capped(monkeypatch, tmp_path):
kernel = Kernel(monkeypatch, tmp_path)
for index in range(source.MAX_CANDIDATES + 1):
kernel.device(index, bus=5, uniq=str(index))
report = source.controller_input_report()
assert len(report["externalInputInterfaces"]) == source.MAX_CANDIDATES
assert report["truncated"]
@@ -9,7 +9,8 @@ from openpilot.selfdrive.car.card import Car
from openpilot.selfdrive.car.tests.publication_fixture import initialize_publication_sources
from openpilot.selfdrive.car.cruise import CRUISE_LONG_PRESS, VCruiseHelper
from openpilot.selfdrive.car.tests.test_hyundai_aol import candidate
from openpilot.starpilot.controllers.wheel_actions import ACTIONS, KEYS, SCREEN_OFF_ACTION, WheelConsumer, WheelPublisher, capture
from openpilot.starpilot.controllers.wheel_actions import (ACTIONS, ENGINE_SOUND_ACTIONS, KEYS, SCREEN_OFF_ACTION, WheelConsumer,
WheelPublisher, capture)
TYPE = car.CarState.ButtonEvent.Type
@@ -53,7 +54,7 @@ def context(tmp_path):
def test_exact_catalog_and_missing_vs_saved_off(context):
params, _ = context
assert sorted(ACTIONS.values()) == list(range(16))
assert sorted(ACTIONS.values()) == list(range(18))
assert ACTIONS["Toggle Screen Off"] == SCREEN_OFF_ACTION
assert len(KEYS) == 15
assert capture(params)['DistanceButtonControl'] == 1
@@ -79,7 +80,8 @@ def test_screen_off_is_directly_assignable_without_longitudinal_control(context)
assert capture(params)[key] == SCREEN_OFF_ACTION
@pytest.mark.parametrize('key,code', [('DistanceButtonControl', code) for code in (1, 2, 5, 6, 7, 8, 11, 12, 13, 14, SCREEN_OFF_ACTION)])
@pytest.mark.parametrize('key,code', [('DistanceButtonControl', code) for code in (1, 2, 5, 6, 7, 8, 11, 12, 13, 14, SCREEN_OFF_ACTION,
*ENGINE_SOUND_ACTIONS)])
def test_real_distance_short_delivers_once_and_claims_serialized_release(context, key, code):
params, cp = context
params.put(key, code, block=True)
@@ -15,9 +15,11 @@ ACTIONS = {
"Off": 0, "Cycle personality": 1, "Force coast": 2, "Pause steering": 3, "Pause longitudinal": 4,
"Experimental override": 5, "Traffic mode": 6, "Switchback Mode": 7, "Bookmark": 8,
"Toggle AOL": 9, "Adopt speed limit": 10, "Quick Select 1": 11, "Quick Select 2": 12,
"Quick Select 3": 13, "Pulse and glide": 14, "Toggle Screen Off": SCREEN_OFF_ACTION,
"Quick Select 3": 13, "Pulse and glide": 14, "Toggle Screen Off": SCREEN_OFF_ACTION, "Toggle Engine Sounds": 16,
"Next Engine Sound": 17,
}
ACTION_VALUES = frozenset(str(value).encode() for value in ACTIONS.values())
ENGINE_SOUND_ACTIONS = (16, 17)
KEYS = ("LKASButtonControl", "MainCruiseButtonControl", "DistanceButtonControl", "LongDistanceButtonControl",
"VeryLongDistanceButtonControl", "CancelButtonControl", "LongCancelButtonControl", "VeryLongCancelButtonControl",
"ModeButtonControl", "LongModeButtonControl", "VeryLongModeButtonControl", "StarButtonControl",
@@ -25,7 +27,7 @@ KEYS = ("LKASButtonControl", "MainCruiseButtonControl", "DistanceButtonControl",
PADDLE_KEY = "LeftPaddleButtonControl"
LIFETIME_NS = 250_000_000
SESSION = re.compile(r"[0-9a-f]{32}\Z")
DELIVERED_ACTIONS = frozenset((1, 2, 5, 6, 7, 8, 10, 11, 12, 13, 14, SCREEN_OFF_ACTION))
DELIVERED_ACTIONS = frozenset((1, 2, 5, 6, 7, 8, 10, 11, 12, 13, 14, SCREEN_OFF_ACTION, *ENGINE_SOUND_ACTIONS))
DEFAULTS = {"DistanceButtonControl": 1, "LongDistanceButtonControl": 5, "VeryLongDistanceButtonControl": 6}
BUTTON_KEYS = {
Button.LKAS: (KEYS[0],), Button.DISTANCE: KEYS[2:5], Button.MODE: KEYS[8:11], Button.CUSTOM: KEYS[11:14],
@@ -0,0 +1,62 @@
The loops in these banks were rendered with tools/make_bank.py, then lowered with tools/lower_bank.py
at its default settings.
From the engine scripts of engine-sim (https://github.com/ange-yaghi/engine-sim,
commit 85f7c3b959a908ed5232ede4f1a4ac7eafe6b630), recorded with tools/esrec:
f1_car assets/engines/atg-video-2/12_ferrari_412_t2.mr
ferrari_f136 assets/engines/atg-video-2/08_ferrari_f136_v8.mr
lfa assets/engines/atg-video-2/10_lfa_v10.mr
supra_turbo assets/engines/atg-video-2/03_2jz.mr, its off_3450 loop then lowered 6.1 dB to the level of its neighbours
bmw_m3 assets/engines/bmw/M52B28.mr, lowered again with tools/lower_bank.py --pitch 1.15 --bass 3 --treble -3
--off-mix 0 --off-mid 0
bmw_m3_deep assets/engines/bmw/M52B28.mr, lowered again with tools/lower_bank.py --pitch 1.5 --bass 8 --treble -9
--off-mix 0 --off-mid 0
From recordings of real cars supplied for this project, built with tools/bank_from_recording.py:
hellcat hellcat.wav: --cylinders 8 --anchor 14 700 --idle 10.5-17.5 --on 25-94 --off 94-119,
then equalised with tools/lower_bank.py --pitch 1.0 --off-mix 0 --off-mid 0
ioniq_5n Ioniq5.mp3 (the Ioniq 5 N's Ignition sound), its closing video fade from 52 s divided back out first:
--cylinders 6 (the comb's strongest line is the 6th) --half-orders --anchor 6 6180 --anchor 20.5 7140
--on 4.6-6.8 10.2-11.7 16-17.3 17.6-21.3 31.5-33.4 34-35.2 35.6-37.9 41.5-43.3 43.5-44.6 46-48.2
--off 12-14.3 22.6-25.1 48.5-49.9 50.3-57.9 --idle 57.9-59.7 --denoise 15, leaving out the stretches with
tyre squeal
jaguar_ftype Jaguar2.wav: --cylinders 8 --half-orders --anchor 17 721 --anchor 40 5122 --anchor 66 4402
--idle 14.5-19.5 --on 20.5-45.8 52-77 --denoise 10, not equalised (the in-car recording is already
bass-heavy); the 750 rpm loop (a second idle) and the 3500 rpm loop (dominated by crank-rate boom) removed
nissan_super_gt NissanSuperGT.wav: --cylinders 8 --half-orders, rpm labelled as 120 x the spacing of its harmonic
comb (whether that is rpm/120 or rpm/60 cannot be told from the recording; the profile uses the same
units, so the pitch is right either way), pinned with --anchor at every 0.25 s point whose comb
measured clearly, --idle 18.6-19.6 --on 9-17 19.7-65 79.4-88.2 --off 9-17 65-71 74.2-76 79.4-88.2,
then the recording's wind hiss lowered 18 dB between the engine orders (fading in from 500 Hz, full
from 1 kHz up) and equalised with tools/lower_bank.py --pitch 1.0 --bass 4 --treble -8 --off-mix 0
--off-mid 0
nissan_super_gt2 the same loops, hiss lowered the same way, equalised with tools/lower_bank.py --pitch 1.3 --bass 6
--treble -10 --off-mix 0 --off-mid 0
turbo/blowoff.wav is the blow-off flutter from 11.89-14.45 s of flutter.wav, a recording supplied for this project,
with the recording's own engine taken out from under it (high-passed at 180 Hz and its steady spectrum subtracted).
pops/burble_grains.wav is the 62 pops of the two overrun bursts at 6.35-7.5 s and 9.85-11.3 s of burbles.wav, a
recording supplied for this project: 52 ms from 2 ms before each pop, band-passed 100 Hz-20 kHz, each normalised.
engine-sim is distributed under the following license:
MIT License
Copyright 2022 AngeTheGreat (Ange Yaghi)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,114 @@
{
"version": 1,
"source": "engine-sim engines/bmw/M52B28.mr",
"layers": {
"on": [
{
"rpm": 1208,
"file": "on_1208.wav"
},
{
"rpm": 2070,
"file": "on_2070.wav"
},
{
"rpm": 2932,
"file": "on_2932.wav"
},
{
"rpm": 3795,
"file": "on_3795.wav"
},
{
"rpm": 4658,
"file": "on_4658.wav"
},
{
"rpm": 5520,
"file": "on_5520.wav"
},
{
"rpm": 6382,
"file": "on_6382.wav"
},
{
"rpm": 7245,
"file": "on_7245.wav"
},
{
"rpm": 8107,
"file": "on_8107.wav"
},
{
"rpm": 8970,
"file": "on_8970.wav"
},
{
"rpm": 9832,
"file": "on_9832.wav"
},
{
"rpm": 10695,
"file": "on_10695.wav"
},
{
"rpm": 11558,
"file": "on_11558.wav"
}
],
"off": [
{
"rpm": 1208,
"file": "off_1208.wav"
},
{
"rpm": 2070,
"file": "off_2070.wav"
},
{
"rpm": 2932,
"file": "off_2932.wav"
},
{
"rpm": 3795,
"file": "off_3795.wav"
},
{
"rpm": 4658,
"file": "off_4658.wav"
},
{
"rpm": 5520,
"file": "off_5520.wav"
},
{
"rpm": 6382,
"file": "off_6382.wav"
},
{
"rpm": 7245,
"file": "off_7245.wav"
},
{
"rpm": 8107,
"file": "off_8107.wav"
},
{
"rpm": 8970,
"file": "off_8970.wav"
},
{
"rpm": 9832,
"file": "off_9832.wav"
},
{
"rpm": 10695,
"file": "off_10695.wav"
},
{
"rpm": 11558,
"file": "off_11558.wav"
}
]
}
}
@@ -0,0 +1,114 @@
{
"version": 1,
"source": "engine-sim engines/bmw/M52B28.mr",
"layers": {
"on": [
{
"rpm": 1575,
"file": "on_1575.wav"
},
{
"rpm": 2700,
"file": "on_2700.wav"
},
{
"rpm": 3825,
"file": "on_3825.wav"
},
{
"rpm": 4950,
"file": "on_4950.wav"
},
{
"rpm": 6075,
"file": "on_6075.wav"
},
{
"rpm": 7200,
"file": "on_7200.wav"
},
{
"rpm": 8325,
"file": "on_8325.wav"
},
{
"rpm": 9450,
"file": "on_9450.wav"
},
{
"rpm": 10575,
"file": "on_10575.wav"
},
{
"rpm": 11700,
"file": "on_11700.wav"
},
{
"rpm": 12825,
"file": "on_12825.wav"
},
{
"rpm": 13950,
"file": "on_13950.wav"
},
{
"rpm": 15075,
"file": "on_15075.wav"
}
],
"off": [
{
"rpm": 1575,
"file": "off_1575.wav"
},
{
"rpm": 2700,
"file": "off_2700.wav"
},
{
"rpm": 3825,
"file": "off_3825.wav"
},
{
"rpm": 4950,
"file": "off_4950.wav"
},
{
"rpm": 6075,
"file": "off_6075.wav"
},
{
"rpm": 7200,
"file": "off_7200.wav"
},
{
"rpm": 8325,
"file": "off_8325.wav"
},
{
"rpm": 9450,
"file": "off_9450.wav"
},
{
"rpm": 10575,
"file": "off_10575.wav"
},
{
"rpm": 11700,
"file": "off_11700.wav"
},
{
"rpm": 12825,
"file": "off_12825.wav"
},
{
"rpm": 13950,
"file": "off_13950.wav"
},
{
"rpm": 15075,
"file": "off_15075.wav"
}
]
}
}
@@ -0,0 +1,138 @@
{
"version": 1,
"source": "engine-sim engines/atg-video-2/12_ferrari_412_t2.mr",
"layers": {
"on": [
{
"rpm": 3000,
"file": "on_3000.wav"
},
{
"rpm": 4500,
"file": "on_4500.wav"
},
{
"rpm": 6000,
"file": "on_6000.wav"
},
{
"rpm": 7500,
"file": "on_7500.wav"
},
{
"rpm": 9000,
"file": "on_9000.wav"
},
{
"rpm": 10500,
"file": "on_10500.wav"
},
{
"rpm": 12000,
"file": "on_12000.wav"
},
{
"rpm": 13500,
"file": "on_13500.wav"
},
{
"rpm": 15000,
"file": "on_15000.wav"
},
{
"rpm": 16500,
"file": "on_16500.wav"
},
{
"rpm": 18000,
"file": "on_18000.wav"
},
{
"rpm": 19500,
"file": "on_19500.wav"
},
{
"rpm": 21000,
"file": "on_21000.wav"
},
{
"rpm": 22500,
"file": "on_22500.wav"
},
{
"rpm": 24000,
"file": "on_24000.wav"
},
{
"rpm": 25500,
"file": "on_25500.wav"
}
],
"off": [
{
"rpm": 3000,
"file": "off_3000.wav"
},
{
"rpm": 4500,
"file": "off_4500.wav"
},
{
"rpm": 6000,
"file": "off_6000.wav"
},
{
"rpm": 7500,
"file": "off_7500.wav"
},
{
"rpm": 9000,
"file": "off_9000.wav"
},
{
"rpm": 10500,
"file": "off_10500.wav"
},
{
"rpm": 12000,
"file": "off_12000.wav"
},
{
"rpm": 13500,
"file": "off_13500.wav"
},
{
"rpm": 15000,
"file": "off_15000.wav"
},
{
"rpm": 16500,
"file": "off_16500.wav"
},
{
"rpm": 18000,
"file": "off_18000.wav"
},
{
"rpm": 19500,
"file": "off_19500.wav"
},
{
"rpm": 21000,
"file": "off_21000.wav"
},
{
"rpm": 22500,
"file": "off_22500.wav"
},
{
"rpm": 24000,
"file": "off_24000.wav"
},
{
"rpm": 25500,
"file": "off_25500.wav"
}
]
}
}

Some files were not shown because too many files have changed in this diff Show More