| 344 | } |
| 345 | |
| 346 | int main(int argc, char *argv[]) |
| 347 | { |
| 348 | #ifdef USE_STACK_TRACE_LOGGER |
| 349 | google::InitGoogleLogging(argv[0]); |
| 350 | google::InstallFailureSignalHandler(); |
| 351 | #endif |
| 352 | |
| 353 | // create options |
| 354 | popl::OptionParser op("Allowed options"); |
| 355 | auto help = op.add<popl::Switch>("h", "help", "produce help message"); |
| 356 | auto vocab_file_path = op.add<popl::Value<std::string>>("v", "vocab", "vocabulary file path"); |
| 357 | auto data_dir_path = op.add<popl::Value<std::string>>("d", "data-dir", "directory path which contains dataset"); |
| 358 | auto config_file_path = op.add<popl::Value<std::string>>("c", "config", "config file path"); |
| 359 | auto frame_skip = op.add<popl::Value<unsigned int>>("", "frame-skip", "interval of frame skip", 1); |
| 360 | auto no_sleep = op.add<popl::Switch>("", "no-sleep", "not wait for next frame in real time"); |
| 361 | auto auto_term = op.add<popl::Switch>("", "auto-term", "automatically terminate the viewer"); |
| 362 | auto debug_mode = op.add<popl::Switch>("", "debug", "debug mode"); |
| 363 | auto eval_log = op.add<popl::Switch>("", "eval-log", "store trajectory and tracking times for evaluation"); |
| 364 | auto map_db_path = op.add<popl::Value<std::string>>("p", "map-db", "store a map database at this path after SLAM", ""); |
| 365 | try |
| 366 | { |
| 367 | op.parse(argc, argv); |
| 368 | } |
| 369 | catch (const std::exception &e) |
| 370 | { |
| 371 | std::cerr << e.what() << std::endl; |
| 372 | std::cerr << std::endl; |
| 373 | std::cerr << op << std::endl; |
| 374 | return EXIT_FAILURE; |
| 375 | } |
| 376 | |
| 377 | // check validness of options |
| 378 | if (help->is_set()) |
| 379 | { |
| 380 | std::cerr << op << std::endl; |
| 381 | return EXIT_FAILURE; |
| 382 | } |
| 383 | if (!vocab_file_path->is_set() || !data_dir_path->is_set() || !config_file_path->is_set()) |
| 384 | { |
| 385 | std::cerr << "invalid arguments" << std::endl; |
| 386 | std::cerr << std::endl; |
| 387 | std::cerr << op << std::endl; |
| 388 | return EXIT_FAILURE; |
| 389 | } |
| 390 | |
| 391 | // setup logger |
| 392 | spdlog::set_pattern("[%Y-%m-%d %H:%M:%S.%e] %^[%L] %v%$"); |
| 393 | if (debug_mode->is_set()) |
| 394 | { |
| 395 | spdlog::set_level(spdlog::level::debug); |
| 396 | } |
| 397 | else |
| 398 | { |
| 399 | spdlog::set_level(spdlog::level::info); |
| 400 | } |
| 401 | |
| 402 | // load configuration |
| 403 | std::shared_ptr<PLPSLAM::config> cfg; |
nothing calls this directly
no test coverage detected