This commit is contained in:
Your Name
2024-05-02 20:16:33 -05:00
parent 132171d23b
commit 1b13eaf1eb
4 changed files with 35 additions and 65 deletions

View File

@@ -1,7 +1,8 @@
Dev: Dev:
- New behavior for lane change assist - when starting lane change, disable - New behavior for lane change assist - when starting lane change, disable
lateral until .5 seconds after blinkers stop lateral until .5 seconds after blinkers stop
- - // Clearpilot allow leadInfo (test me)
Test: Test:
- New colors for driving - New colors for driving

View File

@@ -138,9 +138,10 @@ FrogPilotVisualsPanel::FrogPilotVisualsPanel(SettingsWindow *parent) : FrogPilot
modifiedCustomOnroadUIKeys.erase("DeveloperUI"); modifiedCustomOnroadUIKeys.erase("DeveloperUI");
} }
if (!hasOpenpilotLongitudinal || !isRelease) { // Clearpilot allow leadInfo (test me)
modifiedCustomOnroadUIKeys.erase("LeadInfo"); // if (!hasOpenpilotLongitudinal || !isRelease) {
} // modifiedCustomOnroadUIKeys.erase("LeadInfo");
// }
toggle->setVisible(modifiedCustomOnroadUIKeys.find(key.c_str()) != modifiedCustomOnroadUIKeys.end()); toggle->setVisible(modifiedCustomOnroadUIKeys.find(key.c_str()) != modifiedCustomOnroadUIKeys.end());
} }

View File

