wip
This commit is contained in:
@@ -1,10 +1,13 @@
|
|||||||
|
|
||||||
|
|
||||||
- test that lkas button crashes controlsd, it should
|
- test that lkas button crashes controlsd, it should
|
||||||
- test that lkas button creates an alert, it should
|
- test that lkas button creates an alert, it should
|
||||||
|
|
||||||
- hyundai clsc https://github.com/garrettpall/openpilot/commit/5528198aa73d3d017d16ec4ca38306b11e5da0a8
|
- hyundai clsc https://github.com/garrettpall/openpilot/commit/5528198aa73d3d017d16ec4ca38306b11e5da0a8
|
||||||
|
|
||||||
- test tools/replay to get UI working offline
|
- get ui to work on its own using no video feed, custom ui state inputs
|
||||||
|
- dress up ui
|
||||||
|
|
||||||
- add debug elements to ui with a boolean at top of onroad.cc to enable/disable:
|
- add debug elements to ui with a boolean at top of onroad.cc to enable/disable:
|
||||||
- curviture
|
- curviture
|
||||||
- current speed limit
|
- current speed limit
|
||||||
@@ -14,6 +17,9 @@
|
|||||||
- current distance to lead based on model draw distance
|
- current distance to lead based on model draw distance
|
||||||
- current speed of lead
|
- current speed of lead
|
||||||
|
|
||||||
|
- when changing lanes and lateral disabled, draw a narrow single 'line' down center
|
||||||
|
- of computed path, and don't show side lane boundaries
|
||||||
|
|
||||||
- make side lanes 10% wider and the disengage mode 10% brighter
|
- make side lanes 10% wider and the disengage mode 10% brighter
|
||||||
- make 25% of side lanes 50% darker than base
|
- make 25% of side lanes 50% darker than base
|
||||||
|
|
||||||
@@ -86,11 +92,17 @@ Oscar -> OP
|
|||||||
|
|
||||||
behaviors:
|
behaviors:
|
||||||
|
|
||||||
|
- getting head mode - turn off babysitter with an alert on the screen that it is off, suspend for 10 minutes
|
||||||
|
- in this mode it should be extra grouchy if a curve is detected, slowdown is detected, or lane lines are weak
|
||||||
|
|
||||||
- lane change wrong way reenable lateral
|
- lane change wrong way reenable lateral
|
||||||
- blinker signal wheel angle minor enable lateral
|
- blinker signal wheel angle minor enable lateral
|
||||||
- wheel angle sharp only engage lateral if over lane edge unless hands not on wheel
|
- wheel angle sharp only engage lateral if over lane edge unless hands not on wheel
|
||||||
- no lateral on turn signal - only enforce if model curvature > 10 degrees, hands on wheel, or wheel override (maybe curve not necessary?)
|
- no lateral on turn signal - only enforce if model curvature > 10 degrees, hands on wheel, or wheel override (maybe curve not necessary?)
|
||||||
|
|
||||||
|
|
||||||
|
- basic lane keep - nudge wheel slightly if over line and still going straight and hands on wheel
|
||||||
|
|
||||||
- debug mode activated bu lkas
|
- debug mode activated bu lkas
|
||||||
|
|
||||||
- See where disk free is going with NCDU and add smarter log rotation
|
- See where disk free is going with NCDU and add smarter log rotation
|
||||||
|
|||||||
BIN
selfdrive/clearpilot/resource/debug_ui_scene.png
Normal file
BIN
selfdrive/clearpilot/resource/debug_ui_scene.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 MiB |
@@ -30,6 +30,7 @@ HomeWindow::HomeWindow(QWidget* parent) : QWidget(parent) {
|
|||||||
sidebar = new Sidebar(this);
|
sidebar = new Sidebar(this);
|
||||||
main_layout->addWidget(sidebar);
|
main_layout->addWidget(sidebar);
|
||||||
QObject::connect(sidebar, &Sidebar::openSettings, this, &HomeWindow::openSettings);
|
QObject::connect(sidebar, &Sidebar::openSettings, this, &HomeWindow::openSettings);
|
||||||
|
QObject::connect(sidebar, &Sidebar::openOnroad, this, &HomeWindow::openOnroad);
|
||||||
|
|
||||||
slayout = new QStackedLayout();
|
slayout = new QStackedLayout();
|
||||||
main_layout->addLayout(slayout);
|
main_layout->addLayout(slayout);
|
||||||
@@ -42,9 +43,6 @@ HomeWindow::HomeWindow(QWidget* parent) : QWidget(parent) {
|
|||||||
QObject::connect(onroad, &OnroadWindow::mapPanelRequested, this, [=] { sidebar->hide(); });
|
QObject::connect(onroad, &OnroadWindow::mapPanelRequested, this, [=] { sidebar->hide(); });
|
||||||
slayout->addWidget(onroad);
|
slayout->addWidget(onroad);
|
||||||
|
|
||||||
body = new BodyWindow(this);
|
|
||||||
slayout->addWidget(body);
|
|
||||||
|
|
||||||
// CLEARPILOT
|
// CLEARPILOT
|
||||||
ready = new ReadyWindow(this);
|
ready = new ReadyWindow(this);
|
||||||
slayout->addWidget(ready);
|
slayout->addWidget(ready);
|
||||||
@@ -62,6 +60,11 @@ HomeWindow::HomeWindow(QWidget* parent) : QWidget(parent) {
|
|||||||
QObject::connect(uiState(), &UIState::offroadTransition, sidebar, &Sidebar::offroadTransition);
|
QObject::connect(uiState(), &UIState::offroadTransition, sidebar, &Sidebar::offroadTransition);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Debug function to activate onroad UI
|
||||||
|
void HomeWindow::openOnroad() {
|
||||||
|
sidebar->setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
void HomeWindow::showSidebar(bool show) {
|
void HomeWindow::showSidebar(bool show) {
|
||||||
sidebar->setVisible(show);
|
sidebar->setVisible(show);
|
||||||
}
|
}
|
||||||
@@ -72,26 +75,15 @@ void HomeWindow::showMapPanel(bool show) {
|
|||||||
|
|
||||||
void HomeWindow::updateState(const UIState &s) {
|
void HomeWindow::updateState(const UIState &s) {
|
||||||
// const SubMaster &sm = *(s.sm);
|
// const SubMaster &sm = *(s.sm);
|
||||||
|
|
||||||
// CLEARPILOT
|
|
||||||
// switch to the generic robot UI
|
|
||||||
// if (onroad->isVisible() && !body->isEnabled() && sm["carParams"].getCarParams().getNotCar()) {
|
|
||||||
// body->setEnabled(true);
|
|
||||||
// slayout->setCurrentWidget(body);
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (s.scene.started) {
|
if (s.scene.started) {
|
||||||
showDriverView(s.scene.driver_camera_timer >= 10, true);
|
showDriverView(s.scene.driver_camera_timer >= 10, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void HomeWindow::offroadTransition(bool offroad) {
|
void HomeWindow::offroadTransition(bool offroad) {
|
||||||
body->setEnabled(false);
|
|
||||||
if (offroad) {
|
if (offroad) {
|
||||||
sidebar->setVisible(false);
|
sidebar->setVisible(false);
|
||||||
slayout->setCurrentWidget(ready);
|
slayout->setCurrentWidget(ready);
|
||||||
// slayout->setCurrentWidget(home);
|
|
||||||
// this->showDriverView(true, true); // Temp
|
|
||||||
} else {
|
} else {
|
||||||
sidebar->setVisible(false);
|
sidebar->setVisible(false);
|
||||||
slayout->setCurrentWidget(onroad);
|
slayout->setCurrentWidget(onroad);
|
||||||
@@ -119,13 +111,6 @@ void HomeWindow::mousePressEvent(QMouseEvent* e) {
|
|||||||
// CLEARPILOT todo - tap on main goes straight to settings
|
// CLEARPILOT todo - tap on main goes straight to settings
|
||||||
// Unless we click a debug widget.
|
// Unless we click a debug widget.
|
||||||
|
|
||||||
// Handle sidebar collapsing
|
|
||||||
// if ((onroad->isVisible() || body->isVisible()) && (!sidebar->isVisible() || e->x() > sidebar->width())) {
|
|
||||||
// sidebar->setVisible(!sidebar->isVisible() && !onroad->isMapVisible());
|
|
||||||
// uiState()->scene.map_open = onroad->isMapVisible();
|
|
||||||
// params.putBool("Sidebar", sidebar->isVisible());
|
|
||||||
// }
|
|
||||||
|
|
||||||
// CLEARPILOT - click ready shows home
|
// CLEARPILOT - click ready shows home
|
||||||
if (!onroad->isVisible() && ready->isVisible()) {
|
if (!onroad->isVisible() && ready->isVisible()) {
|
||||||
sidebar->setVisible(true);
|
sidebar->setVisible(true);
|
||||||
@@ -141,14 +126,6 @@ void HomeWindow::mousePressEvent(QMouseEvent* e) {
|
|||||||
void HomeWindow::mouseDoubleClickEvent(QMouseEvent* e) {
|
void HomeWindow::mouseDoubleClickEvent(QMouseEvent* e) {
|
||||||
HomeWindow::mousePressEvent(e);
|
HomeWindow::mousePressEvent(e);
|
||||||
const SubMaster &sm = *(uiState()->sm);
|
const SubMaster &sm = *(uiState()->sm);
|
||||||
if (sm["carParams"].getCarParams().getNotCar()) {
|
|
||||||
if (onroad->isVisible()) {
|
|
||||||
slayout->setCurrentWidget(body);
|
|
||||||
} else if (body->isVisible()) {
|
|
||||||
slayout->setCurrentWidget(onroad);
|
|
||||||
}
|
|
||||||
showSidebar(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// OffroadHome: the offroad home page
|
// OffroadHome: the offroad home page
|
||||||
@@ -250,8 +227,10 @@ void OffroadHome::refresh() {
|
|||||||
date->setText(QLocale(uiState()->language.mid(5)).toString(QDateTime::currentDateTime(), "dddd, MMMM d"));
|
date->setText(QLocale(uiState()->language.mid(5)).toString(QDateTime::currentDateTime(), "dddd, MMMM d"));
|
||||||
version->setText(getBrand() + " v" + getVersion().left(14).trimmed() + " - " + model);
|
version->setText(getBrand() + " v" + getVersion().left(14).trimmed() + " - " + model);
|
||||||
|
|
||||||
bool updateAvailable = update_widget->refresh();
|
// bool updateAvailable = update_widget->refresh();
|
||||||
|
|
||||||
int alerts = alerts_widget->refresh();
|
int alerts = alerts_widget->refresh();
|
||||||
|
|
||||||
if (alerts > 0 && !alerts_widget->isVisible()) {
|
if (alerts > 0 && !alerts_widget->isVisible()) {
|
||||||
alerts_widget->setVisible(true);
|
alerts_widget->setVisible(true);
|
||||||
} else if (alerts == 0 && alerts_widget->isVisible()) {
|
} else if (alerts == 0 && alerts_widget->isVisible()) {
|
||||||
@@ -260,20 +239,19 @@ void OffroadHome::refresh() {
|
|||||||
|
|
||||||
// pop-up new notification
|
// pop-up new notification
|
||||||
// CLEARPILOT temp disabled update notifications
|
// CLEARPILOT temp disabled update notifications
|
||||||
int idx = center_layout->currentIndex();
|
// int idx = center_layout->currentIndex();
|
||||||
if (!updateAvailable && !alerts && false) {
|
// if (!updateAvailable && !alerts && false) {
|
||||||
idx = 0;
|
// idx = 0;
|
||||||
} else if (updateAvailable && (!update_notif->isVisible() || (!alerts && idx == 2))) {
|
// } else if (updateAvailable && (!update_notif->isVisible() || (!alerts && idx == 2))) {
|
||||||
idx = 1;
|
// idx = 1;
|
||||||
} else if (alerts && (!alert_notif->isVisible() || (!updateAvailable && idx == 1))) {
|
// } else if (alerts && (!alert_notif->isVisible() || (!updateAvailable && idx == 1))) {
|
||||||
idx = 2;
|
// idx = 2;
|
||||||
}
|
// }
|
||||||
center_layout->setCurrentIndex(idx);
|
// center_layout->setCurrentIndex(idx);
|
||||||
|
|
||||||
// CLEARPILOT temp disabled update notifications
|
// CLEARPILOT temp disabled update notifications
|
||||||
// update_notif->setVisible(updateAvailable);
|
// update_notif->setVisible(updateAvailable);
|
||||||
// alert_notif->setVisible(alerts);
|
// alert_notif->setVisible(alerts);
|
||||||
update_notif->setVisible(false);
|
|
||||||
alert_notif->setVisible(false);
|
alert_notif->setVisible(false);
|
||||||
if (alerts) {
|
if (alerts) {
|
||||||
alert_notif->setText(QString::number(alerts) + (alerts > 1 ? tr(" ALERTS") : tr(" ALERT")));
|
alert_notif->setText(QString::number(alerts) + (alerts > 1 ? tr(" ALERTS") : tr(" ALERT")));
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
|
|
||||||
#include "common/params.h"
|
#include "common/params.h"
|
||||||
#include "selfdrive/ui/qt/offroad/driverview.h"
|
#include "selfdrive/ui/qt/offroad/driverview.h"
|
||||||
#include "selfdrive/ui/qt/body.h"
|
|
||||||
#include "selfdrive/ui/qt/ready.h"
|
#include "selfdrive/ui/qt/ready.h"
|
||||||
#include "selfdrive/ui/qt/onroad.h"
|
#include "selfdrive/ui/qt/onroad.h"
|
||||||
#include "selfdrive/ui/qt/sidebar.h"
|
#include "selfdrive/ui/qt/sidebar.h"
|
||||||
@@ -70,7 +69,6 @@ private:
|
|||||||
Sidebar *sidebar;
|
Sidebar *sidebar;
|
||||||
OffroadHome *home;
|
OffroadHome *home;
|
||||||
OnroadWindow *onroad;
|
OnroadWindow *onroad;
|
||||||
BodyWindow *body;
|
|
||||||
DriverViewWindow *driver_view;
|
DriverViewWindow *driver_view;
|
||||||
QStackedLayout *slayout;
|
QStackedLayout *slayout;
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ Sidebar::Sidebar(QWidget *parent) : QFrame(parent), onroad(false), flag_pressed(
|
|||||||
home_img = loadPixmap("../assets/images/button_home.png", home_btn.size());
|
home_img = loadPixmap("../assets/images/button_home.png", home_btn.size());
|
||||||
flag_img = loadPixmap("../assets/images/button_flag.png", home_btn.size());
|
flag_img = loadPixmap("../assets/images/button_flag.png", home_btn.size());
|
||||||
settings_img = loadPixmap("../assets/images/button_settings.png", settings_btn.size(), Qt::IgnoreAspectRatio);
|
settings_img = loadPixmap("../assets/images/button_settings.png", settings_btn.size(), Qt::IgnoreAspectRatio);
|
||||||
|
currentColors = QColor(255, 255, 255);
|
||||||
|
|
||||||
connect(this, &Sidebar::valueChanged, [=] { update(); });
|
connect(this, &Sidebar::valueChanged, [=] { update(); });
|
||||||
|
|
||||||
@@ -49,52 +50,6 @@ Sidebar::Sidebar(QWidget *parent) : QFrame(parent), onroad(false), flag_pressed(
|
|||||||
isStorageLeft = params.getBool("ShowStorageLeft");
|
isStorageLeft = params.getBool("ShowStorageLeft");
|
||||||
isStorageUsed = params.getBool("ShowStorageUsed");
|
isStorageUsed = params.getBool("ShowStorageUsed");
|
||||||
|
|
||||||
holidayThemeConfiguration = {
|
|
||||||
{0, {"stock", {QColor(255, 255, 255)}}},
|
|
||||||
{1, {"april_fools", {QColor(255, 165, 0)}}},
|
|
||||||
{2, {"christmas", {QColor(0, 72, 255)}}},
|
|
||||||
{3, {"cinco_de_mayo", {QColor(0, 104, 71)}}},
|
|
||||||
{4, {"easter", {QColor(200, 150, 200)}}},
|
|
||||||
{5, {"fourth_of_july", {QColor(0, 72, 255)}}},
|
|
||||||
{6, {"halloween", {QColor(255, 0, 0)}}},
|
|
||||||
{7, {"new_years_day", {QColor(23, 134, 68)}}},
|
|
||||||
{8, {"st_patricks_day", {QColor(0, 128, 0)}}},
|
|
||||||
{9, {"thanksgiving", {QColor(255, 0, 0)}}},
|
|
||||||
{10, {"valentines_day", {QColor(23, 134, 68)}}},
|
|
||||||
{11, {"world_frog_day", {QColor(23, 134, 68)}}},
|
|
||||||
};
|
|
||||||
|
|
||||||
for (auto &[key, themeData] : holidayThemeConfiguration) {
|
|
||||||
QString &themeName = themeData.first;
|
|
||||||
QString base = themeName == "stock" ? "../assets/images" : QString("../frogpilot/assets/holiday_themes/%1/images").arg(themeName);
|
|
||||||
std::vector<QString> paths = {base + "/button_home.png", base + "/button_flag.png", base + "/button_settings.png"};
|
|
||||||
|
|
||||||
holiday_home_imgs[key] = loadPixmap(paths[0], home_btn.size());
|
|
||||||
holiday_flag_imgs[key] = loadPixmap(paths[1], home_btn.size());
|
|
||||||
holiday_settings_imgs[key] = loadPixmap(paths[2], settings_btn.size(), Qt::IgnoreAspectRatio);
|
|
||||||
}
|
|
||||||
|
|
||||||
themeConfiguration = {
|
|
||||||
{0, {"stock", {QColor(255, 255, 255)}}},
|
|
||||||
{1, {"frog_theme", {QColor(255, 255, 255)}}},
|
|
||||||
{2, {"tesla_theme", {QColor(255, 255, 255)}}},
|
|
||||||
{3, {"stalin_theme", {QColor(255, 255, 255)}}}
|
|
||||||
};
|
|
||||||
|
|
||||||
for (auto &[key, themeData] : themeConfiguration) {
|
|
||||||
QString &themeName = themeData.first;
|
|
||||||
QString base = themeName == "stock" ? "../assets/images" : QString("../frogpilot/assets/custom_themes/%1/images").arg(themeName);
|
|
||||||
std::vector<QString> paths = {base + "/button_home.png", base + "/button_flag.png", base + "/button_settings.png"};
|
|
||||||
|
|
||||||
home_imgs[key] = loadPixmap(paths[0], home_btn.size());
|
|
||||||
flag_imgs[key] = loadPixmap(paths[1], home_btn.size());
|
|
||||||
settings_imgs[key] = loadPixmap(paths[2], settings_btn.size(), Qt::IgnoreAspectRatio);
|
|
||||||
}
|
|
||||||
|
|
||||||
home_img = home_imgs[scene.custom_icons];
|
|
||||||
flag_img = flag_imgs[scene.custom_icons];
|
|
||||||
settings_img = settings_imgs[scene.custom_icons];
|
|
||||||
currentColors = themeConfiguration[scene.custom_colors].second;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sidebar::mousePressEvent(QMouseEvent *event) {
|
void Sidebar::mousePressEvent(QMouseEvent *event) {
|
||||||
@@ -163,9 +118,14 @@ void Sidebar::mouseReleaseEvent(QMouseEvent *event) {
|
|||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
if (home_btn.contains(event->pos())) {
|
if (home_btn.contains(event->pos())) {
|
||||||
|
|
||||||
|
// ?? remove?
|
||||||
MessageBuilder msg;
|
MessageBuilder msg;
|
||||||
msg.initEvent().initUserFlag();
|
msg.initEvent().initUserFlag();
|
||||||
pm->send("userFlag", msg);
|
pm->send("userFlag", msg);
|
||||||
|
|
||||||
|
emit openOnroad();
|
||||||
|
|
||||||
} else if (settings_btn.contains(event->pos())) {
|
} else if (settings_btn.contains(event->pos())) {
|
||||||
emit openSettings();
|
emit openSettings();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ public:
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void openSettings(int index = 0, const QString ¶m = "");
|
void openSettings(int index = 0, const QString ¶m = "");
|
||||||
|
void openOnroad(int index = 0, const QString ¶m = "");
|
||||||
void valueChanged();
|
void valueChanged();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ typedef enum UIStatus {
|
|||||||
STATUS_TRAFFIC_MODE_ACTIVE,
|
STATUS_TRAFFIC_MODE_ACTIVE,
|
||||||
STATUS_EXPERIMENTAL_ACTIVE,
|
STATUS_EXPERIMENTAL_ACTIVE,
|
||||||
CENTER_LANE_COLOR,
|
CENTER_LANE_COLOR,
|
||||||
|
CHANGE_LANE_PATH_COLOR,
|
||||||
} UIStatus;
|
} UIStatus;
|
||||||
|
|
||||||
// Clearpilot new alpha constants
|
// Clearpilot new alpha constants
|
||||||
@@ -39,16 +40,18 @@ const float OTHER_LANE_ALPHA = 0.75;
|
|||||||
const int CENTER_LANE_WIDTH = 70;
|
const int CENTER_LANE_WIDTH = 70;
|
||||||
const int OTHER_LANE_WIDTH = 16;
|
const int OTHER_LANE_WIDTH = 16;
|
||||||
|
|
||||||
|
const ACTIVE_COLOR = QColor(189, 199, 252, 0xd1);
|
||||||
|
|
||||||
// Clearpilot custom colors
|
// Clearpilot custom colors
|
||||||
const QColor bg_colors [] = {
|
const QColor bg_colors [] = {
|
||||||
[STATUS_DISENGAGED] = QColor(0x17, 0x33, 0x49, 0xc8),
|
[STATUS_DISENGAGED] = QColor(0x17, 0x33, 0x49, 0xc8),
|
||||||
[STATUS_OVERRIDE] = QColor(94, 112, 255, 0xd1),
|
[STATUS_OVERRIDE] = ACTIVE_COLOR,
|
||||||
[STATUS_ENGAGED] = QColor(76, 97, 255, 0xd1),
|
[STATUS_ENGAGED] = ACTIVE_COLOR,
|
||||||
[STATUS_ALWAYS_ON_LATERAL_ACTIVE] = QColor(209, 215, 250, 0xd1),
|
[STATUS_ALWAYS_ON_LATERAL_ACTIVE] = ACTIVE_COLOR,
|
||||||
// [STATUS_ALWAYS_ON_LATERAL_ACTIVE] = QColor(184, 193, 255, 0xd1),
|
[STATUS_TRAFFIC_MODE_ACTIVE] = ACTIVE_COLOR,
|
||||||
[STATUS_TRAFFIC_MODE_ACTIVE] = QColor(0xc9, 0x22, 0x31, 0xd1), // ? unused?
|
[STATUS_EXPERIMENTAL_ACTIVE] = QColor(201, 41, 204, 0xd1),
|
||||||
[STATUS_EXPERIMENTAL_ACTIVE] = QColor(201, 41, 204, 0xd1), // Magenta
|
[CENTER_LANE_COLOR] = QColor(150, 150, 150, 0xd1),
|
||||||
[CENTER_LANE_COLOR] = QColor(150, 150, 150, 0xd1), // Gray
|
[CHANGE_LANE_PATH_COLOR] = QColor(245, 241, 93, 0xd1),
|
||||||
};
|
};
|
||||||
|
|
||||||
static std::map<cereal::ControlsState::AlertStatus, QColor> alert_colors = {
|
static std::map<cereal::ControlsState::AlertStatus, QColor> alert_colors = {
|
||||||
|
|||||||
Reference in New Issue
Block a user