mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-10-01 01:43:41 +08:00
General: Lead Vehicle Departure Alert (#73)
* UI: Display E2E Longitudinal status icon * don't forget init * take these out * and this * can't leave this * spam the event * publish here instead * try this now * expose the toggle * Spam all the time!!! * Spam all the time with this! * see if this works * new way to trigger * fix * another one * more to it * more of that * move to car controls instead * no longer needed * 20 hz * unnecessary * send like this pls * move to long planner * let's see what it looks like first * don't alert yet lol * re-enable and try out prompt! * move chime event to longitudinal_planner * AlertStatus to userPrompt * Add more reset conditions * less conditions to test first * louder sound * permanent alert * LOUDER SON! * use stock prompt * Revert "less conditions to test first" This reverts commit b24a096e65e80f303f7d92072cdf273a30dd37e2. * remove lead car take off alert (in separate PR) * cleanup * longer * Nicki Minaj Model (#28218) * New model: 2ff7490f-8a2f-4c0d-87a8-b0fa3a4a6a71 * Updated model_replay_ref_commit (cherry picked from commit328b5d9d47) * use the event * move logic to c++ * cleanup * no prompt border * use brake light from car state * lead car take off event * lead car take off event * always reset last distance * show border when prompted * remove lead car take off alert (in separate PR) * don't prompt when lead car detected * Revert "Nicki Minaj Model (#28218)" This reverts commit b25e96c9d8fe0ac3a93c97eec2e91064c12a5649. * bad sounds * simpler * lead car takeoff prompt * log to tmux * Nicki Minaj Model (#28218) * New model: 2ff7490f-8a2f-4c0d-87a8-b0fa3a4a6a71 * Updated model_replay_ref_commit (cherry picked from commit328b5d9d47) * only print when stopping or starting * remove debug msgs * Revert "Nicki Minaj Model (#28218)" This reverts commit 4fa06f12db858f65570bbf4bc2d9ee1709aead19. --------- Co-authored-by: Mitchell Goff <mitchellgoffpc@gmail.com>
This commit is contained in:
@@ -28,7 +28,7 @@ SPGeneralPanel::SPGeneralPanel(QWidget *parent) : QWidget(parent) {
|
||||
|
||||
// General: Green Traffic Light Chime
|
||||
endToEndLongAlert = new ParamControl(
|
||||
"EndToEndLongAlert",
|
||||
"EndToEndLongAlertLight",
|
||||
tr("Green Traffic Light Chime (Beta)"),
|
||||
QString("%1<br>"
|
||||
"<h4>%2</h4><br>")
|
||||
@@ -40,6 +40,18 @@ SPGeneralPanel::SPGeneralPanel(QWidget *parent) : QWidget(parent) {
|
||||
main_layout->addWidget(horizontal_line());
|
||||
main_layout->addWidget(endToEndLongAlert);
|
||||
|
||||
// General: Lead Vehicle Departure Alert
|
||||
main_layout->addWidget(horizontal_line());
|
||||
main_layout->addWidget(new ParamControl(
|
||||
"EndToEndLongAlertLead",
|
||||
tr("Lead Vehicle Departure Alert"),
|
||||
QString("%1<br>"
|
||||
"<h4>%2</h4><br>")
|
||||
.arg(tr("Enable this will notify when the leading vehicle drives away."))
|
||||
.arg(tr("Note: This chime is only designed as a notification. It is the driver's responsibility to observe their environment and make decisions accordingly.")),
|
||||
"../assets/offroad/icon_road.png"
|
||||
));
|
||||
|
||||
// General: Custom Boot Screen
|
||||
main_layout->addWidget(horizontal_line());
|
||||
main_layout->addWidget(new ParamControl(
|
||||
|
||||
+20
-12
@@ -568,6 +568,8 @@ void AnnotatedCameraWidget::updateState(const UIState &s) {
|
||||
static bool chime_sent = false;
|
||||
static int chime_count = 0;
|
||||
int chime_prompt = 0;
|
||||
static float last_lead_distance = -1;
|
||||
const float lead_distance = radar_state.getLeadOne().getDRel();
|
||||
|
||||
if (!s.scene.e2e_long_alert_ui) {
|
||||
e2eLStatus = 0;
|
||||
@@ -579,18 +581,33 @@ void AnnotatedCameraWidget::updateState(const UIState &s) {
|
||||
e2eLStatus = 0;
|
||||
}
|
||||
|
||||
if (!s.scene.e2e_long_alert || radar_state.getLeadOne().getStatus()) {
|
||||
if (!car_state.getStandstill()) {
|
||||
chime_prompt = 0;
|
||||
chime_sent = false;
|
||||
chime_count = 0;
|
||||
} else if (e2eLStatus == 2) {
|
||||
|
||||
if (last_lead_distance != -1) {
|
||||
last_lead_distance = -1;
|
||||
}
|
||||
}
|
||||
|
||||
if (e2eLStatus == 2) {
|
||||
if ((car_state.getCruiseState().getEnabled() || car_state.getBrakeLights()) && !car_state.getGasPressed() && car_state.getStandstill()) {
|
||||
if (chime_sent) {
|
||||
chime_count = 0;
|
||||
} else {
|
||||
chime_count += 1;
|
||||
}
|
||||
if (chime_count >= 2 && !chime_sent) {
|
||||
if (radar_state.getLeadOne().getStatus()) {
|
||||
if ((last_lead_distance == -1) || (lead_distance < last_lead_distance)) {
|
||||
last_lead_distance = lead_distance;
|
||||
} else if (s.scene.e2e_long_alert_lead && (lead_distance - last_lead_distance > 1.0) && !chime_sent) {
|
||||
chime_prompt = 2;
|
||||
chime_sent = true;
|
||||
} else {
|
||||
chime_prompt = 0;
|
||||
}
|
||||
} else if (s.scene.e2e_long_alert_light && chime_count >= 2 && !chime_sent) {
|
||||
chime_prompt = 1;
|
||||
chime_sent = true;
|
||||
} else {
|
||||
@@ -598,15 +615,6 @@ void AnnotatedCameraWidget::updateState(const UIState &s) {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
chime_prompt = 0;
|
||||
chime_sent = false;
|
||||
chime_count = 0;
|
||||
}
|
||||
|
||||
if (!car_state.getStandstill()) {
|
||||
chime_prompt = 0;
|
||||
chime_sent = false;
|
||||
chime_count = 0;
|
||||
}
|
||||
|
||||
setProperty("e2eStatus", chime_prompt);
|
||||
|
||||
+2
-1
@@ -255,7 +255,8 @@ void ui_update_params(UIState *s) {
|
||||
s->scene.dev_ui_info = std::atoi(params.get("DevUIInfo").c_str());
|
||||
s->scene.button_auto_hide = params.getBool("ButtonAutoHide");
|
||||
s->scene.reverse_dm_cam = params.getBool("ReverseDmCam");
|
||||
s->scene.e2e_long_alert = params.getBool("EndToEndLongAlert");
|
||||
s->scene.e2e_long_alert_light = params.getBool("EndToEndLongAlertLight");
|
||||
s->scene.e2e_long_alert_lead = params.getBool("EndToEndLongAlertLead");
|
||||
s->scene.e2e_long_alert_ui = params.getBool("EndToEndLongAlertUI");
|
||||
|
||||
if (s->scene.onroadScreenOff > 0) {
|
||||
|
||||
+1
-1
@@ -186,7 +186,7 @@ typedef struct UIScene {
|
||||
|
||||
bool reverse_dm_cam;
|
||||
|
||||
bool e2e_long_alert, e2e_long_alert_ui;
|
||||
bool e2e_long_alert_light, e2e_long_alert_lead, e2e_long_alert_ui;
|
||||
float e2eX[13] = {0};
|
||||
} UIScene;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user