From 9c5f5f33942b47f5da98a2772a8461c584e04342 Mon Sep 17 00:00:00 2001 From: Vladyslav Usenko Date: Wed, 10 Jul 2019 11:58:11 +0200 Subject: [PATCH] fix test --- include/basalt/optimization/spline_optimize.h | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/include/basalt/optimization/spline_optimize.h b/include/basalt/optimization/spline_optimize.h index e42e7ca..6d4614e 100644 --- a/include/basalt/optimization/spline_optimize.h +++ b/include/basalt/optimization/spline_optimize.h @@ -302,12 +302,14 @@ class SplineOptimization { // std::cout << "spline.minTimeNs() " << spline.minTimeNs() << std::endl; // std::cout << "spline.maxTimeNs() " << spline.maxTimeNs() << std::endl; - while (mocap_measurements.front().timestamp_ns <= - spline.minTimeNs() + spline.getDtNs()) + while (!mocap_measurements.empty() && + mocap_measurements.front().timestamp_ns <= + spline.minTimeNs() + spline.getDtNs()) mocap_measurements.pop_front(); - while (mocap_measurements.back().timestamp_ns >= - spline.maxTimeNs() - spline.getDtNs()) + while (!mocap_measurements.empty() && + mocap_measurements.back().timestamp_ns >= + spline.maxTimeNs() - spline.getDtNs()) mocap_measurements.pop_back(); ccd.calibration = calib.get();