Camera view selection
Added toggle to select the preferred camera view between "auto", "standard", "wide", and "driver".
This commit is contained in:
@@ -217,6 +217,7 @@ std::unordered_map<std::string, uint32_t> keys = {
|
|||||||
{"AlwaysOnLateralMain", PERSISTENT},
|
{"AlwaysOnLateralMain", PERSISTENT},
|
||||||
{"ApiCache_DriveStats", PERSISTENT},
|
{"ApiCache_DriveStats", PERSISTENT},
|
||||||
{"BlindSpotPath", PERSISTENT},
|
{"BlindSpotPath", PERSISTENT},
|
||||||
|
{"CameraView", PERSISTENT},
|
||||||
{"CustomAlerts", PERSISTENT},
|
{"CustomAlerts", PERSISTENT},
|
||||||
{"CustomUI", PERSISTENT},
|
{"CustomUI", PERSISTENT},
|
||||||
{"DecelerationProfile", PERSISTENT},
|
{"DecelerationProfile", PERSISTENT},
|
||||||
|
|||||||
BIN
selfdrive/frogpilot/assets/toggle_icons/icon_camera.png
Normal file
BIN
selfdrive/frogpilot/assets/toggle_icons/icon_camera.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 26 KiB |
@@ -11,6 +11,8 @@ FrogPilotVisualsPanel::FrogPilotVisualsPanel(SettingsWindow *parent) : FrogPilot
|
|||||||
{"WarningSoftVolume", "Warning Soft Volume", "Related alerts:\n\nBRAKE!, Risk of Collision\nTAKE CONTROL IMMEDIATELY", ""},
|
{"WarningSoftVolume", "Warning Soft Volume", "Related alerts:\n\nBRAKE!, Risk of Collision\nTAKE CONTROL IMMEDIATELY", ""},
|
||||||
{"WarningImmediateVolume", "Warning Immediate Volume", "Related alerts:\n\nDISENGAGE IMMEDIATELY, Driver Distracted\nDISENGAGE IMMEDIATELY, Driver Unresponsive", ""},
|
{"WarningImmediateVolume", "Warning Immediate Volume", "Related alerts:\n\nDISENGAGE IMMEDIATELY, Driver Distracted\nDISENGAGE IMMEDIATELY, Driver Unresponsive", ""},
|
||||||
|
|
||||||
|
{"CameraView", "Camera View", "Choose your preferred camera view for the onroad UI. This is a visual change only and doesn't impact openpilot.", "../frogpilot/assets/toggle_icons/icon_camera.png"},
|
||||||
|
|
||||||
{"CustomAlerts", "Custom Alerts", "Enable custom alerts for various logic or situational changes.", "../frogpilot/assets/toggle_icons/icon_green_light.png"},
|
{"CustomAlerts", "Custom Alerts", "Enable custom alerts for various logic or situational changes.", "../frogpilot/assets/toggle_icons/icon_green_light.png"},
|
||||||
|
|
||||||
{"CustomUI", "Custom Onroad UI", "Customize the Onroad UI with some additional visual functions.", "../assets/offroad/icon_road.png"},
|
{"CustomUI", "Custom Onroad UI", "Customize the Onroad UI with some additional visual functions.", "../assets/offroad/icon_road.png"},
|
||||||
@@ -40,6 +42,11 @@ FrogPilotVisualsPanel::FrogPilotVisualsPanel(SettingsWindow *parent) : FrogPilot
|
|||||||
toggle = new FrogPilotParamValueControl(param, title, desc, icon, 0, 100, std::map<int, QString>(), this, false, "%");
|
toggle = new FrogPilotParamValueControl(param, title, desc, icon, 0, 100, std::map<int, QString>(), this, false, "%");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} else if (param == "CameraView") {
|
||||||
|
std::vector<QString> cameraOptions{tr("Auto"), tr("Standard"), tr("Wide"), tr("Driver")};
|
||||||
|
FrogPilotButtonParamControl *preferredCamera = new FrogPilotButtonParamControl(param, title, desc, icon, cameraOptions);
|
||||||
|
toggle = preferredCamera;
|
||||||
|
|
||||||
} else if (param == "CustomAlerts") {
|
} else if (param == "CustomAlerts") {
|
||||||
FrogPilotParamManageControl *customAlertsToggle = new FrogPilotParamManageControl(param, title, desc, icon, this);
|
FrogPilotParamManageControl *customAlertsToggle = new FrogPilotParamManageControl(param, title, desc, icon, this);
|
||||||
QObject::connect(customAlertsToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {
|
QObject::connect(customAlertsToggle, &FrogPilotParamManageControl::manageButtonClicked, this, [this]() {
|
||||||
|
|||||||
@@ -659,7 +659,7 @@ void AnnotatedCameraWidget::paintGL() {
|
|||||||
|
|
||||||
// Wide or narrow cam dependent on speed
|
// Wide or narrow cam dependent on speed
|
||||||
bool has_wide_cam = available_streams.count(VISION_STREAM_WIDE_ROAD);
|
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();
|
float v_ego = sm["carState"].getCarState().getVEgo();
|
||||||
if ((v_ego < 10) || available_streams.size() == 1) {
|
if ((v_ego < 10) || available_streams.size() == 1) {
|
||||||
wide_cam_requested = true;
|
wide_cam_requested = true;
|
||||||
@@ -670,7 +670,9 @@ void AnnotatedCameraWidget::paintGL() {
|
|||||||
// for replay of old routes, never go to widecam
|
// for replay of old routes, never go to widecam
|
||||||
wide_cam_requested = wide_cam_requested && s->scene.calibration_wide_valid;
|
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 == 3 ? VISION_STREAM_DRIVER :
|
||||||
|
cameraView == 2 || wide_cam_requested ? VISION_STREAM_WIDE_ROAD :
|
||||||
|
VISION_STREAM_ROAD);
|
||||||
|
|
||||||
s->scene.wide_cam = CameraWidget::getStreamType() == VISION_STREAM_WIDE_ROAD;
|
s->scene.wide_cam = CameraWidget::getStreamType() == VISION_STREAM_WIDE_ROAD;
|
||||||
if (s->scene.calibration_valid) {
|
if (s->scene.calibration_valid) {
|
||||||
@@ -758,6 +760,8 @@ void AnnotatedCameraWidget::updateFrogPilotWidgets(QPainter &p) {
|
|||||||
blindSpotLeft = scene.blind_spot_left;
|
blindSpotLeft = scene.blind_spot_left;
|
||||||
blindSpotRight = scene.blind_spot_right;
|
blindSpotRight = scene.blind_spot_right;
|
||||||
|
|
||||||
|
cameraView = scene.camera_view;
|
||||||
|
|
||||||
experimentalMode = scene.experimental_mode;
|
experimentalMode = scene.experimental_mode;
|
||||||
|
|
||||||
if (alwaysOnLateral) {
|
if (alwaysOnLateral) {
|
||||||
|
|||||||
@@ -124,6 +124,8 @@ private:
|
|||||||
bool blindSpotRight;
|
bool blindSpotRight;
|
||||||
bool experimentalMode;
|
bool experimentalMode;
|
||||||
|
|
||||||
|
int cameraView;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void paintGL() override;
|
void paintGL() override;
|
||||||
void initializeGL() override;
|
void initializeGL() override;
|
||||||
|
|||||||
@@ -260,6 +260,7 @@ void ui_update_frogpilot_params(UIState *s) {
|
|||||||
UIScene &scene = s->scene;
|
UIScene &scene = s->scene;
|
||||||
|
|
||||||
scene.always_on_lateral = params.getBool("AlwaysOnLateral");
|
scene.always_on_lateral = params.getBool("AlwaysOnLateral");
|
||||||
|
scene.camera_view = params.getInt("CameraView");
|
||||||
|
|
||||||
bool custom_onroad_ui = params.getBool("CustomUI");
|
bool custom_onroad_ui = params.getBool("CustomUI");
|
||||||
scene.acceleration_path = custom_onroad_ui && params.getBool("AccelerationPath");
|
scene.acceleration_path = custom_onroad_ui && params.getBool("AccelerationPath");
|
||||||
|
|||||||
@@ -181,6 +181,8 @@ typedef struct UIScene {
|
|||||||
float lane_width_left;
|
float lane_width_left;
|
||||||
float lane_width_right;
|
float lane_width_right;
|
||||||
|
|
||||||
|
int camera_view;
|
||||||
|
|
||||||
QPolygonF track_adjacent_vertices[6];
|
QPolygonF track_adjacent_vertices[6];
|
||||||
|
|
||||||
} UIScene;
|
} UIScene;
|
||||||
|
|||||||
Reference in New Issue
Block a user