From 46db7efd4c2c6b67f84bfb88e97297bcac77420f Mon Sep 17 00:00:00 2001
From: Christoph Pohl <christoph.pohl@kit.edu>
Date: Tue, 12 Dec 2023 12:50:23 +0100
Subject: [PATCH] Fix inconsistent timestamps in RobotStateComponent

---
 .../RobotAPI/components/RobotState/RobotStateComponent.cpp  | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/source/RobotAPI/components/RobotState/RobotStateComponent.cpp b/source/RobotAPI/components/RobotState/RobotStateComponent.cpp
index a17005e6d..d646b7ae3 100644
--- a/source/RobotAPI/components/RobotState/RobotStateComponent.cpp
+++ b/source/RobotAPI/components/RobotState/RobotStateComponent.cpp
@@ -37,6 +37,8 @@
 #include <ArmarXCore/core/rapidxml/wrapper/RapidXmlReader.h>
 #include <ArmarXCore/core/system/ArmarXDataPath.h>
 #include <ArmarXCore/core/time/TimeUtil.h>
+#include <RobotAPI/components/units/RobotUnit/util/RtTiming.h>
+#include <RobotAPI/components/units/RobotUnit/util/NonRtTiming.h>
 
 
 using namespace Eigen;
@@ -296,10 +298,10 @@ namespace armarx
     {
         if (timestamp <= 0)
         {
-            timestamp = IceUtil::Time::now().toMicroSeconds();
+            timestamp = armarx::rtNow().toMicroSeconds();
         }
 
-        IceUtil::Time time = IceUtil::Time::microSeconds(timestamp);
+        IceUtil::Time time = mapRtTimestampToNonRtTimestamp(IceUtil::Time::microSeconds(timestamp));
 
         ARMARX_DEBUG << deactivateSpam(1) << "Got new jointangles: " << jointAngles
                      << " from timestamp " << time.toDateTime()
-- 
GitLab