mirror of
https://jihulab.com/mr-one/openpilot.git
synced 2026-10-26 20:43:49 +08:00
volkswagen: read MQB EVO radar tracks from Strukturen_01
This commit is contained in:
@@ -18,15 +18,29 @@ SIGNAL_SETS = tuple(
|
||||
)
|
||||
|
||||
|
||||
# The gateway harness does not expose the raw radar points, but the camera publishes filtered
|
||||
# tracks: two per lane, for the left, center and right lanes. MEB calls that message
|
||||
# MEB_Distance_01, while the MQB EVO DBC carries the exact same payload as Strukturen_01.
|
||||
RADAR_TRACK_MESSAGE = (
|
||||
(VolkswagenFlags.MEB, "MEB_Distance_01"),
|
||||
(VolkswagenFlags.MQB_EVO, "Strukturen_01"),
|
||||
)
|
||||
|
||||
|
||||
class RadarInterface(RadarInterfaceBase):
|
||||
def __init__(self, CP, CP_SP):
|
||||
super().__init__(CP, CP_SP)
|
||||
|
||||
# With the MEB gateway harness, we do not have access to the raw points from the radar.
|
||||
# However, the camera publishes decent, albeit filtered, tracks. Two for each lane; left, center, and right.
|
||||
self.rcp: CANParser | None = None
|
||||
if CP.flags & (VolkswagenFlags.MEB | VolkswagenFlags.MQB_EVO) and not self.CP.radarUnavailable:
|
||||
self.rcp = CANParser(DBC[CP.carFingerprint][Bus.radar], [("MEB_Distance_01", 25)], CanBus(CP).cam)
|
||||
self.radar_message: str | None = None
|
||||
if not self.CP.radarUnavailable:
|
||||
for flag, message in RADAR_TRACK_MESSAGE:
|
||||
if CP.flags & flag:
|
||||
self.radar_message = message
|
||||
break
|
||||
|
||||
if self.radar_message is not None:
|
||||
self.rcp = CANParser(DBC[CP.carFingerprint][Bus.radar], [(self.radar_message, 25)], CanBus(CP).cam)
|
||||
|
||||
def update(self, can_strings):
|
||||
if self.rcp is None:
|
||||
@@ -34,8 +48,10 @@ class RadarInterface(RadarInterfaceBase):
|
||||
|
||||
self.rcp.update(can_strings)
|
||||
|
||||
if len(self.rcp.vl_all["MEB_Distance_01"]["Distance_Status"]) == 0:
|
||||
return None
|
||||
if len(self.rcp.vl_all[self.radar_message]["Distance_Status"]) == 0:
|
||||
# The track message hasn't been seen yet. Keep publishing empty radar data instead of
|
||||
# nothing, so consumers waiting on radarTracks don't stall.
|
||||
return super().update(None)
|
||||
|
||||
return self._update()
|
||||
|
||||
@@ -46,7 +62,7 @@ class RadarInterface(RadarInterfaceBase):
|
||||
ret.errors.canError = True
|
||||
return ret
|
||||
|
||||
msg = self.rcp.vl["MEB_Distance_01"]
|
||||
msg = self.rcp.vl[self.radar_message]
|
||||
|
||||
# Can be 3 when radar sensor is obstructed
|
||||
if msg["Distance_Status"] != 0:
|
||||
|
||||
Reference in New Issue
Block a user