ui: disable toggles while onroad (#22975)
Co-authored-by: Adeeb Shihadeh <adeebshihadeh@gmail.com>pull/22979/head
parent
1b800f4075
commit
63779c385d
|
@ -25,69 +25,88 @@
|
|||
#include "selfdrive/ui/qt/util.h"
|
||||
#include "selfdrive/ui/qt/qt_window.h"
|
||||
|
||||
TogglesPanel::TogglesPanel(QWidget *parent) : ListWidget(parent) {
|
||||
auto params = Params();
|
||||
addItem(new ParamControl("OpenpilotEnabledToggle",
|
||||
"Enable openpilot",
|
||||
"Use the openpilot system for adaptive cruise control and lane keep driver assistance. Your attention is required at all times to use this feature. Changing this setting takes effect when the car is powered off.",
|
||||
"../assets/offroad/icon_openpilot.png",
|
||||
this));
|
||||
addItem(new ParamControl("IsLdwEnabled",
|
||||
"Enable Lane Departure Warnings",
|
||||
"Receive alerts to steer back into the lane when your vehicle drifts over a detected lane line without a turn signal activated while driving over 31mph (50kph).",
|
||||
"../assets/offroad/icon_warning.png",
|
||||
this));
|
||||
addItem(new ParamControl("IsRHD",
|
||||
"Enable Right-Hand Drive",
|
||||
"Allow openpilot to obey left-hand traffic conventions and perform driver monitoring on right driver seat.",
|
||||
"../assets/offroad/icon_openpilot_mirrored.png",
|
||||
this));
|
||||
addItem(new ParamControl("IsMetric",
|
||||
"Use Metric System",
|
||||
"Display speed in km/h instead of mph.",
|
||||
"../assets/offroad/icon_metric.png",
|
||||
this));
|
||||
addItem(new ParamControl("CommunityFeaturesToggle",
|
||||
"Enable Community Features",
|
||||
"Use features, such as community supported hardware, from the open source community that are not maintained or supported by comma.ai and have not been confirmed to meet the standard safety model. Be extra cautious when using these features",
|
||||
"../assets/offroad/icon_shell.png",
|
||||
this));
|
||||
|
||||
addItem(new ParamControl("UploadRaw",
|
||||
"Upload Raw Logs",
|
||||
"Upload full logs and full resolution video by default while on Wi-Fi. If not enabled, individual logs can be marked for upload at useradmin.comma.ai.",
|
||||
"../assets/offroad/icon_network.png",
|
||||
this));
|
||||
|
||||
ParamControl *record_toggle = new ParamControl("RecordFront",
|
||||
"Record and Upload Driver Camera",
|
||||
"Upload data from the driver facing camera and help improve the driver monitoring algorithm.",
|
||||
"../assets/offroad/icon_monitoring.png",
|
||||
this);
|
||||
addItem(record_toggle);
|
||||
addItem(new ParamControl("EndToEndToggle",
|
||||
"\U0001f96c Disable use of lanelines (Alpha) \U0001f96c",
|
||||
"In this mode openpilot will ignore lanelines and just drive how it thinks a human would.",
|
||||
"../assets/offroad/icon_road.png",
|
||||
this));
|
||||
TogglesPanel::TogglesPanel(SettingsWindow *parent) : ListWidget(parent) {
|
||||
// param, title, desc, icon
|
||||
std::vector<std::tuple<QString, QString, QString, QString>> toggles{
|
||||
{
|
||||
"OpenpilotEnabledToggle",
|
||||
"Enable openpilot",
|
||||
"Use the openpilot system for adaptive cruise control and lane keep driver assistance. Your attention is required at all times to use this feature. Changing this setting takes effect when the car is powered off.",
|
||||
"../assets/offroad/icon_openpilot.png",
|
||||
},
|
||||
{
|
||||
"IsLdwEnabled",
|
||||
"Enable Lane Departure Warnings",
|
||||
"Receive alerts to steer back into the lane when your vehicle drifts over a detected lane line without a turn signal activated while driving over 31mph (50kph).",
|
||||
"../assets/offroad/icon_warning.png",
|
||||
},
|
||||
{
|
||||
"IsRHD",
|
||||
"Enable Right-Hand Drive",
|
||||
"Allow openpilot to obey left-hand traffic conventions and perform driver monitoring on right driver seat.",
|
||||
"../assets/offroad/icon_openpilot_mirrored.png",
|
||||
},
|
||||
{
|
||||
"IsMetric",
|
||||
"Use Metric System",
|
||||
"Display speed in km/h instead of mph.",
|
||||
"../assets/offroad/icon_metric.png",
|
||||
},
|
||||
{
|
||||
"CommunityFeaturesToggle",
|
||||
"Enable Community Features",
|
||||
"Use features, such as community supported hardware, from the open source community that are not maintained or supported by comma.ai and have not been confirmed to meet the standard safety model. Be extra cautious when using these features",
|
||||
"../assets/offroad/icon_shell.png",
|
||||
},
|
||||
{
|
||||
"UploadRaw",
|
||||
"Upload Raw Logs",
|
||||
"Upload full logs and full resolution video by default while on Wi-Fi. If not enabled, individual logs can be marked for upload at useradmin.comma.ai.",
|
||||
"../assets/offroad/icon_network.png",
|
||||
},
|
||||
{
|
||||
"RecordFront",
|
||||
"Record and Upload Driver Camera",
|
||||
"Upload data from the driver facing camera and help improve the driver monitoring algorithm.",
|
||||
"../assets/offroad/icon_monitoring.png",
|
||||
},
|
||||
{
|
||||
"EndToEndToggle",
|
||||
"\U0001f96c Disable use of lanelines (Alpha) \U0001f96c",
|
||||
"In this mode openpilot will ignore lanelines and just drive how it thinks a human would.",
|
||||
"../assets/offroad/icon_road.png",
|
||||
},
|
||||
#ifdef ENABLE_MAPS
|
||||
addItem(new ParamControl("NavSettingTime24h",
|
||||
"Show ETA in 24h format",
|
||||
"Use 24h format instead of am/pm",
|
||||
"../assets/offroad/icon_metric.png",
|
||||
this));
|
||||
{
|
||||
"NavSettingTime24h",
|
||||
"Show ETA in 24h format",
|
||||
"Use 24h format instead of am/pm",
|
||||
"../assets/offroad/icon_metric.png",
|
||||
},
|
||||
#endif
|
||||
if (params.getBool("DisableRadar_Allow")) {
|
||||
addItem(new ParamControl("DisableRadar",
|
||||
"openpilot Longitudinal Control",
|
||||
"openpilot will disable the car's radar and will take over control of gas and brakes. Warning: this disables AEB!",
|
||||
"../assets/offroad/icon_speed_limit.png",
|
||||
this));
|
||||
|
||||
};
|
||||
|
||||
Params params;
|
||||
|
||||
if (params.getBool("DisableRadar_Allow")) {
|
||||
toggles.push_back({
|
||||
"DisableRadar",
|
||||
"openpilot Longitudinal Control",
|
||||
"openpilot will disable the car's radar and will take over control of gas and brakes. Warning: this disables AEB!",
|
||||
"../assets/offroad/icon_speed_limit.png",
|
||||
});
|
||||
}
|
||||
|
||||
bool record_lock = params.getBool("RecordFrontLock");
|
||||
record_toggle->setEnabled(!record_lock);
|
||||
for (auto &[param, title, desc, icon] : toggles) {
|
||||
auto toggle = new ParamControl(param, title, desc, icon, this);
|
||||
bool locked = params.getBool((param + "Lock").toStdString());
|
||||
toggle->setEnabled(!locked);
|
||||
if (!locked) {
|
||||
connect(parent, &SettingsWindow::offroadTransition, toggle, &ParamControl::setEnabled);
|
||||
}
|
||||
addItem(toggle);
|
||||
}
|
||||
}
|
||||
|
||||
DevicePanel::DevicePanel(QWidget* parent) : ListWidget(parent) {
|
||||
|
@ -123,8 +142,8 @@ DevicePanel::DevicePanel(QWidget* parent) : ListWidget(parent) {
|
|||
double pitch = calib.getRpyCalib()[1] * (180 / M_PI);
|
||||
double yaw = calib.getRpyCalib()[2] * (180 / M_PI);
|
||||
desc += QString(" Your device is pointed %1° %2 and %3° %4.")
|
||||
.arg(QString::number(std::abs(pitch), 'g', 1), pitch > 0 ? "up" : "down",
|
||||
QString::number(std::abs(yaw), 'g', 1), yaw > 0 ? "right" : "left");
|
||||
.arg(QString::number(std::abs(pitch), 'g', 1), pitch > 0 ? "up" : "down",
|
||||
QString::number(std::abs(yaw), 'g', 1), yaw > 0 ? "right" : "left");
|
||||
}
|
||||
} catch (kj::Exception) {
|
||||
qInfo() << "invalid CalibrationParams";
|
||||
|
|
|
@ -12,42 +12,6 @@
|
|||
#include "selfdrive/ui/qt/widgets/controls.h"
|
||||
|
||||
// ********** settings window + top-level panels **********
|
||||
|
||||
class DevicePanel : public ListWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DevicePanel(QWidget* parent = nullptr);
|
||||
signals:
|
||||
void reviewTrainingGuide();
|
||||
void showDriverView();
|
||||
};
|
||||
|
||||
class TogglesPanel : public ListWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TogglesPanel(QWidget *parent = nullptr);
|
||||
};
|
||||
|
||||
class SoftwarePanel : public ListWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SoftwarePanel(QWidget* parent = nullptr);
|
||||
|
||||
private:
|
||||
void showEvent(QShowEvent *event) override;
|
||||
void updateLabels();
|
||||
|
||||
LabelControl *gitBranchLbl;
|
||||
LabelControl *gitCommitLbl;
|
||||
LabelControl *osVersionLbl;
|
||||
LabelControl *versionLbl;
|
||||
LabelControl *lastUpdateLbl;
|
||||
ButtonControl *updateBtn;
|
||||
|
||||
Params params;
|
||||
QFileSystemWatcher *fs_watch;
|
||||
};
|
||||
|
||||
class SettingsWindow : public QFrame {
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -70,3 +34,38 @@ private:
|
|||
QButtonGroup *nav_btns;
|
||||
QStackedWidget *panel_widget;
|
||||
};
|
||||
|
||||
class DevicePanel : public ListWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit DevicePanel(QWidget* parent = nullptr);
|
||||
signals:
|
||||
void reviewTrainingGuide();
|
||||
void showDriverView();
|
||||
};
|
||||
|
||||
class TogglesPanel : public ListWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit TogglesPanel(SettingsWindow *parent);
|
||||
};
|
||||
|
||||
class SoftwarePanel : public ListWidget {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit SoftwarePanel(QWidget* parent = nullptr);
|
||||
|
||||
private:
|
||||
void showEvent(QShowEvent *event) override;
|
||||
void updateLabels();
|
||||
|
||||
LabelControl *gitBranchLbl;
|
||||
LabelControl *gitCommitLbl;
|
||||
LabelControl *osVersionLbl;
|
||||
LabelControl *versionLbl;
|
||||
LabelControl *lastUpdateLbl;
|
||||
ButtonControl *updateBtn;
|
||||
|
||||
Params params;
|
||||
QFileSystemWatcher *fs_watch;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue