From 20a4fd176bcf01c6eec6279b95240606c17a8f90 Mon Sep 17 00:00:00 2001
From: mederic_fourmy <mederic.fourmy@gmail.com>
Date: Tue, 7 May 2019 14:38:40 +0200
Subject: [PATCH] Adapted apriltag processor gtest to apriltag 3 families +
 minor yaml inconsistencies

---
 src/examples/processor_imu.yaml               |  1 +
 src/examples/processor_imu_no_vote.yaml       |  1 +
 src/examples/processor_imu_t1.yaml            |  1 +
 src/examples/processor_imu_t6.yaml            |  1 +
 ...st_processor_tracker_landmark_apriltag.cpp | 35 +++++++++++++++----
 5 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/src/examples/processor_imu.yaml b/src/examples/processor_imu.yaml
index 9d3d4fb80..8e8a6c8cd 100644
--- a/src/examples/processor_imu.yaml
+++ b/src/examples/processor_imu.yaml
@@ -1,6 +1,7 @@
 processor type: "IMU"              # This must match the KEY used in the SensorFactory. Otherwise it is an error.
 processor name: "Main imu"        # This is ignored. The name provided to the SensorFactory prevails
 unmeasured perturbation std: 0.00001
+time tolerance: 0.0025         # Time tolerance for joining KFs
 keyframe vote:
     max time span:      2.0   # seconds
     max buffer length:  20000    # motion deltas
diff --git a/src/examples/processor_imu_no_vote.yaml b/src/examples/processor_imu_no_vote.yaml
index 4a1dd140e..678867b71 100644
--- a/src/examples/processor_imu_no_vote.yaml
+++ b/src/examples/processor_imu_no_vote.yaml
@@ -1,5 +1,6 @@
 processor type: "IMU"              # This must match the KEY used in the SensorFactory. Otherwise it is an error.
 processor name: "Main imu"        # This is ignored. The name provided to the SensorFactory prevails
+time tolerance: 0.0025         # Time tolerance for joining KFs
 unmeasured perturbation std: 0.00001
 keyframe vote:
     max time span:      999999.0   # seconds
diff --git a/src/examples/processor_imu_t1.yaml b/src/examples/processor_imu_t1.yaml
index e290b5ac4..b68740d24 100644
--- a/src/examples/processor_imu_t1.yaml
+++ b/src/examples/processor_imu_t1.yaml
@@ -1,6 +1,7 @@
 processor type: "IMU"              # This must match the KEY used in the SensorFactory. Otherwise it is an error.
 processor name: "Main imu"        # This is ignored. The name provided to the SensorFactory prevails
 unmeasured perturbation std: 0.00001
+time tolerance: 0.0025         # Time tolerance for joining KFs
 keyframe vote:
     max time span:      0.9999   # seconds
     max buffer length:  10000    # motion deltas
diff --git a/src/examples/processor_imu_t6.yaml b/src/examples/processor_imu_t6.yaml
index b864e9859..511a917c7 100644
--- a/src/examples/processor_imu_t6.yaml
+++ b/src/examples/processor_imu_t6.yaml
@@ -1,6 +1,7 @@
 processor type: "IMU"              # This must match the KEY used in the SensorFactory. Otherwise it is an error.
 processor name: "Main imu"        # This is ignored. The name provided to the SensorFactory prevails
 unmeasured perturbation std: 0.00001
+time tolerance: 0.0025         # Time tolerance for joining KFs
 keyframe vote:
     max time span:      5.9999   # seconds
     max buffer length:  10000    # motion deltas
diff --git a/test/gtest_processor_tracker_landmark_apriltag.cpp b/test/gtest_processor_tracker_landmark_apriltag.cpp
index e3cd1cfb0..f3b3e1607 100644
--- a/test/gtest_processor_tracker_landmark_apriltag.cpp
+++ b/test/gtest_processor_tracker_landmark_apriltag.cpp
@@ -126,26 +126,47 @@ TEST(ProcessorTrackerLandmarkApriltag, Constructor)
     std::string s2;
 
     ProcessorParamsTrackerLandmarkApriltagPtr params = std::make_shared<ProcessorParamsTrackerLandmarkApriltag>();
-    params->tag_family_ = "tag36h11";
-    ProcessorTrackerLandmarkApriltagPtr p = std::make_shared<ProcessorTrackerLandmarkApriltag>(params);
+
+    ProcessorTrackerLandmarkApriltagPtr p;
+
+    params->tag_family_ = "tag16h5";
+    p = std::make_shared<ProcessorTrackerLandmarkApriltag>(params);
     ASSERT_TRUE(p->getTagFamily() == params->tag_family_);
 
-    params->tag_family_ = "tag36h10";
+    params->tag_family_ = "tag25h9";
     p = std::make_shared<ProcessorTrackerLandmarkApriltag>(params);
     ASSERT_TRUE(p->getTagFamily() == params->tag_family_);
 
-    params->tag_family_ = "tag36artoolkit";
+    params->tag_family_ = "tag36h11";
     p = std::make_shared<ProcessorTrackerLandmarkApriltag>(params);
-    ASSERT_TRUE(p->getTagFamily() == "artoolkit"); // This tagfamily is stored differently by apriltag library
+    ASSERT_TRUE(p->getTagFamily() == params->tag_family_);
 
-    params->tag_family_ = "tag25h9";
+    params->tag_family_ = "tagCircle21h7";
     p = std::make_shared<ProcessorTrackerLandmarkApriltag>(params);
     ASSERT_TRUE(p->getTagFamily() == params->tag_family_);
 
-    params->tag_family_ = "tag25h7";
+    params->tag_family_ = "tagStandard41h12";
     p = std::make_shared<ProcessorTrackerLandmarkApriltag>(params);
     ASSERT_TRUE(p->getTagFamily() == params->tag_family_);
 
+    // ! At the time of this test rewriting, Apriltag3 bugs on the creation of the 
+    // subsequent family's detector 
+
+    // NOPE
+    // params->tag_family_ = "tagCircle49h12";
+    // p = std::make_shared<ProcessorTrackerLandmarkApriltag>(params);
+    // ASSERT_TRUE(p->getTagFamily() == params->tag_family_);
+
+    // NOPE
+    // params->tag_family_ = "tagCustom48h12";
+    // p = std::make_shared<ProcessorTrackerLandmarkApriltag>(params);
+    // ASSERT_TRUE(p->getTagFamily() == params->tag_family_);
+
+    // NOPE
+    // params->tag_family_ = "tagStandard52h13";
+    // p = std::make_shared<ProcessorTrackerLandmarkApriltag>(params);
+    // ASSERT_TRUE(p->getTagFamily() == params->tag_family_);
+
     params->tag_family_ = "wrong_family";
     WOLF_INFO("The following runtime error \"Unrecognized tag family name. Use e.g. \"tag36h11\".\" is expected and does not imply a failed test:");
     ASSERT_DEATH( { std::make_shared<ProcessorTrackerLandmarkApriltag>(params); }, "" );
-- 
GitLab