-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixup ford radar #1408
Fixup ford radar #1408
Changes from 5 commits
889ff0e
e845356
091313e
9f4b520
c29a30c
cbfde49
69b3c3a
df6edf9
2685938
056bfbc
b71e8ba
f210b35
8fc05fd
5ccf294
6b31bbf
0a6bfe2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,7 +26,7 @@ def _create_delphi_mrr_radar_can_parser(CP) -> CANParser: | |
msg = f"MRR_Detection_{i:03d}" | ||
messages += [(msg, 33)] | ||
|
||
return CANParser(RADAR.DELPHI_MRR, messages, CanBus(CP).radar) | ||
return CANParser(RADAR.DELPHI_MRR, messages + [('MRR_Header_InformationDetections', 33)], CanBus(CP).radar) | ||
|
||
|
||
class RadarInterface(RadarInterfaceBase): | ||
|
@@ -45,6 +45,7 @@ def __init__(self, CP): | |
elif self.radar == RADAR.DELPHI_MRR: | ||
self.rcp = _create_delphi_mrr_radar_can_parser(CP) | ||
self.trigger_msg = DELPHI_MRR_RADAR_START_ADDR + DELPHI_MRR_RADAR_MSG_COUNT - 1 | ||
print('trigger_msg:', self.trigger_msg) | ||
else: | ||
raise ValueError(f"Unsupported radar: {self.radar}") | ||
|
||
|
@@ -55,7 +56,9 @@ def update(self, can_strings): | |
vls = self.rcp.update_strings(can_strings) | ||
self.updated_messages.update(vls) | ||
|
||
if self.trigger_msg not in self.updated_messages: | ||
# print('updated_messages:', self.updated_messages) | ||
# if self.trigger_msg not in self.updated_messages: | ||
if 368 not in self.updated_messages: | ||
return None | ||
|
||
ret = structs.RadarData() | ||
|
@@ -68,6 +71,10 @@ def update(self, can_strings): | |
self._update_delphi_esr() | ||
elif self.radar == RADAR.DELPHI_MRR: | ||
self._update_delphi_mrr() | ||
print('pts', len(self.pts), self.rcp.vl['MRR_Header_InformationDetections']['CAN_NUMBER_OF_DET']) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It was originally thought that Will have to look into the flickering that was noticed in the original PR (commaai/openpilot#24296) though, perhaps some more robust track switching logic is needed, or maybe it's not a problem since Harald added it after the original PR. |
||
if len(self.pts) != self.rcp.vl['MRR_Header_InformationDetections']['CAN_NUMBER_OF_DET']: | ||
print('mismatch!') | ||
# raise Exception | ||
|
||
ret.points = list(self.pts.values()) | ||
self.updated_messages.clear() | ||
|
@@ -103,13 +110,22 @@ def _update_delphi_esr(self): | |
del self.pts[ii] | ||
|
||
def _update_delphi_mrr(self): | ||
print() | ||
header = self.rcp.vl['MRR_Header_InformationDetections'] | ||
scan_index = header['CAN_SCAN_INDEX'] | ||
# print('scan_index', int(scan_index) & 0b11, scan_index) | ||
|
||
for ii in range(1, DELPHI_MRR_RADAR_MSG_COUNT + 1): | ||
msg = self.rcp.vl[f"MRR_Detection_{ii:03d}"] | ||
|
||
# SCAN_INDEX rotates through 0..3 on each message | ||
# treat these as separate points | ||
scanIndex = msg[f"CAN_SCAN_INDEX_2LSB_{ii:02d}"] | ||
i = (ii - 1) * 4 + scanIndex | ||
i = ii # (ii - 1) * 4 + scanIndex | ||
# print('pt scanIndex', scanIndex) | ||
if scanIndex != int(scan_index) & 0b11: | ||
print('doesn\'t match!', scanIndex, int(scan_index) & 0b11, scan_index) | ||
# raise Exception | ||
|
||
if i not in self.pts: | ||
self.pts[i] = structs.RadarData.RadarPoint() | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All track message's LSB scan index signals always match the header counter's 2 LSB when waiting for it now, before it would usually have a few messages that mismatched every cycle (so we should have waited a bit longer for the header message to have the most up to date detection/track messages)