From 21ae267e3bb8558df30df37e83bd7215aacf9f11 Mon Sep 17 00:00:00 2001
From: Joseph Mirabel <jmirabel@laas.fr>
Date: Wed, 3 Feb 2021 19:07:52 +0100
Subject: [PATCH] Reimplement Device::removeJoints (some work is missing)

---
 include/hpp/manipulation/device.hh |  3 +++
 src/device.cc                      | 10 ++++++++++
 2 files changed, 13 insertions(+)

diff --git a/include/hpp/manipulation/device.hh b/include/hpp/manipulation/device.hh
index 25861704..53d12cb9 100644
--- a/include/hpp/manipulation/device.hh
+++ b/include/hpp/manipulation/device.hh
@@ -64,6 +64,9 @@ namespace hpp {
 
         FrameIndices_t robotFrames (const std::string& robotName) const;
 
+        void removeJoints(const std::vector<std::string>& jointNames,
+            Configuration_t referenceConfig);
+
         core::Container <HandlePtr_t> handles;
         core::Container <GripperPtr_t> grippers;
         core::Container <JointAndShapes_t> jointAndShapes;
diff --git a/src/device.cc b/src/device.cc
index 09b8b4af..4d19b9b3 100644
--- a/src/device.cc
+++ b/src/device.cc
@@ -124,6 +124,16 @@ namespace hpp {
       return frameIndices;
     }
 
+    void Device::removeJoints(const std::vector<std::string>& jointNames,
+        Configuration_t referenceConfig)
+    {
+      Parent_t::removeJoints(jointNames, referenceConfig);
+
+      for (auto& pair : grippers.map)
+        pair.second = pinocchio::Gripper::create(pair.second->name(), self_);
+      // TODO update handles and jointAndShapes
+    }
+
     std::ostream& Device::print (std::ostream& os) const
     {
       Parent_t::print (os);
-- 
GitLab