From cf1264eec4538091098ebab5e7e16d4d9f9da9a1 Mon Sep 17 00:00:00 2001
From: Eren Aksoy <eren.aksoy@kit.edu>
Date: Wed, 9 Mar 2016 09:40:30 +0100
Subject: [PATCH] RobotStateComponentName is added as an optional property..It
 was hard coded

---
 source/RobotAPI/components/units/ForceTorqueObserver.cpp | 6 +++---
 source/RobotAPI/components/units/ForceTorqueObserver.h   | 2 ++
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/source/RobotAPI/components/units/ForceTorqueObserver.cpp b/source/RobotAPI/components/units/ForceTorqueObserver.cpp
index 756b00b15..5118f2a2e 100644
--- a/source/RobotAPI/components/units/ForceTorqueObserver.cpp
+++ b/source/RobotAPI/components/units/ForceTorqueObserver.cpp
@@ -76,13 +76,13 @@ void ForceTorqueObserver::onInitObserver()
     offerConditionCheck("magnitudelarger", new ConditionCheckMagnitudeLarger());
     offerConditionCheck("magnitudesmaller", new ConditionCheckMagnitudeSmaller());
 
-    usingProxy("RobotStateComponent");
+    usingProxy(getProperty<std::string>("RobotStateComponentName").getValue());
     offeringTopic("DebugDrawerUpdates");
 }
 
 void ForceTorqueObserver::onConnectObserver()
 {
-
+    robot = getProxy<RobotStateComponentInterfacePrx>(getProperty<std::string>("RobotStateComponentName").getValue());
     debugDrawer = getTopic<DebugDrawerInterfacePrx>("DebugDrawerUpdates");
     if (getProperty<bool>("VisualizeForce").getValue())
     {
@@ -125,7 +125,7 @@ void ForceTorqueObserver::visualizerFunction()
         float forceFactor = getProperty<float>("ForceVisualizerFactor").getValue();
         RemoteRobot::synchronizeLocalClone(localRobot, robot);
         auto channels = getAvailableChannels(false);
-        for (auto& channel : channels)
+        for (auto & channel : channels)
         {
             if (localRobot->hasRobotNode(channel.first))
             {
diff --git a/source/RobotAPI/components/units/ForceTorqueObserver.h b/source/RobotAPI/components/units/ForceTorqueObserver.h
index 8cf255be2..6e17f88e8 100644
--- a/source/RobotAPI/components/units/ForceTorqueObserver.h
+++ b/source/RobotAPI/components/units/ForceTorqueObserver.h
@@ -46,6 +46,8 @@ namespace armarx
             defineOptionalProperty<int>("VisualizeForceUpdateFrequency", 20, "Frequency with which the force is visualized");
             defineOptionalProperty<float>("ForceVisualizerFactor", 0.01, "Factor by which the forces are scaled to fit into 0..1 (only for visulization) ");
             defineOptionalProperty<float>("MaxForceArrowLength", 150, "Length of the force visu arrow in mm");
+            defineOptionalProperty<std::string>("RobotStateComponentName", "RobotStateComponent", "Name of the RobotStateComponent that should be used");
+
         }
     };
 
-- 
GitLab