diff --git a/apps/lidar_odometry_step_1/lidar_odometry.cpp b/apps/lidar_odometry_step_1/lidar_odometry.cpp index 855e7a21..a8151236 100644 --- a/apps/lidar_odometry_step_1/lidar_odometry.cpp +++ b/apps/lidar_odometry_step_1/lidar_odometry.cpp @@ -11,6 +11,8 @@ #include #endif +#include "spdlog/spdlog.h" + #include namespace fs = std::filesystem; @@ -260,6 +262,45 @@ bool load_data( const std::string imuSnToUse = MLvxCalib::GetImuSnToUse(calibrationFile); const auto idToSn = MLvxCalib::GetIdToSnMapping(sn_file); + // gate invalid calibration + std::stringstream err; + if (idToSn.size() > 1) + { + bool valid = true; + for (const auto& [_, sn] : idToSn) + { + if (!preloadedCalibration.contains(sn)) + { + valid = false; + err << "Missing serial number from calibration file " << sn.c_str() << "\n"; + } + } + + if (!valid) + { + err << "Data containst Lidars with those serial numbers :" << std::endl; + for (const auto& [id, sn] : idToSn) + { + err << " - " << id << " : " << sn.c_str() << "\n"; + } + + if (calibrationFile.empty()) + { + err << "But no calibration was given found\n"; + } + else + { + err << "Calibration file found : " << calibrationFile.c_str() << ", but contains following Lidars : \n"; + for (const auto& [sn, _] : preloadedCalibration) + { + err << " - " << sn << "\n"; + } + } + spdlog::error(err.str()); + throw std::runtime_error(err.str()); + } + } + if (!preloadedCalibration.empty()) { std::cout << "Loaded calibration for:\n"; diff --git a/apps/lidar_odometry_step_1/lidar_odometry_gui.cpp b/apps/lidar_odometry_step_1/lidar_odometry_gui.cpp index fc369fc0..0230c23c 100644 --- a/apps/lidar_odometry_step_1/lidar_odometry_gui.cpp +++ b/apps/lidar_odometry_step_1/lidar_odometry_gui.cpp @@ -724,7 +724,7 @@ void step1(const std::string& input_folder_name, const std::atomic& loPaus else { std::string message_info = "Problem with loading data from folder '" + input_folder_name + - "' (Pease check if folder exists). Program will close once You click OK!!!"; + "' (Please check if folder exists). Program will close once You click OK!!!"; std::cout << message_info << std::endl; throw std::runtime_error("Input data loading failed: " + input_folder_name); }