mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-08-05 08:16:06 +08:00
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:
Binary file not shown.
|
After Width: | Height: | Size: 63 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 73 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 51 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 73 KiB |
@@ -22,6 +22,16 @@ ExperimentalButton::ExperimentalButton(QWidget *parent) : experimental_mode(fals
|
||||
engage_img = loadPixmap("../assets/img_chffr_wheel.png", {img_size, img_size});
|
||||
experimental_img = loadPixmap("../assets/img_experimental.svg", {img_size, img_size});
|
||||
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() {
|
||||
@@ -49,13 +59,31 @@ void ExperimentalButton::updateState(const UIState &s) {
|
||||
// FrogPilot variables
|
||||
const UIScene &scene = s.scene;
|
||||
|
||||
alwaysOnLateralActive = scene.always_on_lateral_active;
|
||||
conditionalExperimental = scene.conditional_experimental;
|
||||
conditionalStatus = scene.conditional_status;
|
||||
navigateOnOpenpilot = scene.navigate_on_openpilot;
|
||||
trafficModeActive = scene.traffic_mode_active;
|
||||
wheelIcon = scene.wheel_icon;
|
||||
}
|
||||
|
||||
void ExperimentalButton::paintEvent(QPaintEvent *event) {
|
||||
if (wheelIcon < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
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 ?
|
||||
(alwaysOnLateralActive ? bg_colors[STATUS_ALWAYS_ON_LATERAL_ACTIVE] :
|
||||
(conditionalStatus == 1 || conditionalStatus == 3 || conditionalStatus == 5 ? bg_colors[STATUS_CONDITIONAL_OVERRIDDEN] :
|
||||
(experimental_mode ? bg_colors[STATUS_EXPERIMENTAL_MODE_ACTIVE] :
|
||||
(trafficModeActive ? bg_colors[STATUS_TRAFFIC_MODE_ACTIVE] :
|
||||
(navigateOnOpenpilot ? 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);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,9 +25,15 @@ private:
|
||||
bool engageable;
|
||||
|
||||
// FrogPilot variables
|
||||
bool alwaysOnLateralActive;
|
||||
bool conditionalExperimental;
|
||||
bool navigateOnOpenpilot;
|
||||
bool trafficModeActive;
|
||||
|
||||
int conditionalStatus;
|
||||
int wheelIcon;
|
||||
|
||||
QMap<int, QPixmap> wheelImages;
|
||||
|
||||
Params paramsMemory{"/dev/shm/params"};
|
||||
};
|
||||
|
||||
@@ -321,6 +321,7 @@ void ui_update_frogpilot_params(UIState *s, Params ¶ms) {
|
||||
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.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_vtsc = params.getBool("VisionTurnControl") && params.getBool("DisableVTSCSmoothing");
|
||||
|
||||
@@ -182,6 +182,7 @@ typedef struct UIScene {
|
||||
int conditional_speed_lead;
|
||||
int conditional_status;
|
||||
int tethering_config;
|
||||
int wheel_icon;
|
||||
|
||||
QPolygonF track_adjacent_vertices[6];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user