wip
This commit is contained in:
@@ -1,5 +1,15 @@
|
|||||||
|
-----
|
||||||
|
Latest:
|
||||||
|
- fix hiding path if disabled
|
||||||
|
- fix suspend on override behavior - override doesnt happen on always on lateral. need alternative check.
|
||||||
|
- fix & test lane line narrow on lane change view
|
||||||
|
- the acc cancel does nothing.
|
||||||
|
- must simulate actual button presses.
|
||||||
|
- add radar dist, model dist, radar speed, model speed to debug hud
|
||||||
|
- fix always on lateral saying its on when actually fully engaged
|
||||||
|
|
||||||
|
|
||||||
|
------
|
||||||
- fix lane lines
|
- fix lane lines
|
||||||
- fix always on lateral detection
|
- fix always on lateral detection
|
||||||
- position override under 25 mph suspends assist
|
- position override under 25 mph suspends assist
|
||||||
|
|||||||
@@ -21,21 +21,21 @@ const SteeringLimits HYUNDAI_CANFD_STEERING_LIMITS = {
|
|||||||
const CanMsg HYUNDAI_CANFD_HDA2_TX_MSGS[] = {
|
const CanMsg HYUNDAI_CANFD_HDA2_TX_MSGS[] = {
|
||||||
{0x50, 0, 16}, // LKAS
|
{0x50, 0, 16}, // LKAS
|
||||||
{0x1CF, 1, 8}, // CRUISE_BUTTON
|
{0x1CF, 1, 8}, // CRUISE_BUTTON
|
||||||
{426, 1, 16}, // CRUISE_BUTTONS_ALT
|
{0x1AA, 1, 16}, // CRUISE_BUTTONS_ALT
|
||||||
{0x2A4, 0, 24}, // CAM_0x2A4
|
{0x2A4, 0, 24}, // CAM_0x2A4
|
||||||
};
|
};
|
||||||
|
|
||||||
const CanMsg HYUNDAI_CANFD_HDA2_ALT_STEERING_TX_MSGS[] = {
|
const CanMsg HYUNDAI_CANFD_HDA2_ALT_STEERING_TX_MSGS[] = {
|
||||||
{0x110, 0, 32}, // LKAS_ALT
|
{0x110, 0, 32}, // LKAS_ALT
|
||||||
{0x1CF, 1, 8}, // CRUISE_BUTTON
|
{0x1CF, 1, 8}, // CRUISE_BUTTON
|
||||||
{426, 1, 16}, // CRUISE_BUTTONS_ALT
|
{0x1AA, 1, 16}, // CRUISE_BUTTONS_ALT
|
||||||
{0x362, 0, 32}, // CAM_0x362
|
{0x362, 0, 32}, // CAM_0x362
|
||||||
};
|
};
|
||||||
|
|
||||||
const CanMsg HYUNDAI_CANFD_HDA2_LONG_TX_MSGS[] = {
|
const CanMsg HYUNDAI_CANFD_HDA2_LONG_TX_MSGS[] = {
|
||||||
{0x50, 0, 16}, // LKAS
|
{0x50, 0, 16}, // LKAS
|
||||||
{0x1CF, 1, 8}, // CRUISE_BUTTON
|
{0x1CF, 1, 8}, // CRUISE_BUTTON
|
||||||
{426, 1, 16}, // CRUISE_BUTTONS_ALT
|
{0x1AA, 1, 16}, // CRUISE_BUTTONS_ALT
|
||||||
{0x2A4, 0, 24}, // CAM_0x2A4
|
{0x2A4, 0, 24}, // CAM_0x2A4
|
||||||
{0x51, 0, 32}, // ADRV_0x51
|
{0x51, 0, 32}, // ADRV_0x51
|
||||||
{0x730, 1, 8}, // tester present for ADAS ECU disable
|
{0x730, 1, 8}, // tester present for ADAS ECU disable
|
||||||
@@ -73,8 +73,8 @@ const CanMsg HYUNDAI_CANFD_HDA1_TX_MSGS[] = {
|
|||||||
#define HYUNDAI_CANFD_ALT_BUTTONS_ADDR_CHECK(pt_bus) \
|
#define HYUNDAI_CANFD_ALT_BUTTONS_ADDR_CHECK(pt_bus) \
|
||||||
{.msg = {{0x1aa, (pt_bus), 16, .check_checksum = false, .max_counter = 0xffU, .frequency = 50U}, { 0 }, { 0 }}}, \
|
{.msg = {{0x1aa, (pt_bus), 16, .check_checksum = false, .max_counter = 0xffU, .frequency = 50U}, { 0 }, { 0 }}}, \
|
||||||
|
|
||||||
#define HYUNDAI_CANFD_ALT_BUTTONS_ADDR_CHECK(pt_bus) \
|
// #define HYUNDAI_CANFD_ALT_BUTTONS_ADDR_CHECK(pt_bus) \
|
||||||
{.msg = {{0x1aa, (pt_bus), 16, .check_checksum = false, .max_counter = 0xffU, .frequency = 50U}, { 0 }, { 0 }}}, \
|
// {.msg = {{0x1aa, (pt_bus), 16, .check_checksum = false, .max_counter = 0xffU, .frequency = 50U}, { 0 }, { 0 }}}, \
|
||||||
|
|
||||||
// SCC_CONTROL (from ADAS unit or camera)
|
// SCC_CONTROL (from ADAS unit or camera)
|
||||||
#define HYUNDAI_CANFD_SCC_ADDR_CHECK(scc_bus) \
|
#define HYUNDAI_CANFD_SCC_ADDR_CHECK(scc_bus) \
|
||||||
|
|||||||
@@ -132,7 +132,10 @@ class CarController(CarControllerBase):
|
|||||||
can_sends.extend(hyundaicanfd.create_spas_messages(self.packer, self.CAN, self.frame, CC.leftBlinker, CC.rightBlinker))
|
can_sends.extend(hyundaicanfd.create_spas_messages(self.packer, self.CAN, self.frame, CC.leftBlinker, CC.rightBlinker))
|
||||||
|
|
||||||
# params_memory = Params("/dev/shm/params")
|
# params_memory = Params("/dev/shm/params")
|
||||||
# if params_memory.get_bool("CPTLkasButtonAction"):
|
if params_memory.get_bool("CPTLkasButtonAction"):
|
||||||
|
if self.frame % 10 == 0:
|
||||||
|
for _ in range(20):
|
||||||
|
can_sends.append(hyundaicanfd.create_buttons_alt(self.packer, self.CP, self.CAN, CS.buttons_counter+1, Buttons.SET_DECEL))
|
||||||
# can_sends.extend(hyundaicanfd.create_adrv_messages(self.packer, self.CAN, self.frame))
|
# can_sends.extend(hyundaicanfd.create_adrv_messages(self.packer, self.CAN, self.frame))
|
||||||
# can_sends.append(hyundaicanfd.create_acc_set_speed(self.packer, self.CP, self.CAN, CS.cruise_info, 50))
|
# can_sends.append(hyundaicanfd.create_acc_set_speed(self.packer, self.CP, self.CAN, CS.cruise_info, 50))
|
||||||
# can_sends.append(hyundaicanfd.create_acc_cancel(self.packer, self.CP, self.CAN, CS.cruise_info))
|
# can_sends.append(hyundaicanfd.create_acc_cancel(self.packer, self.CP, self.CAN, CS.cruise_info))
|
||||||
@@ -197,7 +200,6 @@ class CarController(CarControllerBase):
|
|||||||
can_sends = []
|
can_sends = []
|
||||||
if use_clu11:
|
if use_clu11:
|
||||||
if CC.cruiseControl.cancel:
|
if CC.cruiseControl.cancel:
|
||||||
print("Cancel button go")
|
|
||||||
can_sends.append(hyundaican.create_clu11(self.packer, self.frame, CS.clu11, Buttons.CANCEL, self.CP))
|
can_sends.append(hyundaican.create_clu11(self.packer, self.frame, CS.clu11, Buttons.CANCEL, self.CP))
|
||||||
CS.lkas_trigger_result = 5
|
CS.lkas_trigger_result = 5
|
||||||
elif CC.cruiseControl.resume:
|
elif CC.cruiseControl.resume:
|
||||||
@@ -210,17 +212,18 @@ class CarController(CarControllerBase):
|
|||||||
else:
|
else:
|
||||||
if (self.frame - self.last_button_frame) * DT_CTRL > 0.25:
|
if (self.frame - self.last_button_frame) * DT_CTRL > 0.25:
|
||||||
params_memory = Params("/dev/shm/params")
|
params_memory = Params("/dev/shm/params")
|
||||||
if params_memory.get_bool("CPTLkasButtonAction"):
|
# if params_memory.get_bool("CPTLkasButtonAction"):
|
||||||
params_memory.put_bool("CPTLkasButtonAction", False)
|
# params_memory.put_bool("CPTLkasButtonAction", False)
|
||||||
CC.cruiseControl.cancel = True
|
# CC.cruiseControl.cancel = True
|
||||||
print("Debug cancel executed")
|
# print("Debug cancel executed")
|
||||||
# cruise cancel
|
# cruise cancel
|
||||||
if CC.cruiseControl.cancel:
|
if CC.cruiseControl.cancel:
|
||||||
if self.CP.flags & HyundaiFlags.CANFD_ALT_BUTTONS:
|
if self.CP.flags & HyundaiFlags.CANFD_ALT_BUTTONS:
|
||||||
# pass
|
# pass
|
||||||
can_sends.append(hyundaicanfd.create_acc_cancel(self.packer, self.CP, self.CAN, CS.cruise_info))
|
# can_sends.append(hyundaicanfd.create_acc_cancel(self.packer, self.CP, self.CAN, CS.cruise_info))
|
||||||
# can_sends.append(hyundaicanfd.create_buttons_alt(self.packer, self.CP, self.CAN, CS.buttons_counter+1, Buttons.CANCEL))
|
for _ in range(20):
|
||||||
print("Yes2")
|
can_sends.append(hyundaicanfd.create_buttons_alt(self.packer, self.CP, self.CAN, CS.buttons_counter+1, Buttons.CANCEL))
|
||||||
|
print("Try Cancel Button Alt")
|
||||||
self.last_button_frame = self.frame
|
self.last_button_frame = self.frame
|
||||||
CS.lkas_trigger_result = 1
|
CS.lkas_trigger_result = 1
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -673,9 +673,9 @@ class Controls:
|
|||||||
|
|
||||||
if model_v2.meta.laneChangeState == LaneChangeState.laneChangeStarting and clearpilot_disable_lat_on_lane_change:
|
if model_v2.meta.laneChangeState == LaneChangeState.laneChangeStarting and clearpilot_disable_lat_on_lane_change:
|
||||||
CC.latActive = False
|
CC.latActive = False
|
||||||
self.params_memory.put_int("no_lat_lane_change", 1)
|
self.params_memory.put_bool("no_lat_lane_change", True)
|
||||||
else:
|
else:
|
||||||
self.params_memory.put_int("no_lat_lane_change", 0)
|
self.params_memory.put_bool("no_lat_lane_change", False)
|
||||||
|
|
||||||
if CS.leftBlinker or CS.rightBlinker:
|
if CS.leftBlinker or CS.rightBlinker:
|
||||||
self.last_blinker_frame = self.sm.frame
|
self.last_blinker_frame = self.sm.frame
|
||||||
|
|||||||
@@ -75,7 +75,7 @@ void OnroadWindow::updateState(const UIState &s) {
|
|||||||
nvg->updateState(s);
|
nvg->updateState(s);
|
||||||
|
|
||||||
QColor bgColor = bg_colors[s.status];
|
QColor bgColor = bg_colors[s.status];
|
||||||
if (paramsMemory.getInt("no_lat_lane_change") == 1) {
|
if (paramsMemory.getBool("no_lat_lane_change") == 1) {
|
||||||
bgColor = bg_colors[STATUS_DISENGAGED];
|
bgColor = bg_colors[STATUS_DISENGAGED];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -355,9 +355,6 @@ AnnotatedCameraWidget::AnnotatedCameraWidget(VisionStreamType type, QWidget* par
|
|||||||
top_right_layout->setSpacing(0);
|
top_right_layout->setSpacing(0);
|
||||||
top_right_layout->addLayout(buttons_layout);
|
top_right_layout->addLayout(buttons_layout);
|
||||||
|
|
||||||
pedal_icons = new PedalIcons(this);
|
|
||||||
// top_right_layout->addWidget(pedal_icons, 0, Qt::AlignRight);
|
|
||||||
|
|
||||||
main_layout->addLayout(top_right_layout, 0);
|
main_layout->addLayout(top_right_layout, 0);
|
||||||
main_layout->setAlignment(top_right_layout, Qt::AlignTop | Qt::AlignRight);
|
main_layout->setAlignment(top_right_layout, Qt::AlignTop | Qt::AlignRight);
|
||||||
|
|
||||||
@@ -530,13 +527,13 @@ void AnnotatedCameraWidget::drawHud(QPainter &p) {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
void AnnotatedCameraWidget::drawSpeedWidget(QPainter &p, int x, int y, const QString &title, const QString &speedLimitStr, QColor colorSpeed) {
|
void AnnotatedCameraWidget::drawSpeedWidget(QPainter &p, int x, int y, const QString &title, const QString &speedLimitStr, QColor colorSpeed, int width = 176) {
|
||||||
// Draw outer box + border to contain set speed and speed limit
|
// Draw outer box + border to contain set speed and speed limit
|
||||||
const int sign_margin = 12;
|
const int sign_margin = 12;
|
||||||
const int us_sign_height = 186;
|
const int us_sign_height = 186;
|
||||||
const int eu_sign_size = 176;
|
const int eu_sign_size = width;
|
||||||
|
|
||||||
const QSize default_size = {172, 204};
|
const QSize default_size = {width, 204};
|
||||||
QSize set_speed_size = default_size;
|
QSize set_speed_size = default_size;
|
||||||
if (is_metric || has_eu_speed_limit) set_speed_size.rwidth() = 200;
|
if (is_metric || has_eu_speed_limit) set_speed_size.rwidth() = 200;
|
||||||
if (has_us_speed_limit && speedLimitStr.size() >= 3) set_speed_size.rwidth() = 223;
|
if (has_us_speed_limit && speedLimitStr.size() >= 3) set_speed_size.rwidth() = 223;
|
||||||
@@ -560,9 +557,9 @@ void AnnotatedCameraWidget::drawSpeedWidget(QPainter &p, int x, int y, const QSt
|
|||||||
p.setFont(InterFont(90, QFont::Bold));
|
p.setFont(InterFont(90, QFont::Bold));
|
||||||
p.setPen(colorSpeed);
|
p.setPen(colorSpeed);
|
||||||
p.drawText(set_speed_rect.adjusted(0, 77, 0, 0), Qt::AlignTop | Qt::AlignHCenter, speedLimitStr);
|
p.drawText(set_speed_rect.adjusted(0, 77, 0, 0), Qt::AlignTop | Qt::AlignHCenter, speedLimitStr);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void AnnotatedCameraWidget::drawText(QPainter &p, int x, int y, const QString &text, int alpha) {
|
void AnnotatedCameraWidget::drawText(QPainter &p, int x, int y, const QString &text, int alpha) {
|
||||||
QRect real_rect = p.fontMetrics().boundingRect(text);
|
QRect real_rect = p.fontMetrics().boundingRect(text);
|
||||||
real_rect.moveCenter({x, y - real_rect.height() / 2});
|
real_rect.moveCenter({x, y - real_rect.height() / 2});
|
||||||
@@ -622,19 +619,19 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
|
|||||||
// paint center lane path
|
// paint center lane path
|
||||||
// QColor bg_colors[CHANGE_LANE_PATH_COLOR];
|
// QColor bg_colors[CHANGE_LANE_PATH_COLOR];
|
||||||
|
|
||||||
// int is_no_lat_lane_change = paramsMemory.getInt("no_lat_lane_change");
|
bool is_no_lat_lane_change = paramsMemory.getBool("no_lat_lane_change");
|
||||||
|
|
||||||
QColor center_lane_color;
|
QColor center_lane_color;
|
||||||
|
|
||||||
// if (is_no_lat_lane_change) {
|
if (is_no_lat_lane_change) {
|
||||||
// center_lane_color = bg_colors[CHANGE_LANE_PATH_COLOR];
|
center_lane_color = bg_colors[CHANGE_LANE_PATH_COLOR];
|
||||||
// } else {
|
} else {
|
||||||
center_lane_color = bg_colors[CENTER_LANE_COLOR];
|
center_lane_color = bg_colors[CENTER_LANE_COLOR];
|
||||||
// }
|
}
|
||||||
|
|
||||||
QLinearGradient path_gradient(0, height(), 0, 0);
|
QLinearGradient path_gradient(0, height(), 0, 0);
|
||||||
|
|
||||||
// if (edgeColor != bg_colors[STATUS_DISENGAGED] || is_no_lat_lane_change) {
|
if (edgeColor != bg_colors[STATUS_DISENGAGED] || is_no_lat_lane_change) {
|
||||||
if (scene.acceleration_path) {
|
if (scene.acceleration_path) {
|
||||||
// The first half of track_vertices are the points for the right side of the path
|
// The first half of track_vertices are the points for the right side of the path
|
||||||
// and the indices match the positions of accel from uiPlan
|
// and the indices match the positions of accel from uiPlan
|
||||||
@@ -684,7 +681,7 @@ void AnnotatedCameraWidget::drawLaneLines(QPainter &painter, const UIState *s) {
|
|||||||
|
|
||||||
painter.setBrush(path_gradient);
|
painter.setBrush(path_gradient);
|
||||||
painter.drawPolygon(scene.track_vertices);
|
painter.drawPolygon(scene.track_vertices);
|
||||||
// }
|
}
|
||||||
|
|
||||||
// Paint path edges ,Use current background color
|
// Paint path edges ,Use current background color
|
||||||
if (edgeColor != bg_colors[STATUS_DISENGAGED]) {
|
if (edgeColor != bg_colors[STATUS_DISENGAGED]) {
|
||||||
@@ -924,8 +921,6 @@ void AnnotatedCameraWidget::showEvent(QShowEvent *event) {
|
|||||||
void AnnotatedCameraWidget::initializeFrogPilotWidgets() {
|
void AnnotatedCameraWidget::initializeFrogPilotWidgets() {
|
||||||
bottom_layout = new QHBoxLayout();
|
bottom_layout = new QHBoxLayout();
|
||||||
|
|
||||||
distance_btn = new DistanceButton(this);
|
|
||||||
// bottom_layout->addWidget(distance_btn);
|
|
||||||
|
|
||||||
// QSpacerItem *spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
// QSpacerItem *spacer = new QSpacerItem(0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum);
|
||||||
// bottom_layout->addItem(spacer);
|
// bottom_layout->addItem(spacer);
|
||||||
@@ -983,8 +978,6 @@ void AnnotatedCameraWidget::updateFrogPilotWidgets() {
|
|||||||
obstacleDistance = scene.obstacle_distance;
|
obstacleDistance = scene.obstacle_distance;
|
||||||
obstacleDistanceStock = scene.obstacle_distance_stock;
|
obstacleDistanceStock = scene.obstacle_distance_stock;
|
||||||
|
|
||||||
onroadDistanceButton = scene.onroad_distance_button;
|
|
||||||
|
|
||||||
roadNameUI = scene.road_name_ui;
|
roadNameUI = scene.road_name_ui;
|
||||||
|
|
||||||
speedLimitController = scene.speed_limit_controller;
|
speedLimitController = scene.speed_limit_controller;
|
||||||
@@ -1042,91 +1035,10 @@ void AnnotatedCameraWidget::paintFrogPilotWidgets(QPainter &p) {
|
|||||||
drawSLCConfirmation(p);
|
drawSLCConfirmation(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// bool enableDistanceButton = onroadDistanceButton && !hideBottomIcons;
|
|
||||||
// distance_btn->setVisible(enableDistanceButton);
|
|
||||||
// if (enableDistanceButton) {
|
|
||||||
// distance_btn->updateState();
|
|
||||||
// bottom_layout->setAlignment(distance_btn, (rightHandDM ? Qt::AlignRight : Qt::AlignLeft));
|
|
||||||
// }
|
|
||||||
|
|
||||||
// bool enablePedalIcons = scene.pedals_on_ui && !bigMapOpen;
|
|
||||||
// pedal_icons->setVisible(enablePedalIcons);
|
|
||||||
// if (enablePedalIcons) {
|
|
||||||
// pedal_icons->updateState();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// recorder_btn->setVisible(scene.screen_recorder && !mapOpen);
|
// recorder_btn->setVisible(scene.screen_recorder && !mapOpen);
|
||||||
recorder_btn->setVisible(false);
|
recorder_btn->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
DistanceButton::DistanceButton(QWidget *parent) : QPushButton(parent), scene(uiState()->scene) {
|
|
||||||
// setFixedSize(btn_size * 1.5, btn_size * 1.5);
|
|
||||||
|
|
||||||
// profile_data = {
|
|
||||||
// {QPixmap("../frogpilot/assets/other_images/traffic.png"), "Traffic"},
|
|
||||||
// {QPixmap("../frogpilot/assets/other_images/aggressive.png"), "Aggressive"},
|
|
||||||
// {QPixmap("../frogpilot/assets/other_images/standard.png"), "Standard"},
|
|
||||||
// {QPixmap("../frogpilot/assets/other_images/relaxed.png"), "Relaxed"}
|
|
||||||
// };
|
|
||||||
|
|
||||||
// profile_data_kaofui = {
|
|
||||||
// {QPixmap("../frogpilot/assets/other_images/traffic_kaofui.png"), "Traffic"},
|
|
||||||
// {QPixmap("../frogpilot/assets/other_images/aggressive_kaofui.png"), "Aggressive"},
|
|
||||||
// {QPixmap("../frogpilot/assets/other_images/standard_kaofui.png"), "Standard"},
|
|
||||||
// {QPixmap("../frogpilot/assets/other_images/relaxed_kaofui.png"), "Relaxed"}
|
|
||||||
// };
|
|
||||||
|
|
||||||
// transitionTimer.start();
|
|
||||||
|
|
||||||
// connect(this, &QPushButton::pressed, this, &DistanceButton::buttonPressed);
|
|
||||||
// connect(this, &QPushButton::released, this, &DistanceButton::buttonReleased);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DistanceButton::buttonPressed() {
|
|
||||||
// paramsMemory.putBool("OnroadDistanceButtonPressed", true);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DistanceButton::buttonReleased() {
|
|
||||||
// paramsMemory.putBool("OnroadDistanceButtonPressed", false);
|
|
||||||
}
|
|
||||||
|
|
||||||
void DistanceButton::updateState() {
|
|
||||||
// if (trafficModeActive != scene.traffic_mode_active || personality != static_cast<int>(scene.personality) && !trafficModeActive) {
|
|
||||||
// transitionTimer.restart();
|
|
||||||
// }
|
|
||||||
|
|
||||||
// personality = static_cast<int>(scene.personality);
|
|
||||||
trafficModeActive = scene.traffic_mode_active;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DistanceButton::paintEvent(QPaintEvent *event) {
|
|
||||||
// QPainter p(this);
|
|
||||||
// p.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
|
|
||||||
|
|
||||||
// constexpr qreal fadeDuration = 1000.0;
|
|
||||||
// constexpr qreal textDuration = 3000.0;
|
|
||||||
// int elapsed = transitionTimer.elapsed();
|
|
||||||
|
|
||||||
// qreal textOpacity = qBound(0.0, 1.0 - ((elapsed - textDuration) / fadeDuration), 1.0);
|
|
||||||
// qreal imageOpacity = qBound(0.0, (elapsed - textDuration) / fadeDuration, 1.0);
|
|
||||||
|
|
||||||
// int profile = trafficModeActive ? 0 : personality + 1;
|
|
||||||
// auto &[profileImage, profileText] = scene.use_kaofui_icons ? profile_data_kaofui[profile] : profile_data[profile];
|
|
||||||
|
|
||||||
// if (textOpacity != 0.0) {
|
|
||||||
// p.setOpacity(textOpacity);
|
|
||||||
// p.setFont(InterFont(40, QFont::Bold));
|
|
||||||
// p.setPen(Qt::white);
|
|
||||||
// QRect textRect(-25, 0, width(), height() + 95);
|
|
||||||
// p.drawText(textRect, Qt::AlignCenter, profileText);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// if (imageOpacity != 0.0) {
|
|
||||||
// drawIcon(p, QPoint((btn_size / 2) * 1.25, btn_size / 2 + 95), profileImage, Qt::transparent, imageOpacity);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
void AnnotatedCameraWidget::drawLeadInfo(QPainter &p) {
|
void AnnotatedCameraWidget::drawLeadInfo(QPainter &p) {
|
||||||
static QElapsedTimer timer;
|
static QElapsedTimer timer;
|
||||||
static bool isFiveSecondsPassed = false;
|
static bool isFiveSecondsPassed = false;
|
||||||
@@ -1241,43 +1153,6 @@ void AnnotatedCameraWidget::drawLeadInfo(QPainter &p) {
|
|||||||
p.restore();
|
p.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
PedalIcons::PedalIcons(QWidget *parent) : QWidget(parent), scene(uiState()->scene) {
|
|
||||||
setFixedSize(btn_size, btn_size);
|
|
||||||
|
|
||||||
brake_pedal_img = loadPixmap("../frogpilot/assets/other_images/brake_pedal.png", QSize(img_size, img_size));
|
|
||||||
gas_pedal_img = loadPixmap("../frogpilot/assets/other_images/gas_pedal.png", QSize(img_size, img_size));
|
|
||||||
}
|
|
||||||
|
|
||||||
void PedalIcons::updateState() {
|
|
||||||
// acceleration = scene.acceleration;
|
|
||||||
|
|
||||||
// accelerating = acceleration > 0.25;
|
|
||||||
// decelerating = acceleration < -0.25;
|
|
||||||
|
|
||||||
// if (accelerating || decelerating) {
|
|
||||||
// update();
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
void PedalIcons::paintEvent(QPaintEvent *event) {
|
|
||||||
// QPainter p(this);
|
|
||||||
// p.setRenderHint(QPainter::Antialiasing);
|
|
||||||
|
|
||||||
// int totalWidth = 2 * img_size;
|
|
||||||
// int startX = (width() - totalWidth) / 2;
|
|
||||||
|
|
||||||
// int brakeX = startX + img_size / 2;
|
|
||||||
// int gasX = startX + img_size;
|
|
||||||
|
|
||||||
// float brakeOpacity = scene.standstill ? 1.0f : decelerating ? std::max(0.25f, std::abs(acceleration)) : 0.25f;
|
|
||||||
// float gasOpacity = accelerating ? std::max(0.25f, acceleration) : 0.25f;
|
|
||||||
|
|
||||||
// p.setOpacity(brakeOpacity);
|
|
||||||
// p.drawPixmap(brakeX, (height() - img_size) / 2, brake_pedal_img);
|
|
||||||
|
|
||||||
// p.setOpacity(gasOpacity);
|
|
||||||
// p.drawPixmap(gasX, (height() - img_size) / 2, gas_pedal_img);
|
|
||||||
}
|
|
||||||
|
|
||||||
void AnnotatedCameraWidget::drawSLCConfirmation(QPainter &p) {
|
void AnnotatedCameraWidget::drawSLCConfirmation(QPainter &p) {
|
||||||
p.save();
|
p.save();
|
||||||
|
|||||||
@@ -38,53 +38,6 @@ private:
|
|||||||
UIScene &scene;
|
UIScene &scene;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DistanceButton : public QPushButton {
|
|
||||||
public:
|
|
||||||
explicit DistanceButton(QWidget *parent = nullptr);
|
|
||||||
|
|
||||||
void buttonPressed();
|
|
||||||
void buttonReleased();
|
|
||||||
void updateState();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void paintEvent(QPaintEvent *event) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
Params paramsMemory{"/dev/shm/params"};
|
|
||||||
|
|
||||||
UIScene &scene;
|
|
||||||
|
|
||||||
bool trafficModeActive;
|
|
||||||
|
|
||||||
// int personality;
|
|
||||||
|
|
||||||
QElapsedTimer transitionTimer;
|
|
||||||
|
|
||||||
QVector<std::pair<QPixmap, QString>> profile_data;
|
|
||||||
QVector<std::pair<QPixmap, QString>> profile_data_kaofui;
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class PedalIcons : public QWidget {
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
explicit PedalIcons(QWidget *parent = 0);
|
|
||||||
void updateState();
|
|
||||||
|
|
||||||
private:
|
|
||||||
void paintEvent(QPaintEvent *event) override;
|
|
||||||
|
|
||||||
QPixmap brake_pedal_img;
|
|
||||||
QPixmap gas_pedal_img;
|
|
||||||
|
|
||||||
UIScene &scene;
|
|
||||||
|
|
||||||
bool accelerating;
|
|
||||||
bool decelerating;
|
|
||||||
|
|
||||||
float acceleration;
|
|
||||||
};
|
|
||||||
|
|
||||||
// container window for the NVG UI
|
// container window for the NVG UI
|
||||||
class AnnotatedCameraWidget : public CameraWidget {
|
class AnnotatedCameraWidget : public CameraWidget {
|
||||||
@@ -97,7 +50,7 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
void drawText(QPainter &p, int x, int y, const QString &text, int alpha = 255);
|
void drawText(QPainter &p, int x, int y, const QString &text, int alpha = 255);
|
||||||
void drawSpeedWidget(QPainter &p, int x, int y, const QString &title, const QString &speedLimitStr, QColor colorSpeed);
|
void drawSpeedWidget(QPainter &p, int x, int y, const QString &title, const QString &speedLimitStr, QColor colorSpeed, int width = 172);
|
||||||
|
|
||||||
QVBoxLayout *main_layout;
|
QVBoxLayout *main_layout;
|
||||||
QPixmap dm_img;
|
QPixmap dm_img;
|
||||||
@@ -135,8 +88,6 @@ private:
|
|||||||
Params paramsMemory{"/dev/shm/params"};
|
Params paramsMemory{"/dev/shm/params"};
|
||||||
UIScene &scene;
|
UIScene &scene;
|
||||||
|
|
||||||
DistanceButton *distance_btn;
|
|
||||||
PedalIcons *pedal_icons;
|
|
||||||
ScreenRecorder *recorder_btn;
|
ScreenRecorder *recorder_btn;
|
||||||
|
|
||||||
QHBoxLayout *bottom_layout;
|
QHBoxLayout *bottom_layout;
|
||||||
@@ -146,7 +97,6 @@ private:
|
|||||||
bool blindSpotRight;
|
bool blindSpotRight;
|
||||||
bool experimentalMode;
|
bool experimentalMode;
|
||||||
bool leadInfo;
|
bool leadInfo;
|
||||||
bool onroadDistanceButton;
|
|
||||||
bool roadNameUI;
|
bool roadNameUI;
|
||||||
bool showAlwaysOnLateralStatusBar;
|
bool showAlwaysOnLateralStatusBar;
|
||||||
bool showConditionalExperimentalStatusBar;
|
bool showConditionalExperimentalStatusBar;
|
||||||
|
|||||||
@@ -116,7 +116,7 @@ void update_model(UIState *s,
|
|||||||
|
|
||||||
// update path
|
// update path
|
||||||
float path;
|
float path;
|
||||||
if (paramsMemory.getInt("no_lat_lane_change")) {
|
if (paramsMemory.getBool("no_lat_lane_change")) {
|
||||||
path = (float)LANE_CHANGE_NO_LAT_PATH_WIDTH / 20; // Release: better calc for EU users
|
path = (float)LANE_CHANGE_NO_LAT_PATH_WIDTH / 20; // Release: better calc for EU users
|
||||||
} else {
|
} else {
|
||||||
path = (float)CENTER_LANE_WIDTH / 20; // Release: better calc for EU users
|
path = (float)CENTER_LANE_WIDTH / 20; // Release: better calc for EU users
|
||||||
|
|||||||
Reference in New Issue
Block a user