69int main(
int argc,
const char** argv) {
70 if (ca_init(argc, argv) != 0) {
75 ca_description(
"Driver program for Ethan's ICP implementation.");
76 ca_author(
"Ethan Uppal");
79 ca_versioning_info(
"All rights reserved.");
81 ca_synopsis(
"[-h|-v]");
82 ca_synopsis(
"-S FILE -D FILE [-l]");
83 ca_synopsis(
"-b METHOD [-l]");
85 bool* enable_log = NULL;
86 bool* read_scan_files = NULL;
87 bool* basic_mode = NULL;
88 const char* f_src = NULL;
89 const char* f_dst = NULL;
90 const char* config_file =
"view.conf";
91 const char* method =
"vanilla";
93 assert_opt(read_scan_files = ca_opt(
'S',
"src",
".FILE&D", &f_src,
94 "source scan (pass with -D)"));
95 assert_opt(ca_opt(
'D',
"dst",
".FILE&S", &f_dst,
"destination scan (pass with -S)"));
96 assert_opt(ca_opt(
'c',
"config",
".FILE", &config_file,
97 "selects a configuration file (default: view.conf)"));
98 assert_opt(ca_opt(
'm',
"method",
".METHOD", &method,
"selects an ICP method"));
99 assert_opt(basic_mode = ca_long_opt(
"basic-mode",
"", NULL,
"uses a ligher gui background"));
100 assert_opt(enable_log = ca_opt(
'l',
"log",
"", NULL,
"enables debug logging"));
101 assert_opt(ca_opt(
'h',
"help",
"<h", NULL,
"prints this info"));
102 assert_opt(ca_opt(
'v',
"version",
"<v", NULL,
"prints version info"));
107 }
else if (ca_parse(NULL) != 0) {
111 Log.is_enabled = *enable_log;
119 if (!icp_opt.has_value()) {
120 std::cerr <<
"error: unknown ICP method '" << method <<
"'. expected one of:\n";
122 std::cerr <<
"* " << registered_method <<
'\n';
127 std::unique_ptr<icp::ICP>
icp = std::move(icp_opt.value());
142 if (*read_scan_files) {
143 LidarScan source = parse_lidar_scan(f_src);
144 LidarScan destination = parse_lidar_scan(f_dst);
147 config.
set(
"overlap_rate", 0.9);
150 launch_gui(view, std::string(f_src) + std::string(
" and ") + std::string(f_dst));
void set(std::string key, T value)
Associates key with an integer, double, or string value.
static std::optional< std::unique_ptr< ICP > > from_method(std::string name, const Config ¶ms=Config())
Factory constructor for the ICP method name with configuration config.
int main(int argc, const char **argv)
void assert_opt(bool *opt_result)
void launch_gui(LidarView *view, std::string visualized="LiDAR scans")
void set_config_param(const char *var, const char *data, void *user_data)
void parse_config(const char *path)