radard cleanup (#2266)

* some cleanup

* more realistic profiling

* Update selfdrive/controls/radard.py

Co-authored-by: Willem Melching <willem.melching@gmail.com>

Co-authored-by: Comma Device <device@comma.ai>
Co-authored-by: Willem Melching <willem.melching@gmail.com>
old-commit-hash: a77548bff606a20537ed7ff526d605bed1b7a721
This commit is contained in:
Adeeb Shihadeh
2020-10-05 02:37:39 -07:00
committed by GitHub
parent 349b5814bb
commit af2ec63bea
3 changed files with 19 additions and 25 deletions
+4 -6
View File
@@ -11,7 +11,7 @@ class SubSocket():
def __init__(self, msgs, trigger):
self.i = 0
self.trigger = trigger
self.msgs = [m for m in msgs if m.which() == trigger]
self.msgs = [m.as_builder().to_bytes() for m in msgs if m.which() == trigger]
self.max_i = len(self.msgs) - 1
def receive(self, non_blocking=False):
@@ -23,16 +23,14 @@ class SubSocket():
while True:
msg = self.msgs[self.i]
msg = msg.as_builder()
self.i += 1
return msg.to_bytes()
return msg
class PubSocket():
def send(self, data):
pass
if not isinstance(data, bytes):
data = data.to_bytes()
class SubMaster(messaging.SubMaster):
+2 -2
View File
@@ -32,7 +32,7 @@ def get_inputs(msgs, process):
def profile(proc, func, car='toyota'):
segment, fingerprint = CARS['toyota']
segment, fingerprint = CARS[car]
segment = segment.replace('|', '/')
rlog_url = f"{BASE_URL}{segment}/rlog.bz2"
msgs = list(LogReader(rlog_url))
@@ -66,7 +66,7 @@ if __name__ == '__main__':
'radard': radard_thread,
'controlsd': controlsd_thread,
}
proc = sys.argv[1]
if proc not in procs:
print(f"{proc} not available")