From e079751f79c5256b1881cb34d1a92d08faa128d7 Mon Sep 17 00:00:00 2001 From: Shane Smiskol Date: Sat, 5 Nov 2022 15:05:30 -0700 Subject: [PATCH] ui: revert e2e path changes (#26382) * Revert "ui: fade to default path color when inactive (#26375)" This reverts commit 0b385a5650c4e0b06eb83e44bdba3fcff117beeb. * Revert "ui: minor e2e path tweaks (#26351)" This reverts commit d257e28479f49339e7f79491ff9d67e9ba034dfe. * stronger colors 45 --- selfdrive/ui/qt/onroad.cc | 17 +++++++++-------- selfdrive/ui/qt/onroad.h | 1 - selfdrive/ui/ui.cc | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/selfdrive/ui/qt/onroad.cc b/selfdrive/ui/qt/onroad.cc index c4e4beb76a..bfd2f44561 100644 --- a/selfdrive/ui/qt/onroad.cc +++ b/selfdrive/ui/qt/onroad.cc @@ -170,7 +170,7 @@ void OnroadAlerts::paintEvent(QPaintEvent *event) { } -AnnotatedCameraWidget::AnnotatedCameraWidget(VisionStreamType type, QWidget* parent) : fps_filter(UI_FREQ, 3, 1. / UI_FREQ), accel_filter(UI_FREQ, .5, 1. / UI_FREQ), CameraWidget("camerad", type, true, parent) { +AnnotatedCameraWidget::AnnotatedCameraWidget(VisionStreamType type, QWidget* parent) : fps_filter(UI_FREQ, 3, 1. / UI_FREQ), CameraWidget("camerad", type, true, parent) { pm = std::make_unique>({"uiDebug"}); engage_img = loadPixmap("../assets/img_chffr_wheel.png", {img_size, img_size}); @@ -463,18 +463,19 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) { if (scene.end_to_end_long) { const auto &acceleration = (*s->sm)["modelV2"].getModelV2().getAcceleration(); float acceleration_future = 0; - if (acceleration.getZ().size() > 10 && (*s->sm)["carControl"].getCarControl().getLongActive()) { - acceleration_future = acceleration.getX()[10]; // 1.0 second + if (acceleration.getZ().size() > 16) { + acceleration_future = acceleration.getX()[16]; // 2.5 seconds } - // speed up: 148, slow down: 0 - start_hue = fmax(fmin(60 + accel_filter.update(acceleration_future) * 80, 148), 0); + start_hue = 60; + // speed up: 120, slow down: 0 + end_hue = fmax(fmin(start_hue + acceleration_future * 45, 148), 0); // FIXME: painter.drawPolygon can be slow if hue is not rounded - start_hue = int(start_hue * 100 + 0.5) / 100; + end_hue = int(end_hue * 100 + 0.5) / 100; bg.setColorAt(0.0, QColor::fromHslF(start_hue / 360., 0.97, 0.56, 0.4)); - bg.setColorAt(0.75, QColor::fromHslF(63 / 360., 1.0, 0.68, 0.35)); - bg.setColorAt(1.0, QColor::fromHslF(63 / 360., 1.0, 0.68, 0.0)); + bg.setColorAt(0.5, QColor::fromHslF(end_hue / 360., 1.0, 0.68, 0.35)); + bg.setColorAt(1.0, QColor::fromHslF(end_hue / 360., 1.0, 0.68, 0.0)); } else { const auto &orientation = (*s->sm)["modelV2"].getModelV2().getOrientation(); float orientation_future = 0; diff --git a/selfdrive/ui/qt/onroad.h b/selfdrive/ui/qt/onroad.h index 1f6a49bf8c..7edca6b3d5 100644 --- a/selfdrive/ui/qt/onroad.h +++ b/selfdrive/ui/qt/onroad.h @@ -87,7 +87,6 @@ protected: double prev_draw_t = 0; FirstOrderFilter fps_filter; - FirstOrderFilter accel_filter; }; // container for all onroad widgets diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index 0198405769..945218ec11 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -214,7 +214,7 @@ void UIState::updateStatus() { UIState::UIState(QObject *parent) : QObject(parent) { sm = std::make_unique>({ - "modelV2", "carControl", "controlsState", "liveCalibration", "radarState", "deviceState", "roadCameraState", + "modelV2", "controlsState", "liveCalibration", "radarState", "deviceState", "roadCameraState", "pandaStates", "carParams", "driverMonitoringState", "carState", "liveLocationKalman", "wideRoadCameraState", "managerState", "navInstruction", "navRoute", "gnssMeasurements", });