From b8f4239933b1ff48239b088d764e3e6aa1f92485 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joan=20Sol=C3=A0?= <jsola@iri.upc.edu> Date: Fri, 17 Jun 2022 10:56:48 +0200 Subject: [PATCH] Add bootstrap params to PrcImuYaml creator --- src/yaml/processor_imu_yaml.cpp | 35 +++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/src/yaml/processor_imu_yaml.cpp b/src/yaml/processor_imu_yaml.cpp index 199f59af4..ff2b02eaf 100644 --- a/src/yaml/processor_imu_yaml.cpp +++ b/src/yaml/processor_imu_yaml.cpp @@ -48,17 +48,40 @@ static ParamsProcessorBasePtr createProcessorImuParams(const std::string & _file if (config["type"].as<std::string>() == "ProcessorImu") { - YAML::Node kf_vote = config["keyframe_vote"]; ParamsProcessorImuPtr params = std::make_shared<ParamsProcessorImu>(); params->time_tolerance = config["time_tolerance"] .as<double>(); params->unmeasured_perturbation_std = config["unmeasured_perturbation_std"].as<double>(); - params->max_time_span = kf_vote["max_time_span"] .as<double>(); - params->max_buff_length = kf_vote["max_buff_length"] .as<SizeEigen>(); - params->dist_traveled = kf_vote["dist_traveled"] .as<double>(); - params->angle_turned = kf_vote["angle_turned"] .as<double>(); - params->voting_active = kf_vote["voting_active"] .as<bool>(); + YAML::Node kf_vote = config["keyframe_vote"]; + params->max_time_span = kf_vote["max_time_span"].as<double>(); + params->max_buff_length = kf_vote["max_buff_length"].as<SizeEigen>(); + params->dist_traveled = kf_vote["dist_traveled"].as<double>(); + params->angle_turned = kf_vote["angle_turned"].as<double>(); + params->voting_active = kf_vote["voting_active"].as<bool>(); + + YAML::Node bootstrap = config["bootstrap"]; + params->bootstrap_enable = bootstrap["enable"].as<bool>(); + if (params->bootstrap_enable) + { + string str = bootstrap["method"].as<string>(); + std::transform(str.begin(), str.end(), str.begin(), ::toupper); + if (str == "STATIC" /**/) + { + params->bootstrap_method = ParamsProcessorImu::BootstrapMethod::BOOTSTRAP_STATIC; + params->bootstrap_averaging_length = bootstrap["averaging_length"].as<int>(); + } + if (str == "G" /* */) + { + params->bootstrap_method = ParamsProcessorImu::BootstrapMethod::BOOTSTRAP_G; + params->bootstrap_averaging_length = bootstrap["averaging_length"].as<int>(); + } + if (str == "V0_G" /* */) + { + params->bootstrap_method = ParamsProcessorImu::BootstrapMethod::BOOTSTRAP_V0_G; + } + } + return params; } -- GitLab