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
15 changes: 9 additions & 6 deletions apps/lidar_odometry_step_1/lidar_odometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,10 @@ static void write_calibration_validation(const fs::path& wdp, const std::vector<
static constexpr double kLidarGapWarningS = 0.05;

// Warns about gaps inside each file and between consecutive files (t_first/t_last are 0 for a file without
// points). The first file is skipped, as its points are never used.
// points). Files before first_file are skipped, as their points are never used.
static void report_lidar_gaps(
const std::vector<std::string>& files,
size_t first_file,
const std::vector<std::vector<LidarGap>>& gaps_in_file,
const std::vector<double>& t_first,
const std::vector<double>& t_last)
Expand All @@ -84,7 +85,7 @@ static void report_lidar_gaps(

double previous_last = 0.0;
std::string previous_name;
for (size_t i = 1; i < gaps_in_file.size(); i++)
for (size_t i = first_file; i < gaps_in_file.size(); i++)
{
if (t_first[i] == 0.0 && t_last[i] == 0.0)
continue;
Expand Down Expand Up @@ -371,6 +372,8 @@ bool load_data(
}

pointsPerFile.resize(minSize);
// the first file's points are dropped unless params.skip_first_file is off
const size_t firstUsedFile = params.skip_first_file ? 1 : 0;

// --- Working directories

Expand Down Expand Up @@ -410,7 +413,7 @@ bool load_data(
L.done.assign(minSize, 0);
std::vector<std::vector<LidarGap>> gaps_in_file(minSize);
tbb::parallel_for(
size_t(1), // upstream clears the first file's cloud after loading: it is never used
std::min(firstUsedFile, minSize), // a skipped file's cloud is never used
minSize,
[&](size_t i)
{
Expand All @@ -426,7 +429,7 @@ bool load_data(
}
gaps_in_file[i] = find_lidar_gaps(data, kLidarGapWarningS);
});
report_lidar_gaps(L.files, gaps_in_file, L.t_first, L.t_last);
report_lidar_gaps(L.files, firstUsedFile, gaps_in_file, L.t_first, L.t_last);
if (params.save_calibration_validation && minSize > 0) // as the eager load: the first file, then dropped
write_calibration_validation(wdp, L.load(0), params);
size_t totalPoints = 0;
Expand Down Expand Up @@ -472,9 +475,9 @@ bool load_data(
// Store results
pointsPerFile[i] = std::move(data);
});
report_lidar_gaps(laz_files, gaps_in_file, t_first, t_last);
report_lidar_gaps(laz_files, firstUsedFile, gaps_in_file, t_first, t_last);

if (pointsPerFile.size() > 0)
if (params.skip_first_file && pointsPerFile.size() > 0)
pointsPerFile.front().clear();

// --- Summary
Expand Down
4 changes: 4 additions & 0 deletions apps/lidar_odometry_step_1/lidar_odometry_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,10 @@ void settings_gui()
return;
}

ImGui::Checkbox("Skip first file", &params.skip_first_file);
if (ImGui::IsItemHovered())
ImGui::SetTooltip("drop the points of the first LAZ file during load (its IMU data is kept)");

ImGui::PushItemWidth(ImGuiNumberWidth);
ImGui::InputDouble("Filter threshold XY inner [m]", &params.filter_threshold_xy_inner, 0.0, 0.0, "%.3f");
if (ImGui::IsItemHovered())
Expand Down
1 change: 1 addition & 0 deletions apps/lidar_odometry_step_1/lidar_odometry_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ struct LidarOdometryParams
std::function<void(const Eigen::Vector3d&)> publish_processing_head; // completed worker, never the predicted tail

// filter points
bool skip_first_file = true; // drop the first LAZ file's points during load (IMU data is kept)
double filter_threshold_xy_inner = 0.3; // filtering points during load
double filter_threshold_xy_outer = 70.0; // filtering points during load
double decimation = 0.01; // filtering points during load
Expand Down
4 changes: 3 additions & 1 deletion apps/lidar_odometry_step_1/toml_io.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class TomlIO
{ "real_time_threshold_seconds", &LidarOdometryParams::real_time_threshold_seconds },
{ "lazy_load_raw_clouds", &LidarOdometryParams::lazy_load_raw_clouds },
{ "points_global_spill_directory", &LidarOdometryParams::points_global_spill_directory },
{ "skip_first_file", &LidarOdometryParams::skip_first_file },
{ "filter_threshold_xy_inner", &LidarOdometryParams::filter_threshold_xy_inner },
{ "filter_threshold_xy_outer", &LidarOdometryParams::filter_threshold_xy_outer },
{ "decimation", &LidarOdometryParams::decimation },
Expand Down Expand Up @@ -128,7 +129,8 @@ class TomlIO
{ "version_info", { "software_version", "config_version", "build_date" } },
{ "performance", { "useMultithread", "real_time_threshold_seconds", "lazy_load_raw_clouds", "points_global_spill_directory" } },
{ "filter_points",
{ "filter_threshold_xy_inner",
{ "skip_first_file",
"filter_threshold_xy_inner",
"filter_threshold_xy_outer",
"decimation",
"threshould_output_filter",
Expand Down
5 changes: 5 additions & 0 deletions apps/mandeye_raw_data_viewer/mandeye_raw_data_viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ std::map<uint64_t, std::string> photo_files_ts;

double filter_threshold_xy_inner = 0.0; // no filtering for raw viewing
double filter_threshold_xy_outer = 300.0; // no filtering for raw viewing
bool skip_first_file = true; // as step 1: the first LAZ file's points are dropped
bool fusionConventionNwu = true;
bool fusionConventionEnu = false;
bool fusionConventionNed = false;
Expand Down Expand Up @@ -1015,6 +1016,7 @@ void loadFiles(std::vector<std::string> input_file_names)
params.lazy_load_raw_clouds = false; // the viewer shows every cloud
params.filter_threshold_xy_inner = filter_threshold_xy_inner;
params.filter_threshold_xy_outer = filter_threshold_xy_outer;
params.skip_first_file = skip_first_file;

std::vector<std::vector<Point3Di>> pointsPerFile;
Imu imu_data;
Expand Down Expand Up @@ -1798,6 +1800,9 @@ void display()
openFiles();
if (ImGui::IsItemHovered())
ImGui::SetTooltip("Select files for analyze");
ImGui::MenuItem("Skip first file", nullptr, &skip_first_file);
if (ImGui::IsItemHovered())
ImGui::SetTooltip("Drop the points of the first LAZ file on the next load, as step 1 does");

ImGui::EndPopup();
}
Expand Down
1 change: 1 addition & 0 deletions pybind/lidar_odometry_binding.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ PYBIND11_MODULE(lidar_odometry_py, m)
// Bind LidarOdometryParams
py::class_<LidarOdometryParams>(m, "LidarOdometryParams")
.def(py::init<>())
.def_readwrite("skip_first_file", &LidarOdometryParams::skip_first_file)
.def_readwrite("filter_threshold_xy_inner", &LidarOdometryParams::filter_threshold_xy_inner)
.def_readwrite("filter_threshold_xy_outer", &LidarOdometryParams::filter_threshold_xy_outer)
.def_readwrite("m_g", &LidarOdometryParams::m_g)
Expand Down
Loading