openpilot v0.7.2 release

This commit is contained in:
Vehicle Researcher
2020-02-06 13:51:42 -08:00
parent 305037fc1a
commit 21f4245444
253 changed files with 49879 additions and 99426 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ SLEEP_INTERVAL = 0.2
monitored_proc_names = [
'ubloxd', 'thermald', 'uploader', 'deleter', 'controlsd', 'plannerd', 'radard', 'mapd', 'loggerd' , 'logmessaged', 'tombstoned',
'logcatd', 'proclogd', 'boardd', 'pandad', './ui', 'ui', 'calibrationd', 'params_learner', 'modeld', 'monitoringd', 'camerad', 'sensord', 'updated', 'gpsd', 'athena']
'logcatd', 'proclogd', 'boardd', 'pandad', './ui', 'ui', 'calibrationd', 'params_learner', 'modeld', 'dmonitoringmodeld', 'camerad', 'sensord', 'updated', 'gpsd', 'athena']
cpu_time_names = ['user', 'system', 'children_user', 'children_system']
timer = getattr(time, 'monotonic', time.time)
+42
View File
@@ -0,0 +1,42 @@
#!/usr/bin/env python3
import os
import argparse
import json
import cereal.messaging as messaging
LEVELS = {
"DEBUG": 10,
"INFO": 20,
"WARNING": 30,
"ERROR": 40,
"CRITICAL": 50,
}
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--level', default='DEBUG')
parser.add_argument('--addr', default='127.0.0.1')
parser.add_argument("socket", type=str, nargs='*', help="socket name")
args = parser.parse_args()
if args.addr != "127.0.0.1":
os.environ["ZMQ"] = "1"
messaging.context = messaging.Context()
poller = messaging.Poller()
sock = messaging.sub_sock("logMessage", poller, addr=args.addr)
min_level = LEVELS[args.level]
while True:
polld = poller.poll(1000)
for sock in polld:
evt = messaging.recv_one(sock)
log = json.loads(evt.logMessage)
if log['levelnum'] >= min_level:
print(f"{log['filename']}:{log.get('lineno', '')} - {log.get('funcname', '')}: {log['msg']}")
+16 -1
View File
@@ -15,6 +15,7 @@ def cputime_busy(ct):
sm = SubMaster(['thermal', 'procLog'])
last_temp = 0.0
last_mem = 0.0
total_times = [0., 0., 0., 0.]
busy_times = [0., 0., 0.0, 0.]
@@ -25,10 +26,20 @@ while True:
if sm.updated['thermal']:
t = sm['thermal']
last_temp = np.mean([t.cpu0, t.cpu1, t.cpu2, t.cpu3]) / 10.
last_mem = t.memUsedPercent
if sm.updated['procLog']:
m = sm['procLog']
mems = {}
for proc in m.procs:
name = proc.name
if len(proc.cmdline):
name = proc.cmdline[0]
if len(proc.exe):
name = proc.exe + " - " + name
mems[name] = float(proc.memRss) / 1e6
cores = [0., 0., 0., 0.]
total_times_new = [0., 0., 0., 0.]
busy_times_new = [0., 0., 0.0, 0.]
@@ -46,4 +57,8 @@ while True:
total_times = total_times_new[:]
busy_times = busy_times_new[:]
print("CPU %.2f%% - Temp %.2f" % (100. * np.mean(cores), last_temp ))
print()
print("CPU %.2f%% - RAM: %.2f - Temp %.2f" % (100. * np.mean(cores), last_mem, last_temp))
print("Top memory usage:")
for k, v in sorted(mems.items(), key=lambda item: item[1], reverse=True)[:10]:
print(f"{k.rjust(70)} {v:.2f} MB")
+86
View File
@@ -0,0 +1,86 @@
#!/usr/bin/env python3
import traceback
import sys
from tqdm import tqdm
from tools.lib.logreader import LogReader
from selfdrive.car.fw_versions import match_fw_to_car
from selfdrive.car.toyota.values import FW_VERSIONS as TOYOTA_FW_VERSIONS
from selfdrive.car.honda.values import FW_VERSIONS as HONDA_FW_VERSIONS
from selfdrive.car.toyota.values import FINGERPRINTS as TOYOTA_FINGERPRINTS
from selfdrive.car.honda.values import FINGERPRINTS as HONDA_FINGERPRINTS
if __name__ == "__main__":
if len(sys.argv) < 2:
print("Usage: ./test_fw_query_on_routes.py <route_list>")
sys.exit(1)
wrong = 0
good = 0
dongles = []
for route in tqdm(list(open(sys.argv[1]))):
route = route.rstrip()
dongle_id, time = route.split('|')
qlog_path = f"cd:/{dongle_id}/{time}/0/qlog.bz2"
if dongle_id in dongles:
continue
try:
lr = LogReader(qlog_path)
for msg in lr:
if msg.which() == "health":
if msg.health.hwType not in ['uno', 'blackPanda']:
dongles.append(dongle_id)
break
elif msg.which() == "carParams":
car_fw = msg.carParams.carFw
if len(car_fw) == 0:
break
dongles.append(dongle_id)
live_fingerprint = msg.carParams.carFingerprint
if live_fingerprint not in list(TOYOTA_FINGERPRINTS.keys()) + list(HONDA_FINGERPRINTS.keys()):
continue
candidates = match_fw_to_car(car_fw)
if (len(candidates) == 1) and (list(candidates)[0] == live_fingerprint):
good += 1
print("Correct", live_fingerprint, dongle_id)
break
print(f"{dongle_id}|{time}")
print("Old style:", live_fingerprint, "Vin", msg.carParams.carVin)
print("New style:", candidates)
for version in car_fw:
subaddr = None if version.subAddress == 0 else hex(version.subAddress)
print(f" (Ecu.{version.ecu}, {hex(version.address)}, {subaddr}): [{version.fwVersion}],")
print("Mismatches")
for car_fws in [TOYOTA_FW_VERSIONS, HONDA_FW_VERSIONS]:
if live_fingerprint in car_fws:
expected = car_fws[live_fingerprint]
for (_, expected_addr, expected_sub_addr), v in expected.items():
for version in car_fw:
sub_addr = None if version.subAddress == 0 else version.subAddress
addr = version.address
if (addr, sub_addr) == (expected_addr, expected_sub_addr):
if version.fwVersion not in v:
print(f"({hex(addr)}, {'None' if sub_addr is None else hex(sub_addr)}) - {version.fwVersion}")
print()
wrong += 1
break
except Exception:
traceback.print_exc()
print(f"Fingerprinted: {good} - Not fingerprinted: {wrong}")
print(f"Number of dongle ids checked: {len(dongles)}")