Visuals - Custom Onroad UI - Steering Wheel Icon
Replace the default steering wheel icon with a custom icon. Want to add your own steering wheel? Request one under "feature-requests" on the FrogPilot Discord!
This commit is contained in:
parent
cc2cf306f3
commit
9c7a043300
BIN
selfdrive/frogpilot/assets/wheel_images/frog.png
Normal file
BIN
selfdrive/frogpilot/assets/wheel_images/frog.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 141 KiB |
BIN
selfdrive/frogpilot/assets/wheel_images/hyundai.png
Normal file
BIN
selfdrive/frogpilot/assets/wheel_images/hyundai.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 129 KiB |
BIN
selfdrive/frogpilot/assets/wheel_images/lexus.png
Normal file
BIN
selfdrive/frogpilot/assets/wheel_images/lexus.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 88 KiB |
BIN
selfdrive/frogpilot/assets/wheel_images/rocket.png
Normal file
BIN
selfdrive/frogpilot/assets/wheel_images/rocket.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 19 KiB |
BIN
selfdrive/frogpilot/assets/wheel_images/stalin.png
Normal file
BIN
selfdrive/frogpilot/assets/wheel_images/stalin.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 7.5 KiB |
BIN
selfdrive/frogpilot/assets/wheel_images/toyota.png
Normal file
BIN
selfdrive/frogpilot/assets/wheel_images/toyota.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 132 KiB |
@ -283,6 +283,16 @@ ExperimentalButton::ExperimentalButton(QWidget *parent) : experimental_mode(fals
|
|||||||
engage_img = loadPixmap("../assets/img_chffr_wheel.png", {img_size, img_size});
|
engage_img = loadPixmap("../assets/img_chffr_wheel.png", {img_size, img_size});
|
||||||
experimental_img = loadPixmap("../assets/img_experimental.svg", {img_size, img_size});
|
experimental_img = loadPixmap("../assets/img_experimental.svg", {img_size, img_size});
|
||||||
QObject::connect(this, &QPushButton::clicked, this, &ExperimentalButton::changeMode);
|
QObject::connect(this, &QPushButton::clicked, this, &ExperimentalButton::changeMode);
|
||||||
|
|
||||||
|
wheelImages = {
|
||||||
|
{0, loadPixmap("../assets/img_chffr_wheel.png", {img_size, img_size})},
|
||||||
|
{1, loadPixmap("../frogpilot/assets/wheel_images/lexus.png", {img_size, img_size})},
|
||||||
|
{2, loadPixmap("../frogpilot/assets/wheel_images/toyota.png", {img_size, img_size})},
|
||||||
|
{3, loadPixmap("../frogpilot/assets/wheel_images/frog.png", {img_size, img_size})},
|
||||||
|
{4, loadPixmap("../frogpilot/assets/wheel_images/rocket.png", {img_size, img_size})},
|
||||||
|
{5, loadPixmap("../frogpilot/assets/wheel_images/hyundai.png", {img_size, img_size})},
|
||||||
|
{6, loadPixmap("../frogpilot/assets/wheel_images/stalin.png", {img_size, img_size})},
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExperimentalButton::changeMode() {
|
void ExperimentalButton::changeMode() {
|
||||||
@ -306,11 +316,28 @@ void ExperimentalButton::updateState(const UIState &s) {
|
|||||||
experimental_mode = cs.getExperimentalMode();
|
experimental_mode = cs.getExperimentalMode();
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FrogPilot variables
|
||||||
|
wheelIcon = scene.wheel_icon;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExperimentalButton::paintEvent(QPaintEvent *event) {
|
void ExperimentalButton::paintEvent(QPaintEvent *event) {
|
||||||
|
if (wheelIcon < 0) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
QPainter p(this);
|
QPainter p(this);
|
||||||
QPixmap img = experimental_mode ? experimental_img : engage_img;
|
engage_img = wheelImages[wheelIcon];
|
||||||
|
QPixmap img = wheelIcon != 0 ? engage_img : (experimental_mode ? experimental_img : engage_img);
|
||||||
|
|
||||||
|
QColor background_color = wheelIcon != 0 && !isDown() && engageable ?
|
||||||
|
(scene.always_on_lateral_active ? bg_colors[STATUS_ALWAYS_ON_LATERAL_ACTIVE] :
|
||||||
|
(scene.conditional_status == 1 || scene.conditional_status == 3 || scene.conditional_status == 5 ? bg_colors[STATUS_CONDITIONAL_OVERRIDDEN] :
|
||||||
|
(experimental_mode ? bg_colors[STATUS_EXPERIMENTAL_MODE_ACTIVE] :
|
||||||
|
(scene.traffic_mode_active ? bg_colors[STATUS_TRAFFIC_MODE_ACTIVE] :
|
||||||
|
(scene.navigate_on_openpilot ? bg_colors[STATUS_NAVIGATION_ACTIVE] : QColor(0, 0, 0, 166)))))) :
|
||||||
|
QColor(0, 0, 0, 166);
|
||||||
|
|
||||||
drawIcon(p, QPoint(btn_size / 2, btn_size / 2), img, QColor(0, 0, 0, 166), (isDown() || !engageable) ? 0.6 : 1.0);
|
drawIcon(p, QPoint(btn_size / 2, btn_size / 2), img, QColor(0, 0, 0, 166), (isDown() || !engageable) ? 0.6 : 1.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,6 +104,10 @@ private:
|
|||||||
// FrogPilot variables
|
// FrogPilot variables
|
||||||
Params paramsMemory{"/dev/shm/params"};
|
Params paramsMemory{"/dev/shm/params"};
|
||||||
UIScene &scene;
|
UIScene &scene;
|
||||||
|
|
||||||
|
QMap<int, QPixmap> wheelImages;
|
||||||
|
|
||||||
|
int wheelIcon;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -310,6 +310,7 @@ void ui_update_frogpilot_params(UIState *s) {
|
|||||||
scene.dynamic_pedals_on_ui = scene.pedals_on_ui && params.getBool("DynamicPedalsOnUI");
|
scene.dynamic_pedals_on_ui = scene.pedals_on_ui && params.getBool("DynamicPedalsOnUI");
|
||||||
scene.static_pedals_on_ui = scene.pedals_on_ui && params.getBool("StaticPedalsOnUI");
|
scene.static_pedals_on_ui = scene.pedals_on_ui && params.getBool("StaticPedalsOnUI");
|
||||||
scene.road_name_ui = custom_onroad_ui && params.getBool("RoadNameUI");
|
scene.road_name_ui = custom_onroad_ui && params.getBool("RoadNameUI");
|
||||||
|
scene.wheel_icon = custom_onroad_ui ? params.getInt("WheelIcon") : 0;
|
||||||
|
|
||||||
scene.disable_smoothing_mtsc = params.getBool("MTSCEnabled") && params.getBool("DisableMTSCSmoothing");
|
scene.disable_smoothing_mtsc = params.getBool("MTSCEnabled") && params.getBool("DisableMTSCSmoothing");
|
||||||
scene.disable_smoothing_vtsc = params.getBool("VisionTurnControl") && params.getBool("DisableVTSCSmoothing");
|
scene.disable_smoothing_vtsc = params.getBool("VisionTurnControl") && params.getBool("DisableVTSCSmoothing");
|
||||||
|
@ -242,6 +242,7 @@ typedef struct UIScene {
|
|||||||
int conditional_speed;
|
int conditional_speed;
|
||||||
int conditional_speed_lead;
|
int conditional_speed_lead;
|
||||||
int conditional_status;
|
int conditional_status;
|
||||||
|
int wheel_icon;
|
||||||
|
|
||||||
QPolygonF track_adjacent_vertices[6];
|
QPolygonF track_adjacent_vertices[6];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user