Toyota radar-ACC cars: radarUnavailableTemporary while the ARS510's fault flag is held

As in commaai/opendbc#3860. EVENT_STATE (0x196) RADAR_FAULT is held while
the radar declares itself blocked (car-bus PCS_DUST), as STATUS_MSG reports on
the other TSS2 radars. Across comma's public fleet logs (127 radar-on hours,
about 240 cars) two or more consecutive set cycles were seen only then; the
single set cycle at power-up is ignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ds-sebastian
2026-11-28 13:23:32 -05:00
parent fbae9da2a2
commit e1eb30f4b5
2 changed files with 23 additions and 2 deletions
@@ -17,16 +17,22 @@ TARGET_ADDRS = {0x235, 0x237, 0x239}
class RadarInterface(RadarInterfaceBase):
def __init__(self, CP):
super().__init__(CP)
self.rcp = CANParser(RADAR_DBC, [("ACC_TARGET_1", 50), ("ACC_TARGET_2", 50), ("ACC_TARGET_3", 50)], 1)
# EVENT_STATE is not required: it carries the radar's fault flag
self.rcp = CANParser(RADAR_DBC, [("ACC_TARGET_1", 50), ("ACC_TARGET_2", 50), ("ACC_TARGET_3", 50), ("EVENT_STATE", nan)], 1)
self.trigger_msg = 0x237
self.updated_messages = set()
self.cycle = None
self.last_record_t = None
self.fault_cycles = 0
def update(self, can_strings):
self.frame += 1
packets = [(nanos, [(addr, dat, src) for addr, dat, src in frames if addr not in TARGET_ADDRS or len(dat) == 8]) for nanos, frames in can_strings]
self.updated_messages.update(self.rcp.update(packets))
updated = self.rcp.update(packets)
self.updated_messages.update(updated)
if 0x196 in updated:
# RADAR_FAULT is held while the radar declares itself blocked, and set on one cycle at power-up
self.fault_cycles = self.fault_cycles + 1 if self.rcp.vl["EVENT_STATE"]["RADAR_FAULT"] else 0
t = can_strings[-1][0] * 1e-9 if can_strings else None
cycle = self.rcp.vl["ACC_TARGET_3"]["TIMESTAMP"]
clock_seen = bool(self.rcp.ts_nanos["ACC_TARGET_3"]["TIMESTAMP"])
@@ -45,6 +51,9 @@ class RadarInterface(RadarInterfaceBase):
if not self.rcp.can_valid:
ret.errors.canError = True
return ret
if self.fault_cycles >= 2:
ret.errors.radarUnavailableTemporary = True
return ret
target, position = self.rcp.vl["ACC_TARGET_1"], self.rcp.vl["ACC_TARGET_2"]
if target["STATE"] == 5 and position["PRESENT"]:
@@ -99,6 +99,18 @@ def test_rav4_startup_wait_does_not_stall_live_tracks():
assert all(not r.points and not r.errors.radarUnavailableTemporary for r in outputs if r is not None)
def test_acc_target_reports_unavailable_while_the_fault_flag_is_held():
# EVENT_STATE RADAR_FAULT: one set cycle (power-up) is ignored, two or more report radarUnavailableTemporary
radar = AccRadarInterface(structs.CarParams())
packer = CANPacker(RADAR_DBC)
reports = []
for i, fault in enumerate((True, False, True, True, True, False)):
frames = [packer.make_can_msg("EVENT_STATE", 1, {"RADAR_FAULT": int(fault)})] + acc_frames(packer, i, 60000 * (i + 1))
ret = radar.update([(1_000_000_000 + i * 60_000_000, frames)])
reports.append((ret.errors.radarUnavailableTemporary, len(ret.points)))
assert reports == [(False, 1), (False, 1), (False, 1), (True, 0), (True, 0), (False, 1)]
@pytest.mark.parametrize('candidate', sorted(ARS510_RADAR_CAR))
def test_pcs_alarm_sets_stock_fcw_on_ars510_cars(candidate):
from opendbc.can import CANParser