Visuals - Quality of Life - Map Style

Select a map style to use with navigation.

Co-Authored-By: mike8643 <98910897+mike8643@users.noreply.github.com>
Co-Authored-By: multikyd <72329880+multikyd@users.noreply.github.com>
Co-Authored-By: Tim Jumpertz <44060819+pencilpusher@users.noreply.github.com>
This commit is contained in:
FrogAi 2024-05-11 15:13:29 -07:00
parent 8984a623fd
commit b4d4f7e455
4 changed files with 28 additions and 0 deletions

View File

@ -305,6 +305,30 @@ void MapWindow::updateState(const UIState &s) {
m_map->updateSource("modelPathSource", modelV2Path);
model_rcv_frame = sm.rcv_frame("uiPlan");
}
// Map Styling - Credit goes to OPKR!
int map_style = uiState()->scene.map_style;
if (map_style != previous_map_style) {
std::unordered_map<int, std::string> styleUrls = {
{0, "mapbox://styles/commaai/clkqztk0f00ou01qyhsa5bzpj"}, // Stock openpilot
{1, "mapbox://styles/mapbox/streets-v11"}, // Mapbox Streets
{2, "mapbox://styles/mapbox/outdoors-v11"}, // Mapbox Outdoors
{3, "mapbox://styles/mapbox/light-v10"}, // Mapbox Light
{4, "mapbox://styles/mapbox/dark-v10"}, // Mapbox Dark
{5, "mapbox://styles/mapbox/satellite-v9"}, // Mapbox Satellite
{6, "mapbox://styles/mapbox/satellite-streets-v11"}, // Mapbox Satellite Streets
{7, "mapbox://styles/mapbox/navigation-day-v1"}, // Mapbox Navigation Day
{8, "mapbox://styles/mapbox/navigation-night-v1"}, // Mapbox Navigation Night
{9, "mapbox://styles/mapbox/traffic-night-v2"}, // Mapbox Traffic Night
{10, "mapbox://styles/mike854/clt0hm8mw01ok01p4blkr27jp"}, // mike854's (Satellite hybrid)
};
std::unordered_map<int, std::string>::iterator it = styleUrls.find(map_style);
m_map->setStyleUrl(QString::fromStdString(it->second));
}
previous_map_style = map_style;
}
void MapWindow::setError(const QString &err_str) {

View File

@ -82,6 +82,8 @@ private:
// FrogPilot variables
Params params;
int previous_map_style;
uint64_t model_rcv_frame = 0;
private slots:

View File

@ -424,6 +424,7 @@ void ui_update_frogpilot_params(UIState *s, Params &params) {
scene.driver_camera = quality_of_life_visuals && params.getBool("DriverCamera");
scene.hide_speed = quality_of_life_visuals && params.getBool("HideSpeed");
scene.hide_speed_ui = scene.hide_speed && params.getBool("HideSpeedUI");
scene.map_style = quality_of_life_visuals ? params.getInt("MapStyle") : 0;
scene.speed_limit_controller = scene.longitudinal_control && params.getBool("SpeedLimitController");
scene.show_slc_offset = scene.speed_limit_controller && params.getBool("ShowSLCOffset");

View File

@ -239,6 +239,7 @@ typedef struct UIScene {
int custom_signals;
int desired_follow;
int driver_camera_timer;
int map_style;
int model_length;
int obstacle_distance;
int obstacle_distance_stock;