This commit is contained in:
concordia
2024-05-02 21:29:10 -05:00
parent f56042fcb9
commit 00f797f931
2 changed files with 17 additions and 16 deletions

View File

@@ -828,7 +828,8 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
int base_red = 150; // Dark red component int base_red = 150; // Dark red component
int base_green = 150; // Minimal green component int base_green = 150; // Minimal green component
int base_blue = 150; // Minimal blue component int base_blue = 150; // Minimal blue component
float base_alpha = 0.4; // 60% opacity float path_alpha = 0.75; // 60% opacity
float other_alpha = 0.75; // 60% opacity
QColor baseColor(base_red, base_green, base_blue); QColor baseColor(base_red, base_green, base_blue);
@@ -886,7 +887,7 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
float adjusted_lightness = util::map_val(adjusted_saturation, 0.f, 1.f, static_cast<float>(_l), 0.95f); // Using base lightness as a starting point float adjusted_lightness = util::map_val(adjusted_saturation, 0.f, 1.f, static_cast<float>(_l), 0.95f); // Using base lightness as a starting point
// Calculate dynamic alpha based on lin_grad_point // Calculate dynamic alpha based on lin_grad_point
float dynamic_alpha = util::map_val(lin_grad_point, 0.75f / 2.f, 0.75f, base_alpha, 0.f); float dynamic_alpha = util::map_val(lin_grad_point, 0.75f / 2.f, 0.75f, path_alpha, 0.f);
QColor final_color = QColor::fromHslF(static_cast<float>(_h / 360.f), adjusted_saturation, adjusted_lightness, dynamic_alpha); QColor final_color = QColor::fromHslF(static_cast<float>(_h / 360.f), adjusted_saturation, adjusted_lightness, dynamic_alpha);
bg.setColorAt(lin_grad_point, final_color); bg.setColorAt(lin_grad_point, final_color);
@@ -895,9 +896,9 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
} }
} else { } else {
bg.setColorAt(0.0, QColor(baseColor.red(), baseColor.green(), baseColor.blue(), static_cast<int>(base_alpha * 255 * 0.4))); bg.setColorAt(0.0, QColor(baseColor.red(), baseColor.green(), baseColor.blue(), static_cast<int>(other_alpha * 255 * 0.4)));
bg.setColorAt(0.5, QColor(baseColor.red(), baseColor.green(), baseColor.blue(), static_cast<int>(base_alpha * 255 * 0.35))); bg.setColorAt(0.5, QColor(baseColor.red(), baseColor.green(), baseColor.blue(), static_cast<int>(other_alpha * 255 * 0.35)));
bg.setColorAt(1.0, QColor(baseColor.red(), baseColor.green(), baseColor.blue(), static_cast<int>(base_alpha * 255 * 0.0))); bg.setColorAt(1.0, QColor(baseColor.red(), baseColor.green(), baseColor.blue(), static_cast<int>(other_alpha * 255 * 0.0)));
} }
painter.setBrush(bg); painter.setBrush(bg);
@@ -907,14 +908,14 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
QLinearGradient pe(0, height(), 0, 0); QLinearGradient pe(0, height(), 0, 0);
if (alwaysOnLateralActive) { if (alwaysOnLateralActive) {
QColor color = bg_colors[STATUS_ALWAYS_ON_LATERAL_ACTIVE]; QColor color = bg_colors[STATUS_ALWAYS_ON_LATERAL_ACTIVE];
pe.setColorAt(0.0, QColor(color.red(), color.green(), color.blue(), static_cast<int>(base_alpha * 255))); pe.setColorAt(0.0, QColor(color.red(), color.green(), color.blue(), static_cast<int>(other_alpha * 255)));
pe.setColorAt(0.5, QColor(color.red(), color.green(), color.blue(), static_cast<int>(base_alpha * 255 * 0.5))); pe.setColorAt(0.5, QColor(color.red(), color.green(), color.blue(), static_cast<int>(other_alpha * 255 * 0.5)));
pe.setColorAt(1.0, QColor(color.red(), color.green(), color.blue(), static_cast<int>(base_alpha * 255 * 0.1))); pe.setColorAt(1.0, QColor(color.red(), color.green(), color.blue(), static_cast<int>(other_alpha * 255 * 0.1)));
} else if (conditionalStatus == 1 || conditionalStatus == 3 || conditionalStatus == 5 || experimentalMode) { } else if (conditionalStatus == 1 || conditionalStatus == 3 || conditionalStatus == 5 || experimentalMode) {
QColor color = bg_colors[STATUS_EXPERIMENTAL_ACTIVE]; QColor color = bg_colors[STATUS_EXPERIMENTAL_ACTIVE];
pe.setColorAt(0.0, QColor(color.red(), color.green(), color.blue(), static_cast<int>(base_alpha * 255))); pe.setColorAt(0.0, QColor(color.red(), color.green(), color.blue(), static_cast<int>(other_alpha * 255)));
pe.setColorAt(0.5, QColor(color.red(), color.green(), color.blue(), static_cast<int>(base_alpha * 255 * 0.5))); pe.setColorAt(0.5, QColor(color.red(), color.green(), color.blue(), static_cast<int>(other_alpha * 255 * 0.5)));
pe.setColorAt(1.0, QColor(color.red(), color.green(), color.blue(), static_cast<int>(base_alpha * 255 * 0.1))); pe.setColorAt(1.0, QColor(color.red(), color.green(), color.blue(), static_cast<int>(other_alpha * 255 * 0.1)));
} else if (trafficModeActive) { } else if (trafficModeActive) {
pe.setColorAt(0.0, QColor::fromHslF(355 / 360., 0.71, 0.46, 1.0)); pe.setColorAt(0.0, QColor::fromHslF(355 / 360., 0.71, 0.46, 1.0));
pe.setColorAt(0.5, QColor::fromHslF(355 / 360., 0.71, 0.46, 0.5)); pe.setColorAt(0.5, QColor::fromHslF(355 / 360., 0.71, 0.46, 0.5));
@@ -925,9 +926,9 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
pe.setColorAt(1.0, QColor::fromHslF(205 / 360., 0.85, 0.56, 0.1)); pe.setColorAt(1.0, QColor::fromHslF(205 / 360., 0.85, 0.56, 0.1));
} else { } else {
QColor color = bg_colors[STATUS_ENGAGED]; QColor color = bg_colors[STATUS_ENGAGED];
pe.setColorAt(0.0, QColor(color.red(), color.green(), color.blue(), static_cast<int>(base_alpha * 255))); pe.setColorAt(0.0, QColor(color.red(), color.green(), color.blue(), static_cast<int>(other_alpha * 255)));
pe.setColorAt(0.5, QColor(color.red(), color.green(), color.blue(), static_cast<int>(base_alpha * 255 * 0.5))); pe.setColorAt(0.5, QColor(color.red(), color.green(), color.blue(), static_cast<int>(other_alpha * 255 * 0.5)));
pe.setColorAt(1.0, QColor(color.red(), color.green(), color.blue(), static_cast<int>(base_alpha * 255 * 0.1))); pe.setColorAt(1.0, QColor(color.red(), color.green(), color.blue(), static_cast<int>(other_alpha * 255 * 0.1)));
} }
QPainterPath path; QPainterPath path;

