From 8385b27cad0cdf6a358561deb5c092451e99ce83 Mon Sep 17 00:00:00 2001 From: Vehicle Researcher Date: Tue, 3 Oct 2017 00:22:32 -0700 Subject: [PATCH] openpilot v0.3.7 tweaks --- .gitignore | 1 + opendbc | 2 +- {common => selfdrive}/crash.py | 8 ++++++-- selfdrive/manager.py | 2 +- selfdrive/tombstoned.py | 1 + selfdrive/ui/ui.c | 32 +++++++++++++++++++++++++++++++- selfdrive/visiond/visiond | Bin 13285152 -> 13285152 bytes 7 files changed, 41 insertions(+), 5 deletions(-) rename {common => selfdrive}/crash.py (79%) diff --git a/.gitignore b/.gitignore index 2f936454dc..38b208e41c 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ .idea model2.png +*.DSYM *.d *.pyc *.pyo diff --git a/opendbc b/opendbc index 063032ff2b..e25689edc1 160000 --- a/opendbc +++ b/opendbc @@ -1 +1 @@ -Subproject commit 063032ff2b9b878c2cc10301504bad9db54f655f +Subproject commit e25689edc18276f3ef728f0cdf63939240fcebda diff --git a/common/crash.py b/selfdrive/crash.py similarity index 79% rename from common/crash.py rename to selfdrive/crash.py index bc5be003d7..18c27ec1f5 100644 --- a/common/crash.py +++ b/selfdrive/crash.py @@ -2,6 +2,8 @@ import os import sys +from selfdrive.swaglog import cloudlog + if os.getenv("NOLOG") or os.getenv("NOCRASH"): def capture_exception(*exc_info): pass @@ -18,7 +20,9 @@ else: client = Client('https://1994756b5e6f41cf939a4c65de45f4f2:cefebaf3a8aa40d182609785f7189bd7@app.getsentry.com/77924', install_sys_hook=False, transport=HTTPTransport) - capture_exception = client.captureException + def capture_exception(*args, **kwargs): + client.captureException(*args, **kwargs) + cloudlog.error("crash", exc_info=kwargs.get('exc_info', 1)) def bind_user(**kwargs): client.user_context(kwargs) @@ -31,6 +35,6 @@ else: __excepthook__ = sys.excepthook def handle_exception(*exc_info): if exc_info[0] not in (KeyboardInterrupt, SystemExit): - client.captureException(exc_info=exc_info) + capture_exception(exc_info=exc_info) __excepthook__(*exc_info) sys.excepthook = handle_exception diff --git a/selfdrive/manager.py b/selfdrive/manager.py index 1c275cf8f5..77b9395c38 100755 --- a/selfdrive/manager.py +++ b/selfdrive/manager.py @@ -36,8 +36,8 @@ import selfdrive.messaging as messaging from selfdrive.thermal import read_thermal from selfdrive.registration import register from selfdrive.version import version +import selfdrive.crash as crash -import common.crash as crash from common.params import Params from selfdrive.loggerd.config import ROOT diff --git a/selfdrive/tombstoned.py b/selfdrive/tombstoned.py index df7e60069b..65d925e0d5 100644 --- a/selfdrive/tombstoned.py +++ b/selfdrive/tombstoned.py @@ -61,6 +61,7 @@ def report_tombstone(fn, client): user={'id': os.environ.get('DONGLE_ID')}, message=message, ) + cloudlog.error({"tombstone": message}) def main(gctx): diff --git a/selfdrive/ui/ui.c b/selfdrive/ui/ui.c index 68d979ec99..b17434fd6e 100644 --- a/selfdrive/ui/ui.c +++ b/selfdrive/ui/ui.c @@ -32,6 +32,11 @@ #include "cereal/gen/c/log.capnp.h" +// Calibration status values from controlsd.py +#define CALIBRATION_UNCALIBRATED 0 +#define CALIBRATION_CALIBRATED 1 +#define CALIBRATION_INVALID 2 + #define UI_BUF_COUNT 4 typedef struct UIScene { @@ -48,7 +53,6 @@ typedef struct UIScene { float mpc_y[50]; bool world_objects_visible; - // TODO(mgraczyk): Remove and use full frame for everything. mat3 warp_matrix; // transformed box -> frame. mat4 extrinsic_matrix; // Last row is 0 so we can use mat4. @@ -68,6 +72,10 @@ typedef struct UIScene { char alert_text2[1024]; float awareness_status; + + // Used to display calibration progress + int cal_status; + int cal_perc; } UIScene; typedef struct UIState { @@ -844,6 +852,25 @@ static void ui_draw_vision(UIState *s) { 255 * scene->awareness_status, 0, 128)); nvgFill(s->vg); } + + // Draw calibration progress (if needed) + if (scene->cal_status == CALIBRATION_UNCALIBRATED && scene->cal_perc > 0) { + int rec_width = 1020; + int x_pos = 470; + nvgBeginPath(s->vg); + nvgStrokeWidth(s->vg, 14); + nvgRoundedRect(s->vg, (1920-rec_width)/2, 970, rec_width, 100, 20); + nvgStroke(s->vg); + nvgFillColor(s->vg, nvgRGBA(10,100,220,180)); + nvgFill(s->vg); + + nvgFontSize(s->vg, labelfontsize); + nvgTextAlign(s->vg, NVG_ALIGN_LEFT | NVG_ALIGN_BASELINE); + nvgFillColor(s->vg, nvgRGBA(255, 255, 255, 220)); + char calib_status_str[32]; + snprintf(calib_status_str, sizeof(calib_status_str), "Calibration In Progress: %d%%", scene->cal_perc); + nvgText(s->vg, x_pos, 1040, calib_status_str, NULL); + } } nvgEndFrame(s->vg); @@ -1138,6 +1165,9 @@ static void ui_update(UIState *s) { struct cereal_LiveCalibrationData datad; cereal_read_LiveCalibrationData(&datad, eventd.liveCalibration); + s->scene.cal_status = datad.calStatus; + s->scene.cal_perc = datad.calPerc; + // should we still even have this? capn_list32 warpl = datad.warpMatrix2; capn_resolve(&warpl.p); // is this a bug? diff --git a/selfdrive/visiond/visiond b/selfdrive/visiond/visiond index 17f8c32bdfbb2a4712cc86f6a0004c5e50e6df53..3257247f7c1741d99a29dfd80895defcfbe87809 100755 GIT binary patch delta 665 zcmWN=S62=I0D$3Rl@O7=i^!fKtE`OpGNSCQ>=`msuQEgSh|kE#Cd!Twet}EJO*c-z z!TX%^1Zzt}g3h51b*V>v8W2J#4GE(WjcGzSO=(61&1pd-Eont-+R&DEw5J0d=|pF` z(3L2n=|*>A=s{0n=|yk)(3gJnX8;2k#9)RnlsJYloDsw`l2MFi3}Z7Bg_+D^Hgn2S{{%uy{{E}V_#IbJ6G-)3&vTm7J>Ltw(2Km-OT5&} zyxc3i(yP4MYnR6<_r=7yG(zIOv*4@JD}gr9bz0Xi5alXig+8Xh{^&w4ya_XiGcV6GI0&5=$pK6GuE< zNT4g-NTfSS^q?obNTxS^=u1EPGk}2%VlYD($}mzG&Im>_iqWK!MmiZ}l0`N-jA1Of zjAJ|#m`H$0OlAssOs&lS8wd}nlU7n2$oDi)_YBYUEYJ2F&-Fad_X02UA}{t5FZD7n z_X-zyrB`{i*LbbhdA&Dyqc?f8w|J|!dAoObr+2x~yS>MIz0XD7?*lG2KIlU(@nIkF zQ6KYhpKz&9y3D71+Gl*$=X~B5e9@PD*;jnk*L>YK9P~}!@@?PoUElM4Kk!4B`;i~} ziJ$tJpZkShy26!y<=3wA8^85CzxM}!^e2Dz7k~9PfA