From d8250f7c09c71f13c909613589dfe878287f5076 Mon Sep 17 00:00:00 2001
From: Fabian Reister <fabian.reister@kit.edu>
Date: Mon, 10 May 2021 08:25:14 +0200
Subject: [PATCH] RobotStateMemory: using core visu

---
 .../RobotStateMemory/RobotStateMemory.cpp     | 20 +++++++++++++------
 .../RobotStateMemory/RobotStateMemory.h       |  8 +++++++-
 2 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/source/RobotAPI/components/armem/server/RobotStateMemory/RobotStateMemory.cpp b/source/RobotAPI/components/armem/server/RobotStateMemory/RobotStateMemory.cpp
index 6d6981ff5..45855e314 100644
--- a/source/RobotAPI/components/armem/server/RobotStateMemory/RobotStateMemory.cpp
+++ b/source/RobotAPI/components/armem/server/RobotStateMemory/RobotStateMemory.cpp
@@ -20,8 +20,9 @@
  *             GNU General Public License
  */
 
+#include "RobotStateMemory.h"
+
 // STD
-#include <RobotAPI/interface/units/RobotUnit/RobotUnitInterface.h>
 #include <algorithm>
 #include <iostream>
 #include <fstream>
@@ -29,7 +30,6 @@
 // Header
 #include "ArmarXCore/core/logging/Logging.h"
 #include "RobotAPI/libraries/core/Pose.h"
-#include "RobotStateMemory.h"
 
 // Simox
 #include <SimoxUtility/algorithm/string.h>
@@ -43,6 +43,8 @@
 #include <RobotAPI/libraries/aron/core/navigator/data/AllNavigators.h>
 #include <RobotAPI/libraries/aron/core/navigator/type/AllNavigators.h>
 
+#include <RobotAPI/libraries/armem_robot_state/server/common/Visu.h>
+
 namespace armarx::armem::server::robot_state
 {
     RobotStateMemory::RobotStateMemory()
@@ -55,13 +57,16 @@ namespace armarx::armem::server::robot_state
     {
     }
 
+    RobotStateMemory::~RobotStateMemory() = default;
+
+
     armarx::PropertyDefinitionsPtr RobotStateMemory::createPropertyDefinitions()
     {
         armarx::PropertyDefinitionsPtr defs = new ComponentPropertyDefinitions(getConfigIdentifier());
-        defs->optional(robotUnitSensorPrefix, "SensorValuePrefix", "Prefix of all sensor values");
-        defs->optional(robotUnitMemoryBatchSize, "RobotUnitMemoryBatchSize", "The size of the entity snapshot to send to the memory. Min is 1");
-        defs->optional(robotUnitPollFrequency, "RobotUnitUpdateFrequency", "The frequency in Hz to store values. All other values get discarded. Min is 1, max is " + std::to_string(ROBOT_UNIT_MAXIMUM_FREQUENCY));
-        defs->optional(robotUnitConfigPath, "robotUnitConfigPath", "Specify a configuration file to group the sensor values specifically.");
+        defs->optional(robotUnitSensorPrefix, "RobotUnit.SensorValuePrefix", "Prefix of all sensor values");
+        defs->optional(robotUnitMemoryBatchSize, "RobotUnit.MemoryBatchSize", "The size of the entity snapshot to send to the memory. Min is 1");
+        defs->optional(robotUnitPollFrequency, "RobotUnit.UpdateFrequency", "The frequency in Hz to store values. All other values get discarded. Min is 1, max is " + std::to_string(ROBOT_UNIT_MAXIMUM_FREQUENCY));
+        defs->optional(robotUnitConfigPath, "robotUnit.ConfigPath", "Specify a configuration file to group the sensor values specifically.");
 
         descriptionSegment.defineProperties(defs);
         proprioceptionSegment.defineProperties(defs);
@@ -119,6 +124,9 @@ namespace armarx::armem::server::robot_state
 
         localizationSegment.connect(getArvizClient());
 
+        commonVisu = std::make_unique<Visu>(getArvizClient(), descriptionSegment, proprioceptionSegment, localizationSegment);
+        commonVisu->init();
+
         cfg.loggingNames.emplace_back(robotUnitSensorPrefix);
         handler = make_shared<RobotUnitDataStreamingReceiver>(this, getRobotUnit(), cfg);
         keys = handler->getDataDescription();
diff --git a/source/RobotAPI/components/armem/server/RobotStateMemory/RobotStateMemory.h b/source/RobotAPI/components/armem/server/RobotStateMemory/RobotStateMemory.h
index 6917665b5..c48e44ac8 100644
--- a/source/RobotAPI/components/armem/server/RobotStateMemory/RobotStateMemory.h
+++ b/source/RobotAPI/components/armem/server/RobotStateMemory/RobotStateMemory.h
@@ -47,6 +47,8 @@
 
 namespace armarx::armem::server::robot_state
 {
+    class Visu;
+
     /**
      * @defgroup Component-RobotSensorMemory RobotSensorMemory
      * @ingroup RobotAPI-Components
@@ -67,6 +69,8 @@ namespace armarx::armem::server::robot_state
     public:
         RobotStateMemory();
 
+        virtual ~RobotStateMemory();
+
         /// @see armarx::ManagedIceObject::getDefaultName()
         std::string getDefaultName() const override;
 
@@ -101,7 +105,6 @@ namespace armarx::armem::server::robot_state
         mutable std::recursive_mutex startStopMutex;
 
         // Core segments
-
         // - description
         description::Segment descriptionSegment;
 
@@ -112,6 +115,9 @@ namespace armarx::armem::server::robot_state
         // - localization
         localization::Segment localizationSegment;
 
+        // Joint visu for all segments => robot pose and configuration
+        std::unique_ptr<Visu> commonVisu;
+
         // RobotUnit stuff
         RobotUnitDataStreaming::DataStreamingDescription keys;
         std::vector<RobotUnitDataStreaming::DataEntry> keysList;
-- 
GitLab