Traffic Mode
Added toggle to change the longitudinal behavior to be more focused on driving in traffic.
This commit is contained in:
@@ -493,6 +493,7 @@ void ExperimentalButton::paintEvent(QPaintEvent *event) {
|
||||
(scene.always_on_lateral_active ? QColor(10, 186, 181, 255) :
|
||||
(scene.conditional_status == 1 ? QColor(255, 246, 0, 255) :
|
||||
(experimental_mode ? QColor(218, 111, 37, 241) :
|
||||
(scene.traffic_mode && scene.traffic_mode_active ? QColor(201, 34, 49, 255) :
|
||||
(scene.navigate_on_openpilot ? QColor(49, 161, 238, 255) : QColor(0, 0, 0, 166)))))) :
|
||||
QColor(0, 0, 0, 166);
|
||||
|
||||
@@ -658,6 +659,8 @@ void AnnotatedCameraWidget::drawHud(QPainter &p) {
|
||||
), 6));
|
||||
} else if (scene.reverse_cruise) {
|
||||
p.setPen(QPen(QColor(0, 150, 255), 6));
|
||||
} else if (trafficModeActive) {
|
||||
p.setPen(QPen(redColor(255), 6));
|
||||
} else {
|
||||
p.setPen(QPen(whiteColor(75), 6));
|
||||
}
|
||||
@@ -906,6 +909,10 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
|
||||
pe.setColorAt(0.0, QColor::fromHslF(25 / 360., 0.71, 0.50, 1.0));
|
||||
pe.setColorAt(0.5, QColor::fromHslF(25 / 360., 0.71, 0.50, 0.5));
|
||||
pe.setColorAt(1.0, QColor::fromHslF(25 / 360., 0.71, 0.50, 0.1));
|
||||
} else if (trafficModeActive) {
|
||||
pe.setColorAt(0.0, QColor::fromHslF(355 / 360., 0.71, 0.46, 1.0));
|
||||
pe.setColorAt(0.5, QColor::fromHslF(355 / 360., 0.71, 0.46, 0.5));
|
||||
pe.setColorAt(1.0, QColor::fromHslF(355 / 360., 0.71, 0.46, 0.1));
|
||||
} else if (scene.navigate_on_openpilot) {
|
||||
pe.setColorAt(0.0, QColor::fromHslF(205 / 360., 0.85, 0.56, 1.0));
|
||||
pe.setColorAt(0.5, QColor::fromHslF(205 / 360., 0.85, 0.56, 0.5));
|
||||
@@ -1347,6 +1354,8 @@ void AnnotatedCameraWidget::updateFrogPilotWidgets(QPainter &p) {
|
||||
slcSpeedLimitOffset = scene.speed_limit_offset * (is_metric ? MS_TO_KPH : MS_TO_MPH);
|
||||
useViennaSLCSign = scene.use_vienna_slc_sign;
|
||||
|
||||
trafficModeActive = scene.traffic_mode && scene.traffic_mode_active;
|
||||
|
||||
turnSignalLeft = scene.turn_signal_left;
|
||||
turnSignalRight = scene.turn_signal_right;
|
||||
|
||||
@@ -1602,7 +1611,7 @@ void AnnotatedCameraWidget::drawLeadInfo(QPainter &p) {
|
||||
double currentAcceleration = std::round(scene.acceleration * 100) / 100;
|
||||
static double maxAcceleration = 0.0;
|
||||
|
||||
if (currentAcceleration > maxAcceleration && status == STATUS_ENGAGED) {
|
||||
if (currentAcceleration > maxAcceleration && (status == STATUS_ENGAGED || status == STATUS_TRAFFIC_MODE_ACTIVE)) {
|
||||
maxAcceleration = currentAcceleration;
|
||||
isFiveSecondsPassed = false;
|
||||
timer.start();
|
||||
|
||||
@@ -229,6 +229,7 @@ private:
|
||||
bool showSLCOffset;
|
||||
bool slcOverridden;
|
||||
bool speedLimitController;
|
||||
bool trafficModeActive;
|
||||
bool turnSignalLeft;
|
||||
bool turnSignalRight;
|
||||
bool useViennaSLCSign;
|
||||
|
||||
@@ -349,6 +349,9 @@ void ui_update_frogpilot_params(UIState *s) {
|
||||
scene.experimental_mode_via_screen = params.getBool("ExperimentalModeViaScreen") && params.getBool("ExperimentalModeActivation");
|
||||
scene.fahrenheit = params.getBool("Fahrenheit");
|
||||
|
||||
bool longitudinal_tune = params.getBool("LongitudinalTune");
|
||||
scene.traffic_mode = longitudinal_tune && params.getBool("TrafficMode");
|
||||
|
||||
scene.model_ui = params.getBool("ModelUI");
|
||||
scene.dynamic_path_width = scene.model_ui && params.getBool("DynamicPathWidth");
|
||||
scene.hide_lead_marker = scene.model_ui && params.getBool("HideLeadMarker");
|
||||
@@ -401,7 +404,9 @@ void UIState::updateStatus() {
|
||||
if (state == cereal::ControlsState::OpenpilotState::PRE_ENABLED || state == cereal::ControlsState::OpenpilotState::OVERRIDING) {
|
||||
status = STATUS_OVERRIDE;
|
||||
} else if (scene.always_on_lateral_active) {
|
||||
status = STATUS_LATERAL_ACTIVE;
|
||||
status = STATUS_ALWAYS_ON_LATERAL_ACTIVE;
|
||||
} else if (scene.traffic_mode_active) {
|
||||
status = STATUS_TRAFFIC_MODE_ACTIVE;
|
||||
} else {
|
||||
status = controls_state.getEnabled() ? STATUS_ENGAGED : STATUS_DISENGAGED;
|
||||
}
|
||||
@@ -469,15 +474,10 @@ void UIState::update() {
|
||||
}
|
||||
|
||||
// FrogPilot live variables that need to be constantly checked
|
||||
if (scene.conditional_experimental) {
|
||||
scene.conditional_status = paramsMemory.getInt("CEStatus");
|
||||
}
|
||||
if (scene.holiday_themes) {
|
||||
scene.current_holiday_theme = paramsMemory.getInt("CurrentHolidayTheme");
|
||||
}
|
||||
if (scene.random_events) {
|
||||
scene.current_random_event = paramsMemory.getInt("CurrentRandomEvent");
|
||||
}
|
||||
scene.conditional_status = scene.conditional_experimental ? paramsMemory.getInt("CEStatus") : 0;
|
||||
scene.current_holiday_theme = scene.holiday_themes ? paramsMemory.getInt("CurrentHolidayTheme") : 0;
|
||||
scene.current_random_event = scene.random_events ? paramsMemory.getInt("CurrentRandomEvent") : 0;
|
||||
scene.traffic_mode_active = scene.conditional_experimental && scene.enabled && paramsMemory.getBool("TrafficModeActive");
|
||||
}
|
||||
|
||||
void UIState::setPrimeType(PrimeType type) {
|
||||
|
||||
@@ -113,7 +113,8 @@ typedef enum UIStatus {
|
||||
STATUS_ENGAGED,
|
||||
|
||||
// FrogPilot statuses
|
||||
STATUS_LATERAL_ACTIVE,
|
||||
STATUS_ALWAYS_ON_LATERAL_ACTIVE,
|
||||
STATUS_TRAFFIC_MODE_ACTIVE,
|
||||
} UIStatus;
|
||||
|
||||
enum PrimeType {
|
||||
@@ -132,7 +133,8 @@ const QColor bg_colors [] = {
|
||||
[STATUS_ENGAGED] = QColor(0x17, 0x86, 0x44, 0xf1),
|
||||
|
||||
// FrogPilot colors
|
||||
[STATUS_LATERAL_ACTIVE] = QColor(0x0a, 0xba, 0xb5, 0xf1),
|
||||
[STATUS_ALWAYS_ON_LATERAL_ACTIVE] = QColor(0x0a, 0xba, 0xb5, 0xf1),
|
||||
[STATUS_TRAFFIC_MODE_ACTIVE] = QColor(0xc9, 0x22, 0x31, 0xf1),
|
||||
};
|
||||
|
||||
static std::map<cereal::ControlsState::AlertStatus, QColor> alert_colors = {
|
||||
@@ -228,6 +230,8 @@ typedef struct UIScene {
|
||||
bool standstill;
|
||||
bool status_changed;
|
||||
bool tethering_enabled;
|
||||
bool traffic_mode;
|
||||
bool traffic_mode_active;
|
||||
bool turn_signal_left;
|
||||
bool turn_signal_right;
|
||||
bool unlimited_road_ui_length;
|
||||
|
||||
Reference in New Issue
Block a user