@@ -823,6 +823,14 @@ void AnnotatedCameraWidget::updateFrameMat() {
void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) { void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
painter.save(); painter.save();
// CLEARPILOT: color channel code rewriten to allow custom colors
// Define base RGB color and alpha
int base_red = 255; // Example red color
int base_green = 200; // Example green color
int base_blue = 150; // Example blue color
float base_alpha = 0.75; // Example base alpha
QColor baseColor(base_red, base_green, base_blue);
SubMaster &sm = *(s->sm); SubMaster &sm = *(s->sm);
// lanelines // lanelines
@@ -864,59 +872,32 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
} }
for (int i = 0; i < max_len; ++i) { for (int i = 0; i < max_len; ++i) {
// Some points are out of frame
if (scene.track_vertices[i].y() < 0 || scene.track_vertices[i].y() > height()) continue; if (scene.track_vertices[i].y() < 0 || scene.track_vertices[i].y() > height()) continue;
// Flip so 0 is bottom of frame
float lin_grad_point = (height() - scene.track_vertices[i].y()) / height(); float lin_grad_point = (height() - scene.track_vertices[i].y()) / height();
// CLEARPILOT disabling custom theme colors float path_hue = std::max(std::min(60 + acceleration[i] * 35, 120.f), 0.f);
// // If acceleration is between -0.25 and 0.25, resort to the theme color path_hue = static_cast<int>(path_hue * 100 + 0.5) / 100; // Ensuring hue is rounded to reduce processing
// if (std::abs(acceleration[i]) < 0.25 && (currentHolidayTheme != 0)) {
// const auto &colorMap = std::get<2>(holidayThemeConfiguration[currentHolidayTheme]);
// for (const auto &[position, brush] : colorMap) {
// bg.setColorAt(position, brush.color());
// }
// } else if (std::abs(acceleration[i]) < 0.25 && (customColors != 0)) { float saturation = std::min(std::abs(acceleration[i] * 1.5f), 1.f);
// const auto &colorMap = std::get<2>(themeConfiguration[customColors]); float lightness = util::map_val(saturation, 0.5f, 0.0f, 0.95f, 0.62f); // lighter when grey
// for (const auto &[position, brush] : colorMap) {
// bg.setColorAt(position, brush.color());
// }
// } else { float dynamic_alpha = util::map_val(lin_grad_point, 0.75f / 2.f, 0.75f, base_alpha, 0.0f);
// speed up: 120, slow down: 0
float path_hue = fmax(fmin(60 + acceleration[i] * 35, 120), 0);
// FIXME: painter.drawPolygon can be slow if hue is not rounded
path_hue = int(path_hue * 100 + 0.5) / 100;
float saturation = fmin(fabs(acceleration[i] * 1.5), 1); QColor base_color = QColor::fromRgb(base_red, base_green, base_blue);
float lightness = util::map_val(saturation, 0.0f, 1.0f, 0.95f, 0.62f); // lighter when grey float h, s, l;
float alpha = util::map_val(lin_grad_point, 0.75f / 2.f, 0.75f, 0.4f, 0.0f); // matches previous alpha fade base_color.getHslF(&h, &s, &l);
bg.setColorAt(lin_grad_point, QColor::fromHslF(path_hue / 360., saturation, lightness, alpha)); QColor final_color = QColor::fromHslF(path_hue / 360., saturation, lightness, dynamic_alpha);
// Skip a point, unless next is last bg.setColorAt(lin_grad_point, final_color);
i += (i + 2) < max_len ? 1 : 0;
// } i += (i + 2) < max_len ? 1 : 0; // skipping a point to optimize rendering
} }
// CLEARPILOT disabling custom theme colors
// } else if (currentHolidayTheme != 0) {
// const auto &colorMap = std::get<2>(holidayThemeConfiguration[currentHolidayTheme]);
// for (const auto &[position, brush] : colorMap) {
// bg.setColorAt(position, brush.color());
// }
// } else if (customColors != 0) {
// const auto &colorMap = std::get<2>(themeConfiguration[customColors]);
// for (const auto &[position, brush] : colorMap) {
// bg.setColorAt(position, brush.color());
// }
} else { } else {
bg.setColorAt(0.0, QColor::fromHslF(148 / 360., 0.94, 0.51, 0.4)); bg.setColorAt(0.0, QColor(baseColor.red(), baseColor.green(), baseColor.blue(), static_cast<int>(base_alpha * 255 * 0.4)));
bg.setColorAt(0.5, QColor::fromHslF(112 / 360., 1.0, 0.68, 0.35)); bg.setColorAt(0.5, QColor(baseColor.red(), baseColor.green(), baseColor.blue(), static_cast<int>(base_alpha * 255 * 0.35)));
bg.setColorAt(1.0, QColor::fromHslF(112 / 360., 1.0, 0.68, 0.0)); bg.setColorAt(1.0, QColor(baseColor.red(), baseColor.green(), baseColor.blue(), static_cast<int>(base_alpha * 255 * 0.0)));
} }
painter.setBrush(bg); painter.setBrush(bg);
@@ -944,22 +925,10 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
pe.setColorAt(0.0, QColor::fromHslF(205 / 360., 0.85, 0.56, 1.0)); pe.setColorAt(0.0, QColor::fromHslF(205 / 360., 0.85, 0.56, 1.0));
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 if (currentHolidayTheme != 0) {
// const auto &colorMap = std::get<2>(holidayThemeConfiguration[currentHolidayTheme]);
// for (const auto &[position, brush] : colorMap) {
// QColor darkerColor = brush.color().darker(120);
// pe.setColorAt(position, darkerColor);
// }
// } else if (customColors != 0) {
// const auto &colorMap = std::get<2>(themeConfiguration[customColors]);
// for (const auto &[position, brush] : colorMap) {
// QColor darkerColor = brush.color().darker(120);
// pe.setColorAt(position, darkerColor);
// }
} else { } else {
pe.setColorAt(0.0, QColor::fromHslF(148 / 360., 0.94, 0.51, 1.0)); pe.setColorAt(0.0, QColor(baseColor.red(), baseColor.green(), baseColor.blue(), static_cast<int>(base_alpha * 255)));
pe.setColorAt(0.5, QColor::fromHslF(112 / 360., 1.00, 0.68, 0.5)); pe.setColorAt(0.5, QColor(baseColor.red(), baseColor.green(), baseColor.blue(), static_cast<int>(base_alpha * 255 * 0.5)));
pe.setColorAt(1.0, QColor::fromHslF(112 / 360., 1.00, 0.68, 0.1)); pe.setColorAt(1.0, QColor(baseColor.red(), baseColor.green(), baseColor.blue(), static_cast<int>(base_alpha * 255 * 0.1)));
} }
QPainterPath path; QPainterPath path;

View File

@@ -130,12 +130,11 @@ enum PrimeType {
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, 0x9b, 0x95, 0xf1), [STATUS_OVERRIDE] = QColor(0x91, 0x7b, 0x7b, 0xf1)),
// [STATUS_ENGAGED] = QColor(0x17, 0x86, 0x44, 0xf1), [STATUS_ENGAGED] = QColor(0x91, 0x7b, 0x7b, 0xf1), // CLEARPILOT changed to redish gray
[STATUS_ENGAGED] = QColor(47, 158, 238, 0xf1), // CLEARPILOT changed to light blue
// FrogPilot colors // FrogPilot colors
[STATUS_ALWAYS_ON_LATERAL_ACTIVE] = QColor(4, 64, 11, 0xf1), // CLEARPILOT changed to dark blue [STATUS_ALWAYS_ON_LATERAL_ACTIVE] = QColor(0x91, 0x7b, 0x7b, 0xf1), // CLEARPILOT changed to dark blue
[STATUS_TRAFFIC_MODE_ACTIVE] = QColor(0xc9, 0x22, 0x31, 0xf1), [STATUS_TRAFFIC_MODE_ACTIVE] = QColor(0xc9, 0x22, 0x31, 0xf1),
}; };