Skip to content
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

Log radar_interface CAN error, Process Comm Errors #95

Merged
merged 4 commits into from
Aug 21, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions selfdrive/can/plant_can_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from selfdrive.car.honda.hondacan import fix
from common.realtime import sec_since_boot
from common.dbc import dbc
from selfdrive.tinklad.tinkla_interface import TinklaClient

class CANParser(object):
def __init__(self, dbc_f, signals, checks=None):
Expand Down Expand Up @@ -57,8 +56,6 @@ def __init__(self, dbc_f, signals, checks=None):
for i, x in enumerate(self._msgs):
self._message_indices[x].append(i)

self.tinklaClient = TinklaClient()

def update_can(self, can_recv):
msgs_upd = []
cn_vl_max = 5 # no more than 5 wrong counter checks
Expand All @@ -82,7 +79,6 @@ def update_can(self, can_recv):
# compare recalculated vs received checksum
if msg_vl != cdat:
print("CHECKSUM FAIL: {0}".format(hex(msg)))
self.tinklaClient.logCANErrorEvent(canMessage=msg, additionalInformation="Checksum failure")
self.ck[msg] = False
self.ok[msg] = False
# counter check
Expand All @@ -98,7 +94,6 @@ def update_can(self, can_recv):
# message status is invalid if we received too many wrong counter values
if self.cn_vl[msg] >= cn_vl_max:
print("COUNTER WRONG: {0}".format(hex(msg)))
self.tinklaClient.logCANErrorEvent(canMessage=msg, additionalInformation="Too many wrong counter values")
self.ok[msg] = False

# update msg time stamps and counter value
Expand Down Expand Up @@ -134,5 +129,4 @@ def _check_dead_msgs(self):
for msg in set(self._msgs):
if msg in self.msgs_ck and self.sec_since_boot_cached - self.ct[msg] > 10./self.frqs[msg]:
self.ok[msg] = False
self.tinklaClient.logCANErrorEvent(canMessage=msg, additionalInformation="Dead message")

5 changes: 5 additions & 0 deletions selfdrive/car/tesla/radar_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from selfdrive.services import service_list
import selfdrive.messaging as messaging
from selfdrive.car.tesla.readconfig import CarSettings
from selfdrive.tinklad.tinkla_interface import TinklaClient

#RADAR_A_MSGS = list(range(0x371, 0x37F , 3))
#RADAR_B_MSGS = list(range(0x372, 0x37F, 3))
Expand Down Expand Up @@ -47,6 +48,9 @@ def _create_radard_can_parser():


class RadarInterface(object):

tinklaClient = TinklaClient()

def __init__(self,CP):
# radar
self.pts = {}
Expand Down Expand Up @@ -159,6 +163,7 @@ def _update(self, updated_messages):
errors = []
if not self.rcp.can_valid:
errors.append("canError")
self.tinklaClient.logCANErrorEvent(source="radar_interface", canMessage=0, additionalInformation="Invalid CAN Count")
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how can we extract the message to log from the can parser (rcp)? Or where would it make sense for this to be called from?

ret.errors = errors
return ret,self.extPts.values()

Expand Down
4 changes: 2 additions & 2 deletions selfdrive/tinklad/tinkla_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,12 @@ def logCrashStackTraceEvent(self, dongleId = None):
event.value.textValue="%s\n%s\n%s" % (userInfo, gitInfo, trace)
self.logUserEvent(event)

def logCANErrorEvent(self, canMessage, additionalInformation, dongleId = None):
def logCANErrorEvent(self, source, canMessage, additionalInformation, dongleId = None):
if dongleId is None:
dongleId = self.dongleId
event = tinkla.Interface.Event.new_message(
openPilotId=dongleId,
source=hex(canMessage),
source=source,
category=self.eventCategoryKeys.canError,
name="CAN Error",
)
Expand Down
2 changes: 1 addition & 1 deletion selfdrive/tinklad/tinkladTestClient.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def __init__(self):
self.tinklaClient.logCrashStackTraceEvent(dongleId="test_openpilotId")

print("send can error")
self.tinklaClient.logCANErrorEvent(canMessage=123, additionalInformation="test can error logging", dongleId="test_openpilotId")
self.tinklaClient.logCANErrorEvent(source="tinkladTestClient", canMessage=123, additionalInformation="test can error logging", dongleId="test_openpilotId")

if __name__ == "__main__":
TinklaTestClient()
Expand Down