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
Original file line number Diff line number Diff line change
Expand Up @@ -2217,10 +2217,7 @@ void display()

void on_exit()
{
// remove cache
std::cout << "remove cache: '" << params.working_directory_cache << "' START" << std::endl;
std::filesystem::remove_all(params.working_directory_cache);
std::cout << "remove cache: '" << params.working_directory_cache << "' FINISHED" << std::endl;
remove_cache(params);
}

void mouse(int glut_button, int state, int x, int y)
Expand Down
13 changes: 13 additions & 0 deletions apps/lidar_odometry_step_1/lidar_odometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1192,6 +1192,19 @@ void release_raw_clouds(std::vector<std::vector<Point3Di>>& pointsPerFile, Lidar
release_freed_heap();
}

void remove_cache(const LidarOdometryParams& params)
{
if (params.working_directory_cache.empty())
return;
std::cout << "remove cache: '" << params.working_directory_cache << "' START" << std::endl;
std::error_code ec;
fs::remove_all(params.working_directory_cache, ec);
if (ec)
std::cerr << "remove cache: '" << params.working_directory_cache << "' FAILED: " << ec.message() << std::endl;
else
std::cout << "remove cache: '" << params.working_directory_cache << "' FINISHED" << std::endl;
}

std::vector<WorkerData> run_lidar_odometry(const std::string& input_dir, LidarOdometryParams& params)
{
HDMAP_ZONE_SCOPE("run_lidar_odometry");
Expand Down
2 changes: 2 additions & 0 deletions apps/lidar_odometry_step_1/lidar_odometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ bool compute_step_1(
const std::atomic<bool>& pause);
// after a successful step 1: free the raw clouds (and the lazy loader) — nothing after step 1 reads them
void release_raw_clouds(std::vector<std::vector<Point3Di>>& pointsPerFile, LidarOdometryParams& params);
// remove params.working_directory_cache; call only once nothing reads worker_data[*].*_cache_file_name any more
void remove_cache(const LidarOdometryParams& params);
void run_consistency(std::vector<WorkerData>& worker_data, const LidarOdometryParams& params);
void filter_reference_buckets(LidarOdometryParams& params);
void load_reference_point_clouds(const std::vector<std::string>& input_file_names, LidarOdometryParams& params);
Expand Down
7 changes: 3 additions & 4 deletions apps/lidar_odometry_step_1/lidar_odometry_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2626,10 +2626,7 @@ void display()

void on_exit()
{
// remove cache
std::cout << "remove cache: '" << params.working_directory_cache << "' START" << std::endl;
std::filesystem::remove_all(params.working_directory_cache);
std::cout << "remove cache: '" << params.working_directory_cache << "' FINISHED" << std::endl;
remove_cache(params);
}

void mouse(int glut_button, int state, int x, int y)
Expand Down Expand Up @@ -2759,6 +2756,7 @@ int main(int argc, char* argv[])
const fs::path result_dir = get_next_result_path(working_directory);
save_results(false, elapsed_seconds.count(), working_directory, worker_data, params, result_dir);
std::cout << "Results saved to folder: '" << result_dir.string() << "'" << std::endl;
remove_cache(params);
}
}
else if (argc == 4) // runnning from command line with custom params
Expand Down Expand Up @@ -2789,6 +2787,7 @@ int main(int argc, char* argv[])
<< "Elapsed time: " << formatTime(elapsed_seconds.count()).c_str() << "s\n";

save_results(false, elapsed_seconds.count(), working_directory, worker_data, params, argv[3]);
remove_cache(params);
}
else // full GUI mode
{
Expand Down
Loading