From f3558f0aef511a8c5bca6795340fce0a24ab904f Mon Sep 17 00:00:00 2001
From: Mirko Waechter <mirko.waechter@kit.edu>
Date: Fri, 29 Aug 2014 14:39:59 +0200
Subject: [PATCH] Fixed Virtual Robot includes

---
 .../RobotAPI/applications/HeadIKUnit/CMakeLists.txt |  6 ++++++
 .../KinematicUnitSimulation/CMakeLists.txt          |  6 ++++++
 .../applications/MovePlatform/CMakeLists.txt        |  6 ++++++
 .../MovePlatformToLandmark/CMakeLists.txt           |  6 ++++++
 .../applications/TCPControlUnit/CMakeLists.txt      |  6 ++++++
 .../applications/TCPMoverUnit/CMakeLists.txt        |  6 ++++++
 source/RobotAPI/core/CMakeLists.txt                 |  2 +-
 source/RobotAPI/robotstate/RobotStateComponent.cpp  |  1 +
 source/RobotAPI/robotstate/SharedRobotServants.cpp  |  4 ++++
 source/RobotAPI/robotstate/SharedRobotServants.h    | 13 +++++++++----
 source/RobotAPI/robotstate/remote/CMakeLists.txt    |  3 ++-
 .../robotstate/remote/RobotStateObserver.cpp        |  1 +
 .../RobotAPI/robotstate/remote/RobotStateObserver.h | 11 ++++++++---
 13 files changed, 62 insertions(+), 9 deletions(-)

diff --git a/source/RobotAPI/applications/HeadIKUnit/CMakeLists.txt b/source/RobotAPI/applications/HeadIKUnit/CMakeLists.txt
index 2062804a3..7def4d89f 100644
--- a/source/RobotAPI/applications/HeadIKUnit/CMakeLists.txt
+++ b/source/RobotAPI/applications/HeadIKUnit/CMakeLists.txt
@@ -9,6 +9,12 @@ if (Eigen3_FOUND)
         ${Eigen3_INCLUDE_DIR})
 endif()
 
+if (NOT Simox_FOUND)
+    find_package(Simox 2.3.0 QUIET)
+endif()
+armarx_build_if(Simox_FOUND "Simox-VirtualRobot not available")
+include_directories(${Simox_INCLUDE_DIRS})
+
 set(COMPONENT_LIBS RobotAPIUnits)
 
 set(SOURCES main.cpp HeadIKUnitApp.h)
diff --git a/source/RobotAPI/applications/KinematicUnitSimulation/CMakeLists.txt b/source/RobotAPI/applications/KinematicUnitSimulation/CMakeLists.txt
index 11b478b49..4c74a3e44 100644
--- a/source/RobotAPI/applications/KinematicUnitSimulation/CMakeLists.txt
+++ b/source/RobotAPI/applications/KinematicUnitSimulation/CMakeLists.txt
@@ -8,6 +8,12 @@ if (Eigen3_FOUND)
     include_directories(${Eigen3_INCLUDE_DIR})
 endif()
 
+if (NOT Simox_FOUND)
+    find_package(Simox 2.3.0 QUIET)
+endif()
+armarx_build_if(Simox_FOUND "Simox-VirtualRobot not available")
+include_directories(${Simox_INCLUDE_DIRS})
+
 set(COMPONENT_LIBS RobotAPIUnits)
 
 set(SOURCES main.cpp KinematicUnitSimulationApp.h)
diff --git a/source/RobotAPI/applications/MovePlatform/CMakeLists.txt b/source/RobotAPI/applications/MovePlatform/CMakeLists.txt
index 62f9f4c1b..9c9c63e79 100644
--- a/source/RobotAPI/applications/MovePlatform/CMakeLists.txt
+++ b/source/RobotAPI/applications/MovePlatform/CMakeLists.txt
@@ -8,6 +8,12 @@ armarx_build_if(Eigen3_FOUND "Eigen3 not available")
 
 include_directories(${Eigen3_INCLUDE_DIR})
 
