From 332fb067c07e4575442757c807047061fa9cdad8 Mon Sep 17 00:00:00 2001
From: Peter Kaiser <peter.kaiser@kit.edu>
Date: Sun, 7 Feb 2016 21:31:37 +0100
Subject: [PATCH] HeadIK: Make head target visualization optional

---
 source/RobotAPI/components/units/HeadIKUnit.cpp | 4 ++--
 source/RobotAPI/components/units/HeadIKUnit.h   | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/source/RobotAPI/components/units/HeadIKUnit.cpp b/source/RobotAPI/components/units/HeadIKUnit.cpp
index 46dcd0ab5..c7ccaca52 100644
--- a/source/RobotAPI/components/units/HeadIKUnit.cpp
+++ b/source/RobotAPI/components/units/HeadIKUnit.cpp
@@ -121,7 +121,7 @@ namespace armarx
         this->targetPosition->frame = targetPosition->frame;
         FramedPositionPtr globalTarget = FramedPositionPtr::dynamicCast(targetPosition)->toGlobal(robotStateComponentPrx->getSynchronizedRobot());
 
-        if (drawer)
+        if (drawer && getProperty<bool>("VisualizeIKTarget").getValue())
         {
             drawer->setSphereDebugLayerVisu("HeadViewTarget",
                                             globalTarget,
@@ -295,7 +295,7 @@ namespace armarx
 
             ARMARX_DEBUG << "Solution found";
 
-            if (drawer && localRobot->hasRobotNode("Cameras"))
+            if (drawer && localRobot->hasRobotNode("Cameras") && getProperty<bool>("VisualizeIKTarget").getValue())
             {
                 Vector3Ptr startPos = new Vector3(localRobot->getRobotNode("Cameras")->getGlobalPose());
                 drawer->setSphereDebugLayerVisu("HeadViewTargetSolution",
diff --git a/source/RobotAPI/components/units/HeadIKUnit.h b/source/RobotAPI/components/units/HeadIKUnit.h
index 6deff5a7a..f76b57c7d 100644
--- a/source/RobotAPI/components/units/HeadIKUnit.h
+++ b/source/RobotAPI/components/units/HeadIKUnit.h
@@ -50,6 +50,7 @@ namespace armarx
             defineOptionalProperty<std::string>("RobotStateTopicName", "RobotState", "Name of the RobotComponent State topic.");
             defineOptionalProperty<std::string>("HeadIKUnitTopicName", "HeadIKUnitTopic",  "Name of the HeadIKUnit Topic");
             defineOptionalProperty<std::string>("RobotStateComponentName", "RobotStateComponent", "Name of the RobotStateComponent that should be used");
+            defineOptionalProperty<bool>("VisualizeIKTarget", true, "Visualize the current IK target using the debug drawer");
             defineOptionalProperty<int>("CycleTime", 30, "Cycle time of the tcp control in ms");
         }
     };
-- 
GitLab