Blind spot path
Added toggle to display a red path in the adjacent lane when a vehicle is detected in the blind spot.
This commit is contained in:
@@ -537,6 +537,24 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
|
||||
painter.setBrush(bg);
|
||||
painter.drawPolygon(scene.track_vertices);
|
||||
|
||||
// Paint blindspot path
|
||||
if (scene.blind_spot_path) {
|
||||
QLinearGradient bs(0, height(), 0, 0);
|
||||
if (blindSpotLeft || blindSpotRight) {
|
||||
bs.setColorAt(0.0, QColor::fromHslF(0 / 360., 0.75, 0.50, 0.6));
|
||||
bs.setColorAt(0.5, QColor::fromHslF(0 / 360., 0.75, 0.50, 0.4));
|
||||
bs.setColorAt(1.0, QColor::fromHslF(0 / 360., 0.75, 0.50, 0.2));
|
||||
}
|
||||
|
||||
painter.setBrush(bs);
|
||||
if (blindSpotLeft) {
|
||||
painter.drawPolygon(scene.track_adjacent_vertices[4]);
|
||||
}
|
||||
if (blindSpotRight) {
|
||||
painter.drawPolygon(scene.track_adjacent_vertices[5]);
|
||||
}
|
||||
}
|
||||
|
||||
painter.restore();
|
||||
}
|
||||
|
||||
@@ -737,6 +755,9 @@ void AnnotatedCameraWidget::updateFrogPilotWidgets(QPainter &p) {
|
||||
alwaysOnLateral = scene.always_on_lateral;
|
||||
alwaysOnLateralActive = scene.always_on_lateral_active;
|
||||
|
||||
blindSpotLeft = scene.blind_spot_left;
|
||||
blindSpotRight = scene.blind_spot_right;
|
||||
|
||||
experimentalMode = scene.experimental_mode;
|
||||
|
||||
if (alwaysOnLateral) {
|
||||
|
||||
@@ -120,6 +120,8 @@ private:
|
||||
|
||||
bool alwaysOnLateral;
|
||||
bool alwaysOnLateralActive;
|
||||
bool blindSpotLeft;
|
||||
bool blindSpotRight;
|
||||
bool experimentalMode;
|
||||
|
||||
protected:
|
||||
|
||||
@@ -114,6 +114,11 @@ 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 adjacent paths
|
||||
for (int i = 4; i <= 5; i++) {
|
||||
update_line_data(s, lane_lines[i], scene.blind_spot_path ? (i == 4 ? scene.lane_width_left : scene.lane_width_right) / 2 : 0, 0, &scene.track_adjacent_vertices[i], max_idx);
|
||||
}
|
||||
}
|
||||
|
||||
void update_dmonitoring(UIState *s, const cereal::DriverStateV2::Reader &driverstate, float dm_fade_state, bool is_rhd) {
|
||||
@@ -202,6 +207,10 @@ static void update_state(UIState *s) {
|
||||
}
|
||||
if (sm.updated("carState")) {
|
||||
auto carState = sm["carState"].getCarState();
|
||||
if (scene.blind_spot_path) {
|
||||
scene.blind_spot_left = carState.getLeftBlindspot();
|
||||
scene.blind_spot_right = carState.getRightBlindspot();
|
||||
}
|
||||
}
|
||||
if (sm.updated("controlsState")) {
|
||||
auto controlsState = sm["controlsState"].getControlsState();
|
||||
@@ -216,6 +225,10 @@ static void update_state(UIState *s) {
|
||||
}
|
||||
if (sm.updated("frogpilotPlan")) {
|
||||
auto frogpilotPlan = sm["frogpilotPlan"].getFrogpilotPlan();
|
||||
if (scene.blind_spot_path) {
|
||||
scene.lane_width_left = frogpilotPlan.getLaneWidthLeft();
|
||||
scene.lane_width_right = frogpilotPlan.getLaneWidthRight();
|
||||
}
|
||||
}
|
||||
if (sm.updated("liveLocationKalman")) {
|
||||
auto liveLocationKalman = sm["liveLocationKalman"].getLiveLocationKalman();
|
||||
@@ -250,6 +263,7 @@ void ui_update_frogpilot_params(UIState *s) {
|
||||
|
||||
bool custom_onroad_ui = params.getBool("CustomUI");
|
||||
scene.acceleration_path = custom_onroad_ui && params.getBool("AccelerationPath");
|
||||
scene.blind_spot_path = custom_onroad_ui && params.getBool("BlindSpotPath");
|
||||
|
||||
bool quality_of_life_controls = params.getBool("QOLControls");
|
||||
|
||||
|
||||
@@ -172,9 +172,17 @@ typedef struct UIScene {
|
||||
bool acceleration_path;
|
||||
bool always_on_lateral;
|
||||
bool always_on_lateral_active;
|
||||
bool blind_spot_left;
|
||||
bool blind_spot_path;
|
||||
bool blind_spot_right;
|
||||
bool enabled;
|
||||
bool experimental_mode;
|
||||
|
||||
float lane_width_left;
|
||||
float lane_width_right;
|
||||
|
||||
QPolygonF track_adjacent_vertices[6];
|
||||
|
||||
} UIScene;
|
||||
|
||||
class UIState : public QObject {
|
||||
|
||||
Reference in New Issue
Block a user