From 4f843d607a2287b15228599b025089cde811837c Mon Sep 17 00:00:00 2001
From: Fabian Reister <fabian.reister@kit.edu>
Date: Tue, 24 Sep 2024 12:20:13 +0200
Subject: [PATCH] fix: used wrong robot

---
 .../hand/common/AbstractHandControllerWrapper.cpp      | 10 +++++++---
 .../hand/common/AbstractHandUnitControllerWrapper.h    |  4 +++-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/source/devices/ethercat/hand/common/AbstractHandControllerWrapper.cpp b/source/devices/ethercat/hand/common/AbstractHandControllerWrapper.cpp
index 9de48e27..014ba711 100644
--- a/source/devices/ethercat/hand/common/AbstractHandControllerWrapper.cpp
+++ b/source/devices/ethercat/hand/common/AbstractHandControllerWrapper.cpp
@@ -24,13 +24,15 @@ namespace devices::ethercat::hand::common
         auto robotToUse = robot;
         if(forceRobotFileReload)
         {
-            ARMARX_INFO << "Reloading robot model `" << robot->getFilename() << "`";
+            ARMARX_VERBOSE << "Reloading robot model `" << robot->getFilename() << "`";
             robotToUse = VirtualRobot::RobotIO::loadRobot(robot->getFilename(), VirtualRobot::BaseIO::eStructure);
         }
 
-        const auto eef = robot->getEndEffector(eefName);
+        const auto eef = robotToUse->getEndEffector(eefName);
         const std::vector<std::string> preshapeNames = eef->getPreshapes();
 
+        ARMARX_VERBOSE << handName;
+
         for (const auto& preshapeName : preshapeNames)
         {
             const VirtualRobot::RobotConfigPtr preshape = eef->getPreshape(preshapeName);
@@ -41,9 +43,11 @@ namespace devices::ethercat::hand::common
             std::map<std::string, float> preshapeMap;
             for (const auto& pair : jointValues)
             {
-                preshapeMap[simox::alg::remove_prefix(pair.first, handName)] = pair.second;
+                const std::string jointName = simox::alg::remove_prefix(pair.first, handName);
+                preshapeMap[jointName] = pair.second;
             }
 
+            ARMARX_VERBOSE << preshapeName << ": " << preshapeMap;
             preshapesByName.emplace(preshapeName, preshapeMap);
         }
 
diff --git a/source/devices/ethercat/hand/common/AbstractHandUnitControllerWrapper.h b/source/devices/ethercat/hand/common/AbstractHandUnitControllerWrapper.h
index 35902146..a18d9af7 100644
--- a/source/devices/ethercat/hand/common/AbstractHandUnitControllerWrapper.h
+++ b/source/devices/ethercat/hand/common/AbstractHandUnitControllerWrapper.h
@@ -24,7 +24,9 @@ namespace devices::ethercat::hand::common
         virtual std::map<std::string, float> getShapeJointValues(const std::string& shape) = 0;
 
         // virtual void reloadPreshapes() = 0;
-        virtual void reloadPreshapes() {};
+        virtual void reloadPreshapes() {
+            ARMARX_WARNING << "NYI";
+        };
 
         virtual std::string
         describeHandState() const
-- 
GitLab