mirror of
https://github.com/firestar5683/StarPilot.git
synced 2026-07-16 06:42:12 +08:00
Camera view selection
Added toggle to select the preferred camera view between "auto", "standard", "wide", and "driver".
This commit is contained in:
@@ -218,6 +218,8 @@ std::unordered_map<std::string, uint32_t> keys = {
|
||||
{"ApiCache_DriveStats", PERSISTENT},
|
||||
{"AutomaticUpdates", PERSISTENT},
|
||||
{"BlindSpotPath", PERSISTENT},
|
||||
{"CameraView", PERSISTENT},
|
||||
{"CameraViewReset", PERSISTENT},
|
||||
{"CustomAlerts", PERSISTENT},
|
||||
{"CustomPaths", PERSISTENT},
|
||||
{"CustomUI", PERSISTENT},
|
||||
|
||||
@@ -17,6 +17,7 @@ FrogPilotVisualsPanel::FrogPilotVisualsPanel(SettingsWindow *parent) : FrogPilot
|
||||
{"CustomPaths", tr("Paths"), tr("Show your projected acceleration on the driving path, detected adjacent lanes, or when a vehicle is detected in your blindspot."), ""},
|
||||
|
||||
{"QOLVisuals", tr("Quality of Life"), tr("Miscellaneous quality of life changes to improve your overall openpilot experience."), "../frogpilot/assets/toggle_icons/quality_of_life.png"},
|
||||
{"CameraView", tr("Camera View"), tr("Choose your preferred camera view for the onroad UI. This is purely a visual change and doesn't impact how openpilot drives."), ""},
|
||||
};
|
||||
|
||||
for (const auto &[param, title, desc, icon] : visualToggles) {
|
||||
@@ -75,6 +76,10 @@ FrogPilotVisualsPanel::FrogPilotVisualsPanel(SettingsWindow *parent) : FrogPilot
|
||||
}
|
||||
});
|
||||
toggle = qolToggle;
|
||||
} else if (param == "CameraView") {
|
||||
std::vector<QString> cameraOptions{tr("Auto"), tr("Driver"), tr("Standard"), tr("Wide")};
|
||||
FrogPilotButtonParamControl *preferredCamera = new FrogPilotButtonParamControl(param, title, desc, icon, cameraOptions);
|
||||
toggle = preferredCamera;
|
||||
|
||||
} else {
|
||||
toggle = new ParamControl(param, title, desc, icon, this);
|
||||
|
||||
@@ -27,7 +27,7 @@ private:
|
||||
std::set<QString> customOnroadUIKeys = {"CustomPaths"};
|
||||
std::set<QString> customThemeKeys = {};
|
||||
std::set<QString> modelUIKeys = {};
|
||||
std::set<QString> qolKeys = {};
|
||||
std::set<QString> qolKeys = {"CameraView"};
|
||||
std::set<QString> screenKeys = {};
|
||||
|
||||
std::map<std::string, ParamControl*> toggles;
|
||||
|
||||
@@ -62,6 +62,10 @@ def manager_init(frogpilot_functions) -> None:
|
||||
if is_release_branch():
|
||||
params.clear_all(ParamKeyType.DEVELOPMENT_ONLY)
|
||||
|
||||
if not params.get_bool("CameraViewReset"):
|
||||
params.remove("CameraView")
|
||||
params.put_bool("CameraViewReset", True)
|
||||
|
||||
default_params: list[tuple[str, str | bytes]] = [
|
||||
("CarParamsPersistent", ""),
|
||||
("CompletedTrainingVersion", "0"),
|
||||
|
||||
@@ -658,7 +658,7 @@ void AnnotatedCameraWidget::paintGL() {
|
||||
|
||||
// Wide or narrow cam dependent on speed
|
||||
bool has_wide_cam = available_streams.count(VISION_STREAM_WIDE_ROAD);
|
||||
if (has_wide_cam) {
|
||||
if (has_wide_cam && cameraView == 0) {
|
||||
float v_ego = sm["carState"].getCarState().getVEgo();
|
||||
if ((v_ego < 10) || available_streams.size() == 1) {
|
||||
wide_cam_requested = true;
|
||||
@@ -669,7 +669,9 @@ void AnnotatedCameraWidget::paintGL() {
|
||||
// for replay of old routes, never go to widecam
|
||||
wide_cam_requested = wide_cam_requested && s->scene.calibration_wide_valid;
|
||||
}
|
||||
CameraWidget::setStreamType(wide_cam_requested ? VISION_STREAM_WIDE_ROAD : VISION_STREAM_ROAD);
|
||||
CameraWidget::setStreamType(cameraView == 1 ? VISION_STREAM_DRIVER :
|
||||
cameraView == 3 || wide_cam_requested ? VISION_STREAM_WIDE_ROAD :
|
||||
VISION_STREAM_ROAD);
|
||||
|
||||
s->scene.wide_cam = CameraWidget::getStreamType() == VISION_STREAM_WIDE_ROAD;
|
||||
if (s->scene.calibration_valid) {
|
||||
@@ -756,6 +758,8 @@ void AnnotatedCameraWidget::updateFrogPilotWidgets() {
|
||||
blindSpotLeft = scene.blind_spot_left;
|
||||
blindSpotRight = scene.blind_spot_right;
|
||||
|
||||
cameraView = scene.camera_view;
|
||||
|
||||
experimentalMode = scene.experimental_mode;
|
||||
|
||||
mapOpen = scene.map_open;
|
||||
|
||||
@@ -126,6 +126,7 @@ private:
|
||||
bool showAlwaysOnLateralStatusBar;
|
||||
|
||||
int alertSize;
|
||||
int cameraView;
|
||||
|
||||
protected:
|
||||
void paintGL() override;
|
||||
|
||||
@@ -271,6 +271,7 @@ void ui_update_frogpilot_params(UIState *s) {
|
||||
bool quality_of_life_controls = params.getBool("QOLControls");
|
||||
|
||||
bool quality_of_life_visuals = params.getBool("QOLVisuals");
|
||||
scene.camera_view = quality_of_life_visuals ? params.getInt("CameraView") : 0;
|
||||
}
|
||||
|
||||
void UIState::updateStatus() {
|
||||
|
||||
@@ -187,6 +187,7 @@ typedef struct UIScene {
|
||||
float lane_width_right;
|
||||
|
||||
int alert_size;
|
||||
int camera_view;
|
||||
|
||||
QPolygonF track_adjacent_vertices[6];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user