Skip to content

Commit

Permalink
this one is more correct, and now its values match properly
Browse files Browse the repository at this point in the history
  • Loading branch information
sshane committed Oct 24, 2024
1 parent f210b35 commit 8fc05fd
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions opendbc/car/ford/radar_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
DELPHI_ESR_RADAR_MSGS = list(range(0x500, 0x540))

DELPHI_MRR_RADAR_START_ADDR = 0x120
DELPHI_MRR_RADAR_HEADER_ADDR = 0x170 # MRR_Header_InformationDetections
DELPHI_MRR_RADAR_HEADER_ADDR = 0x174 # MRR_Header_SensorCoverage
DELPHI_MRR_RADAR_MSG_COUNT = 64


Expand All @@ -21,7 +21,10 @@ def _create_delphi_esr_radar_can_parser(CP) -> CANParser:


def _create_delphi_mrr_radar_can_parser(CP) -> CANParser:
messages = [("MRR_Header_InformationDetections", 33)]
messages = [
("MRR_Header_InformationDetections", 33),
("MRR_Header_SensorCoverage", 33),
]

for i in range(1, DELPHI_MRR_RADAR_MSG_COUNT + 1):
msg = f"MRR_Detection_{i:03d}"
Expand All @@ -36,6 +39,8 @@ def __init__(self, CP):

self.frame = 0

self.can_range_coverage = {i: 0 for i in range(4)}

self.updated_messages = set()
self.track_id = 0
self.radar = DBC[CP.carFingerprint]['radar']
Expand Down Expand Up @@ -122,6 +127,9 @@ def _update_delphi_mrr(self):
look_id = int(header['CAN_LOOK_ID'])
# print('scan_index', int(scan_index) & 0b11, scan_index)

self.can_range_coverage[scan_index & 0b11] = int(self.rcp.vl['MRR_Header_SensorCoverage']['CAN_RANGE_COVERAGE'])
print(self.can_range_coverage)

if self.frame > 10:
assert self.rcp.vl['MRR_Header_InformationDetections']['CAN_SCAN_INDEX'] == self.rcp.vl['MRR_Header_InformationDetections']['CAN_LOOK_INDEX']
if look_id == 0:
Expand All @@ -135,7 +143,7 @@ def _update_delphi_mrr(self):

print('updated msgs', len(self.updated_messages))
if self.frame > 10:
assert len(self.updated_messages) == DELPHI_MRR_RADAR_MSG_COUNT + 1, len(self.updated_messages)
assert len(self.updated_messages) == DELPHI_MRR_RADAR_MSG_COUNT + 2, len(self.updated_messages)

for ii in range(1, DELPHI_MRR_RADAR_MSG_COUNT + 1):
# if look_index != 0:
Expand Down

0 comments on commit 8fc05fd

Please sign in to comment.