Custom steering wheel icons
Added toggle for custom steering wheel icons in the onroad UI. Want to add your own steering wheel? Request one under "feature-requests" on the FrogPilot Discord!
This commit is contained in:
@@ -265,6 +265,7 @@ std::unordered_map<std::string, uint32_t> keys = {
|
||||
{"UpdateSchedule", PERSISTENT},
|
||||
{"UpdateTime", PERSISTENT},
|
||||
{"UseSI", PERSISTENT},
|
||||
{"WheelIcon", PERSISTENT},
|
||||
{"WideCamera", PERSISTENT},
|
||||
};
|
||||
|
||||
|
||||
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: 142 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: 100 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 |
@@ -20,6 +20,7 @@ FrogPilotVisualsPanel::FrogPilotVisualsPanel(SettingsWindow *parent) : FrogPilot
|
||||
{"UnlimitedLength", "'Unlimited' Road UI Length", "Extend the display of the path, lane lines, and road edges as far as the system can detect, providing a more expansive view of the road ahead.", ""},
|
||||
|
||||
{"ScreenBrightness", "Screen Brightness", "Customize your screen brightness.", "../frogpilot/assets/toggle_icons/icon_light.png"},
|
||||
{"WheelIcon", "Steering Wheel Icon", "Replace the default steering wheel icon with a custom design, adding a unique touch to your interface.", "../assets/offroad/icon_openpilot.png"},
|
||||
};
|
||||
|
||||
for (const auto &[param, title, desc, icon] : visualToggles) {
|
||||
@@ -67,6 +68,12 @@ FrogPilotVisualsPanel::FrogPilotVisualsPanel(SettingsWindow *parent) : FrogPilot
|
||||
}
|
||||
toggle = new FrogPilotParamValueControl(param, title, desc, icon, 0, 101, brightnessLabels, this, false);
|
||||
|
||||
} else if (param == "WheelIcon") {
|
||||
std::vector<QString> wheelToggles{};
|
||||
std::vector<QString> wheelToggleNames{};
|
||||
std::map<int, QString> steeringWheelLabels = {{0, "Stock"}, {1, "Lexus"}, {2, "Toyota"}, {3, "Frog"}, {4, "Rocket"}, {5, "Hyundai"}, {6, "Stalin"}};
|
||||
toggle = new FrogPilotParamValueToggleControl(param, title, desc, icon, 0, 6, steeringWheelLabels, this, true, "", 1, wheelToggles, wheelToggleNames);
|
||||
|
||||
} else {
|
||||
toggle = new ParamControl(param, title, desc, icon, this);
|
||||
}
|
||||
|
||||
@@ -286,6 +286,17 @@ 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);
|
||||
|
||||
// Custom steering wheel images
|
||||
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() {
|
||||
@@ -308,13 +319,25 @@ void ExperimentalButton::updateState(const UIState &s, bool leadInfo) {
|
||||
}
|
||||
|
||||
// FrogPilot variables
|
||||
wheelIcon = scene.wheel_icon;
|
||||
|
||||
y_offset = leadInfo ? 10 : 0;
|
||||
}
|
||||
|
||||
void ExperimentalButton::paintEvent(QPaintEvent *event) {
|
||||
QPainter p(this);
|
||||
QPixmap img = experimental_mode ? experimental_img : engage_img;
|
||||
drawIcon(p, QPoint(btn_size / 2, btn_size / 2 + y_offset), img, QColor(0, 0, 0, 166), (isDown() || (!engageable && !scene.always_on_lateral_active)) ? 0.6 : 1.0);
|
||||
// Custom steering wheel icon
|
||||
engage_img = wheelImages[wheelIcon];
|
||||
QPixmap img = wheelIcon ? engage_img : (experimental_mode ? experimental_img : engage_img);
|
||||
|
||||
QColor background_color = wheelIcon && !isDown() && engageable ?
|
||||
(scene.conditional_status == 1 ? QColor(255, 246, 0, 255) :
|
||||
(experimental_mode ? QColor(218, 111, 37, 241) :
|
||||
(scene.navigate_on_openpilot ? QColor(49, 161, 238, 255) : QColor(0, 0, 0, 166)))) :
|
||||
(scene.always_on_lateral_active ? QColor(10, 186, 181, 255) :
|
||||
QColor(0, 0, 0, 166));
|
||||
|
||||
drawIcon(p, QPoint(btn_size / 2, btn_size / 2 + y_offset), img, background_color, (isDown() || (!engageable && !scene.always_on_lateral_active)) ? 0.6 : 1.0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -57,6 +57,9 @@ private:
|
||||
// FrogPilot variables
|
||||
UIScene &scene;
|
||||
|
||||
std::map<int, QPixmap> wheelImages;
|
||||
|
||||
int wheelIcon;
|
||||
int y_offset;
|
||||
};
|
||||
|
||||
|
||||
@@ -294,6 +294,7 @@ void ui_update_params(UIState *s) {
|
||||
scene.unlimited_road_ui_length = scene.model_ui && params.getBool("UnlimitedLength");
|
||||
|
||||
scene.screen_brightness = params.getInt("ScreenBrightness");
|
||||
scene.wheel_icon = params.getInt("WheelIcon");
|
||||
}
|
||||
|
||||
void UIState::updateStatus() {
|
||||
|
||||
@@ -200,6 +200,7 @@ typedef struct UIScene {
|
||||
int obstacle_distance_stock;
|
||||
int screen_brightness;
|
||||
int stopped_equivalence;
|
||||
int wheel_icon;
|
||||
QPolygonF track_adjacent_vertices[6];
|
||||
QPolygonF track_edge_vertices;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user