+if (NOT Simox_FOUND)
+    find_package(Simox 2.3.0 QUIET)
+endif()
+armarx_build_if(Simox_FOUND "Simox-VirtualRobot not available")
+include_directories(${Simox_INCLUDE_DIRS})
+
 set(COMPONENT_LIBS MovePlatform)
 
 set(SOURCES main.cpp
diff --git a/source/RobotAPI/applications/MovePlatformToLandmark/CMakeLists.txt b/source/RobotAPI/applications/MovePlatformToLandmark/CMakeLists.txt
index a8d0c65af..a368cd102 100644
--- a/source/RobotAPI/applications/MovePlatformToLandmark/CMakeLists.txt
+++ b/source/RobotAPI/applications/MovePlatformToLandmark/CMakeLists.txt
@@ -8,6 +8,12 @@ armarx_build_if(Eigen3_FOUND "Eigen3 not available")
 
 include_directories(${Eigen3_INCLUDE_DIR})
 
+if (NOT Simox_FOUND)
+    find_package(Simox 2.3.0 QUIET)
+endif()
+armarx_build_if(Simox_FOUND "Simox-VirtualRobot not available")
+include_directories(${Simox_INCLUDE_DIRS})
+
 set(COMPONENT_LIBS MovePlatformToLandmark)
 
 set(SOURCES main.cpp
diff --git a/source/RobotAPI/applications/TCPControlUnit/CMakeLists.txt b/source/RobotAPI/applications/TCPControlUnit/CMakeLists.txt
index fe203c509..9f18a5c81 100644
--- a/source/RobotAPI/applications/TCPControlUnit/CMakeLists.txt
+++ b/source/RobotAPI/applications/TCPControlUnit/CMakeLists.txt
@@ -9,6 +9,12 @@ if (Eigen3_FOUND)
         ${Eigen3_INCLUDE_DIR})
 endif()
 
+if (NOT Simox_FOUND)
+    find_package(Simox 2.3.0 QUIET)
+endif()
+armarx_build_if(Simox_FOUND "Simox-VirtualRobot not available")
+include_directories(${Simox_INCLUDE_DIRS})
+
 set(COMPONENT_LIBS RobotAPIUnits)
 
 set(SOURCES main.cpp TCPControlUnitApp.h)
diff --git a/source/RobotAPI/applications/TCPMoverUnit/CMakeLists.txt b/source/RobotAPI/applications/TCPMoverUnit/CMakeLists.txt
index 00b1e0807..5e2d27cc9 100644
--- a/source/RobotAPI/applications/TCPMoverUnit/CMakeLists.txt
+++ b/source/RobotAPI/applications/TCPMoverUnit/CMakeLists.txt
@@ -9,6 +9,12 @@ if (Eigen3_FOUND)
         ${Eigen3_INCLUDE_DIR})
 endif()
 
+if (NOT Simox_FOUND)
+    find_package(Simox 2.3.0 QUIET)
+endif()
+armarx_build_if(Simox_FOUND "Simox-VirtualRobot not available")
+include_directories(${Simox_INCLUDE_DIRS})
+
 set(COMPONENT_LIBS RobotAPIUnits)
 
 set(SOURCES main.cpp TCPMoverUnitApp.h)
diff --git a/source/RobotAPI/core/CMakeLists.txt b/source/RobotAPI/core/CMakeLists.txt
index 434dd7ea2..840451b97 100644
--- a/source/RobotAPI/core/CMakeLists.txt
+++ b/source/RobotAPI/core/CMakeLists.txt
@@ -17,7 +17,7 @@ set(LIB_NAME       RobotAPICore)
 set(LIB_VERSION    0.1.0)
 set(LIB_SOVERSION  0)
 
