Controls - Experimental Mode Activation
Toggle Experimental Mode with either buttons on the steering wheel or the screen. Overrides 'Conditional Experimental Mode'.
This commit is contained in:
parent
1266b2282a
commit
69006ee3f2
@ -29,12 +29,17 @@ class ConditionalExperimentalMode:
|
||||
self.stop_light_mac = MovingAverageCalculator()
|
||||
|
||||
def update(self, carState, enabled, frogpilotNavigation, lead_distance, lead, modelData, road_curvature, slower_lead, v_ego, v_lead, frogpilot_toggles):
|
||||
if frogpilot_toggles.experimental_mode_via_press and enabled:
|
||||
overridden = self.params_memory.get_int("CEStatus")
|
||||
else:
|
||||
overridden = 0
|
||||
|
||||
self.update_conditions(lead_distance, lead.status, modelData, road_curvature, slower_lead, carState.standstill, v_ego, v_lead, frogpilot_toggles)
|
||||
|
||||
condition_met = self.check_conditions(carState, frogpilotNavigation, lead, modelData, v_ego, frogpilot_toggles) and enabled
|
||||
self.experimental_mode = condition_met
|
||||
self.experimental_mode = condition_met and overridden not in {1, 3, 5} or overridden in {2, 4, 6}
|
||||
|
||||
self.params_memory.put_int("CEStatus", self.status_value if condition_met else 0)
|
||||
self.params_memory.put_int("CEStatus", overridden if overridden in {1, 2, 3, 4, 5, 6} else self.status_value if condition_met else 0)
|
||||
|
||||
def check_conditions(self, carState, frogpilotNavigation, lead, modelData, v_ego, frogpilot_toggles):
|
||||
if carState.standstill:
|
||||
|
@ -230,8 +230,13 @@ void ExperimentalButton::changeMode() {
|
||||
const auto cp = (*uiState()->sm)["carParams"].getCarParams();
|
||||
bool can_change = hasLongitudinalControl(cp) && params.getBool("ExperimentalModeConfirmed");
|
||||
if (can_change) {
|
||||
if (scene.conditional_experimental) {
|
||||
int override_value = (scene.conditional_status >= 1 && scene.conditional_status <= 6) ? 0 : scene.conditional_status >= 7 ? 5 : 6;
|
||||
paramsMemory.putIntNonBlocking("CEStatus", override_value);
|
||||
} else {
|
||||
params.putBool("ExperimentalMode", !experimental_mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void ExperimentalButton::updateState(const UIState &s) {
|
||||
@ -901,6 +906,20 @@ void AnnotatedCameraWidget::drawStatusBar(QPainter &p) {
|
||||
newStatus = conditionalStatusMap[status != STATUS_DISENGAGED ? conditionalStatus : 0];
|
||||
}
|
||||
|
||||
QString distanceSuffix = tr(". Long press the \"distance\" button to revert");
|
||||
QString lkasSuffix = tr(". Double press the \"LKAS\" button to revert");
|
||||
QString screenSuffix = tr(". Double tap the screen to revert");
|
||||
|
||||
if (!alwaysOnLateralActive && !mapOpen && status != STATUS_DISENGAGED && !newStatus.isEmpty()) {
|
||||
if (conditionalStatus == 1 || conditionalStatus == 2) {
|
||||
newStatus += distanceSuffix;
|
||||
} else if (conditionalStatus == 3 || conditionalStatus == 4) {
|
||||
newStatus += lkasSuffix;
|
||||
} else if (conditionalStatus == 5 || conditionalStatus == 6) {
|
||||
newStatus += screenSuffix;
|
||||
}
|
||||
}
|
||||
|
||||
if (newStatus != lastShownStatus) {
|
||||
displayStatusText = true;
|
||||
lastShownStatus = newStatus;
|
||||
|
@ -116,6 +116,7 @@ typedef enum UIStatus {
|
||||
|
||||
// FrogPilot statuses
|
||||
STATUS_ALWAYS_ON_LATERAL_ACTIVE,
|
||||
STATUS_CONDITIONAL_OVERRIDDEN,
|
||||
STATUS_EXPERIMENTAL_MODE_ACTIVE,
|
||||
STATUS_NAVIGATION_ACTIVE,
|
||||
} UIStatus;
|
||||
@ -137,6 +138,7 @@ const QColor bg_colors [] = {
|
||||
|
||||
// FrogPilot colors
|
||||
[STATUS_ALWAYS_ON_LATERAL_ACTIVE] = QColor(0x0a, 0xba, 0xb5, 0xf1),
|
||||
[STATUS_CONDITIONAL_OVERRIDDEN] = QColor(0xff, 0xff, 0x00, 0xf1),
|
||||
[STATUS_EXPERIMENTAL_MODE_ACTIVE] = QColor(0xda, 0x6f, 0x25, 0xf1),
|
||||
[STATUS_NAVIGATION_ACTIVE] = QColor(0x31, 0xa1, 0xee, 0xf1),
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user