Visuals - Model UI - Path Edges
Adjust the width of the path edges shown on your UI to represent different driving modes and statuses. Default is 20% of the total path. Blue = Navigation Light Blue = 'Always On Lateral' Green = Default Orange = 'Experimental Mode' Red = 'Traffic Mode' Yellow = 'Conditional Experimental Mode' Overriden
This commit is contained in:
parent
ca10ff1ee1
commit
29271b0f4c
|
@ -441,6 +441,50 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s, c
|
|||
paintLane(scene.track_adjacent_vertices[5], laneWidthRight, blindSpotRight);
|
||||
}
|
||||
|
||||
// Paint path edges
|
||||
QLinearGradient pe(0, height(), 0, 0);
|
||||
auto setGradientColors = [&](const QColor &baseColor) {
|
||||
pe.setColorAt(0.0, baseColor);
|
||||
QColor color = baseColor;
|
||||
color.setAlphaF(0.5);
|
||||
pe.setColorAt(0.5, color);
|
||||
color.setAlphaF(0.1);
|
||||
pe.setColorAt(1.0, color);
|
||||
};
|
||||
|
||||
if (alwaysOnLateralActive) {
|
||||
setGradientColors(bg_colors[STATUS_ALWAYS_ON_LATERAL_ACTIVE]);
|
||||
} else if (conditionalStatus == 1 || conditionalStatus == 3 || conditionalStatus == 5) {
|
||||
setGradientColors(bg_colors[STATUS_CONDITIONAL_OVERRIDDEN]);
|
||||
} else if (experimentalMode) {
|
||||
setGradientColors(bg_colors[STATUS_EXPERIMENTAL_MODE_ACTIVE]);
|
||||
} else if (trafficModeActive) {
|
||||
setGradientColors(bg_colors[STATUS_TRAFFIC_MODE_ACTIVE]);
|
||||
} else if (scene.navigate_on_openpilot) {
|
||||
setGradientColors(bg_colors[STATUS_NAVIGATION_ACTIVE]);
|
||||
} else if (currentHolidayTheme != 0) {
|
||||
const std::map<double, QBrush> &colorMap = std::get<2>(holidayThemeConfiguration[currentHolidayTheme]);
|
||||
for (const std::pair<double, QBrush> &entry : colorMap) {
|
||||
pe.setColorAt(entry.first, entry.second.color().darker(120));
|
||||
}
|
||||
} else if (customColors != 0) {
|
||||
const std::map<double, QBrush> &colorMap = std::get<2>(themeConfiguration[customColors]);
|
||||
for (const std::pair<double, QBrush> &entry : colorMap) {
|
||||
pe.setColorAt(entry.first, entry.second.color().darker(120));
|
||||
}
|
||||
} else {
|
||||
pe.setColorAt(0.0, QColor::fromHslF(148 / 360., 0.94, 0.51, 1.0));
|
||||
pe.setColorAt(0.5, QColor::fromHslF(112 / 360., 1.00, 0.68, 0.5));
|
||||
pe.setColorAt(1.0, QColor::fromHslF(112 / 360., 1.00, 0.68, 0.1));
|
||||
}
|
||||
|
||||
QPainterPath path;
|
||||
path.addPolygon(scene.track_vertices);
|
||||
path.addPolygon(scene.track_edge_vertices);
|
||||
|
||||
painter.setBrush(pe);
|
||||
painter.drawPath(path);
|
||||
|
||||
painter.restore();
|
||||
}
|
||||
|
||||
|
|
|
@ -132,7 +132,10 @@ void update_model(UIState *s,
|
|||
}
|
||||
}
|
||||
max_idx = get_path_length_idx(plan_position, max_distance);
|
||||
update_line_data(s, plan_position, 0.9, 1.22, &scene.track_vertices, max_idx, false);
|
||||
update_line_data(s, plan_position, scene.model_ui ? path * (1 - scene.path_edge_width / 100.0f) : 0.9, 1.22, &scene.track_vertices, max_idx, false);
|
||||
|
||||
// Update path edges
|
||||
update_line_data(s, plan_position, scene.model_ui ? path : 0, 1.22, &scene.track_edge_vertices, max_idx, false);
|
||||
}
|
||||
|
||||
void update_dmonitoring(UIState *s, const cereal::DriverStateV2::Reader &driverstate, float dm_fade_state, bool is_rhd) {
|
||||
|
@ -404,6 +407,7 @@ void ui_update_frogpilot_params(UIState *s, Params ¶ms) {
|
|||
scene.dynamic_path_width = scene.model_ui && params.getBool("DynamicPathWidth");
|
||||
scene.hide_lead_marker = scene.model_ui && params.getBool("HideLeadMarker");
|
||||
scene.lane_line_width = params.getInt("LaneLinesWidth") * (scene.is_metric ? 1.0f : INCH_TO_CM) / 200.0f;
|
||||
scene.path_edge_width = params.getInt("PathEdgeWidth");
|
||||
|
||||
bool quality_of_life_controls = params.getBool("QOLControls");
|
||||
scene.reverse_cruise = quality_of_life_controls && params.getBool("ReverseCruise");
|
||||
|
|
|
@ -209,6 +209,7 @@ typedef struct UIScene {
|
|||
float lane_width_right;
|
||||
float lat_accel;
|
||||
float lead_detection_threshold;
|
||||
float path_edge_width;
|
||||
float speed_jerk;
|
||||
float speed_jerk_difference;
|
||||
float speed_limit;
|
||||
|
@ -237,6 +238,7 @@ typedef struct UIScene {
|
|||
int wheel_icon;
|
||||
|
||||
QPolygonF track_adjacent_vertices[6];
|
||||
QPolygonF track_edge_vertices;
|
||||
|
||||
} UIScene;
|
||||
|
||||
|
|
Loading…
Reference in New Issue