From a8fe4f50cc0843150e1aacf4261df2e01dd53d41 Mon Sep 17 00:00:00 2001 From: Isaac Date: Mon, 4 Nov 2024 18:33:27 -0800 Subject: [PATCH] Fix frozen_map usage --- src/Constants.cpp | 4 ++-- src/Constants.h | 4 ++-- src/camera/Camera.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Constants.cpp b/src/Constants.cpp index 0eea9edc..3edb963d 100644 --- a/src/Constants.cpp +++ b/src/Constants.cpp @@ -51,12 +51,12 @@ const robot::types::CameraID MAST_CAMERA_ID = 40; const robot::types::CameraID WRIST_CAMERA_ID = 30; const robot::types::CameraID HAND_CAMERA_ID = 20; -constexpr frozen::unordered_map CAMERA_CONFIG_PATHS = { +constexpr frozen::unordered_map CAMERA_CONFIG_PATHS = { {MAST_CAMERA_ID, "../camera-config/MastCameraCalibration.yml"}, {WRIST_CAMERA_ID, "../camera-config/WristCameraCalibration.yml"}, {HAND_CAMERA_ID, "../camera-config/HandCameraCalibration.yml"}}; -constexpr frozen::unordered_map CAMERA_NAME_TO_ID = { +constexpr frozen::unordered_map CAMERA_NAME_TO_ID = { {"mast", MAST_CAMERA_ID}, {"wrist", WRIST_CAMERA_ID}, {"hand", HAND_CAMERA_ID}}; /** diff --git a/src/Constants.h b/src/Constants.h index 0822c0ff..f2bf9dd7 100644 --- a/src/Constants.h +++ b/src/Constants.h @@ -57,9 +57,9 @@ extern const robot::types::CameraID MAST_CAMERA_ID; extern const robot::types::CameraID WRIST_CAMERA_ID; extern const robot::types::CameraID HAND_CAMERA_ID; -extern constexpr frozen::unordered_map +extern const frozen::unordered_map CAMERA_CONFIG_PATHS; -extern constexpr frozen::unordered_map CAMERA_NAME_TO_ID; +extern const frozen::unordered_map CAMERA_NAME_TO_ID; extern const uint16_t WS_SERVER_PORT; diff --git a/src/camera/Camera.cpp b/src/camera/Camera.cpp index 7a3dd5a7..54ddfb5e 100644 --- a/src/camera/Camera.cpp +++ b/src/camera/Camera.cpp @@ -62,7 +62,7 @@ void Camera::init() { } std::stringstream Camera::GStreamerFromFile(robot::types::CameraID camera_id) { - cv::FileStorage fs(Constants::CAMERA_CONFIG_PATHS.at(camera_id), cv::FileStorage::READ); + cv::FileStorage fs(Constants::CAMERA_CONFIG_PATHS.at(camera_id).data(), cv::FileStorage::READ); if (!fs.isOpened()) { throw std::invalid_argument("Configuration file of camera ID" + std::to_string(camera_id) + " does not exist");