mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-09-30 19:33:45 +08:00
GM: disengage on radar fault (#396)
* GM: copy cadillac's radar header DBC
* Remove unused interface imports
* Rename num targets message to radar header
* Catch various radar faults
old-commit-hash: 3d05cca678
This commit is contained in:
@@ -11,13 +11,13 @@ from common.realtime import sec_since_boot
|
||||
from selfdrive.services import service_list
|
||||
import selfdrive.messaging as messaging
|
||||
|
||||
NUM_TARGETS_MSG = 1120
|
||||
SLOT_1_MSG = NUM_TARGETS_MSG + 1
|
||||
RADAR_HEADER_MSG = 1120
|
||||
SLOT_1_MSG = RADAR_HEADER_MSG + 1
|
||||
NUM_SLOTS = 20
|
||||
|
||||
# Actually it's 0x47f, but can parser only reports
|
||||
# messages that are present in DBC
|
||||
LAST_RADAR_MSG = NUM_TARGETS_MSG + NUM_SLOTS
|
||||
LAST_RADAR_MSG = RADAR_HEADER_MSG + NUM_SLOTS
|
||||
|
||||
def create_radard_can_parser(canbus, car_fingerprint):
|
||||
|
||||
@@ -25,12 +25,16 @@ def create_radard_can_parser(canbus, car_fingerprint):
|
||||
if car_fingerprint == CAR.VOLT:
|
||||
# C1A-ARS3-A by Continental
|
||||
radar_targets = range(SLOT_1_MSG, SLOT_1_MSG + NUM_SLOTS)
|
||||
signals = zip(['LRRNumObjects'] +
|
||||
signals = zip(['FLRRNumValidTargets',
|
||||
'FLRRSnsrBlckd', 'FLRRYawRtPlsblityFlt',
|
||||
'FLRRHWFltPrsntInt', 'FLRRAntTngFltPrsnt',
|
||||
'FLRRAlgnFltPrsnt', 'FLRRSnstvFltPrsntInt'] +
|
||||
['TrkRange'] * NUM_SLOTS + ['TrkRangeRate'] * NUM_SLOTS +
|
||||
['TrkRangeAccel'] * NUM_SLOTS + ['TrkAzimuth'] * NUM_SLOTS +
|
||||
['TrkWidth'] * NUM_SLOTS + ['TrkObjectID'] * NUM_SLOTS,
|
||||
[NUM_TARGETS_MSG] + radar_targets * 6,
|
||||
[0] + [0.0] * NUM_SLOTS + [0.0] * NUM_SLOTS +
|
||||
[RADAR_HEADER_MSG] * 7 + radar_targets * 6,
|
||||
[0] * 7 +
|
||||
[0.0] * NUM_SLOTS + [0.0] * NUM_SLOTS +
|
||||
[0.0] * NUM_SLOTS + [0.0] * NUM_SLOTS +
|
||||
[0.0] * NUM_SLOTS + [0] * NUM_SLOTS)
|
||||
|
||||
@@ -44,8 +48,6 @@ class RadarInterface(object):
|
||||
def __init__(self, CP):
|
||||
# radar
|
||||
self.pts = {}
|
||||
self.track_id = 0
|
||||
self.num_targets = 0
|
||||
|
||||
self.delay = 0.0 # Delay of radar
|
||||
|
||||
@@ -70,22 +72,27 @@ class RadarInterface(object):
|
||||
if LAST_RADAR_MSG in updated_messages:
|
||||
break
|
||||
|
||||
header = self.rcp.vl[RADAR_HEADER_MSG]
|
||||
fault = header['FLRRSnsrBlckd'] or header['FLRRSnstvFltPrsntInt'] or \
|
||||
header['FLRRYawRtPlsblityFlt'] or header['FLRRHWFltPrsntInt'] or \
|
||||
header['FLRRAntTngFltPrsnt'] or header['FLRRAlgnFltPrsnt']
|
||||
errors = []
|
||||
if not self.rcp.can_valid:
|
||||
errors.append("notValid")
|
||||
errors.append("commIssue")
|
||||
if fault:
|
||||
errors.append("fault")
|
||||
ret.errors = errors
|
||||
|
||||
currentTargets = set()
|
||||
if self.rcp.vl[NUM_TARGETS_MSG]['LRRNumObjects'] != self.num_targets:
|
||||
self.num_targets = self.rcp.vl[NUM_TARGETS_MSG]['LRRNumObjects']
|
||||
num_targets = header['FLRRNumValidTargets']
|
||||
|
||||
# Not all radar messages describe targets,
|
||||
# no need to monitor all of the sself.rcp.msgs_upd
|
||||
# no need to monitor all of the self.rcp.msgs_upd
|
||||
for ii in updated_messages:
|
||||
if ii == NUM_TARGETS_MSG:
|
||||
if ii == RADAR_HEADER_MSG:
|
||||
continue
|
||||
|
||||
if self.num_targets == 0:
|
||||
if num_targets == 0:
|
||||
break
|
||||
|
||||
cpt = self.rcp.vl[ii]
|
||||
|
||||
Reference in New Issue
Block a user