From 33c26cee27088ef53db7326e13773924e694a006 Mon Sep 17 00:00:00 2001 From: Gregor Kikelj Date: Tue, 29 Sep 2020 14:27:45 +0200 Subject: [PATCH] More logs, a bit of cleaning, still no idea how this works --- selfdrive/locationd/ubloxd_main.cc | 9 +++--- selfdrive/manager.py | 2 +- selfdrive/test/replay_learning.py | 52 ++++++++++++++---------------- 3 files changed, 31 insertions(+), 32 deletions(-) diff --git a/selfdrive/locationd/ubloxd_main.cc b/selfdrive/locationd/ubloxd_main.cc index 62fbfa81d2..12229e4846 100644 --- a/selfdrive/locationd/ubloxd_main.cc +++ b/selfdrive/locationd/ubloxd_main.cc @@ -43,10 +43,11 @@ int ubloxd_main(poll_ubloxraw_msg_func poll_func, send_gps_event_func send_func) subscriber->setTimeout(100); PubMaster pm({"ubloxGnss", "gpsLocationExternal"}); - // int t=0; + int t=0; while (!do_exit) { - // std::cout<<"Got to here on round "<receive(); + std::cout<getData()<((msg->getSize() / sizeof(capnp::word)) + 1); memcpy(amsg.begin(), msg->getData(), msg->getSize()); - // std::cout<<"Message is :"<(); auto ubloxRaw = event.getUbloxRaw(); diff --git a/selfdrive/manager.py b/selfdrive/manager.py index d5d2a1b3b1..fd729b292e 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -179,7 +179,7 @@ managed_processes = { "proclogd": ("selfdrive/proclogd", ["./proclogd"]), "boardd": ("selfdrive/boardd", ["./boardd"]), "pandad": "selfdrive.pandad", - "ui": ("selfdrive/ui", ["./ui"]), + "ui": ("selfdrive/ui", ["./ui"]), # 2 "calibrationd": "selfdrive.locationd.calibrationd", "paramsd": "selfdrive.locationd.paramsd", "camerad": ("selfdrive/camerad", ["./camerad"]), diff --git a/selfdrive/test/replay_learning.py b/selfdrive/test/replay_learning.py index 9ad2e3755a..3372591c14 100644 --- a/selfdrive/test/replay_learning.py +++ b/selfdrive/test/replay_learning.py @@ -10,13 +10,10 @@ else: from tqdm import tqdm # type: ignore import cereal.messaging as messaging -from common.params import Params -# from cereal.services import service_list from collections import namedtuple from tools.lib.logreader import LogReader -ProcessConfig = namedtuple('ProcessConfig', ['proc_name', 'pub_sub', 'ignore',]) - +ProcessConfig = namedtuple('ProcessConfig', ['proc_name', 'pub_sub', 'ignore', 'command', 'path']) def wait_for_event(evt): if not evt.wait(20): @@ -27,14 +24,14 @@ def wait_for_event(evt): # done testing this process, let it die sys.exit(0) -class SimplePubMaster(messaging.PubMaster): +class SimplePubMaster(): def __init__(self, services): # pylint: disable=super-init-not-called self.sock = {} for s in services: self.sock[s] = messaging.pub_sock(s) def send(self, s, dat): - print(dat) + # print(dat) self.sock[s].send(dat.to_bytes()) @@ -94,6 +91,17 @@ CONFIGS = [ "ubloxRaw": ["ubloxGnss", "gpsLocationExternal"], }, ignore=[], + command="./ubloxd & sleep 10; kill $!", + path="../locationd", + ), + ProcessConfig( + proc_name="loggerd", + pub_sub={ + "ubloxRaw": ["ubloxGnss", "gpsLocationExternal"], + }, + ignore=[], + command="./loggerd & sleep 10; kill $!", + path="../loggerd", ), ] @@ -113,33 +121,23 @@ def valgrindlauncher(arg, cwd): def replay_process(cfg, lr): pub_sockets = [s for s in cfg.pub_sub.keys() if s != 'can'] # We dump data from logs here - fpm = SimplePubMaster(pub_sockets) - + pm = SimplePubMaster(pub_sockets) + print("Sorting logs") all_msgs = sorted(lr, key=lambda msg: msg.logMonoTime) pub_msgs = [msg for msg in all_msgs if msg.which() in list(cfg.pub_sub.keys())] - params = Params() - params.clear_all() - params.manager_start() - params.put("OpenpilotEnabledToggle", "1") - params.put("Passive", "0") - params.put("CommunityFeaturesToggle", "1") - - os.environ['NO_RADAR_SLEEP'] = "1" - - thread = threading.Thread(target=valgrindlauncher, args=("./ubloxd & sleep 10; kill $!", "../locationd")) + thread = threading.Thread(target=valgrindlauncher, args=(cfg.command, cfg.path)) thread.daemon = True thread.start() - + time.sleep(10) # We give the process time to start for msg in tqdm(pub_msgs): - print("MSG incoming(not a chemical, a message)") - # print(msg) - fpm.send(msg.which(), msg.as_builder()) - -URL = "https://commadata2.blob.core.windows.net/commadata2/a74b011b32b51b56/\ -2020-09-21--10-29-15/0/rlog.bz2?se=2020-09-29T12%3A08%3A10Z&sp=r&sv=2018-03-2\ -8&sr=b&rscd=attachment%3B%20filename%3Da74b011b32b51b56_2020-09-21--10-29-15--0--rlog.bz2\ -&sig=0KVC2BWVlvW4yXTPpUm9Sim8Pp0HFKA5rNyTpnvHv8o%3D" + pm.send(msg.which(), msg.as_builder()) + + # for s in pub_sockets: + # pm.send(s, b"") + +URL = "https://commadata2.blob.core.windows.net/commadata2/a74b011b32b51b56/2020-09-21--10-29-15\ +/0/rlog.bz2?se=2020-09-29T13%3A13%3A40Z&sp=r&sv=2018-03-28&sr=b&rscd=attachment%3B%20filename%3Da74b011b32b51b56_2020-09-21--10-29-15--0--rlog.bz2&sig=iPiuSfthiYo3xL3tDKoKwr8kQH7odHW%2BqGcCqmnY2EY%3D" if __name__ == "__main__": cfg = CONFIGS[0]