mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-04 21:12:07 +08:00
Pause Acceleration/Braking
This commit is contained in:
@@ -20,6 +20,7 @@ class FrogPilotCard:
|
||||
self.decel_pressed = False
|
||||
self.distancePressed_previously = False
|
||||
self.force_coast = False
|
||||
self.pause_longitudinal = False
|
||||
|
||||
self.gap_counter = 0
|
||||
|
||||
@@ -36,6 +37,8 @@ class FrogPilotCard:
|
||||
self.handle_experimental_mode(sm, frogpilot_toggles)
|
||||
elif sm["carControl"].longActive and getattr(frogpilot_toggles, f"force_coast_via_{key}"):
|
||||
self.force_coast = not self.force_coast
|
||||
elif sm["carControl"].longActive and getattr(frogpilot_toggles, f"pause_longitudinal_via_{key}"):
|
||||
self.pause_longitudinal = not self.pause_longitudinal
|
||||
|
||||
def handle_experimental_mode(self, sm, frogpilot_toggles):
|
||||
if frogpilot_toggles.conditional_experimental_mode:
|
||||
@@ -100,5 +103,6 @@ class FrogPilotCard:
|
||||
frogpilotCarState.distanceLongPressed = self.very_long_press_threshold > self.gap_counter >= self.long_press_threshold
|
||||
frogpilotCarState.distanceVeryLongPressed = self.gap_counter >= self.very_long_press_threshold
|
||||
frogpilotCarState.forceCoast = self.force_coast
|
||||
frogpilotCarState.pauseLongitudinal = self.pause_longitudinal
|
||||
|
||||
return frogpilotCarState
|
||||
|
||||
@@ -159,6 +159,7 @@ void FrogPilotAnnotatedCameraWidget::updateState(const UIState &s, const FrogPil
|
||||
forceCoast = frogpilotCarState.getForceCoast();
|
||||
laneWidthLeft = frogpilotPlan.getLaneWidthLeft();
|
||||
laneWidthRight = frogpilotPlan.getLaneWidthRight();
|
||||
longitudinalPaused = frogpilotCarState.getPauseLongitudinal();
|
||||
redLight = frogpilotPlan.getRedLight();
|
||||
roadCurvature = frogpilotPlan.getRoadCurvature();
|
||||
roadName = QString::fromStdString(params_memory.get("RoadName"));
|
||||
@@ -230,7 +231,7 @@ void FrogPilotAnnotatedCameraWidget::paintFrogPilotWidgets(QPainter &p, UIState
|
||||
}
|
||||
}
|
||||
|
||||
if (!hideBottomIcons && (forceCoast)) {
|
||||
if (!hideBottomIcons && (forceCoast || longitudinalPaused)) {
|
||||
paintLongitudinalPaused(p);
|
||||
}
|
||||
|
||||
|
||||
@@ -79,6 +79,7 @@ private:
|
||||
bool cscTraining;
|
||||
bool experimentalMode;
|
||||
bool forceCoast;
|
||||
bool longitudinalPaused;
|
||||
bool redLight;
|
||||
|
||||
int animationFrameIndex;
|
||||
|
||||
Reference in New Issue
Block a user