mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-07 14:42:08 +08:00
Force Stop Icon replaces banner
This commit is contained in:
@@ -194,6 +194,7 @@ struct StarPilotPlan @0xf98d843bfd7004a3 {
|
||||
weatherId @34 :Int16;
|
||||
disableThrottle @35 :Bool;
|
||||
trackingLead @36 :Bool;
|
||||
stopSignConfirmed @37 :Bool;
|
||||
}
|
||||
|
||||
struct StarPilotRadarState @0xb86e6369214c01c8 {
|
||||
|
||||
@@ -438,17 +438,13 @@ def forcing_stop_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMas
|
||||
return Alert(
|
||||
"Holding the car at a stop",
|
||||
"Press the gas pedal or 'Resume' button to override",
|
||||
StarPilotAlertStatus.starpilot, AlertSize.mid,
|
||||
StarPilotAlertStatus.starpilot, AlertSize.small,
|
||||
Priority.MID, VisualAlert.none, AudibleAlert.prompt, 1.)
|
||||
|
||||
model_length = sm["starpilotPlan"].forcingStopLength
|
||||
model_length_msg = f"{model_length:.1f} meters" if metric else f"{model_length * CV.METER_TO_FOOT:.1f} feet"
|
||||
|
||||
return Alert(
|
||||
f"Forcing the car to stop in {model_length_msg}",
|
||||
"Press the gas pedal or 'Resume' button to override",
|
||||
StarPilotAlertStatus.starpilot, AlertSize.mid,
|
||||
Priority.MID, VisualAlert.none, AudibleAlert.prompt, 1.)
|
||||
"", "",
|
||||
StarPilotAlertStatus.starpilot, AlertSize.none,
|
||||
Priority.MID, VisualAlert.none, AudibleAlert.none, .1)
|
||||
|
||||
|
||||
def holiday_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int, personality, starpilot_toggles: SimpleNamespace) -> Alert:
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 20 KiB |
@@ -190,6 +190,7 @@ class StarPilotPlanner:
|
||||
|
||||
starpilotPlan.forcingStop = self.starpilot_vcruise.forcing_stop
|
||||
starpilotPlan.forcingStopLength = self.starpilot_vcruise.tracked_model_length
|
||||
starpilotPlan.stopSignConfirmed = self.starpilot_vcruise.stop_sign_confirmed
|
||||
|
||||
starpilotPlan.starpilotEvents = self.starpilot_events.events.to_msg()
|
||||
|
||||
|
||||
@@ -17,6 +17,8 @@ StarPilotAnnotatedCameraWidget::StarPilotAnnotatedCameraWidget(QWidget *parent)
|
||||
nextMapsIcon = loadPixmap("../../starpilot/assets/other_images/next_maps_icon.png", {btn_size / 2, btn_size / 2}).scaled(iconSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
pausedIcon = loadPixmap("../../starpilot/assets/other_images/paused_icon.png", {widget_size, widget_size});
|
||||
speedIcon = loadPixmap("../../starpilot/assets/other_images/speed_icon.png", {widget_size, widget_size});
|
||||
forceStopDashImg = loadPixmap("../../starpilot/assets/other_images/force_stop_dash.png", {btn_size, btn_size});
|
||||
forceStopImg = loadPixmap("../../starpilot/assets/other_images/force_stop.png", {btn_size, btn_size});
|
||||
stopSignImg = loadPixmap("../../starpilot/assets/other_images/stop_sign.png", {btn_size, btn_size});
|
||||
turnIcon = loadPixmap("../../starpilot/assets/other_images/turn_icon.png", {widget_size, widget_size});
|
||||
visionIcon = loadPixmap("../../starpilot/assets/other_images/speed_icon.png", {btn_size / 2, btn_size / 2}).scaled(iconSize, Qt::KeepAspectRatio, Qt::SmoothTransformation);
|
||||
@@ -200,6 +202,9 @@ void StarPilotAnnotatedCameraWidget::updateState(const UIState &s, const StarPil
|
||||
desiredFollowDistance = starpilotPlan.getDesiredFollowDistance();
|
||||
experimentalMode = selfdriveState.getExperimentalMode();
|
||||
forceCoast = starpilotCarState.getForceCoast();
|
||||
forcingStop = starpilotPlan.getForcingStop();
|
||||
forcingStopLength = starpilotPlan.getForcingStopLength();
|
||||
stopSignConfirmed = starpilotPlan.getStopSignConfirmed();
|
||||
laneWidthLeft = starpilotPlan.getLaneWidthLeft();
|
||||
laneWidthRight = starpilotPlan.getLaneWidthRight();
|
||||
lateralPaused = starpilotCarState.getPauseLateral();
|
||||
@@ -313,7 +318,9 @@ void StarPilotAnnotatedCameraWidget::paintStarPilotWidgets(QPainter &p, UIState
|
||||
compassPosition.setY(0);
|
||||
}
|
||||
|
||||
if (!speedLimitChanged && !(signalStyle == "static" && blinkerLeft) && cachedCscStatus) {
|
||||
if (forcingStop) {
|
||||
paintForceStop(p);
|
||||
} else if (!speedLimitChanged && !(signalStyle == "static" && blinkerLeft) && cachedCscStatus) {
|
||||
if (cscTraining) {
|
||||
paintCurveSpeedControlTraining(p);
|
||||
} else if (isCruiseSet && cscControllingSpeed) {
|
||||
@@ -1131,6 +1138,31 @@ void StarPilotAnnotatedCameraWidget::paintStandstillTimer(QPainter &p) {
|
||||
p.restore();
|
||||
}
|
||||
|
||||
void StarPilotAnnotatedCameraWidget::paintForceStop(QPainter &p) {
|
||||
p.save();
|
||||
|
||||
QRect forceStopRect(QPoint(setSpeedRect.right() + UI_BORDER_SIZE, setSpeedRect.top()), QSize(defaultSize.width() * 1.25, defaultSize.width() * 1.25));
|
||||
|
||||
p.setOpacity(1.0);
|
||||
|
||||
QRect cscRect(forceStopRect.topLeft() + QPoint(0, forceStopRect.height() + 10), QSize(forceStopRect.width(), 100));
|
||||
p.setBrush(redColor(166));
|
||||
p.setFont(InterFont(45, QFont::Bold));
|
||||
p.setPen(QPen(QColor(255, 150, 150), 10));
|
||||
p.drawRoundedRect(cscRect, 24, 24);
|
||||
p.setPen(QPen(whiteColor(), 6));
|
||||
p.drawText(cscRect.adjusted(20, 0, 0, 0), Qt::AlignVCenter | Qt::AlignLeft,
|
||||
QString::number(std::nearbyint(forcingStopLength * distanceConversion)) + leadDistanceUnit);
|
||||
|
||||
QPixmap &activeIcon = stopSignConfirmed ? forceStopDashImg : forceStopImg;
|
||||
QSize imgSize = activeIcon.size();
|
||||
QPoint imgPoint(forceStopRect.x() + (forceStopRect.width() - imgSize.width()) / 2,
|
||||
forceStopRect.y() + (forceStopRect.height() - imgSize.height()) / 2);
|
||||
p.drawPixmap(imgPoint, activeIcon);
|
||||
|
||||
p.restore();
|
||||
}
|
||||
|
||||
void StarPilotAnnotatedCameraWidget::paintStoppingPoint(QPainter &p) {
|
||||
p.save();
|
||||
|
||||
|
||||
@@ -72,6 +72,7 @@ private:
|
||||
void paintSpeedLimit(QPainter &p);
|
||||
void paintSpeedLimitSources(QPainter &p);
|
||||
void paintStandstillTimer(QPainter &p);
|
||||
void paintForceStop(QPainter &p);
|
||||
void paintStoppingPoint(QPainter &p);
|
||||
void paintTurnSignals(QPainter &p);
|
||||
void paintWeather(QPainter &p);
|
||||
@@ -83,6 +84,8 @@ private:
|
||||
bool blinkerRight;
|
||||
bool brakeLights;
|
||||
bool cscControllingSpeed;
|
||||
bool forcingStop;
|
||||
bool stopSignConfirmed;
|
||||
bool cscTraining;
|
||||
bool experimentalMode;
|
||||
bool forceCoast;
|
||||
@@ -131,6 +134,7 @@ private:
|
||||
|
||||
float accelerationEgo;
|
||||
float cscSpeed;
|
||||
float forcingStopLength;
|
||||
float dashboardSpeedLimit;
|
||||
float distanceConversion;
|
||||
float laneWidthLeft;
|
||||
@@ -170,6 +174,8 @@ private:
|
||||
QPixmap nextMapsIcon;
|
||||
QPixmap pausedIcon;
|
||||
QPixmap speedIcon;
|
||||
QPixmap forceStopDashImg;
|
||||
QPixmap forceStopImg;
|
||||
QPixmap stopSignImg;
|
||||
QPixmap turnIcon;
|
||||
QPixmap visionIcon;
|
||||
|
||||
Reference in New Issue
Block a user