From f07ea54f7a77eacdb422a4eb2d6ce053e650423f Mon Sep 17 00:00:00 2001
From: Fabian Reister <fabian.reister@kit.edu>
Date: Mon, 6 Mar 2023 16:55:35 +0100
Subject: [PATCH] almost fixed component. still need to work on aron json
 loading

---
 .../articulated_objects_skill_provider/Component.cpp          | 4 +++-
 .../components/articulated_objects_skill_provider/Component.h | 1 -
 source/armarx/manipulation/core/Robot.cpp                     | 2 ++
 source/armarx/manipulation/skills/ReachGrasp.h                | 4 +++-
 4 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/source/armarx/manipulation/components/articulated_objects_skill_provider/Component.cpp b/source/armarx/manipulation/components/articulated_objects_skill_provider/Component.cpp
index c75696b4..afda85c2 100644
--- a/source/armarx/manipulation/components/articulated_objects_skill_provider/Component.cpp
+++ b/source/armarx/manipulation/components/articulated_objects_skill_provider/Component.cpp
@@ -92,7 +92,9 @@ namespace armarx::manipulation::components::articulated_objects_skill_provider
         core::Robot::InjectedServices injectedServices{.proxies = robotProxies,
                                                        .memoryNameSystem = memoryNameSystem()};
 
-        robot = std::make_unique<core::Robot>(injectedServices, properties.robotName);
+        const std::string robotName = robotProxies.robotUnitPrx->getKinematicUnit()->getRobotName();
+
+        robot = std::make_unique<core::Robot>(injectedServices, robotName);
 
         //
         // Private skills
diff --git a/source/armarx/manipulation/components/articulated_objects_skill_provider/Component.h b/source/armarx/manipulation/components/articulated_objects_skill_provider/Component.h
index 4f8f2c1e..3fda19c8 100644
--- a/source/armarx/manipulation/components/articulated_objects_skill_provider/Component.h
+++ b/source/armarx/manipulation/components/articulated_objects_skill_provider/Component.h
@@ -113,7 +113,6 @@ namespace armarx::manipulation::components::articulated_objects_skill_provider
         struct Properties
         {
 
-            std::string robotName = "Armar6";
         };
         Properties properties;
         /* Use a mutex if you access variables from different threads
diff --git a/source/armarx/manipulation/core/Robot.cpp b/source/armarx/manipulation/core/Robot.cpp
index 2bf1dc90..0877467a 100644
--- a/source/armarx/manipulation/core/Robot.cpp
+++ b/source/armarx/manipulation/core/Robot.cpp
@@ -170,6 +170,8 @@ namespace armarx::manipulation::core
     bool
     Robot::synchronize(const armarx::core::time::DateTime& timestamp)
     {
+        ARMARX_CHECK_NOT_NULL(virtualRobot);
+        
         if (robotReader.synchronizeRobot(*virtualRobot, timestamp))
         {
             syncTime = timestamp;
diff --git a/source/armarx/manipulation/skills/ReachGrasp.h b/source/armarx/manipulation/skills/ReachGrasp.h
index 0881816d..627fa28e 100644
--- a/source/armarx/manipulation/skills/ReachGrasp.h
+++ b/source/armarx/manipulation/skills/ReachGrasp.h
@@ -100,10 +100,12 @@ namespace armarx::manipulation::skills
         virtual bool initController(const ParamsT& params) {return true;};
         virtual bool updateControllerTcpTarget(const core::Pose& global_T_tcp) {return true;};
 
-    private:
+    protected:
         Context ctx;
         Parameters parameters;
 
+    private:
+
         VirtualRobot::RobotPtr object;
 
         VirtualRobot::GraspPtr grasp;
-- 
GitLab