Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions apps/lidar_odometry_step_1/lidar_odometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
#include <malloc.h>
#endif

#include "spdlog/spdlog.h"

#include <functional>

namespace fs = std::filesystem;
Expand Down Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion apps/lidar_odometry_step_1/lidar_odometry_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ void step1(const std::string& input_folder_name, const std::atomic<bool>& 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);
}
Expand Down
Loading