From e55c847d6be5d696fd9c18b8e1e3f59a2f692b62 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joan=20Sol=C3=A0?= <jsola@iri.upc.edu>
Date: Sat, 18 Jun 2022 12:49:10 +0200
Subject: [PATCH] bootstrap length in seconds

---
 demos/processor_imu.yaml              | 2 +-
 include/imu/processor/processor_imu.h | 6 +++---
 src/yaml/processor_imu_yaml.cpp       | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/demos/processor_imu.yaml b/demos/processor_imu.yaml
index 0e9c8d10e..d8400410e 100644
--- a/demos/processor_imu.yaml
+++ b/demos/processor_imu.yaml
@@ -13,4 +13,4 @@ keyframe_vote:
 bootstrap:
     enable: true 
     method: "G"
-    averaging_length: 10
\ No newline at end of file
+    averaging_length: 0.25 # seconds
\ No newline at end of file
diff --git a/include/imu/processor/processor_imu.h b/include/imu/processor/processor_imu.h
index 55d5a24d4..e7b6b9549 100644
--- a/include/imu/processor/processor_imu.h
+++ b/include/imu/processor/processor_imu.h
@@ -39,7 +39,7 @@ struct ParamsProcessorImu : public ParamsProcessorMotion
         BOOTSTRAP_G,
         BOOTSTRAP_V0_G
     } bootstrap_method;
-    int bootstrap_averaging_length;
+    double bootstrap_averaging_length;
 
     ParamsProcessorImu() = default;
     ParamsProcessorImu(std::string _unique_name, const ParamsServer& _server):
@@ -54,13 +54,13 @@ struct ParamsProcessorImu : public ParamsProcessorMotion
             {
                 bootstrap_method = BOOTSTRAP_STATIC;
                 bootstrap_averaging_length =
-                    _server.getParam<int>(prefix + _unique_name + "/bootstrap/averaging_length");
+                    _server.getParam<double>(prefix + _unique_name + "/bootstrap/averaging_length");
             }
             if (str == "G" /*     */)
             {
                 bootstrap_method = BOOTSTRAP_G;
                 bootstrap_averaging_length =
-                    _server.getParam<int>(prefix + _unique_name + "/bootstrap/averaging_length");
+                    _server.getParam<double>(prefix + _unique_name + "/bootstrap/averaging_length");
             }
             if (str == "V0_G" /*  */)
             {
diff --git a/src/yaml/processor_imu_yaml.cpp b/src/yaml/processor_imu_yaml.cpp
index ff2b02eaf..53bc6918d 100644
--- a/src/yaml/processor_imu_yaml.cpp
+++ b/src/yaml/processor_imu_yaml.cpp
@@ -74,7 +74,7 @@ static ParamsProcessorBasePtr createProcessorImuParams(const std::string & _file
             if (str == "G" /*     */)
             {
                 params->bootstrap_method           = ParamsProcessorImu::BootstrapMethod::BOOTSTRAP_G;
-                params->bootstrap_averaging_length = bootstrap["averaging_length"].as<int>();
+                params->bootstrap_averaging_length = bootstrap["averaging_length"].as<double>();
             }
             if (str == "V0_G" /*  */)
             {
-- 
GitLab