This commit is contained in:
Your Name
2024-05-02 01:07:51 -05:00
parent 95a98a8fe8
commit c55a879968
83 changed files with 3570 additions and 69 deletions

View File

@@ -40,8 +40,8 @@ def create_steering_messages(packer, CP, CAN, enabled, lat_active, apply_steer):
ret = []
values = {
"LKA_MODE": 2,
"LKA_ICON": 2 if lat_active else 1,
"LKA_MODE": 2, # CP: Whats this?
"LKA_ICON": 2 if lat_active else 1, # CP: Whats this?
"TORQUE_REQUEST": apply_steer,
"LKA_ASSIST": 0,
"STEER_REQ": 1 if lat_active else 0,
@@ -113,10 +113,13 @@ def create_acc_cancel(packer, CP, CAN, cruise_info_copy):
})
return packer.make_can_msg("SCC_CONTROL", CAN.ECAN, values)
# CLEARPILOT changed HDA icons
def create_lfahda_cluster(packer, CAN, enabled, lat_active):
values = {
"HDA_ICON": 1 if enabled else 0,
"LFA_ICON": 2 if lat_active else 0,
# 0 off, 1 gray, 2 green, 3 blinking (wheel icon)
# CP: Is this actually the wheel? Might this be the HDA2 thing?
"HDA_ICON": 0, # Intention is to have this represent stock HDA mode
"LFA_ICON": 2 if enabled else 1 if lat_active else 0,
}
return packer.make_can_msg("LFAHDA_CLUSTER", CAN.ECAN, values)

View File

