From fcfc48ba753c5e7ee1f6af21f725eb060c3d02cd Mon Sep 17 00:00:00 2001
From: armar-user <armar6@kit>
Date: Wed, 10 Nov 2021 15:19:40 +0100
Subject: [PATCH] RobotStateComponent: logging

---
 .../RobotState/RobotStateComponent.cpp        | 23 ++++++++++---------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/source/RobotAPI/components/RobotState/RobotStateComponent.cpp b/source/RobotAPI/components/RobotState/RobotStateComponent.cpp
index 94b1deab9..374fae4c4 100644
--- a/source/RobotAPI/components/RobotState/RobotStateComponent.cpp
+++ b/source/RobotAPI/components/RobotState/RobotStateComponent.cpp
@@ -538,23 +538,24 @@ namespace armarx
         const IceUtil::Time newestTimeInHistory = jointHistory.rbegin()->first;
         if (time > newestTimeInHistory)
         {
-            IceUtil::Time maxOffset = IceUtil::Time::seconds(2);
-            if (time <= newestTimeInHistory + maxOffset)
-            {
-                ARMARX_INFO << deactivateSpam(5)
-                            << "Requested joint timestamp is newer than newest available timestamp!"
-                            << "\n- requested timestamp: \t" << time.toDateTime()
-                            << "\n- newest timestamp:    \t" << newestTimeInHistory.toDateTime()
-                            << "\n- difference:          \t" << (time - newestTimeInHistory).toMicroSeconds() << " us";
-            }
-            else
+            const IceUtil::Time minOffset = IceUtil::Time::milliSeconds(25);
+            const IceUtil::Time maxOffset = IceUtil::Time::seconds(2);
+            if (time > newestTimeInHistory + maxOffset)
             {
-                ARMARX_WARNING << deactivateSpam(1) << "Requested joint timestamp is substantially newer (>"
+                ARMARX_WARNING << deactivateSpam(5) << "Requested joint timestamp is substantially newer (>"
                                << maxOffset.toSecondsDouble() << " sec) than newest available timestamp!"
                                << "\n- requested timestamp: \t" << time.toDateTime()
                                << "\n- newest timestamp:    \t" << newestTimeInHistory.toDateTime();
                 return std::nullopt;
             }
+            else if (time > newestTimeInHistory + minOffset)
+            {
+                ARMARX_INFO << deactivateSpam(10)
+                            << "Requested joint timestamp is newer than newest available timestamp!"
+                            << "\n- requested timestamp: \t" << time.toDateTime()
+                            << "\n- newest timestamp:    \t" << newestTimeInHistory.toDateTime()
+                            << "\n- difference:          \t" << (time - newestTimeInHistory).toMicroSeconds() << " us";
+            }
 
             return Timestamped<NameValueMap> {jointHistory.rbegin()->first, jointHistory.rbegin()->second};
         }
-- 
GitLab