Skip to content

Commit

Permalink
Fix frozen_map usage
Browse files Browse the repository at this point in the history
  • Loading branch information
imisaacwu committed Nov 5, 2024
1 parent 3fde550 commit a8fe4f5
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/Constants.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<robot::types::CameraID, std::string> CAMERA_CONFIG_PATHS = {
constexpr frozen::unordered_map<robot::types::CameraID, frozen::string, 3> 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<std::string, robot::types::CameraID> CAMERA_NAME_TO_ID = {
constexpr frozen::unordered_map<frozen::string, robot::types::CameraID, 3> CAMERA_NAME_TO_ID = {
{"mast", MAST_CAMERA_ID}, {"wrist", WRIST_CAMERA_ID}, {"hand", HAND_CAMERA_ID}};

/**
Expand Down
4 changes: 2 additions & 2 deletions src/Constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<robot::types::CameraID, std::string>
extern const frozen::unordered_map<robot::types::CameraID, frozen::string, 3>
CAMERA_CONFIG_PATHS;
extern constexpr frozen::unordered_map<std::string, robot::types::CameraID> CAMERA_NAME_TO_ID;
extern const frozen::unordered_map<frozen::string, robot::types::CameraID, 3> CAMERA_NAME_TO_ID;

extern const uint16_t WS_SERVER_PORT;

Expand Down
2 changes: 1 addition & 1 deletion src/camera/Camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit a8fe4f5

Please sign in to comment.