Blind spot path

This commit is contained in:
James
2025-12-01 12:00:00 -07:00
parent a5bd0d082e
commit ffd7259193
3 changed files with 29 additions and 0 deletions
@@ -38,6 +38,9 @@ void FrogPilotAnnotatedCameraWidget::updateState(const UIState &s, const FrogPil
speedConversionMetrics = MS_TO_MPH;
}
blindspotLeft = carState.getLeftBlindspot();
blindspotRight = carState.getRightBlindspot();
hideBottomIcons = selfdriveState.getAlertSize() != cereal::SelfdriveState::AlertSize::NONE;
hideBottomIcons |= frogpilotSelfdriveState.getAlertSize() != cereal::FrogPilotSelfdriveState::AlertSize::NONE;
}
@@ -48,3 +51,22 @@ void FrogPilotAnnotatedCameraWidget::mousePressEvent(QMouseEvent *mouseEvent) {
void FrogPilotAnnotatedCameraWidget::paintFrogPilotWidgets(QPainter &p, UIState &s) {
}
void FrogPilotAnnotatedCameraWidget::paintBlindSpotPath(QPainter &p) {
p.save();
QLinearGradient bs(0, height(), 0, 0);
bs.setColorAt(0.0f, QColor::fromHslF(0 / 360.0f, 0.75f, 0.5f, 0.4f));
bs.setColorAt(0.5f, QColor::fromHslF(0 / 360.0f, 0.75f, 0.5f, 0.35f));
bs.setColorAt(1.0f, QColor::fromHslF(0 / 360.0f, 0.75f, 0.5f, 0.0f));
p.setBrush(bs);
if (track_adjacent_vertices[0].boundingRect().width() > 0 && blindspotLeft) {
p.drawPolygon(track_adjacent_vertices[0]);
}
if (track_adjacent_vertices[1].boundingRect().width() > 0 && blindspotRight) {
p.drawPolygon(track_adjacent_vertices[1]);
}
p.restore();
}
@@ -12,6 +12,7 @@ public:
explicit FrogPilotAnnotatedCameraWidget(QWidget *parent = 0);
void mousePressEvent(QMouseEvent *mouseEvent) override;
void paintBlindSpotPath(QPainter &p);
void paintFrogPilotWidgets(QPainter &p, UIState &s);
void updateState(const UIState &s, const FrogPilotUIState &fs);
@@ -40,6 +41,9 @@ protected:
void showEvent(QShowEvent *event) override;
private:
bool blindspotLeft;
bool blindspotRight;
float distanceConversion;
float setSpeed;
float speedConversion;
+3
View File
@@ -168,6 +168,9 @@ void ModelRenderer::drawPath(QPainter &painter, const cereal::ModelDataV2::Reade
painter.drawPolygon(track_vertices);
// FrogPilot variables
if (frogpilot_toggles.value("blind_spot_path").toBool()) {
frogpilot_nvg->paintBlindSpotPath(painter);
}
}
void ModelRenderer::updatePathGradient(QLinearGradient &bg) {