mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-08-21 08:14:00 +08:00
VW MQB: Fahrzeuglängsbeschleunigungssteuerungseinrichtung (#22963)
* can I kick it? * bumpity bump bump * bump panda * everybody's gotta be special * attempt at improving stopping/starting * reduce lateral feedforward * tweak gradient and comfort bands * oops * accel from the dept of redundancy dept * bump opendbc * jerk limiter not needed and causing problems * don't leave stop/start flags hung when not enabled * reduce comfort band with lead car * borrow decel comp from HKG * align stopping state thresholds * (re)try letting PI clean up some of this * bump panda * tweaks and comments * elide superfluous import * VW MQB: Longitudinal prereqs * gate this too * bump CI * cleanup * more cleanup; require gateway integration * don't run long state/actuators unless sending message * setpoint visibility in instrument cluster * show fixed lead car if lead visible * hold my beer? * tuning * the code is darkest before the refactor * a little more * set freewheel and stop distance correctly * rounding issue maybe? * ACC_04 Charisma profiles and HUD alerts * fix ACC_04 counter, fix gradient and accel bugs * revert tuning change in upstream focused branch * need 0.5m/s to leave * reduced braking when not absolutely needed * oops * bump panda * match opendbc to master * filter ACC_13, disable secondary accel * bump panda * bump panda * bump opendbc and panda * startAccel is deprecated * testing manual trans min engage speeds * pass stock ACC type to TSK * bump panda * bump opendbc * bump opendbc * test hax for Brake alert * remove ACC_13 with matching panda bump * fix submodule refs * update long control safety param name * bump panda * actuator delay corrected by Mk1 eyeball * a little more * tweak stop/start thresholds * Revert "tweak stop/start thresholds" This reverts commit 60abd57d2025c3218f069dbec4600c8d14033c05. * more lag reduction * bump opendbc * support both analog and digital clusters * tuning adjustments * bump opendbc and panda * accept two button types for resume * support separate set and resume * bump panda * #24706 * partial revert 6b93ac27 * fixes * one more * refactor all the things * follow experimental long refactor * fill in ACC hud status * temp force E2E availability * start cleaning up * comment touchup * gimme some comfort baby * experiment * SnG me maybe? * a little more rollout * is this why I'm not leaving? * turns out you need startAccel to leave * try without ACC_04 * cleanup unused variables * temp hack to standstill handling * temp hack to button handling * trim rollout distance with slower vEgoStopping * ultra fat comfort band due to noisy E2E actuator * I like big changes and I cannot lie * remove lead car display for now * cleanup, drives somewhat better * partial FtS/basic support * diff reduction * not needed * more cleanup * oops * more cleanup * restore lead car visible for PQ * bump panda * better enable button solution * redundant * OP long on *all* the things * OP long on all the things *sometimes* * docs generator a little TOO clever * solve starting-state a different way * try that again * bump panda * oops * follow DBC refactor * retry CI * signal name changed * sync with custom enable button branch * oops * more follow refactor * bump panda * sync opendbc to master * bump panda * updated comments * light P, no I * bump panda * bump panda again * add openpilot long test_models route * bump panda with replay route * temporarily disable experimental long for merge * bump panda to master * resolve conflict? * now can we go to head? * explicit length check * update refs Co-authored-by: Comma Device <device@comma.ai> Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com> old-commit-hash: b31b0310444e83dc8e151767f57ee21f46f1515b
This commit is contained in:
+1
-1
Submodule panda updated: 997e328074...0ca6d9d924
@@ -172,7 +172,8 @@ routes = [
|
||||
|
||||
CarTestRoute("202c40641158a6e5|2021-09-21--09-43-24", VOLKSWAGEN.ARTEON_MK1),
|
||||
CarTestRoute("2c68dda277d887ac|2021-05-11--15-22-20", VOLKSWAGEN.ATLAS_MK1),
|
||||
CarTestRoute("cae14e88932eb364|2021-03-26--14-43-28", VOLKSWAGEN.GOLF_MK7),
|
||||
CarTestRoute("cae14e88932eb364|2021-03-26--14-43-28", VOLKSWAGEN.GOLF_MK7), # Stock ACC
|
||||
CarTestRoute("3cfdec54aa035f3f|2022-10-13--14-58-58", VOLKSWAGEN.GOLF_MK7), # openpilot longitudinal
|
||||
CarTestRoute("58a7d3b707987d65|2021-03-25--17-26-37", VOLKSWAGEN.JETTA_MK7),
|
||||
CarTestRoute("4d134e099430fba2|2021-03-26--00-26-06", VOLKSWAGEN.PASSAT_MK8),
|
||||
CarTestRoute("3cfdec54aa035f3f|2022-07-19--23-45-10", VOLKSWAGEN.PASSAT_NMS),
|
||||
|
||||
@@ -105,6 +105,7 @@ class CarState(CarStateBase):
|
||||
ret.stockAeb = bool(ext_cp.vl["ACC_10"]["ANB_Teilbremsung_Freigabe"]) or bool(ext_cp.vl["ACC_10"]["ANB_Zielbremsung_Freigabe"])
|
||||
|
||||
# Update ACC radar status.
|
||||
self.acc_type = ext_cp.vl["ACC_06"]["ACC_Typ"]
|
||||
if pt_cp.vl["TSK_06"]["TSK_Status"] == 2:
|
||||
# ACC okay and enabled, but not currently engaged
|
||||
ret.cruiseState.available = True
|
||||
@@ -480,11 +481,13 @@ class MqbExtraSignals:
|
||||
# Additional signal and message lists for optional or bus-portable controllers
|
||||
fwd_radar_signals = [
|
||||
("ACC_Wunschgeschw_02", "ACC_02"), # ACC set speed
|
||||
("ACC_Typ", "ACC_06"), # Basic vs F2S vs SNG
|
||||
("AWV2_Freigabe", "ACC_10"), # FCW brake jerk release
|
||||
("ANB_Teilbremsung_Freigabe", "ACC_10"), # AEB partial braking release
|
||||
("ANB_Zielbremsung_Freigabe", "ACC_10"), # AEB target braking release
|
||||
]
|
||||
fwd_radar_checks = [
|
||||
("ACC_06", 50), # From J428 ACC radar control module
|
||||
("ACC_10", 50), # From J428 ACC radar control module
|
||||
("ACC_02", 17), # From J428 ACC radar control module
|
||||
]
|
||||
|
||||
@@ -32,14 +32,13 @@ class CarInterface(CarInterfaceBase):
|
||||
ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.volkswagenPq)]
|
||||
ret.enableBsm = 0x3BA in fingerprint[0] # SWA_1
|
||||
|
||||
if 0x440 in fingerprint[0]: # Getriebe_1
|
||||
if 0x440 in fingerprint[0] or len(fingerprint[0]) == 0: # Getriebe_1, or empty FP for CI/docs generation
|
||||
ret.transmissionType = TransmissionType.automatic
|
||||
else:
|
||||
ret.transmissionType = TransmissionType.manual
|
||||
|
||||
if any(msg in fingerprint[1] for msg in (0x1A0, 0xC2)): # Bremse_1, Lenkwinkel_1
|
||||
ret.networkLocation = NetworkLocation.gateway
|
||||
ret.experimentalLongitudinalAvailable = True
|
||||
else:
|
||||
ret.networkLocation = NetworkLocation.fwdCamera
|
||||
|
||||
@@ -56,7 +55,7 @@ class CarInterface(CarInterfaceBase):
|
||||
ret.safetyConfigs = [get_safety_config(car.CarParams.SafetyModel.volkswagen)]
|
||||
ret.enableBsm = 0x30F in fingerprint[0] # SWA_01
|
||||
|
||||
if 0xAD in fingerprint[0]: # Getriebe_11
|
||||
if 0xAD in fingerprint[0] or len(fingerprint[0]) == 0: # Getriebe_11, or empty FP for CI/docs generation
|
||||
ret.transmissionType = TransmissionType.automatic
|
||||
elif 0x187 in fingerprint[0]: # EV_Gearshift
|
||||
ret.transmissionType = TransmissionType.direct
|
||||
@@ -82,7 +81,8 @@ class CarInterface(CarInterfaceBase):
|
||||
|
||||
# Global longitudinal tuning defaults, can be overridden per-vehicle
|
||||
|
||||
if experimental_long and candidate in PQ_CARS:
|
||||
ret.experimentalLongitudinalAvailable = ret.networkLocation == NetworkLocation.gateway and False # Disabled for now
|
||||
if experimental_long and False: # Disabled for now
|
||||
# Proof-of-concept, prep for E2E only. No radar points available. Panda ALLOW_DEBUG firmware required.
|
||||
ret.openpilotLongitudinalControl = True
|
||||
ret.safetyConfigs[0].safetyParam |= Panda.FLAG_VOLKSWAGEN_LONG_CONTROL
|
||||
@@ -90,7 +90,11 @@ class CarInterface(CarInterfaceBase):
|
||||
ret.minEnableSpeed = 4.5
|
||||
|
||||
ret.pcmCruise = not ret.openpilotLongitudinalControl
|
||||
ret.longitudinalActuatorDelayUpperBound = 0.5 # s
|
||||
ret.stoppingControl = True
|
||||
ret.startingState = True
|
||||
ret.startAccel = 1.0
|
||||
ret.vEgoStarting = 1.0
|
||||
ret.vEgoStopping = 1.0
|
||||
ret.longitudinalTuning.kpV = [0.1]
|
||||
ret.longitudinalTuning.kiV = [0.0]
|
||||
|
||||
|
||||
@@ -36,3 +36,73 @@ def create_acc_buttons_control(packer, bus, gra_stock_values, counter, cancel=Fa
|
||||
})
|
||||
|
||||
return packer.make_can_msg("GRA_ACC_01", bus, values)
|
||||
|
||||
|
||||
def acc_control_value(main_switch_on, acc_faulted, long_active):
|
||||
if acc_faulted:
|
||||
acc_control = 6
|
||||
elif long_active:
|
||||
acc_control = 3
|
||||
elif main_switch_on:
|
||||
acc_control = 2
|
||||
else:
|
||||
acc_control = 0
|
||||
|
||||
return acc_control
|
||||
|
||||
|
||||
def acc_hud_status_value(main_switch_on, acc_faulted, long_active):
|
||||
# TODO: happens to resemble the ACC control value for now, but extend this for init/gas override later
|
||||
return acc_control_value(main_switch_on, acc_faulted, long_active)
|
||||
|
||||
|
||||
def create_acc_accel_control(packer, bus, acc_type, enabled, accel, acc_control, stopping, starting, esp_hold):
|
||||
commands = []
|
||||
|
||||
acc_06_values = {
|
||||
"ACC_Typ": acc_type,
|
||||
"ACC_Status_ACC": acc_control,
|
||||
"ACC_StartStopp_Info": enabled,
|
||||
"ACC_Sollbeschleunigung_02": accel if enabled else 3.01,
|
||||
"ACC_zul_Regelabw_unten": 0.2, # TODO: dynamic adjustment of comfort-band
|
||||
"ACC_zul_Regelabw_oben": 0.2, # TODO: dynamic adjustment of comfort-band
|
||||
"ACC_neg_Sollbeschl_Grad_02": 4.0 if enabled else 0, # TODO: dynamic adjustment of jerk limits
|
||||
"ACC_pos_Sollbeschl_Grad_02": 4.0 if enabled else 0, # TODO: dynamic adjustment of jerk limits
|
||||
"ACC_Anfahren": starting,
|
||||
"ACC_Anhalten": stopping,
|
||||
}
|
||||
commands.append(packer.make_can_msg("ACC_06", bus, acc_06_values))
|
||||
|
||||
if starting:
|
||||
acc_hold_type = 4 # hold release / startup
|
||||
elif esp_hold:
|
||||
acc_hold_type = 3 # hold standby
|
||||
elif stopping:
|
||||
acc_hold_type = 1 # hold request
|
||||
else:
|
||||
acc_hold_type = 0
|
||||
|
||||
acc_07_values = {
|
||||
"ACC_Anhalteweg": 0.75 if stopping else 20.46, # Distance to stop (stopping coordinator handles terminal roll-out)
|
||||
"ACC_Freilauf_Info": 2 if enabled else 0,
|
||||
"ACC_Folgebeschl": 3.02, # Not using secondary controller accel unless and until we understand its impact
|
||||
"ACC_Sollbeschleunigung_02": accel if enabled else 3.01,
|
||||
"ACC_Anforderung_HMS": acc_hold_type,
|
||||
"ACC_Anfahren": starting,
|
||||
"ACC_Anhalten": stopping,
|
||||
}
|
||||
commands.append(packer.make_can_msg("ACC_07", bus, acc_07_values))
|
||||
|
||||
return commands
|
||||
|
||||
|
||||
def create_acc_hud_control(packer, bus, acc_hud_status, set_speed, lead_visible):
|
||||
values = {
|
||||
"ACC_Status_Anzeige": acc_hud_status,
|
||||
"ACC_Wunschgeschw_02": set_speed if set_speed < 250 else 327.36,
|
||||
"ACC_Gesetzte_Zeitluecke": 3,
|
||||
"ACC_Display_Prio": 3,
|
||||
# TODO: ACC_Abstandsindex for lead car distance, must determine analog vs digital cluster for scaling
|
||||
}
|
||||
|
||||
return packer.make_can_msg("ACC_02", bus, values)
|
||||
|
||||
@@ -1 +1 @@
|
||||
fc3a044c567a8702ed1500d745170c365dd6b3d4
|
||||
dd41df756253a9e711eb0fd0c3e007284f600ee8
|
||||
Reference in New Issue
Block a user