| 336 | } |
| 337 | |
| 338 | int main(int argc, char* argv[]) |
| 339 | { |
| 340 | if (1 >= argc) { |
| 341 | std::cout << "[ERROR] Please running by: " << argv[0] << " [pcd_folder] [optional: config_file_path]"; |
| 342 | return 0; |
| 343 | } |
| 344 | |
| 345 | std::filesystem::path path(argv[1]); |
| 346 | std::string config_file_path; |
| 347 | if (argc > 2) |
| 348 | config_file_path = argv[2]; |
| 349 | else |
| 350 | config_file_path = std::string(argv[1]) + "/dufomap.toml"; |
| 351 | |
| 352 | auto config = readConfig(std::filesystem::path(config_file_path)); |
| 353 | std::cout << "[LOG] Step 1: Successfully read configuration from: " << config_file_path <<std::endl; |
| 354 | ufo::Map<ufo::MapType::SEEN_FREE | ufo::MapType::REFLECTION | ufo::MapType::LABEL> map( |
| 355 | config.map.resolution, config.map.levels); |
| 356 | map.reserve(100'000'000); |
| 357 | |
| 358 | std::vector<std::filesystem::path> pcds; |
| 359 | for (const auto& entry : std::filesystem::directory_iterator(path / "pcd")) { |
| 360 | if (!entry.is_regular_file()) { |
| 361 | continue; |
| 362 | } |
| 363 | std::size_t i = std::stoul(entry.path().stem()); |
| 364 | if (config.dataset.first <= i && config.dataset.last >= i) { |
| 365 | pcds.push_back(entry.path().filename()); |
| 366 | } |
| 367 | } |
| 368 | std::ranges::sort(pcds); |
| 369 | // std::cout << config << std::endl; |
| 370 | pcds.resize(std::min(pcds.size(), config.dataset.num)); |
| 371 | |
| 372 | ufo::Timing timing; |
| 373 | timing.start("Total"); |
| 374 | |
| 375 | ufo::PointCloudColor cloud_acc; |
| 376 | |
| 377 | std::cout << "[LOG] Step 2: Starting Processing data from: " << path << '\n'; |
| 378 | indicators::show_console_cursor(false); |
| 379 | indicators::BlockProgressBar bar{ |
| 380 | indicators::option::BarWidth{50}, |
| 381 | indicators::option::Start{"["}, |
| 382 | indicators::option::End{"]"}, |
| 383 | indicators::option::PrefixText{"[LOG] Running dufomap "}, |
| 384 | indicators::option::ForegroundColor{indicators::Color::white}, |
| 385 | indicators::option::ShowElapsedTime{true}, |
| 386 | indicators::option::ShowRemainingTime{true}, |
| 387 | indicators::option::FontStyles{std::vector<indicators::FontStyle>{indicators::FontStyle::bold}} |
| 388 | }; |
| 389 | |
| 390 | for (std::size_t i{}; std::string filename : pcds) { |
| 391 | bar.set_progress(100 * i / pcds.size()); |
| 392 | ++i; |
| 393 | timing.setTag("Total " + std::to_string(i) + " of " + std::to_string(pcds.size()) + |
| 394 | " (" + std::to_string(100 * i / pcds.size()) + "%)"); |
| 395 |
nothing calls this directly
no test coverage detected