From dcf8e19b268e3068d151df1b7a79320144b25d5b Mon Sep 17 00:00:00 2001 From: FrogAi <91348155+FrogAi@users.noreply.github.com> Date: Sat, 25 May 2024 12:39:42 -0700 Subject: [PATCH] Visuals - Custom Onroad UI - Paths - Blind Spot Show when a vehicle is detected in the blindspot. --- .../frogpilot/controls/frogpilot_planner.py | 2 +- selfdrive/ui/qt/onroad/annotated_camera.cc | 17 +++++++++++++++++ selfdrive/ui/ui.cc | 1 + selfdrive/ui/ui.h | 1 + 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/selfdrive/frogpilot/controls/frogpilot_planner.py b/selfdrive/frogpilot/controls/frogpilot_planner.py index 1cf66cccf..6b892a546 100644 --- a/selfdrive/frogpilot/controls/frogpilot_planner.py +++ b/selfdrive/frogpilot/controls/frogpilot_planner.py @@ -86,7 +86,7 @@ class FrogPilotPlanner: if frogpilot_toggles.conditional_experimental_mode and controlsState.enabled: self.cem.update(carState, frogpilotNavigation, self.lead_one, modelData, self.model_length, self.road_curvature, self.slower_lead, self.tracking_lead, self.v_cruise, v_ego, v_lead, frogpilot_toggles) - check_lane_width = frogpilot_toggles.adjacent_lanes or frogpilot_toggles.lane_detection + check_lane_width = frogpilot_toggles.adjacent_lanes or frogpilot_toggles.blind_spot_path or frogpilot_toggles.lane_detection if check_lane_width and v_ego >= frogpilot_toggles.minimum_lane_change_speed: self.lane_width_left = float(calculate_lane_width(modelData.laneLines[0], modelData.laneLines[1], modelData.roadEdges[0])) self.lane_width_right = float(calculate_lane_width(modelData.laneLines[3], modelData.laneLines[2], modelData.roadEdges[1])) diff --git a/selfdrive/ui/qt/onroad/annotated_camera.cc b/selfdrive/ui/qt/onroad/annotated_camera.cc index d756b7bb3..ed9a5c209 100644 --- a/selfdrive/ui/qt/onroad/annotated_camera.cc +++ b/selfdrive/ui/qt/onroad/annotated_camera.cc @@ -312,6 +312,23 @@ 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); + + 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]); + } + } + // Paint adjacent lane paths if (scene.adjacent_path && (laneWidthLeft != 0 || laneWidthRight != 0)) { const float minLaneWidth = laneDetectionWidth * 0.5f; diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index e797a2961..7c883d52c 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -311,6 +311,7 @@ void ui_update_frogpilot_params(UIState *s) { scene.acceleration_path = custom_paths && params.getBool("AccelerationPath"); scene.adjacent_path = custom_paths && params.getBool("AdjacentPath"); scene.adjacent_path_metrics = scene.adjacent_path && params.getBool("AdjacentPathMetrics"); + scene.blind_spot_path = custom_paths && params.getBool("BlindSpotPath"); scene.compass = custom_onroad_ui && params.getBool("Compass"); scene.disable_smoothing_mtsc = params.getBool("MTSCEnabled") && params.getBool("DisableMTSCSmoothing"); diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index 1621bfaaa..6062a7371 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -126,6 +126,7 @@ typedef struct UIScene { bool adjacent_path_metrics; bool always_on_lateral_active; bool blind_spot_left; + bool blind_spot_path; bool blind_spot_right; bool compass; bool conditional_experimental;