From 6200c4b8b046107ebf1d06e02c2836fa408bd32a Mon Sep 17 00:00:00 2001
From: joanvallve <jvallve@iri.upc.edu>
Date: Mon, 29 Mar 2021 09:26:28 +0200
Subject: [PATCH] added asserts (strange bug in mergeCaptures)

---
 src/processor/processor_imu.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/processor/processor_imu.cpp b/src/processor/processor_imu.cpp
index 4b9009461..f1b7ffbf2 100644
--- a/src/processor/processor_imu.cpp
+++ b/src/processor/processor_imu.cpp
@@ -102,6 +102,11 @@ void ProcessorImu::setCalibration (const CaptureBasePtr _capture, const VectorXd
 
 FactorBasePtr ProcessorImu::emplaceFactor(FeatureBasePtr _feature_motion, CaptureBasePtr _capture_origin)
 {
+    assert(_capture_origin != nullptr && _capture_origin->getType() == "CaptureImu" && "ProcessorImu::emplaceFactor: capture is null or not of type CaptureImu");
+    assert(_feature_motion != nullptr && _feature_motion->getType() == "FeatureImu" && "ProcessorImu::emplaceFactor: feature is null or not of type FeatureImu");
+    assert(_capture_origin->getFrame() && "ProcessorImu::emplaceFactor: capture not linked to a frame");
+    assert(_feature_motion->getCapture() and _feature_motion->getCapture()->getFrame() && "ProcessorImu::emplaceFactor: feature not linked to a capture or a frame");
+
     CaptureImuPtr cap_imu = std::static_pointer_cast<CaptureImu>(_capture_origin);
     FeatureImuPtr ftr_imu = std::static_pointer_cast<FeatureImu>(_feature_motion);
 
-- 
GitLab