View File

@@ -18,7 +18,7 @@
#include "selfdrive/ui/qt/network/wifi_manager.h" #include "selfdrive/ui/qt/network/wifi_manager.h"
#include "system/hardware/hw.h" #include "system/hardware/hw.h"
const int UI_BORDER_SIZE = 30; const int UI_BORDER_SIZE = 20; // clearpilot
const int UI_HEADER_HEIGHT = 420; const int UI_HEADER_HEIGHT = 420;
const int UI_FREQ = 20; // Hz const int UI_FREQ = 20; // Hz
@@ -26,7 +26,7 @@ const int BACKLIGHT_OFFROAD = 50;
typedef cereal::CarControl::HUDControl::AudibleAlert AudibleAlert; typedef cereal::CarControl::HUDControl::AudibleAlert AudibleAlert;
const float MIN_DRAW_DISTANCE = 10.0; const float MIN_DRAW_DISTANCE = 10.0;
const float MAX_DRAW_DISTANCE = 100.0; const float MAX_DRAW_DISTANCE = 100.0; // clearpilot
constexpr mat3 DEFAULT_CALIBRATION = {{ 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0 }}; constexpr mat3 DEFAULT_CALIBRATION = {{ 0.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 0.0, 0.0 }};
constexpr mat3 FCAM_INTRINSIC_MATRIX = (mat3){{2648.0, 0.0, 1928.0 / 2, constexpr mat3 FCAM_INTRINSIC_MATRIX = (mat3){{2648.0, 0.0, 1928.0 / 2,
0.0, 2648.0, 1208.0 / 2, 0.0, 2648.0, 1208.0 / 2,