wip
This commit is contained in:
@@ -38,11 +38,15 @@ class CanBus(CanBusBase):
|
|||||||
|
|
||||||
def create_steering_messages(packer, CP, CAN, enabled, lat_active, apply_steer):
|
def create_steering_messages(packer, CP, CAN, enabled, lat_active, apply_steer):
|
||||||
|
|
||||||
|
# Im sure there is a better way to do this
|
||||||
|
params_memory = Params("/dev/shm/params")
|
||||||
|
no_lat_lane_change = params_memory.get_int("no_lat_lane_change", 1)
|
||||||
|
|
||||||
ret = []
|
ret = []
|
||||||
|
|
||||||
values = {
|
values = {
|
||||||
"LKA_MODE": 2,
|
"LKA_MODE": 2,
|
||||||
"LKA_ICON": 2 if enabled else 1 if lat_active else 0, # right mode icon
|
"LKA_ICON": 0 if no_lat_lane_change else 2 if enabled else 1 if lat_active else 0, # right mode icon
|
||||||
"TORQUE_REQUEST": apply_steer,
|
"TORQUE_REQUEST": apply_steer,
|
||||||
"LKA_ASSIST": 0,
|
"LKA_ASSIST": 0,
|
||||||
"STEER_REQ": 1 if lat_active else 0,
|
"STEER_REQ": 1 if lat_active else 0,
|
||||||
@@ -127,18 +131,9 @@ def create_acc_cancel(packer, CP, CAN, cruise_info_copy):
|
|||||||
# CLEARPILOT changed HDA icons
|
# CLEARPILOT changed HDA icons
|
||||||
# This doesn't appear to do anything on my tucson
|
# This doesn't appear to do anything on my tucson
|
||||||
def create_lfahda_cluster(packer, CAN, enabled, lat_active):
|
def create_lfahda_cluster(packer, CAN, enabled, lat_active):
|
||||||
|
|
||||||
# Im sure there is a better way to do this
|
|
||||||
params = Params()
|
|
||||||
params_memory = Params("/dev/shm/params")
|
|
||||||
no_lat_lane_change = params_memory.get_int("no_lat_lane_change", 1)
|
|
||||||
|
|
||||||
values = {
|
values = {
|
||||||
# 0 off, 1 gray, 2 green, 3 blinking (wheel icon)
|
"HDA_ICON": 0,
|
||||||
# CP: Is this actually the wheel? Might this be the HDA2 thing?
|
"LFA_ICON": 0
|
||||||
"HDA_ICON": 0, # Intention is to have this represent stock HDA mode
|
|
||||||
"LFA_ICON": 0,
|
|
||||||
# "LFA_ICON": 0 if no_lat_lane_change else 2 if enabled else 1 if lat_active else 0,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return packer.make_can_msg("LFAHDA_CLUSTER", CAN.ECAN, values)
|
return packer.make_can_msg("LFAHDA_CLUSTER", CAN.ECAN, values)
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ static void drawIconGif(QPainter &p, const QPoint ¢er, const QMovie &img, co
|
|||||||
}
|
}
|
||||||
|
|
||||||
OnroadWindow::OnroadWindow(QWidget *parent) : QWidget(parent), scene(uiState()->scene) {
|
OnroadWindow::OnroadWindow(QWidget *parent) : QWidget(parent), scene(uiState()->scene) {
|
||||||
bg = QColor(255, 0x33, 0x49, 0xc8); // init to a default color
|
|
||||||
QVBoxLayout *main_layout = new QVBoxLayout(this);
|
QVBoxLayout *main_layout = new QVBoxLayout(this);
|
||||||
main_layout->setMargin(UI_BORDER_SIZE);
|
main_layout->setMargin(UI_BORDER_SIZE);
|
||||||
QStackedLayout *stacked_layout = new QStackedLayout;
|
QStackedLayout *stacked_layout = new QStackedLayout;
|
||||||
@@ -97,11 +96,6 @@ void OnroadWindow::updateState(const UIState &s) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
QColor bgColor = bg_colors[s.status];
|
|
||||||
// Clearpilot
|
|
||||||
if (paramsMemory.getInt("no_lat_lane_change") == 1) {
|
|
||||||
bg = bg_colors[STATUS_DISENGAGED];
|
|
||||||
}
|
|
||||||
|
|
||||||
Alert alert = Alert::get(*(s.sm), s.scene.started_frame);
|
Alert alert = Alert::get(*(s.sm), s.scene.started_frame);
|
||||||
alerts->updateAlert(alert);
|
alerts->updateAlert(alert);
|
||||||
@@ -114,8 +108,12 @@ void OnroadWindow::updateState(const UIState &s) {
|
|||||||
|
|
||||||
nvg->updateState(s);
|
nvg->updateState(s);
|
||||||
|
|
||||||
|
QColor bgColor = bg_colors[s.status];
|
||||||
|
if (paramsMemory.getInt("no_lat_lane_change") == 1) {
|
||||||
|
bgColor = bg_colors[STATUS_DISENGAGED];
|
||||||
|
}
|
||||||
|
|
||||||
if (bg != bgColor) {
|
if (bg != bgColor) {
|
||||||
// repaint border
|
|
||||||
bg = bgColor;
|
bg = bgColor;
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
@@ -639,6 +637,16 @@ void AnnotatedCameraWidget::updateState(const UIState &s) {
|
|||||||
main_layout->setAlignment(map_settings_btn, (rightHandDM ? Qt::AlignLeft : Qt::AlignRight) | Qt::AlignTop);
|
main_layout->setAlignment(map_settings_btn, (rightHandDM ? Qt::AlignLeft : Qt::AlignRight) | Qt::AlignTop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QColor bgColor = bg_colors[s.status];
|
||||||
|
if (paramsMemory.getInt("no_lat_lane_change") == 1) {
|
||||||
|
bgColor = bg_colors[STATUS_DISENGAGED];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bg != bgColor) {
|
||||||
|
bg = bgColor;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
updateFrogPilotWidgets();
|
updateFrogPilotWidgets();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -899,17 +907,12 @@ 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
|
||||||
QColor bgColor = bg_colors[uiState()->status];
|
if (bg != bg_colors[STATUS_DISENGAGED]) {
|
||||||
// Clearpilot
|
|
||||||
if (paramsMemory.getInt("no_lat_lane_change") == 1) {
|
|
||||||
bgColor = bg_colors[STATUS_DISENGAGED];
|
|
||||||
}
|
|
||||||
if (bgColor != bg_colors[STATUS_DISENGAGED]) {
|
|
||||||
QLinearGradient edge_gradient;
|
QLinearGradient edge_gradient;
|
||||||
edge_gradient.setColorAt(0.0, QColor(bgColor.red(), bgColor.green(), bgColor.blue(), static_cast<int>(255)));
|
edge_gradient.setColorAt(0.0, QColor(bg.red(), bg.green(), bg.blue(), static_cast<int>(255)));
|
||||||
edge_gradient.setColorAt(0.5, QColor(bgColor.red(), bgColor.green(), bgColor.blue(), static_cast<int>(255 * 0.7) ));
|
edge_gradient.setColorAt(0.5, QColor(bg.red(), bg.green(), bg.blue(), static_cast<int>(255 * 0.7) ));
|
||||||
edge_gradient.setColorAt(1.0, QColor(bgColor.red(), bgColor.green(), bg.blue(), static_cast<int>(255 * 0.5)));
|
edge_gradient.setColorAt(1.0, QColor(bgr.red(), bg.green(), bg.blue(), static_cast<int>(255 * 0.5)));
|
||||||
|
|
||||||
QPainterPath path;
|
QPainterPath path;
|
||||||
path.addPolygon(scene.track_vertices);
|
path.addPolygon(scene.track_vertices);
|
||||||
|
|||||||
@@ -193,6 +193,7 @@ private:
|
|||||||
bool v_ego_cluster_seen = false;
|
bool v_ego_cluster_seen = false;
|
||||||
int status = STATUS_DISENGAGED;
|
int status = STATUS_DISENGAGED;
|
||||||
std::unique_ptr<PubMaster> pm;
|
std::unique_ptr<PubMaster> pm;
|
||||||
|
QColor bg = bg_colors[STATUS_DISENGAGED];
|
||||||
|
|
||||||
int skip_frame_count = 0;
|
int skip_frame_count = 0;
|
||||||
bool wide_cam_requested = false;
|
bool wide_cam_requested = false;
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ typedef enum UIStatus {
|
|||||||
} UIStatus;
|
} UIStatus;
|
||||||
|
|
||||||
// Clearpilot new alpha constants
|
// Clearpilot new alpha constants
|
||||||
const float CENTER_LANE_ALPHA = 0.40;
|
const float CENTER_LANE_ALPHA = 0.55;
|
||||||
const float OTHER_LANE_ALPHA = 0.75;
|
const float OTHER_LANE_ALPHA = 0.75;
|
||||||
|
|
||||||
const int CENTER_LANE_WIDTH = 50;
|
const int CENTER_LANE_WIDTH = 50;
|
||||||
@@ -354,7 +354,7 @@ private slots:
|
|||||||
private:
|
private:
|
||||||
QTimer *timer;
|
QTimer *timer;
|
||||||
bool started_prev = false;
|
bool started_prev = false;
|
||||||
PrimeType prime_type = PrimeType::UNKNOWN;
|
PrimeType prime_type = PrimeTy pe::UNKNOWN;
|
||||||
|
|
||||||
// FrogPilot variables
|
// FrogPilot variables
|
||||||
Params paramsMemory{"/dev/shm/params"};
|
Params paramsMemory{"/dev/shm/params"};
|
||||||
|
|||||||
Reference in New Issue
Block a user