Nissan Super GT

This commit is contained in:
whoisdomi
2026-11-17 04:24:44 -06:00
parent 525eb79062
commit 807ff54358
47 changed files with 226 additions and 10 deletions
@@ -23519,6 +23519,10 @@ msgstr ""
msgid "Jaguar F-Type"
msgstr ""
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Nissan Super GT"
msgstr ""
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Supra Turbo"
msgstr ""
@@ -23538,6 +23538,10 @@ msgstr "Hellcat"
msgid "Jaguar F-Type"
msgstr "Jaguar F-Type"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Nissan Super GT"
msgstr "Nissan Super GT"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Supra Turbo"
msgstr "Supra Turbo"
@@ -23538,6 +23538,10 @@ msgstr "Hellcat"
msgid "Jaguar F-Type"
msgstr "Jaguar F-Type"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Nissan Super GT"
msgstr "Nissan Super GT"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Supra Turbo"
msgstr "Supra Turbo"
@@ -23538,6 +23538,10 @@ msgstr "Hellcat"
msgid "Jaguar F-Type"
msgstr "Jaguar F-Type"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Nissan Super GT"
msgstr "Nissan Super GT"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Supra Turbo"
msgstr "Supra Turbo"
@@ -23534,6 +23534,10 @@ msgstr "Hellcat"
msgid "Jaguar F-Type"
msgstr "Jaguar F-Type"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Nissan Super GT"
msgstr "Nissan Super GT"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Supra Turbo"
msgstr "Supra Turbo"
@@ -23534,6 +23534,10 @@ msgstr "Hellcat"
msgid "Jaguar F-Type"
msgstr "Jaguar F-Type"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Nissan Super GT"
msgstr "Nissan Super GT"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Supra Turbo"
msgstr "Supra Turbo"
@@ -23534,6 +23534,10 @@ msgstr "Hellcat"
msgid "Jaguar F-Type"
msgstr "Jaguar F-Type"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Nissan Super GT"
msgstr "Nissan Super GT"
#: openpilot/starpilot/engine_sound/profiles.py
msgid "Supra Turbo"
msgstr "Supra Turbo"
@@ -17,6 +17,11 @@ From recordings of real cars supplied for this project, built with tools/bank_fr
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,
not equalised
engine-sim is distributed under the following license:
@@ -0,0 +1,134 @@
{
"version": 1,
"source": "recording NissanSuperGT.wav",
"layers": {
"off": [
{
"rpm": 1556,
"file": "off_1556.wav"
},
{
"rpm": 4000,
"file": "off_4000.wav"
},
{
"rpm": 4250,
"file": "off_4250.wav"
},
{
"rpm": 4500,
"file": "off_4500.wav"
},
{
"rpm": 4750,
"file": "off_4750.wav"
},
{
"rpm": 5000,
"file": "off_5000.wav"
},
{
"rpm": 5250,
"file": "off_5250.wav"
},
{
"rpm": 5500,
"file": "off_5500.wav"
},
{
"rpm": 5750,
"file": "off_5750.wav"
},
{
"rpm": 6000,
"file": "off_6000.wav"
},
{
"rpm": 6250,
"file": "off_6250.wav"
},
{
"rpm": 6500,
"file": "off_6500.wav"
},
{
"rpm": 6750,
"file": "off_6750.wav"
},
{
"rpm": 7000,
"file": "off_7000.wav"
}
],
"on": [
{
"rpm": 1556,
"file": "on_1556.wav"
},
{
"rpm": 3250,
"file": "on_3250.wav"
},
{
"rpm": 3500,
"file": "on_3500.wav"
},
{
"rpm": 3750,
"file": "on_3750.wav"
},
{
"rpm": 4000,
"file": "on_4000.wav"
},
{
"rpm": 4250,
"file": "on_4250.wav"
},
{
"rpm": 4500,
"file": "on_4500.wav"
},
{
"rpm": 4750,
"file": "on_4750.wav"
},
{
"rpm": 5000,
"file": "on_5000.wav"
},
{
"rpm": 5250,
"file": "on_5250.wav"
},
{
"rpm": 5500,
"file": "on_5500.wav"
},
{
"rpm": 5750,
"file": "on_5750.wav"
},
{
"rpm": 6000,
"file": "on_6000.wav"
},
{
"rpm": 6250,
"file": "on_6250.wav"
},
{
"rpm": 6500,
"file": "on_6500.wav"
},
{
"rpm": 6750,
"file": "on_6750.wav"
},
{
"rpm": 7000,
"file": "on_7000.wav"
}
]
}
}
+11 -4
View File
@@ -58,14 +58,18 @@ RACE_REDLINE = 8600.0
def _recorded(name: str, label: str, *, cylinders: int, idle: float, redline: float, loops: str = '', pops: float = 0.0,
turbo: float = 0.0) -> Profile:
"""A bundled loop bank (of the same name unless given), geared like the race car but scaled to its own rev range."""
scale = redline / RACE_REDLINE
turbo: float = 0.0, upshift: float = 0.38, downshift: float = 0.2, gearing: float = 1.0) -> Profile:
"""A bundled loop bank (of the same name unless given), geared like the race car but scaled to its own rev range.
upshift and downshift are the light-throttle shift points as shares of redline; full throttle always shifts at 96%.
gearing above 1 makes every gear shorter, so road speed turns into more rpm.
"""
scale = redline / RACE_REDLINE * gearing
return Profile(
name=name, label=label, loops=loops or name, pops=pops, turbo=turbo,
idle_rpm=idle, redline_rpm=redline,
gears=tuple(ratio * scale for ratio in RACE_GEARS),
upshift_rpm=(0.38 * redline, 0.96 * redline), downshift_rpm=(0.2 * redline, 0.6 * redline),
upshift_rpm=(upshift * redline, 0.96 * redline), downshift_rpm=(downshift * redline, max(0.6, downshift + 0.25) * redline),
launch_slip_rpm=0.4 * redline, rev_seconds=0.8, rise_seconds=0.08, fall_seconds=0.35, limiter=True,
partials=_engine_partials(firing=cylinders, count=40, rough=0.25, bright=0.5),
noise=(0.03, 0.18), gain=(0.7, 1.0),
@@ -81,6 +85,9 @@ PROFILES: dict[str, Profile] = {profile.name: profile for profile in (
_recorded('hellcat', 'Hellcat', cylinders=8, idle=700.0, redline=4500.0),
_recorded('jaguar_ftype', 'Jaguar F-Type', cylinders=8, idle=721.0, redline=6500.0, pops=1.0),
_recorded('lfa', 'LFA', cylinders=10, idle=1000.0, redline=9000.0),
# Recorded only at idle and from 3250 rpm up, so it is geared short and shifts like a race car to stay in that range.
_recorded('nissan_super_gt', 'Nissan Super GT', cylinders=4, idle=1556.0, redline=7500.0, upshift=0.62, downshift=0.45,
gearing=1.2),
_recorded('supra_turbo', 'Supra Turbo', cylinders=6, idle=800.0, redline=6000.0, turbo=1.0),
)}
@@ -112,7 +112,8 @@ def test_drivers_pedal_sets_the_load_even_when_the_car_pulls_hard():
assert run(model, 1.0, 0.25, 8.0, 2.5, True)[1] == pytest.approx(0.25, abs=0.02)
@pytest.mark.parametrize('name', [name for name, profile in PROFILES.items() if profile.gears])
@pytest.mark.parametrize('name', [name for name, profile in PROFILES.items()
if profile.gears and profile.upshift_rpm[0] <= 0.4 * profile.redline_rpm])
def test_light_pedal_shifts_well_below_the_top_of_the_rev_range(name):
profile = PROFILES[name]
model = EngineModel(profile)
@@ -0,0 +1,35 @@
import pytest
from openpilot.starpilot.engine_sound.model import EngineModel
from openpilot.starpilot.engine_sound.profiles import PROFILES, RACE_GEARS, RACE_REDLINE
DT = 0.01
SUPER_GT_RECORDED_FROM = 3250.0
@pytest.mark.parametrize('name', [name for name in PROFILES if name != 'nissan_super_gt'])
def test_default_gearing_and_shift_points(name):
p = PROFILES[name]
assert p.upshift_rpm == pytest.approx((0.38 * p.redline_rpm, 0.96 * p.redline_rpm))
assert p.downshift_rpm == pytest.approx((0.2 * p.redline_rpm, 0.6 * p.redline_rpm))
assert p.gears == pytest.approx(tuple(ratio * p.redline_rpm / RACE_REDLINE for ratio in RACE_GEARS))
def test_super_gt_is_geared_short_and_holds_revs():
p = PROFILES['nissan_super_gt']
assert p.gears[0] == pytest.approx(RACE_GEARS[0] * p.redline_rpm / RACE_REDLINE * 1.2)
assert p.upshift_rpm[0] == pytest.approx(0.62 * p.redline_rpm)
assert p.downshift_rpm == pytest.approx((0.45 * p.redline_rpm, 0.7 * p.redline_rpm))
def test_super_gt_light_pedal_stays_in_the_recorded_range_and_clear_of_redline():
p = PROFILES['nissan_super_gt']
model = EngineModel(p)
speed, revs = 0.0, []
while speed < 30.0:
speed += 1.2 * DT
revs.append(model.update(DT, 0.25, speed, 1.2, True)[0])
cruising = [rpm for rpm, v in zip(revs, (DT * 1.2 * i for i in range(len(revs))), strict=True) if v > 8.0]
assert min(cruising) > SUPER_GT_RECORDED_FROM
assert max(revs) < 0.75 * p.redline_rpm
assert model.gear >= 3
@@ -272,7 +272,7 @@ assert.equal(previewVolume.vm.soundError, "Keep the comma offroad")
assert.equal(previewVolume.vm.previewLabel, "Test alert")
{
const engine = control({ label: "Engine Type", value: "LFA", choices: ["BMW M3", "BMW M52","F1 Car","Ferrari F136", "Hellcat", "Jaguar F-Type", "LFA", "Supra Turbo"],
const engine = control({ label: "Engine Type", value: "LFA", choices: ["BMW M3", "BMW M52","F1 Car","Ferrari F136", "Hellcat", "Jaguar F-Type", "LFA", "Nissan Super GT", "Supra Turbo"],
available: true, action: true, previewSound: "EngineSoundProfile" })
assert.equal(settingControl(engine.vm.row), "select")
assert.equal(engine.vm.previewLabel, "Rev engine")
@@ -122,7 +122,7 @@ class SoundsSettingsTests(unittest.TestCase):
self.params.put("EngineSoundProfile", "race_car", block=True)
row = self.row("EngineSoundProfile")
self.assertEqual((row.value, row.repair_value), ("LFA", ""))
self.assertEqual([r.value for r in self.owner.engine_type_snapshot().rows], ["", "", "", "", "", "", "Active", ""])
self.assertEqual([r.value for r in self.owner.engine_type_snapshot().rows], ["", "", "", "", "", "", "Active", "", ""])
self.assertTrue(self.owner.apply(FeatureSettingsRequest("EngineSoundProfile", row.source, "BMW M52")))
self.assertEqual(self.params.get("EngineSoundProfile"), "bmw_m52")
@@ -161,14 +161,14 @@ class SoundsSettingsTests(unittest.TestCase):
[("BMW M3", "", (("Use", True),)), ("BMW M52", "", (("Use", True),)), ("F1 Car", "", (("Use", True),)),
("Ferrari F136", "", (("Use", True),)), ("Hellcat", "", (("Use", True),)),
("Jaguar F-Type", "", (("Use", True),)), ("LFA", "Active", (("Active", True),)),
("Supra Turbo", "", (("Use", True),))])
("Nissan Super GT", "", (("Use", True),)), ("Supra Turbo", "", (("Use", True),))])
stale = picker.rows[1]
request = owner.engine_choice_request(stale)
assert request is not None
self.assertTrue(owner.apply(request))
self.assertEqual((self.params.get("EngineSoundProfile"), revs), ("bmw_m52", [1]))
picker = owner.engine_type_snapshot()
self.assertEqual([row.value for row in picker.rows], ["", "Active", "", "", "", "", "", ""])
self.assertEqual([row.value for row in picker.rows], ["", "Active", "", "", "", "", "", "", ""])
replay = owner.engine_choice_request(picker.rows[1])
assert replay is not None
self.assertTrue(owner.apply(replay))
@@ -32242,6 +32242,12 @@
"openpilot/starpilot/engine_sound/profiles.py"
]
},
{
"source": "Nissan Super GT",
"refs": [
"openpilot/starpilot/engine_sound/profiles.py"
]
},
{
"source": "Supra Turbo",
"refs": [
+1 -1
View File
@@ -1 +1 @@
{"protected_inventory_sha256": "372391472fc99b83c7071e2210fe34e741e6b1e720ffb0c821cc94f2e7f5bf95", "schema_version": 1}
{"protected_inventory_sha256": "60169ddc374d4c16f1fc902fc4182dc76c8f43c7f794491f9d2f126d201e38a1", "schema_version": 1}