Hello,
An exception prompts quite often for our Hokuyo laser component
(controlled though ethernet).
The exception comes from the Aggregator. I think that the attached patch
should help to avoid this.
The solution is to return the initial period in /getPeriodInternal/ when
the period is not computable from the last samples and is not given.
What do you think?
Best regards,
Raúl
--
Raúl Domínguez (M.Sc.)
Space Robotics
Universität Bremen
FB 3 - Mathematik und Informatik
AG Robotik
Robert-Hooke-Straße 1
28359 Bremen, Germany
Zentrale: +49 421 178 45-6611
Besuchsadresse der Nebengeschäftstelle:
Robert-Hooke-Straße 5
28359 Bremen, Germany
Tel.: +49 421 178 45-6617
Empfang: +49 421 178 45-6600
Fax: +49 421 178 45-4150
E-Mail: [email protected]
Weitere Informationen: http://www.informatik.uni-bremen.de/robotik
>From 603c23fcbd877d071a595e0c17647be3babed068 Mon Sep 17 00:00:00 2001
From: Raul Dominguez <[email protected]>
Date: Tue, 15 Apr 2014 11:28:25 +0200
Subject: [PATCH 1/1] Possible way to solve a too often occurring exception in
getPeriodInternal.
---
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
_______________________________________________
Rock-dev mailing list
[email protected]
http://www.dfki.de/mailman/cgi-bin/listinfo/rock-dev