Blind spot path
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user