[PATCH 1/1] Possible way to solve a too often occurring exception in getPeriodInternal.
Raul Dominguez
Raul.Dominguez at dfki.de
Tue Apr 15 11:28:25 CEST 2014
---
src/TimestampEstimator.cpp | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/TimestampEstimator.cpp b/src/TimestampEstimator.cpp
index b74167f..a1d733a 100644
--- a/src/TimestampEstimator.cpp
+++ b/src/TimestampEstimator.cpp
@@ -135,7 +135,18 @@ double TimestampEstimator::getPeriodInternal() const
latest_it++, count--)
{}
if (count <= 1)
- throw std::logic_error("getPeriodInternal() called with no initial period and less than 2 valid samples");
+ {
+ // I'm not sure how m_got_full_window is computed.
+ // if m_got_full_window is false
+ // and m_initial_period is not false
+ // and for some reason count is <= 1
+ // then I do not need to throw a error I can just
+ // deliver the m_initial_period
+ if (m_initial_period)
+ return m_initial_period;
+ else
+ throw std::logic_error("getPeriodInternal() called with no initial period and less than 2 valid samples");
+ }
double latest = *latest_it;
// m_samples.front() is valid as shortenSampleList makes sure that it is
--
1.7.9.5
--------------050306030804080206080104--
More information about the Rock-dev
mailing list