-set(LIBS RobotAPIInterfaces RobotAPIRobotStateComponent ArmarXCoreObservers ArmarXCoreStatechart ${Simox_LIBRARIES})
+set(LIBS RobotAPIInterfaces RobotAPIRobotStateComponent ArmarXCoreObservers ArmarXCoreStatechart)
 
 set(LIB_FILES
     RobotStatechartContext.cpp
diff --git a/source/RobotAPI/robotstate/RobotStateComponent.cpp b/source/RobotAPI/robotstate/RobotStateComponent.cpp
index 5726bd529..cc50f66c1 100644
--- a/source/RobotAPI/robotstate/RobotStateComponent.cpp
+++ b/source/RobotAPI/robotstate/RobotStateComponent.cpp
@@ -25,6 +25,7 @@
 #include <boost/foreach.hpp>
 #include <VirtualRobot/XML/RobotIO.h>
 #include <VirtualRobot/Nodes/RobotNode.h>
+#include <VirtualRobot/RobotNodeSet.h>
 #include <boost/format.hpp>
 #include <boost/foreach.hpp>
 #include <Core/core/system/ArmarXDataPath.h>
diff --git a/source/RobotAPI/robotstate/SharedRobotServants.cpp b/source/RobotAPI/robotstate/SharedRobotServants.cpp
index 8cfcadad2..fe78f4a15 100644
--- a/source/RobotAPI/robotstate/SharedRobotServants.cpp
+++ b/source/RobotAPI/robotstate/SharedRobotServants.cpp
@@ -10,6 +10,10 @@
 #include <VirtualRobot/Nodes/RobotNodeRevolute.h>
 #include <VirtualRobot/Nodes/RobotNodePrismatic.h>
 #include <VirtualRobot/RobotConfig.h>
+#include <VirtualRobot/VirtualRobot.h>
+#include <VirtualRobot/Robot.h>
+#include <VirtualRobot/RobotNodeSet.h>
+
 
 using namespace std;
 using namespace VirtualRobot;
diff --git a/source/RobotAPI/robotstate/SharedRobotServants.h b/source/RobotAPI/robotstate/SharedRobotServants.h
index d73756d0a..e52797cd9 100644
--- a/source/RobotAPI/robotstate/SharedRobotServants.h
+++ b/source/RobotAPI/robotstate/SharedRobotServants.h
@@ -5,14 +5,19 @@
 #include <Core/core/system/ImportExportComponent.h>
 #include <RobotAPI/robotstate/remote/ArmarPose.h>
 
-#include <VirtualRobot/VirtualRobot.h>
-#include <VirtualRobot/Robot.h>
-#include <VirtualRobot/RobotNodeSet.h>
-#include <VirtualRobot/Nodes/RobotNode.h>
+
 #include <RobotAPI/interface/robotstate/RobotState.h>
 
 #include <boost/thread.hpp>
 
+namespace VirtualRobot
+{
+    class Robot;
+    typedef boost::shared_ptr<Robot> RobotPtr;
+    class RobotNode;
+    typedef boost::shared_ptr<RobotNode> RobotNodePtr;
+}
+
 namespace armarx {
     // Zugriff muss mutex geschuetzt werden!
 
diff --git a/source/RobotAPI/robotstate/remote/CMakeLists.txt b/source/RobotAPI/robotstate/remote/CMakeLists.txt
index 5fc457af8..06d72d311 100644
--- a/source/RobotAPI/robotstate/remote/CMakeLists.txt
+++ b/source/RobotAPI/robotstate/remote/CMakeLists.txt
@@ -17,7 +17,8 @@ set(LIB_SOVERSION  0)
 
 set(LIBS ArmarXCore ArmarXCoreObservers RobotAPIInterfaces ${Simox_LIBRARIES} )
 
-set(LIB_FILES ArmarPose.cpp
+set(LIB_FILES
+            ArmarPose.cpp
             LinkedPose.cpp
             RobotStateObserver.cpp
             RemoteRobot.cpp
diff --git a/source/RobotAPI/robotstate/remote/RobotStateObserver.cpp b/source/RobotAPI/robotstate/remote/RobotStateObserver.cpp
index f7de02605..fb9d0b347 100644
--- a/source/RobotAPI/robotstate/remote/RobotStateObserver.cpp
+++ b/source/RobotAPI/robotstate/remote/RobotStateObserver.cpp
@@ -33,6 +33,7 @@
 #include <VirtualRobot/VirtualRobot.h>
 #include <VirtualRobot/RobotNodeSet.h>
 #include <VirtualRobot/Nodes/RobotNode.h>
+#include <VirtualRobot/VirtualRobot.h>
 
 
 using namespace armarx;
diff --git a/source/RobotAPI/robotstate/remote/RobotStateObserver.h b/source/RobotAPI/robotstate/remote/RobotStateObserver.h
index 16c6698ee..6c375013f 100644
--- a/source/RobotAPI/robotstate/remote/RobotStateObserver.h
+++ b/source/RobotAPI/robotstate/remote/RobotStateObserver.h
@@ -35,8 +35,13 @@
 
 #include <string>
 
-
-#include <VirtualRobot/VirtualRobot.h>
+namespace VirtualRobot
+{
+    class Robot;
+    typedef boost::shared_ptr<Robot> RobotPtr;
+    class RobotNode;
+    typedef boost::shared_ptr<RobotNode> RobotNodePtr;
+}
 
 namespace armarx
 {
@@ -70,7 +75,7 @@ namespace armarx
 
         virtual PropertyDefinitionsPtr createPropertyDefinitions();
 
-        virtual std::string getDefaultName() const { return "RobotStateObserver"; };
+        virtual std::string getDefaultName() const { return "RobotStateObserver"; }
 
     protected:
 		void updateRobotModel(const NameValueMap& nameValueMap);
-- 
GitLab