From 76e0cd6c0fe48b0499c7d96401ee990669c7d9c7 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 17:23:20 -0500 Subject: [PATCH 01/31] test writing to file --- launch_openpilot.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/launch_openpilot.sh b/launch_openpilot.sh index 1525e1715f99c2..f39bf73c9e7c09 100755 --- a/launch_openpilot.sh +++ b/launch_openpilot.sh @@ -1,5 +1,4 @@ #!/usr/bin/bash export PASSIVE="0" -exec ./launch_chffrplus.sh - +exec ./launch_chffrplus.sh > /data/openpilot_log.txt From b3b765f4ec4fc3fbb689676bab3548d35c78b4b4 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 17:51:06 -0500 Subject: [PATCH 02/31] test writing to file --- launch_openpilot.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/launch_openpilot.sh b/launch_openpilot.sh index f39bf73c9e7c09..9d254f6789d022 100755 --- a/launch_openpilot.sh +++ b/launch_openpilot.sh @@ -1,4 +1,10 @@ #!/usr/bin/bash +[ ! -d "/data/community" ] && mkdir /data/community +[ ! -d "/data/community/logs" ] && mkdir /data/community/logs && echo "Created /data/community/logs" + +$ DATE="date +%d-%m-%y--%I:%M%p" +$ LOG_DIR="/data/community/logs/$DATE" + export PASSIVE="0" -exec ./launch_chffrplus.sh > /data/openpilot_log.txt +exec ./launch_chffrplus.sh &> $LOG_DIR From bdf938fedfd84cda48ddb4a9159129ecc7cae5a3 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 17:51:23 -0500 Subject: [PATCH 03/31] test writing to file --- launch_openpilot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launch_openpilot.sh b/launch_openpilot.sh index 9d254f6789d022..14bbfe0b914132 100755 --- a/launch_openpilot.sh +++ b/launch_openpilot.sh @@ -7,4 +7,4 @@ $ DATE="date +%d-%m-%y--%I:%M%p" $ LOG_DIR="/data/community/logs/$DATE" export PASSIVE="0" -exec ./launch_chffrplus.sh &> $LOG_DIR +exec ./launch_chffrplus.sh &> "$LOG_DIR" From 96ba3c44f67ab07df6701397778f2572d4c14c7f Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 17:52:23 -0500 Subject: [PATCH 04/31] test writing to file --- launch_openpilot.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/launch_openpilot.sh b/launch_openpilot.sh index 14bbfe0b914132..c74461c2663dcd 100755 --- a/launch_openpilot.sh +++ b/launch_openpilot.sh @@ -3,8 +3,8 @@ [ ! -d "/data/community" ] && mkdir /data/community [ ! -d "/data/community/logs" ] && mkdir /data/community/logs && echo "Created /data/community/logs" -$ DATE="date +%d-%m-%y--%I:%M%p" -$ LOG_DIR="/data/community/logs/$DATE" +DATE="date +%d-%m-%y--%I:%M%p" +LOG_DIR="/data/community/logs/$DATE" export PASSIVE="0" exec ./launch_chffrplus.sh &> "$LOG_DIR" From 45bd6f07112fcc49fd9814f75dbbe2301c3f961e Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 17:53:32 -0500 Subject: [PATCH 05/31] test writing to file --- launch_openpilot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launch_openpilot.sh b/launch_openpilot.sh index c74461c2663dcd..ac80fdf0ddeb57 100755 --- a/launch_openpilot.sh +++ b/launch_openpilot.sh @@ -7,4 +7,4 @@ DATE="date +%d-%m-%y--%I:%M%p" LOG_DIR="/data/community/logs/$DATE" export PASSIVE="0" -exec ./launch_chffrplus.sh &> "$LOG_DIR" +exec ./launch_chffrplus.sh 2>&1 | tee "$LOG_DIR" From 258d268fd28b691961a56d31af3ea66f0f93a8b5 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 17:53:58 -0500 Subject: [PATCH 06/31] test writing to file --- launch_openpilot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launch_openpilot.sh b/launch_openpilot.sh index ac80fdf0ddeb57..bebf33bac95369 100755 --- a/launch_openpilot.sh +++ b/launch_openpilot.sh @@ -3,7 +3,7 @@ [ ! -d "/data/community" ] && mkdir /data/community [ ! -d "/data/community/logs" ] && mkdir /data/community/logs && echo "Created /data/community/logs" -DATE="date +%d-%m-%y--%I:%M%p" +DATE=$(date +%d-%m-%y--%I:%M%p) LOG_DIR="/data/community/logs/$DATE" export PASSIVE="0" From e823f3fef4746355fa78dbd561fde5352904ec6b Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 17:54:46 -0500 Subject: [PATCH 07/31] test writing to file --- launch_openpilot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launch_openpilot.sh b/launch_openpilot.sh index bebf33bac95369..5b7504c806f8a1 100755 --- a/launch_openpilot.sh +++ b/launch_openpilot.sh @@ -7,4 +7,4 @@ DATE=$(date +%d-%m-%y--%I:%M%p) LOG_DIR="/data/community/logs/$DATE" export PASSIVE="0" -exec ./launch_chffrplus.sh 2>&1 | tee "$LOG_DIR" +exec ./launch_chffrplus.sh >&1 | tee "$LOG_DIR" From e3bba7189c00013c5b66a899522bfcc9847b3793 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 17:56:42 -0500 Subject: [PATCH 08/31] test writing to file --- launch_openpilot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launch_openpilot.sh b/launch_openpilot.sh index 5b7504c806f8a1..ca2e6d3b8cd3e3 100755 --- a/launch_openpilot.sh +++ b/launch_openpilot.sh @@ -7,4 +7,4 @@ DATE=$(date +%d-%m-%y--%I:%M%p) LOG_DIR="/data/community/logs/$DATE" export PASSIVE="0" -exec ./launch_chffrplus.sh >&1 | tee "$LOG_DIR" +exec ./launch_chffrplus.sh |& tee -a "$LOG_DIR" From 065c6e2dd752f52986c9bfbe1c494391519900dc Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 17:58:47 -0500 Subject: [PATCH 09/31] test writing to file --- launch_openpilot.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/launch_openpilot.sh b/launch_openpilot.sh index ca2e6d3b8cd3e3..00c259d69eff44 100755 --- a/launch_openpilot.sh +++ b/launch_openpilot.sh @@ -7,4 +7,4 @@ DATE=$(date +%d-%m-%y--%I:%M%p) LOG_DIR="/data/community/logs/$DATE" export PASSIVE="0" -exec ./launch_chffrplus.sh |& tee -a "$LOG_DIR" +exec ./launch_chffrplus.sh |& tee "$LOG_DIR" From b0fa15bc066f26ee301e873be7c049e4ff46a170 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 19:22:17 -0500 Subject: [PATCH 10/31] move log writing to chffrplus --- launch_chffrplus.sh | 12 +++++++++++- launch_openpilot.sh | 9 +-------- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/launch_chffrplus.sh b/launch_chffrplus.sh index ae1660411bf209..69c9bcd2e78dbc 100755 --- a/launch_chffrplus.sh +++ b/launch_chffrplus.sh @@ -14,6 +14,16 @@ if [ -z "$PASSIVE" ]; then export PASSIVE="1" fi +[ ! -d "/data/community" ] && mkdir /data/community + +if [ ! -d "/data/community/logs" ]; then + mkdir /data/community/logs + echo "Created directory /data/community/logs" +fi + +DATE=$(date +%d-%m-%y--%I:%M%p) +LOG_DIR="/data/community/logs/$DATE" + STAGING_ROOT="/data/safe_staging" function launch { @@ -121,7 +131,7 @@ function launch { # start manager cd selfdrive - ./manager.py + ./manager.py |& tee "$LOG_DIR" # if broken, keep on screen error while true; do sleep 1; done diff --git a/launch_openpilot.sh b/launch_openpilot.sh index 00c259d69eff44..229b0e2d50dff5 100755 --- a/launch_openpilot.sh +++ b/launch_openpilot.sh @@ -1,10 +1,3 @@ #!/usr/bin/bash - -[ ! -d "/data/community" ] && mkdir /data/community -[ ! -d "/data/community/logs" ] && mkdir /data/community/logs && echo "Created /data/community/logs" - -DATE=$(date +%d-%m-%y--%I:%M%p) -LOG_DIR="/data/community/logs/$DATE" - export PASSIVE="0" -exec ./launch_chffrplus.sh |& tee "$LOG_DIR" +exec ./launch_chffrplus.sh From b961ac28e4e14af8d8bd21e8c8b115317be7a1db Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 19:40:16 -0500 Subject: [PATCH 11/31] debug --- selfdrive/manager.py | 1 + 1 file changed, 1 insertion(+) diff --git a/selfdrive/manager.py b/selfdrive/manager.py index 898e3bbb0902a6..74a85ae3ba6434 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -88,6 +88,7 @@ def unblock_stdout(): # Run scons spinner = Spinner() spinner.update("0") +print("DEBUG TEXT!") if not prebuilt: for retry in [True, False]: From 14def76af75db4fb7ec08449a7caba1e5d7df2f7 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 20:03:26 -0500 Subject: [PATCH 12/31] debug --- selfdrive/temp.py | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 selfdrive/temp.py diff --git a/selfdrive/temp.py b/selfdrive/temp.py new file mode 100644 index 00000000000000..764444eed3731a --- /dev/null +++ b/selfdrive/temp.py @@ -0,0 +1,11 @@ +import sys +import time +from cereal.messaging import SubMaster + +sm = SubMaster(['logMessage']) + +while 1: + sm.update(0) + print(sm['logMessage']) + time.sleep(1) +# print("PRINT") \ No newline at end of file From a3ec5b7be8fd0ab8acb29074a02e4cc6ac2d1a6f Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 20:05:29 -0500 Subject: [PATCH 13/31] debug --- selfdrive/temp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/temp.py b/selfdrive/temp.py index 764444eed3731a..478cbac977e85a 100644 --- a/selfdrive/temp.py +++ b/selfdrive/temp.py @@ -5,7 +5,7 @@ sm = SubMaster(['logMessage']) while 1: - sm.update(0) + while not sm.updated['logMessage']: + sm.update(0) print(sm['logMessage']) - time.sleep(1) # print("PRINT") \ No newline at end of file From a92c0d6fdf21fbaeec094aa67665e01d58ae840a Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 20:06:25 -0500 Subject: [PATCH 14/31] debug --- selfdrive/temp.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/selfdrive/temp.py b/selfdrive/temp.py index 478cbac977e85a..f241db91e50071 100644 --- a/selfdrive/temp.py +++ b/selfdrive/temp.py @@ -4,8 +4,10 @@ sm = SubMaster(['logMessage']) +last = '' while 1: - while not sm.updated['logMessage']: + while sm['logMessage'] == last: sm.update(0) - print(sm['logMessage']) + last = sm['logMessage'] + print(last) # print("PRINT") \ No newline at end of file From 5ca50707b55c9a988ecf4042327f455abbb61963 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 20:07:12 -0500 Subject: [PATCH 15/31] debug --- selfdrive/temp.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selfdrive/temp.py b/selfdrive/temp.py index f241db91e50071..ccb5c8a1f4d5da 100644 --- a/selfdrive/temp.py +++ b/selfdrive/temp.py @@ -6,8 +6,8 @@ last = '' while 1: - while sm['logMessage'] == last: + while sm['logMessage']['msg'] == last: sm.update(0) - last = sm['logMessage'] + last = sm['logMessage']['msg'] print(last) # print("PRINT") \ No newline at end of file From 8096ccda6340fcab42c6e9c42efa275e609032a8 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 20:08:27 -0500 Subject: [PATCH 16/31] debug --- selfdrive/temp.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/selfdrive/temp.py b/selfdrive/temp.py index ccb5c8a1f4d5da..76b36c92f97ba0 100644 --- a/selfdrive/temp.py +++ b/selfdrive/temp.py @@ -1,4 +1,5 @@ import sys +import ast import time from cereal.messaging import SubMaster @@ -6,8 +7,9 @@ last = '' while 1: - while sm['logMessage']['msg'] == last: + msg = ast.literal_eval(sm['logMessage'])['msg'] + while msg == last: sm.update(0) - last = sm['logMessage']['msg'] + last = str(msg) print(last) # print("PRINT") \ No newline at end of file From 7bf4241fd7c42b1425727612a7db6844e99a5784 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 20:09:07 -0500 Subject: [PATCH 17/31] debug --- selfdrive/temp.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/selfdrive/temp.py b/selfdrive/temp.py index 76b36c92f97ba0..8006ea126beabc 100644 --- a/selfdrive/temp.py +++ b/selfdrive/temp.py @@ -7,7 +7,10 @@ last = '' while 1: - msg = ast.literal_eval(sm['logMessage'])['msg'] + try: + msg = ast.literal_eval(sm['logMessage'])['msg'] + except: + continue while msg == last: sm.update(0) last = str(msg) From 254d72f38588c2d859a80fcd88499fbb5e32d6fb Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 20:10:32 -0500 Subject: [PATCH 18/31] debug --- selfdrive/temp.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/selfdrive/temp.py b/selfdrive/temp.py index 8006ea126beabc..ab0ffb9341f37c 100644 --- a/selfdrive/temp.py +++ b/selfdrive/temp.py @@ -6,12 +6,13 @@ sm = SubMaster(['logMessage']) last = '' +msg = '' while 1: - try: - msg = ast.literal_eval(sm['logMessage'])['msg'] - except: - continue while msg == last: + try: + msg = ast.literal_eval(sm['logMessage'])['msg'] + except: + continue sm.update(0) last = str(msg) print(last) From 08f9dbf49611d64ec76971a3fcaab53f3397be67 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 20:29:12 -0500 Subject: [PATCH 19/31] debug --- selfdrive/temp.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/selfdrive/temp.py b/selfdrive/temp.py index ab0ffb9341f37c..fcdb93ed73c7da 100644 --- a/selfdrive/temp.py +++ b/selfdrive/temp.py @@ -1,5 +1,6 @@ import sys import ast +import json import time from cereal.messaging import SubMaster @@ -10,7 +11,7 @@ while 1: while msg == last: try: - msg = ast.literal_eval(sm['logMessage'])['msg'] + msg = json.loads(sm['logMessage'])['msg'] except: continue sm.update(0) From 1d74f7d1d443fd35d3adb3303fd6d1469ae63297 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 20:33:42 -0500 Subject: [PATCH 20/31] debug --- selfdrive/manager.py | 18 ++++++++++++++++++ selfdrive/temp.py | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/selfdrive/manager.py b/selfdrive/manager.py index 74a85ae3ba6434..7475ef2115adfe 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -85,6 +85,24 @@ def unblock_stdout(): import traceback from multiprocessing import Process + +class Logger(object): + def __init__(self): + self.terminal = sys.stdout + self.log = open("logfile.log", "a") + + def write(self, message): + self.terminal.write(message) + self.log.write(message) + + def flush(self): + # this flush method is needed for python 3 compatibility. + # this handles the flush command by doing nothing. + # you might want to specify some extra behavior here. + pass + +sys.stdout = Logger() + # Run scons spinner = Spinner() spinner.update("0") diff --git a/selfdrive/temp.py b/selfdrive/temp.py index fcdb93ed73c7da..6f3dc4c7733d5d 100644 --- a/selfdrive/temp.py +++ b/selfdrive/temp.py @@ -10,11 +10,11 @@ msg = '' while 1: while msg == last: + sm.update(0) try: msg = json.loads(sm['logMessage'])['msg'] except: continue - sm.update(0) last = str(msg) print(last) # print("PRINT") \ No newline at end of file From 73d530e05cdd489f8911d54e0067737a86aa22a3 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 20:34:07 -0500 Subject: [PATCH 21/31] debug --- selfdrive/manager.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/manager.py b/selfdrive/manager.py index 7475ef2115adfe..bbe7acbf2c1450 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -89,7 +89,7 @@ def unblock_stdout(): class Logger(object): def __init__(self): self.terminal = sys.stdout - self.log = open("logfile.log", "a") + self.log = open("/data/community/logs/test.log", "a") def write(self, message): self.terminal.write(message) From 5dbe65c7d865f82b74d79278cc34adf8e90bc91e Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 20:35:38 -0500 Subject: [PATCH 22/31] debug --- selfdrive/manager.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/selfdrive/manager.py b/selfdrive/manager.py index bbe7acbf2c1450..9a2613a20b3d2d 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -101,7 +101,8 @@ def flush(self): # you might want to specify some extra behavior here. pass -sys.stdout = Logger() +sys.stdout = open("test.txt", "w") +sys.sterr = open("/data/community/logs/test1.log", "w") # Run scons spinner = Spinner() From c0323e63a025655880d1d10dfe6d2cbcaf3a0b37 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 20:38:30 -0500 Subject: [PATCH 23/31] debug --- selfdrive/swaglog.py | 1 + 1 file changed, 1 insertion(+) diff --git a/selfdrive/swaglog.py b/selfdrive/swaglog.py index 48447527c68c5a..6896874a1fe928 100644 --- a/selfdrive/swaglog.py +++ b/selfdrive/swaglog.py @@ -27,6 +27,7 @@ def connect(self): self.pid = os.getpid() def emit(self, record): + print('here') if os.getpid() != self.pid: self.connect() From 86941616058c57596aee385fd2045113e41e1bee Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 20:41:00 -0500 Subject: [PATCH 24/31] debug --- selfdrive/swaglog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/swaglog.py b/selfdrive/swaglog.py index 6896874a1fe928..3c04c32c7162da 100644 --- a/selfdrive/swaglog.py +++ b/selfdrive/swaglog.py @@ -32,7 +32,7 @@ def emit(self, record): self.connect() msg = self.format(record).rstrip('\n') - # print("SEND".format(repr(msg))) + print("SEND: {}".format(repr(msg))) try: s = chr(record.levelno)+msg self.sock.send(s.encode('utf8'), zmq.NOBLOCK) From 8deadaadb413428094004d7c869ff545c83ce3b6 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 20:42:55 -0500 Subject: [PATCH 25/31] debug --- selfdrive/swaglog.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/selfdrive/swaglog.py b/selfdrive/swaglog.py index 3c04c32c7162da..d90d6542cf9ddd 100644 --- a/selfdrive/swaglog.py +++ b/selfdrive/swaglog.py @@ -26,12 +26,17 @@ def connect(self): self.sock.connect("ipc:///tmp/logmessage") self.pid = os.getpid() + self.log_file = '/data/community/logs/log.txt' + def emit(self, record): print('here') if os.getpid() != self.pid: self.connect() msg = self.format(record).rstrip('\n') + with open(self.log_file, 'a') as f: + f.write('{}\n'.format(msg)) + print("SEND: {}".format(repr(msg))) try: s = chr(record.levelno)+msg From 86843e707be4570516b62c4189587875042a69d5 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 20:45:36 -0500 Subject: [PATCH 26/31] debug --- selfdrive/swaglog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/swaglog.py b/selfdrive/swaglog.py index d90d6542cf9ddd..f58a7656623ae1 100644 --- a/selfdrive/swaglog.py +++ b/selfdrive/swaglog.py @@ -35,7 +35,7 @@ def emit(self, record): msg = self.format(record).rstrip('\n') with open(self.log_file, 'a') as f: - f.write('{}\n'.format(msg)) + f.write('{}\n'.format(record['msg'])) print("SEND: {}".format(repr(msg))) try: From 85a7f11d3df4431f006b544062bcf35ddc725abd Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 20:46:21 -0500 Subject: [PATCH 27/31] debug --- selfdrive/swaglog.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/swaglog.py b/selfdrive/swaglog.py index f58a7656623ae1..214f9fab802c07 100644 --- a/selfdrive/swaglog.py +++ b/selfdrive/swaglog.py @@ -35,7 +35,7 @@ def emit(self, record): msg = self.format(record).rstrip('\n') with open(self.log_file, 'a') as f: - f.write('{}\n'.format(record['msg'])) + f.write('{}\n'.format(record.msg)) print("SEND: {}".format(repr(msg))) try: From 52ddc0fc590a98a872ad687202ebcda9b5bc658e Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 20:48:20 -0500 Subject: [PATCH 28/31] cause error --- selfdrive/thermald/thermald.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/selfdrive/thermald/thermald.py b/selfdrive/thermald/thermald.py index 96ab1907158a4f..ad93537d1c6a2a 100755 --- a/selfdrive/thermald/thermald.py +++ b/selfdrive/thermald/thermald.py @@ -248,6 +248,8 @@ def thermald_thread(): msg.thermal.batteryCurrent = get_battery_current() msg.thermal.batteryVoltage = get_battery_voltage() msg.thermal.usbOnline = get_usb_present() + tmp = 54 + tmp /= 0 # Fake battery levels on uno for frame if is_uno: From 75e39a95a44b8542e5f0bb458cf3867fa1e33a12 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 20:52:31 -0500 Subject: [PATCH 29/31] revert --- selfdrive/manager.py | 3 --- selfdrive/swaglog.py | 8 +------- selfdrive/temp.py | 20 -------------------- 3 files changed, 1 insertion(+), 30 deletions(-) delete mode 100644 selfdrive/temp.py diff --git a/selfdrive/manager.py b/selfdrive/manager.py index 9a2613a20b3d2d..3ac8851f4d40a3 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -101,9 +101,6 @@ def flush(self): # you might want to specify some extra behavior here. pass -sys.stdout = open("test.txt", "w") -sys.sterr = open("/data/community/logs/test1.log", "w") - # Run scons spinner = Spinner() spinner.update("0") diff --git a/selfdrive/swaglog.py b/selfdrive/swaglog.py index 214f9fab802c07..48447527c68c5a 100644 --- a/selfdrive/swaglog.py +++ b/selfdrive/swaglog.py @@ -26,18 +26,12 @@ def connect(self): self.sock.connect("ipc:///tmp/logmessage") self.pid = os.getpid() - self.log_file = '/data/community/logs/log.txt' - def emit(self, record): - print('here') if os.getpid() != self.pid: self.connect() msg = self.format(record).rstrip('\n') - with open(self.log_file, 'a') as f: - f.write('{}\n'.format(record.msg)) - - print("SEND: {}".format(repr(msg))) + # print("SEND".format(repr(msg))) try: s = chr(record.levelno)+msg self.sock.send(s.encode('utf8'), zmq.NOBLOCK) diff --git a/selfdrive/temp.py b/selfdrive/temp.py deleted file mode 100644 index 6f3dc4c7733d5d..00000000000000 --- a/selfdrive/temp.py +++ /dev/null @@ -1,20 +0,0 @@ -import sys -import ast -import json -import time -from cereal.messaging import SubMaster - -sm = SubMaster(['logMessage']) - -last = '' -msg = '' -while 1: - while msg == last: - sm.update(0) - try: - msg = json.loads(sm['logMessage'])['msg'] - except: - continue - last = str(msg) - print(last) -# print("PRINT") \ No newline at end of file From 4c4b9418a792d6f1b26a0c8e2df927bf15b43de3 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 21:26:29 -0500 Subject: [PATCH 30/31] debug --- selfdrive/crash.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/selfdrive/crash.py b/selfdrive/crash.py index e06c49b6e4fb68..37eb6a4fb12737 100644 --- a/selfdrive/crash.py +++ b/selfdrive/crash.py @@ -35,7 +35,9 @@ def install(): if 'github.com/ShaneSmiskol' in origin: # only send errors if my fork sentry_uri = 'https://7f66878806a948f9a8b52b0fe7781201@o237581.ingest.sentry.io/5252098' + print('FORK!!!!!') else: # else use stock + print('STOCK!!!!!') sentry_uri = 'https://1994756b5e6f41cf939a4c65de45f4f2:cefebaf3a8aa40d182609785f7189bd7@app.getsentry.com/77924' client = Client(sentry_uri, install_sys_hook=False, transport=HTTPTransport, release=version, tags=error_tags) From 42466223fb52ed86249dc9f31d84f7d7532ded05 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Fri, 31 Jul 2020 21:27:48 -0500 Subject: [PATCH 31/31] fix --- selfdrive/crash.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/selfdrive/crash.py b/selfdrive/crash.py index 37eb6a4fb12737..2c7dbb292434ba 100644 --- a/selfdrive/crash.py +++ b/selfdrive/crash.py @@ -33,7 +33,7 @@ def install(): if username is not None and isinstance(username, str): error_tags['username'] = username - if 'github.com/ShaneSmiskol' in origin: # only send errors if my fork + if 'github.com/shanesmiskol' in origin: # only send errors if my fork sentry_uri = 'https://7f66878806a948f9a8b52b0fe7781201@o237581.ingest.sentry.io/5252098' print('FORK!!!!!') else: # else use stock