@@ -200,6 +200,12 @@ class StartupAlert(Alert):
alert_status, AlertSize.mid,
Priority.LOWER, VisualAlert.none, AudibleAlert.none, 5.),
# ClearPilot
class InvisibleAlert(Alert):
def __init__(self, alert_text_1: str, alert_text_2: str = "", alert_status=AlertStatus.normal):
super().__init__(alert_text_1, alert_text_2,
alert_status, AlertSize.none,
Priority.LOWER, VisualAlert.none, AudibleAlert.none, 5.),
# ********** helper functions **********
def get_display_speed(speed_ms: float, metric: bool) -> str:
@@ -232,7 +238,8 @@ def startup_master_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubM
if "REPLAY" in os.environ:
branch = "replay"
return StartupAlert("Hippity hoppity this is my property", "so I do what I want 🐸", alert_status=AlertStatus.frogpilot)
# Clearpilot disabled
return InvisibleAlert("Hippity hoppity this is my property", "so I do what I want 🐸", alert_status=AlertStatus.frogpilot)
def below_engage_speed_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubMaster, metric: bool, soft_disable_time: int) -> Alert:
return NoEntryAlert(f"Drive above {get_display_speed(CP.minEnableSpeed, metric)} to engage")
@@ -271,7 +278,9 @@ def torque_nn_load_alert(CP: car.CarParams, CS: car.CarState, sm: messaging.SubM
AlertStatus.userPrompt, AlertSize.mid,
Priority.LOW, VisualAlert.none, AudibleAlert.prompt, 5.0)
else:
return Alert(
# CLEARPILOT
# Maybe we should put this on a system console
return InvisibleAlert(
"NNFF Torque Controller loaded",
model_name,
AlertStatus.frogpilot, AlertSize.mid,

View File

@@ -81,7 +81,7 @@ procs = [
PythonProcess("deleter", "system.loggerd.deleter", always_run),
PythonProcess("dmonitoringd", "selfdrive.monitoring.dmonitoringd", driverview, enabled=(not PC or WEBCAM)),
PythonProcess("qcomgpsd", "system.qcomgpsd.qcomgpsd", qcomgps, enabled=TICI),
#PythonProcess("ugpsd", "system.ugpsd", only_onroad, enabled=TICI),
PythonProcess("ugpsd", "system.ugpsd", only_onroad, enabled=TICI),
PythonProcess("navd", "selfdrive.navd.navd", only_onroad),
PythonProcess("pandad", "selfdrive.boardd.pandad", always_run),
PythonProcess("paramsd", "selfdrive.locationd.paramsd", only_onroad),

View File

@@ -827,25 +827,25 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
// lanelines
for (int i = 0; i < std::size(scene.lane_line_vertices); ++i) {
if (currentHolidayTheme != 0) {
painter.setBrush(std::get<2>(holidayThemeConfiguration[currentHolidayTheme]).begin()->second);
} else if (customColors != 0) {
painter.setBrush(std::get<2>(themeConfiguration[customColors]).begin()->second);
} else {
// if (currentHolidayTheme != 0) {
// painter.setBrush(std::get<2>(holidayThemeConfiguration[currentHolidayTheme]).begin()->second);
// } else if (customColors != 0) {
// painter.setBrush(std::get<2>(themeConfiguration[customColors]).begin()->second);
// } else {
painter.setBrush(QColor::fromRgbF(1.0, 1.0, 1.0, std::clamp<float>(scene.lane_line_probs[i], 0.0, 0.7)));
}
// }
painter.drawPolygon(scene.lane_line_vertices[i]);
}
// road edges
for (int i = 0; i < std::size(scene.road_edge_vertices); ++i) {
if (currentHolidayTheme != 0) {
painter.setBrush(std::get<2>(holidayThemeConfiguration[currentHolidayTheme]).begin()->second);
} else if (customColors != 0) {
painter.setBrush(std::get<2>(themeConfiguration[customColors]).begin()->second);
} else {
// for (int i = 0; i < std::size(scene.road_edge_vertices); ++i) {
// if (currentHolidayTheme != 0) {
// painter.setBrush(std::get<2>(holidayThemeConfiguration[currentHolidayTheme]).begin()->second);
// } else if (customColors != 0) {
// painter.setBrush(std::get<2>(themeConfiguration[customColors]).begin()->second);
// } else {
painter.setBrush(QColor::fromRgbF(1.0, 0, 0, std::clamp<float>(1.0 - scene.road_edge_stds[i], 0.0, 1.0)));
}
// }
painter.drawPolygon(scene.road_edge_vertices[i]);
}
@@ -870,20 +870,21 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
// Flip so 0 is bottom of frame
float lin_grad_point = (height() - scene.track_vertices[i].y()) / height();
// If acceleration is between -0.25 and 0.25, resort to the theme color
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());
}
// CLEARPILOT disabling custom theme colors
// // If acceleration is between -0.25 and 0.25, resort to the theme color
// 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)) {
const auto &colorMap = std::get<2>(themeConfiguration[customColors]);
for (const auto &[position, brush] : colorMap) {
bg.setColorAt(position, brush.color());
}
// } else if (std::abs(acceleration[i]) < 0.25 && (customColors != 0)) {
// const auto &colorMap = std::get<2>(themeConfiguration[customColors]);
// for (const auto &[position, brush] : colorMap) {
// bg.setColorAt(position, brush.color());
// }
} else {
// } else {
// 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
@@ -896,20 +897,21 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
// Skip a point, unless next is last
i += (i + 2) < max_len ? 1 : 0;
}
// }
}
} else if (currentHolidayTheme != 0) {
const auto &colorMap = std::get<2>(holidayThemeConfiguration[currentHolidayTheme]);
for (const auto &[position, brush] : colorMap) {
bg.setColorAt(position, brush.color());
}
// 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 if (customColors != 0) {
// const auto &colorMap = std::get<2>(themeConfiguration[customColors]);
// for (const auto &[position, brush] : colorMap) {
// bg.setColorAt(position, brush.color());
// }
} else {
bg.setColorAt(0.0, QColor::fromHslF(148 / 360., 0.94, 0.51, 0.4));
@@ -942,18 +944,18 @@ 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.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));
} 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 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 {
pe.setColorAt(0.0, QColor::fromHslF(148 / 360., 0.94, 0.51, 1.0));
pe.setColorAt(0.5, QColor::fromHslF(112 / 360., 1.00, 0.68, 0.5));
@@ -1093,13 +1095,14 @@ void AnnotatedCameraWidget::drawLead(QPainter &painter, const cereal::ModelDataV
// chevron
QPointF chevron[] = {{x + (sz * 1.25), y + sz}, {x, y}, {x - (sz * 1.25), y + sz}};
if (currentHolidayTheme != 0) {
painter.setBrush(std::get<2>(holidayThemeConfiguration[currentHolidayTheme]).begin()->second);
} else if (customColors != 0) {
painter.setBrush(std::get<2>(themeConfiguration[customColors]).begin()->second);
} else {
// CLEARPILOT disabling custom theme colors
// if (currentHolidayTheme != 0) {
// painter.setBrush(std::get<2>(holidayThemeConfiguration[currentHolidayTheme]).begin()->second);
// } else if (customColors != 0) {
// painter.setBrush(std::get<2>(themeConfiguration[customColors]).begin()->second);
// } else {
painter.setBrush(redColor(fillAlpha));
}
// }
painter.drawPolygon(chevron, std::size(chevron));
if (leadInfo) {

View File

@@ -131,18 +131,19 @@ enum PrimeType {
const QColor bg_colors [] = {
[STATUS_DISENGAGED] = QColor(0x17, 0x33, 0x49, 0xc8),
[STATUS_OVERRIDE] = QColor(0x91, 0x9b, 0x95, 0xf1),
[STATUS_ENGAGED] = QColor(0x17, 0x86, 0x44, 0xf1),
// [STATUS_ENGAGED] = QColor(0x17, 0x86, 0x44, 0xf1),
[STATUS_ENGAGED] = QColor(47, 158, 238, 0xf1), // CLEARPILOT changed to light blue
// FrogPilot colors
[STATUS_ALWAYS_ON_LATERAL_ACTIVE] = QColor(0x0a, 0xba, 0xb5, 0xf1),
[STATUS_ALWAYS_ON_LATERAL_ACTIVE] = QColor(4, 64, 11, 0xf1), // CLEARPILOT changed to dark blue
[STATUS_TRAFFIC_MODE_ACTIVE] = QColor(0xc9, 0x22, 0x31, 0xf1),
};
static std::map<cereal::ControlsState::AlertStatus, QColor> alert_colors = {
{cereal::ControlsState::AlertStatus::NORMAL, QColor(0x15, 0x15, 0x15, 0xf1)},
{cereal::ControlsState::AlertStatus::USER_PROMPT, QColor(0xDA, 0x6F, 0x25, 0xf1)},
{cereal::ControlsState::AlertStatus::USER_PROMPT, QColor(4, 64, 11, 0xf1)}, // CLEARPILOT changed to a shade of dark blue
{cereal::ControlsState::AlertStatus::CRITICAL, QColor(0xC9, 0x22, 0x31, 0xf1)},
{cereal::ControlsState::AlertStatus::FROGPILOT, QColor(0x17, 0x86, 0x44, 0xf1)},
{cereal::ControlsState::AlertStatus::FROGPILOT, QColor(47, 158, 238, 0xf1)}, // CLEARPILOT changed to light blue
};
typedef struct UIScene {