This commit is contained in:
concordia
2024-05-02 21:09:07 -05:00
parent 0f7aa64d3b
commit dc561e3c2d
2 changed files with 31 additions and 33 deletions

View File

@@ -825,10 +825,10 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
// CLEARPILOT: color channel code rewriten to allow custom colors // CLEARPILOT: color channel code rewriten to allow custom colors
// Define base RGB color and alpha // Define base RGB color and alpha
int base_red = 139; // Dark red component int base_red = 200; // Dark red component
int base_green = 0; // Minimal green component int base_green = 0; // Minimal green component
int base_blue = 0; // Minimal blue component int base_blue = 0; // Minimal blue component
float base_alpha = 0.6; // 60% opacity float base_alpha = 0.75; // 60% opacity
QColor baseColor(base_red, base_green, base_blue); QColor baseColor(base_red, base_green, base_blue);
@@ -906,17 +906,15 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
// Paint path edges // Paint path edges
QLinearGradient pe(0, height(), 0, 0); QLinearGradient pe(0, height(), 0, 0);
if (alwaysOnLateralActive) { if (alwaysOnLateralActive) {
pe.setColorAt(0.0, QColor::fromHslF(178 / 360., 0.90, 0.38, 1.0)); QColor color = bg_colors[STATUS_ALWAYS_ON_LATERAL_ACTIVE];
pe.setColorAt(0.5, QColor::fromHslF(178 / 360., 0.90, 0.38, 0.5)); pe.setColorAt(0.0, QColor(color.red(), color.green(), color.blue(), static_cast<int>(base_alpha * 255)));
pe.setColorAt(1.0, QColor::fromHslF(178 / 360., 0.90, 0.38, 0.1)); pe.setColorAt(0.5, QColor(color.red(), color.green(), color.blue(), static_cast<int>(base_alpha * 255 * 0.5)));
} else if (conditionalStatus == 1 || conditionalStatus == 3 || conditionalStatus == 5) { pe.setColorAt(1.0, QColor(color.red(), color.green(), color.blue(), static_cast<int>(base_alpha * 255 * 0.1)));
pe.setColorAt(0.0, QColor::fromHslF(58 / 360., 1.00, 0.50, 1.0)); } else if (conditionalStatus == 1 || conditionalStatus == 3 || conditionalStatus == 5 || experimentalMode) {
pe.setColorAt(0.5, QColor::fromHslF(58 / 360., 1.00, 0.50, 0.5)); QColor color = bg_colors[STATUS_EXPERIMENTAL_ACTIVE];
pe.setColorAt(1.0, QColor::fromHslF(58 / 360., 1.00, 0.50, 0.1)); pe.setColorAt(0.0, QColor(color.red(), color.green(), color.blue(), static_cast<int>(base_alpha * 255)));
} else if (experimentalMode) { pe.setColorAt(0.5, QColor(color.red(), color.green(), color.blue(), static_cast<int>(base_alpha * 255 * 0.5)));
pe.setColorAt(0.0, QColor::fromHslF(25 / 360., 0.71, 0.50, 1.0)); pe.setColorAt(1.0, QColor(color.red(), color.green(), color.blue(), static_cast<int>(base_alpha * 255 * 0.1)));
pe.setColorAt(0.5, QColor::fromHslF(25 / 360., 0.71, 0.50, 0.5));
pe.setColorAt(1.0, QColor::fromHslF(25 / 360., 0.71, 0.50, 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));
@@ -926,9 +924,10 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
pe.setColorAt(0.5, QColor::fromHslF(205 / 360., 0.85, 0.56, 0.5)); pe.setColorAt(0.5, QColor::fromHslF(205 / 360., 0.85, 0.56, 0.5));
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 {
pe.setColorAt(0.0, QColor(baseColor.red(), baseColor.green(), baseColor.blue(), static_cast<int>(base_alpha * 255))); QColor color = bg_colors[STATUS_ENGAGED];
pe.setColorAt(0.5, QColor(baseColor.red(), baseColor.green(), baseColor.blue(), static_cast<int>(base_alpha * 255 * 0.5))); pe.setColorAt(0.0, QColor(color.red(), color.green(), color.blue(), static_cast<int>(base_alpha * 255)));
pe.setColorAt(1.0, QColor(baseColor.red(), baseColor.green(), baseColor.blue(), static_cast<int>(base_alpha * 255 * 0.1))); pe.setColorAt(0.5, QColor(color.red(), color.green(), color.blue(), static_cast<int>(base_alpha * 255 * 0.5)));
pe.setColorAt(1.0, QColor(color.red(), color.green(), color.blue(), static_cast<int>(base_alpha * 255 * 0.1)));
} }
QPainterPath path; QPainterPath path;

View File

@@ -107,17 +107,6 @@ struct Alert {
} }
}; };
typedef enum UIStatus {
STATUS_DISENGAGED,
STATUS_OVERRIDE,
STATUS_ENGAGED,
// FrogPilot statuses
STATUS_ALWAYS_ON_LATERAL_ACTIVE,
STATUS_TRAFFIC_MODE_ACTIVE,
} UIStatus;
enum PrimeType { enum PrimeType {
UNKNOWN = -1, UNKNOWN = -1,
NONE = 0, NONE = 0,
@@ -127,15 +116,25 @@ enum PrimeType {
MAGENTA_NEW = 4, MAGENTA_NEW = 4,
PURPLE = 5, PURPLE = 5,
}; };
// Clearpilot redefined these.
typedef enum UIStatus {
STATUS_DISENGAGED,
STATUS_OVERRIDE,
STATUS_ENGAGED,
STATUS_ALWAYS_ON_LATERAL_ACTIVE,
STATUS_TRAFFIC_MODE_ACTIVE,
STATUS_EXPERIMENTAL_ACTIVE,
} UIStatus;
// Clearpilot custom colors
const QColor bg_colors [] = { const QColor bg_colors [] = {
[STATUS_DISENGAGED] = QColor(0x17, 0x33, 0x49, 0xc8), [STATUS_DISENGAGED] = QColor(0x17, 0x33, 0x49, 0xc8),
[STATUS_OVERRIDE] = QColor(0x91, 0x7b, 0x7b, 0xf1), [STATUS_OVERRIDE] = QColor(218, 112, 36, 0xd1), // When you nudge the steering wheel while engaged
[STATUS_ENGAGED] = QColor(0x91, 0x7b, 0x7b, 0xf1), // CLEARPILOT changed to redish gray [STATUS_ENGAGED] = QColor(218, 112, 36, 0xd1), // Orange
[STATUS_ALWAYS_ON_LATERAL_ACTIVE] = QColor(158, 126, 111, 0xd1), // Gray
// FrogPilot colors [STATUS_TRAFFIC_MODE_ACTIVE] = QColor(0xc9, 0x22, 0x31, 0xd1), // ? unused?
[STATUS_ALWAYS_ON_LATERAL_ACTIVE] = QColor(0x91, 0x7b, 0x7b, 0xf1), // CLEARPILOT changed to dark blue [STATUS_EXPERIMENTAL_ACTIVE] = QColor(126, 32, 128, 0xd1), // Magenta
[STATUS_TRAFFIC_MODE_ACTIVE] = QColor(0xc9, 0x22, 0x31, 0xf1),
}; };
static std::map<cereal::ControlsState::AlertStatus, QColor> alert_colors = { static std::map<cereal::ControlsState::AlertStatus, QColor> alert_colors = {