From f72da6763697d0ed9152c8807c53831386ca2dd8 Mon Sep 17 00:00:00 2001
From: Adrian Knobloch <adrian.knobloch@student.kit.edu>
Date: Tue, 3 Jan 2017 16:33:56 +0000
Subject: [PATCH] Change to show error if the current value remains static over
 a period of time

Previously the error only appears if the current value remains zero over a period of time.
---
 .../KinematicUnitPlugin/KinematicUnitGuiPlugin.cpp        | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/source/RobotAPI/gui-plugins/KinematicUnitPlugin/KinematicUnitGuiPlugin.cpp b/source/RobotAPI/gui-plugins/KinematicUnitPlugin/KinematicUnitGuiPlugin.cpp
index 9c4617560..53a516e7b 100644
--- a/source/RobotAPI/gui-plugins/KinematicUnitPlugin/KinematicUnitGuiPlugin.cpp
+++ b/source/RobotAPI/gui-plugins/KinematicUnitPlugin/KinematicUnitGuiPlugin.cpp
@@ -1277,7 +1277,7 @@ void KinematicUnitWidgetController::highlightCriticalValues()
     // check robot current value of nodes
     for (unsigned int i = 0; i < rn.size(); i++)
     {
-        bool isZero = true;
+        bool isStatic = true;
         float smoothedValue = 0;
 
         for (auto historyIt = jointCurrentHistory.begin(); historyIt != jointCurrentHistory.end(); historyIt++)
@@ -1294,9 +1294,9 @@ void KinematicUnitWidgetController::highlightCriticalValues()
 
             smoothedValue = 0.5f * currentValue + 0.5f * smoothedValue;
 
-            if (currentValue != 0)
+            if (currentValue != jointCurrentHistory.begin()->second.find(rn[i]->getName())->second)
             {
-                isZero = false;
+                isStatic = false;
             }
         }
 
@@ -1304,7 +1304,7 @@ void KinematicUnitWidgetController::highlightCriticalValues()
         it = reportedJointStatuses.find(rn[i]->getName());
         JointStatus currentStatus = it->second;
 
-        if (isZero)
+        if (isStatic)
         {
             if (currentStatus.operation != eOffline)
             {
-- 
GitLab