From 66f8878ba8c4ad117e7e3f3ef98cdee17f6428cf Mon Sep 17 00:00:00 2001 From: FrogAi <91348155+FrogAi@users.noreply.github.com> Date: Sat, 11 May 2024 15:06:50 -0700 Subject: [PATCH] Visuals - Quality of Life - Camera View Choose your preferred camera view for the onroad UI. This is purely a visual change and doesn't impact how openpilot drives. --- selfdrive/ui/qt/onroad/annotated_camera.cc | 8 ++++++-- selfdrive/ui/qt/onroad/annotated_camera.h | 1 + selfdrive/ui/ui.cc | 1 + selfdrive/ui/ui.h | 1 + 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/selfdrive/ui/qt/onroad/annotated_camera.cc b/selfdrive/ui/qt/onroad/annotated_camera.cc index 52532403..9cbc2d47 100644 --- a/selfdrive/ui/qt/onroad/annotated_camera.cc +++ b/selfdrive/ui/qt/onroad/annotated_camera.cc @@ -628,7 +628,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) { if ((v_ego < 10) || available_streams.size() == 1) { wide_cam_requested = true; } else if (v_ego > 15) { @@ -638,7 +638,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) { @@ -811,6 +813,8 @@ void AnnotatedCameraWidget::paintFrogPilotWidgets(QPainter &painter, const UISce blindSpotLeft = scene.blind_spot_left; blindSpotRight = scene.blind_spot_right; + cameraView = scene.camera_view; + compass = scene.compass; bool enableCompass = compass && !hideBottomIcons; compass_img->setVisible(enableCompass); diff --git a/selfdrive/ui/qt/onroad/annotated_camera.h b/selfdrive/ui/qt/onroad/annotated_camera.h index cae4fe59..e6388905 100644 --- a/selfdrive/ui/qt/onroad/annotated_camera.h +++ b/selfdrive/ui/qt/onroad/annotated_camera.h @@ -142,6 +142,7 @@ private: float unconfirmedSpeedLimit; int alertSize; + int cameraView; int conditionalSpeed; int conditionalSpeedLead; int conditionalStatus; diff --git a/selfdrive/ui/ui.cc b/selfdrive/ui/ui.cc index d5e2804a..7e6e97a3 100644 --- a/selfdrive/ui/ui.cc +++ b/selfdrive/ui/ui.cc @@ -420,6 +420,7 @@ void ui_update_frogpilot_params(UIState *s, Params ¶ms) { bool quality_of_life_visuals = params.getBool("QOLVisuals"); scene.big_map = quality_of_life_visuals && params.getBool("BigMap"); scene.full_map = scene.big_map && params.getBool("FullMap"); + scene.camera_view = quality_of_life_visuals ? params.getInt("CameraView") : 0; scene.speed_limit_controller = scene.longitudinal_control && params.getBool("SpeedLimitController"); scene.show_slc_offset = scene.speed_limit_controller && params.getBool("ShowSLCOffset"); diff --git a/selfdrive/ui/ui.h b/selfdrive/ui/ui.h index f01614a7..323f2482 100644 --- a/selfdrive/ui/ui.h +++ b/selfdrive/ui/ui.h @@ -225,6 +225,7 @@ typedef struct UIScene { int alert_size; int bearing_deg; + int camera_view; int conditional_speed; int conditional_speed_lead; int conditional_status;