Skip to content

Commit 88c7362

Browse files
authored
Merge branch 'master' into odyssey-singapore
2 parents 3974b17 + 3dd3997 commit 88c7362

23 files changed

+3364
-79
lines changed

docs/CARS.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<!--- AUTOGENERATED FROM selfdrive/car/CARS_template.md, DO NOT EDIT. --->
22

3-
# Support Information for 383 Known Cars
3+
# Support Information for 384 Known Cars
44

55
|Make|Model|Package|Support Level|
66
|---|---|---|:---:|
@@ -97,11 +97,11 @@
9797
|Honda|Civic Hatchback 2022-24|All|[Upstream](#upstream)|
9898
|Honda|Civic Hatchback Hybrid 2025-26|All|[Upstream](#upstream)|
9999
|Honda|Civic Hatchback Hybrid (Europe only) 2023|All|[Upstream](#upstream)|
100-
|Honda|Civic Hybrid 2025|All|[Upstream](#upstream)|
100+
|Honda|Civic Hybrid 2025-26|All|[Upstream](#upstream)|
101101
|Honda|Clarity 2018-21|All|[Community](#community)|
102102
|Honda|CR-V 2015-16|Touring Trim|[Upstream](#upstream)|
103103
|Honda|CR-V 2017-22|Honda Sensing|[Upstream](#upstream)|
104-
|Honda|CR-V 2023-25|All|[Upstream](#upstream)|
104+
|Honda|CR-V 2023-26|All|[Upstream](#upstream)|
105105
|Honda|CR-V Hybrid 2017-22|Honda Sensing|[Upstream](#upstream)|
106106
|Honda|CR-V Hybrid 2023-25|All|[Upstream](#upstream)|
107107
|Honda|e 2020|All|[Upstream](#upstream)|
@@ -113,7 +113,7 @@
113113
|Honda|Inspire 2018|All|[Upstream](#upstream)|
114114
|Honda|N-Box 2018|All|[Upstream](#upstream)|
115115
|Honda|Odyssey 2018-20|Honda Sensing|[Upstream](#upstream)|
116-
|Honda|Odyssey 2021-25|All|[Upstream](#upstream)|
116+
|Honda|Odyssey 2021-26|All|[Upstream](#upstream)|
117117
|Honda|Passport 2019-25|All|[Upstream](#upstream)|
118118
|Honda|Passport 2026|All|[Upstream](#upstream)|
119119
|Honda|Pilot 2016-22|Honda Sensing|[Upstream](#upstream)|
@@ -247,6 +247,7 @@
247247
|Nissan|Rogue 2018-20|ProPILOT Assist|[Upstream](#upstream)|
248248
|Nissan|X-Trail 2017|ProPILOT Assist|[Upstream](#upstream)|
249249
|Peugeot|208 2019-25|Adaptive Cruise Control (ACC) & Lane Assist|[Dashcam mode](#dashcam)|
250+
|Porsche|Macan 2017-24|Adaptive Cruise Control (ACC) & Lane Assist|[Dashcam mode](#dashcam)|
250251
|Ram|1500 2019-24|Adaptive Cruise Control (ACC)|[Upstream](#upstream)|
251252
|Ram|2500 2020-24|Adaptive Cruise Control (ACC)|[Dashcam mode](#dashcam)|
252253
|Ram|3500 2019-22|Adaptive Cruise Control (ACC)|[Dashcam mode](#dashcam)|

opendbc/can/dbc.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from opendbc.car.subaru.subarucan import subaru_checksum
1212
from opendbc.car.chrysler.chryslercan import chrysler_checksum, fca_giorgio_checksum
1313
from opendbc.car.hyundai.hyundaicanfd import hkg_can_fd_checksum
14+
from opendbc.car.volkswagen.mlbcan import volkswagen_mlb_checksum
1415
from opendbc.car.volkswagen.mqbcan import volkswagen_mqb_meb_checksum, xor_checksum
1516
from opendbc.car.tesla.teslacan import tesla_checksum
1617
from opendbc.car.body.bodycan import body_checksum
@@ -31,6 +32,7 @@ class SignalType:
3132
FCA_GIORGIO_CHECKSUM = 10
3233
TESLA_CHECKSUM = 11
3334
PSA_CHECKSUM = 12
35+
VOLKSWAGEN_MLB_CHECKSUM = 13
3436

3537

3638
@dataclass
@@ -186,6 +188,8 @@ def get_checksum_state(dbc_name: str) -> ChecksumState | None:
186188
return ChecksumState(16, -1, 0, -1, True, SignalType.HKG_CAN_FD_CHECKSUM, hkg_can_fd_checksum)
187189
elif dbc_name.startswith(("vw_mqb", "vw_mqbevo", "vw_meb")):
188190
return ChecksumState(8, 4, 0, 0, True, SignalType.VOLKSWAGEN_MQB_MEB_CHECKSUM, volkswagen_mqb_meb_checksum)
191+
elif dbc_name.startswith("vw_mlb"):
192+
return ChecksumState(8, 4, 0, 0, True, SignalType.VOLKSWAGEN_MLB_CHECKSUM, volkswagen_mlb_checksum)
189193
elif dbc_name.startswith("vw_pq"):
190194
return ChecksumState(8, 4, 0, -1, True, SignalType.XOR_CHECKSUM, xor_checksum)
191195
elif dbc_name.startswith("subaru_global_"):

opendbc/car/honda/fingerprints.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -899,11 +899,13 @@
899899
b'38897-TX6-A010\x00\x00',
900900
],
901901
(Ecu.fwdRadar, 0x18dab0f1, None): [
902+
b'36161-TV9-A040\x00\x00',
902903
b'36161-TV9-A140\x00\x00',
903904
b'36161-TV9-C140\x00\x00',
904905
b'36161-TX6-A030\x00\x00',
905906
],
906907
(Ecu.srs, 0x18da53f1, None): [
908+
b'77959-TX6-A210\x00\x00',
907909
b'77959-TX6-A230\x00\x00',
908910
b'77959-TX6-C210\x00\x00',
909911
],
@@ -985,6 +987,7 @@
985987
b'8S102-T47-AA20\x00\x00',
986988
b'8S102-T50-EA10\x00\x00',
987989
b'8S102-T56-A060\x00\x00',
990+
b'8S102-T56-A070\x00\x00',
988991
b'8S102-T60-AA10\x00\x00',
989992
b'8S102-T64-A040\x00\x00',
990993
],
@@ -1028,12 +1031,14 @@
10281031
CAR.HONDA_CRV_6G: {
10291032
(Ecu.fwdRadar, 0x18dab0f1, None): [
10301033
b'8S302-3A0-A060\x00\x00',
1034+
b'8S302-3A0-A220\x00\x00',
10311035
b'8S302-3C0-Q050\x00\x00',
10321036
b'8S302-3D4-A050\x00\x00',
10331037
],
10341038
(Ecu.fwdCamera, 0x18dab5f1, None): [
10351039
b'8S102-3A0-A090\x00\x00',
10361040
b'8S102-3A0-A110\x00\x00',
1041+
b'8S102-3A0-A230\x00\x00',
10371042
b'8S102-3C0-Q060\x00\x00',
10381043
b'8S102-3D4-A060\x00\x00',
10391044
b'8S102-3D4-A070\x00\x00',

opendbc/car/honda/values.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def init_make(self, CP: structs.CarParams):
111111
else:
112112
harness = CarHarness.nidec
113113

114-
if CP.carFingerprint in (CAR.HONDA_PILOT_4G,):
114+
if CP.carFingerprint in (CAR.HONDA_PILOT_4G, CAR.HONDA_PASSPORT_4G):
115115
self.car_parts = CarParts([Device.threex_angled_mount, harness])
116116
else:
117117
self.car_parts = CarParts.common([harness])
@@ -172,6 +172,7 @@ class CAR(Platforms):
172172
# steerRatio: 11.82 is spec end-to-end
173173
CarSpecs(mass=3279 * CV.LB_TO_KG, wheelbase=2.83, steerRatio=16.33, centerToFrontRatio=0.39, tireStiffnessFactor=0.8467),
174174
{Bus.pt: 'honda_civic_hatchback_ex_2017_can_generated'},
175+
flags=HondaFlags.ALLOW_MANUAL_TRANS,
175176
)
176177
HONDA_ACCORD_11G = HondaBoschCANFDPlatformConfig(
177178
[
@@ -198,7 +199,7 @@ class CAR(Platforms):
198199
HONDA_CIVIC_2022 = HondaBoschPlatformConfig(
199200
[
200201
HondaCarDocs("Honda Civic 2022-24", "All", video="https://youtu.be/ytiOT5lcp6Q"),
201-
HondaCarDocs("Honda Civic Hybrid 2025", "All"),
202+
HondaCarDocs("Honda Civic Hybrid 2025-26", "All"),
202203
HondaCarDocs("Honda Civic Hatchback 2022-24", "All", video="https://youtu.be/ytiOT5lcp6Q"),
203204
HondaCarDocs("Honda Civic Hatchback Hybrid (Europe only) 2023", "All"),
204205
# TODO: Confirm 2024
@@ -217,7 +218,7 @@ class CAR(Platforms):
217218
)
218219
HONDA_CRV_6G = HondaBoschCANFDPlatformConfig(
219220
[
220-
HondaCarDocs("Honda CR-V 2023-25", "All"),
221+
HondaCarDocs("Honda CR-V 2023-26", "All"),
221222
HondaCarDocs("Honda CR-V Hybrid 2023-25", "All"),
222223
],
223224
CarSpecs(mass=1703, wheelbase=2.7, steerRatio=16.2, centerToFrontRatio=0.42),
@@ -270,7 +271,7 @@ class CAR(Platforms):
270271
CarSpecs(mass=4544 * CV.LB_TO_KG, wheelbase=2.89, centerToFrontRatio=0.428, steerRatio=16.2),
271272
)
272273
HONDA_ODYSSEY_5G_MMR = HondaBoschPlatformConfig(
273-
[HondaCarDocs("Honda Odyssey 2021-25", "All", min_steer_speed=70. * CV.KPH_TO_MS)],
274+
[HondaCarDocs("Honda Odyssey 2021-26", "All", min_steer_speed=70. * CV.KPH_TO_MS)],
274275
CarSpecs(mass=4590 * CV.LB_TO_KG, wheelbase=3.00, steerRatio=19.4, centerToFrontRatio=0.41),
275276
{Bus.pt: 'acura_rdx_2020_can_generated'},
276277
flags=HondaFlags.BOSCH_ALT_BRAKE | HondaFlags.BOSCH_ALT_RADAR,

opendbc/car/tests/routes.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,10 @@
2626
HYUNDAI.GENESIS_G90,
2727
VOLKSWAGEN.VOLKSWAGEN_CRAFTER_MK2, # need a route from an ACC-equipped Crafter
2828
SUBARU.SUBARU_FORESTER_HYBRID,
29-
HONDA.ACURA_TLX_2G, # FIXME: replace expired route
29+
# Honda/Acura test routes below expired, replace when CI bucket sync is fixed
30+
HONDA.ACURA_TLX_2G,
31+
HONDA.HONDA_NBOX_2G,
32+
HONDA.ACURA_MDX_4G_MMR,
3033
]
3134

3235

@@ -91,7 +94,6 @@ class CarTestRoute(NamedTuple):
9194
CarTestRoute("320098ff6c5e4730/2023-04-13--17-47-46", HONDA.HONDA_HRV_3G),
9295
CarTestRoute("147613502316e718/00000001--dd141a3140", HONDA.HONDA_HRV_3G), # Brazilian model
9396
CarTestRoute("1e4baee1aa2687a0/00000001--74c4cc0b23", HONDA.HONDA_HRV_3G), # Thailand model use ALT_GEAR
94-
CarTestRoute("414af83891dbf72c/00000006--51fa6d99cd", HONDA.HONDA_NBOX_2G),
9597
CarTestRoute("917b074700869333/2021-05-24--20-40-20", HONDA.ACURA_ILX),
9698
CarTestRoute("08a3deb07573f157/2020-03-06--16-11-19", HONDA.HONDA_ACCORD), # 1.5T
9799
CarTestRoute("1da5847ac2488106/2021-05-24--19-31-50", HONDA.HONDA_ACCORD), # 2.0T
@@ -114,7 +116,6 @@ class CarTestRoute(NamedTuple):
114116
CarTestRoute("b1c832ad56b6bc9d/00000010--debfcf5867", HONDA.HONDA_CIVIC_2022), # 2025 Civic Hatch Hybrid with new eCVT transmission
115117
CarTestRoute("f9c43864cf057d05/2024-01-15--23-01-20", HONDA.HONDA_PILOT_4G), # TODO: Replace with a newer route
116118
CarTestRoute("f39cf149898833ff/0000002b--54f3fae045", HONDA.HONDA_ACCORD_11G),
117-
CarTestRoute("ad9840558640c31d/0000001a--d6cd4871c2", HONDA.ACURA_MDX_4G_MMR), # 2025 MDX
118119
CarTestRoute("56b2cf1dacdcd033/00000017--d24ffdb376", HONDA.HONDA_CITY_7G), # Brazilian model
119120
CarTestRoute("2dc4489d7e1410ca/00000001--bbec3f5117", HONDA.HONDA_CRV_6G),
120121
CarTestRoute("a703d058f4e05aeb/00000008--f169423024", HONDA.HONDA_PASSPORT_4G),
@@ -290,6 +291,7 @@ class CarTestRoute(NamedTuple):
290291
CarTestRoute("66e5edc3a16459c5/2021-05-25--19-00-29", VOLKSWAGEN.SKODA_OCTAVIA_MK3),
291292
CarTestRoute("026b6d18fba6417f/2021-03-26--09-17-04", VOLKSWAGEN.SKODA_KAMIQ_MK1), # Scala
292293
CarTestRoute("b2e9858e29db492b/2021-03-26--16-58-42", VOLKSWAGEN.SKODA_SUPERB_MK3),
294+
CarTestRoute("e8dac44d3a3458a5/0000008d--c3e9496f1c", VOLKSWAGEN.PORSCHE_MACAN_MK1), # placeholder, replace after merge
293295

294296
CarTestRoute("3c8f0c502e119c1c/2020-06-30--12-58-02", SUBARU.SUBARU_ASCENT),
295297
CarTestRoute("c321c6b697c5a5ff/2020-06-23--11-04-33", SUBARU.SUBARU_FORESTER),

opendbc/car/torque_data/override.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ legend = ["LAT_ACCEL_FACTOR", "MAX_LAT_ACCEL_MEASURED", "FRICTION"]
9191
"HONDA_ODYSSEY_5G_MMR" = [0.9, 0.9, 0.2]
9292
"HONDA_NBOX_2G" = [1.2, 1.2, 0.2]
9393
"ACURA_TLX_2G" = [1.2, 1.2, 0.15]
94+
"PORSCHE_MACAN_MK1" = [2.0, 2.0, 0.2]
9495
"HONDA_ODYSSEY_SINGAPORE" = [1.9, 1.9, 0.2]
9596

9697
# Dashcam or fallback configured as ideal car

opendbc/car/volkswagen/carcontroller.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from opendbc.car.lateral import apply_driver_steer_torque_limits
55
from opendbc.car.common.conversions import Conversions as CV
66
from opendbc.car.interfaces import CarControllerBase
7-
from opendbc.car.volkswagen import mqbcan, pqcan
7+
from opendbc.car.volkswagen import mlbcan, mqbcan, pqcan
88
from opendbc.car.volkswagen.values import CanBus, CarControllerParams, VolkswagenFlags
99

1010
VisualAlert = structs.CarControl.HUDControl.VisualAlert
@@ -16,10 +16,16 @@ def __init__(self, dbc_names, CP):
1616
super().__init__(dbc_names, CP)
1717
self.CCP = CarControllerParams(CP)
1818
self.CAN = CanBus(CP)
19-
self.CCS = pqcan if CP.flags & VolkswagenFlags.PQ else mqbcan
2019
self.packer_pt = CANPacker(dbc_names[Bus.pt])
2120
self.aeb_available = not CP.flags & VolkswagenFlags.PQ
2221

22+
if CP.flags & VolkswagenFlags.PQ:
23+
self.CCS = pqcan
24+
elif CP.flags & VolkswagenFlags.MLB:
25+
self.CCS = mlbcan
26+
else:
27+
self.CCS = mqbcan
28+
2329
self.apply_torque_last = 0
2430
self.gra_acc_counter_last = None
2531
self.eps_timer_soft_disable_alert = False

opendbc/car/volkswagen/carstate.py

Lines changed: 77 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def __init__(self, CP):
1818
self.esp_hold_confirmation = False
1919
self.upscale_lead_car_signal = False
2020
self.eps_stock_values = False
21+
self.acc_type = 0
2122

2223
def update_button_enable(self, buttonEvents: list[structs.CarState.ButtonEvent]):
2324
if not self.CP.pcmCruise:
@@ -48,6 +49,8 @@ def update(self, can_parsers) -> structs.CarState:
4849

4950
if self.CP.flags & VolkswagenFlags.PQ:
5051
return self.update_pq(pt_cp, cam_cp, ext_cp)
52+
elif self.CP.flags & VolkswagenFlags.MLB:
53+
return self.update_mlb(pt_cp, cam_cp, ext_cp)
5154

5255
ret = structs.CarState()
5356

@@ -73,11 +76,9 @@ def update(self, can_parsers) -> structs.CarState:
7376
pt_cp.vl["ESP_19"]["ESP_HR_Radgeschw_02"],
7477
)
7578

76-
hca_status = self.CCP.hca_status_values.get(pt_cp.vl["LH_EPS_03"]["EPS_HCA_Status"])
7779
if self.CP.flags & VolkswagenFlags.STOCK_HCA_PRESENT:
7880
ret.carFaultedNonCritical = bool(cam_cp.vl["HCA_01"]["EA_Ruckfreigabe"]) or cam_cp.vl["HCA_01"]["EA_ACC_Sollstatus"] > 0 # EA
7981

80-
drive_mode = True
8182
ret.brake = pt_cp.vl["ESP_05"]["ESP_Bremsdruck"] / 250.0 # FIXME: this is pressure in Bar, not sure what OP expects
8283
brake_pedal_pressed = bool(pt_cp.vl["Motor_14"]["MO_Fahrer_bremst"])
8384
brake_pressure_detected = bool(pt_cp.vl["ESP_05"]["ESP_Fahrer_bremst"])
@@ -114,11 +115,7 @@ def update(self, can_parsers) -> structs.CarState:
114115
# Shared logic
115116
ret.vEgoCluster = pt_cp.vl["Kombi_01"]["KBI_angez_Geschw"] * CV.KPH_TO_MS
116117

117-
ret.steeringAngleDeg = pt_cp.vl["LWI_01"]["LWI_Lenkradwinkel"] * (1, -1)[int(pt_cp.vl["LWI_01"]["LWI_VZ_Lenkradwinkel"])]
118-
ret.steeringRateDeg = pt_cp.vl["LWI_01"]["LWI_Lenkradw_Geschw"] * (1, -1)[int(pt_cp.vl["LWI_01"]["LWI_VZ_Lenkradw_Geschw"])]
119-
ret.steeringTorque = pt_cp.vl["LH_EPS_03"]["EPS_Lenkmoment"] * (1, -1)[int(pt_cp.vl["LH_EPS_03"]["EPS_VZ_Lenkmoment"])]
120-
ret.steeringPressed = abs(ret.steeringTorque) > self.CCP.STEER_DRIVER_ALLOWANCE
121-
ret.steerFaultTemporary, ret.steerFaultPermanent = self.update_hca_state(hca_status, drive_mode)
118+
self.parse_mlb_mqb_steering_state(ret, pt_cp)
122119

123120
ret.gasPressed = pt_cp.vl["Motor_20"]["MO_Fahrpedalrohwert_01"] > 0
124121
ret.espActive = bool(pt_cp.vl["ESP_21"]["ESP_Eingriff"])
@@ -233,6 +230,61 @@ def update_pq(self, pt_cp, cam_cp, ext_cp) -> structs.CarState:
233230
self.frame += 1
234231
return ret
235232

233+
def update_mlb(self, pt_cp, cam_cp, ext_cp) -> structs.CarState:
234+
ret = structs.CarState()
235+
236+
self.parse_wheel_speeds(ret,
237+
pt_cp.vl["ESP_03"]["ESP_VL_Radgeschw"],
238+
pt_cp.vl["ESP_03"]["ESP_VR_Radgeschw"],
239+
pt_cp.vl["ESP_03"]["ESP_HL_Radgeschw"],
240+
pt_cp.vl["ESP_03"]["ESP_HR_Radgeschw"],
241+
)
242+
243+
ret.gasPressed = pt_cp.vl["Motor_03"]["MO_Fahrpedalrohwert_01"] > 0
244+
ret.gearShifter = self.parse_gear_shifter(self.CCP.shifter_values.get(pt_cp.vl["Getriebe_03"]["GE_Waehlhebel"], None))
245+
246+
# ACC okay but disabled (1), ACC ready (2), a radar visibility or other fault/disruption (6 or 7)
247+
# currently regulating speed (3), driver accel override (4), brake only (5)
248+
# TODO: get this from the drivetrain side instead, for openpilot long support later
249+
ret.cruiseState.available = ext_cp.vl["ACC_05"]["ACC_Status_ACC"] in (2, 3, 4, 5)
250+
ret.cruiseState.enabled = ext_cp.vl["ACC_05"]["ACC_Status_ACC"] in (3, 4, 5)
251+
ret.accFaulted = ext_cp.vl["ACC_05"]["ACC_Status_ACC"] in (6, 7)
252+
253+
self.parse_mlb_mqb_steering_state(ret, pt_cp)
254+
255+
ret.brake = pt_cp.vl["ESP_05"]["ESP_Bremsdruck"] / 250.0
256+
brake_pedal_pressed = bool(pt_cp.vl["Motor_03"]["MO_Fahrer_bremst"])
257+
brake_pressure_detected = bool(pt_cp.vl["ESP_05"]["ESP_Fahrer_bremst"])
258+
ret.brakePressed = brake_pedal_pressed or brake_pressure_detected
259+
ret.parkingBrake = bool(pt_cp.vl["Kombi_01"]["KBI_Handbremse"])
260+
ret.espDisabled = pt_cp.vl["ESP_01"]["ESP_Tastung_passiv"] != 0
261+
262+
ret.leftBlinker, ret.rightBlinker = self.update_blinker_from_stalk(300, pt_cp.vl["Gateway_11"]["BH_Blinker_li"],
263+
pt_cp.vl["Gateway_11"]["BH_Blinker_re"])
264+
265+
ret.seatbeltUnlatched = pt_cp.vl["Gateway_06"]["AB_Gurtschloss_FA"] != 3
266+
ret.doorOpen = any([pt_cp.vl["Gateway_05"]["FT_Tuer_geoeffnet"],
267+
pt_cp.vl["Gateway_05"]["BT_Tuer_geoeffnet"],
268+
pt_cp.vl["Gateway_05"]["HL_Tuer_geoeffnet"],
269+
pt_cp.vl["Gateway_05"]["HR_Tuer_geoeffnet"]])
270+
271+
# Consume blind-spot monitoring info/warning LED states, if available.
272+
# Infostufe: BSM LED on, Warnung: BSM LED flashing
273+
if self.CP.enableBsm:
274+
ret.leftBlindspot = bool(ext_cp.vl["SWA_01"]["SWA_Infostufe_SWA_li"]) or bool(ext_cp.vl["SWA_01"]["SWA_Warnung_SWA_li"])
275+
ret.rightBlindspot = bool(ext_cp.vl["SWA_01"]["SWA_Infostufe_SWA_re"]) or bool(ext_cp.vl["SWA_01"]["SWA_Warnung_SWA_re"])
276+
277+
self.ldw_stock_values = cam_cp.vl["LDW_02"] if self.CP.networkLocation == NetworkLocation.fwdCamera else {}
278+
self.gra_stock_values = pt_cp.vl["LS_01"]
279+
280+
ret.buttonEvents = self.create_button_events(pt_cp, self.CCP.BUTTONS)
281+
282+
ret.cruiseState.standstill = self.CP.pcmCruise and self.esp_hold_confirmation
283+
ret.standstill = ret.vEgoRaw == 0
284+
285+
self.frame += 1
286+
return ret
287+
236288
def update_low_speed_alert(self, v_ego: float) -> bool:
237289
# Low speed steer alert hysteresis logic
238290
if (self.CP.minSteerSpeed - 1e-3) > CarControllerParams.DEFAULT_MIN_STEER_SPEED and v_ego < (self.CP.minSteerSpeed + 1.):
@@ -241,6 +293,16 @@ def update_low_speed_alert(self, v_ego: float) -> bool:
241293
self.low_speed_alert = False
242294
return self.low_speed_alert
243295

296+
def parse_mlb_mqb_steering_state(self, ret, pt_cp, drive_mode=True):
297+
ret.steeringAngleDeg = pt_cp.vl["LWI_01"]["LWI_Lenkradwinkel"] * (1, -1)[int(pt_cp.vl["LWI_01"]["LWI_VZ_Lenkradwinkel"])]
298+
ret.steeringRateDeg = pt_cp.vl["LWI_01"]["LWI_Lenkradw_Geschw"] * (1, -1)[int(pt_cp.vl["LWI_01"]["LWI_VZ_Lenkradw_Geschw"])]
299+
ret.steeringTorque = pt_cp.vl["LH_EPS_03"]["EPS_Lenkmoment"] * (1, -1)[int(pt_cp.vl["LH_EPS_03"]["EPS_VZ_Lenkmoment"])]
300+
ret.steeringPressed = abs(ret.steeringTorque) > self.CCP.STEER_DRIVER_ALLOWANCE
301+
302+
hca_status = self.CCP.hca_status_values.get(pt_cp.vl["LH_EPS_03"]["EPS_HCA_Status"])
303+
ret.steerFaultTemporary, ret.steerFaultPermanent = self.update_hca_state(hca_status, drive_mode)
304+
return
305+
244306
def update_hca_state(self, hca_status, drive_mode=True):
245307
# Treat FAULT as temporary for worst likely EPS recovery time, for cars without factory Lane Assist
246308
# DISABLED means the EPS hasn't been configured to support Lane Assist
@@ -254,18 +316,20 @@ def get_can_parsers(CP):
254316
if CP.flags & VolkswagenFlags.PQ:
255317
return CarState.get_can_parsers_pq(CP)
256318

257-
# another case of the 1-50Hz
258-
cam_messages = []
319+
# manually configure some optional and variable-rate/edge-triggered messages
320+
pt_messages, cam_messages = [], []
321+
322+
if not CP.flags & VolkswagenFlags.MLB:
323+
pt_messages += [
324+
("Blinkmodi_02", 1) # From J519 BCM (sent at 1Hz when no lights active, 50Hz when active)
325+
]
259326
if CP.flags & VolkswagenFlags.STOCK_HCA_PRESENT:
260327
cam_messages += [
261328
("HCA_01", 1), # From R242 Driver assistance camera, 50Hz if steering/1Hz if not
262329
]
263330

264331
return {
265-
Bus.pt: CANParser(DBC[CP.carFingerprint][Bus.pt], [
266-
# the 50->1Hz is currently too much for the CANParser to figure out
267-
("Blinkmodi_02", 1), # From J519 BCM (sent at 1Hz when no lights active, 50Hz when active)
268-
], CanBus(CP).pt),
332+
Bus.pt: CANParser(DBC[CP.carFingerprint][Bus.pt], pt_messages, CanBus(CP).pt),
269333
Bus.cam: CANParser(DBC[CP.carFingerprint][Bus.pt], cam_messages, CanBus(CP).cam),
270334
}
271335

0 commit comments

Comments
 (0)