From f3e120d93142b99fea92b42e9708e13887922e97 Mon Sep 17 00:00:00 2001
From: Mathieu Geisert <mgeisert@laas.fr>
Date: Thu, 12 Jun 2014 16:00:29 +0200
Subject: [PATCH] not finish : add gripper to model

---
 CMakeLists.txt                      |  1 -
 include/hpp/manipulation/fwd.hh     |  3 +-
 include/hpp/manipulation/gripper.hh | 89 -----------------------------
 include/hpp/manipulation/handle.hh  |  7 +++
 src/axial-handle.cc                 |  2 +-
 src/handle.cc                       |  2 +-
 src/robot.cc                        |  2 +-
 7 files changed, 11 insertions(+), 95 deletions(-)
 delete mode 100644 include/hpp/manipulation/gripper.hh

diff --git a/CMakeLists.txt b/CMakeLists.txt
index bef800f..bca6860 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -40,7 +40,6 @@ ADD_REQUIRED_DEPENDENCY(hpp-constraints >= 3.0.0)
 
 SET (${PROJECT_NAME}_HEADERS
   include/hpp/manipulation/fwd.hh
-  include/hpp/manipulation/gripper.hh
   include/hpp/manipulation/axial-handle.hh
   include/hpp/manipulation/handle.hh
   include/hpp/manipulation/object.hh
diff --git a/include/hpp/manipulation/fwd.hh b/include/hpp/manipulation/fwd.hh
index ea5034b..f67f1f9 100644
--- a/include/hpp/manipulation/fwd.hh
+++ b/include/hpp/manipulation/fwd.hh
@@ -34,12 +34,11 @@ namespace hpp {
     typedef model::Configuration_t Configuration_t;
     typedef model::ConfigurationIn_t ConfigurationIn_t;
     typedef model::ConfigurationOut_t ConfigurationOut_t;
+    typedef model::GripperPtr_t GripperPtr_t;
     HPP_PREDEF_CLASS (AxialHandle);
     typedef boost::shared_ptr <AxialHandle> AxialHandlePtr_t;
     typedef core::DifferentiableFunction DifferentiableFunction;
     typedef core::DifferentiableFunctionPtr_t DifferentiableFunctionPtr_t;
-    HPP_PREDEF_CLASS (Gripper);
-    typedef boost::shared_ptr <Gripper> GripperPtr_t;
     HPP_PREDEF_CLASS (Handle);
     typedef boost::shared_ptr <Handle> HandlePtr_t;
     HPP_PREDEF_CLASS (Object);
diff --git a/include/hpp/manipulation/gripper.hh b/include/hpp/manipulation/gripper.hh
deleted file mode 100644
index f012c23..0000000
--- a/include/hpp/manipulation/gripper.hh
+++ /dev/null
@@ -1,89 +0,0 @@
-///
-/// Copyright (c) 2014 CNRS
-/// Authors: Florent Lamiraux
-///
-///
-// This file is part of hpp-manipulation.
-// hpp-manipulation is free software: you can redistribute it
-// and/or modify it under the terms of the GNU Lesser General Public
-// License as published by the Free Software Foundation, either version
-// 3 of the License, or (at your option) any later version.
-//
-// hpp-manipulation is distributed in the hope that it will be
-// useful, but WITHOUT ANY WARRANTY; without even the implied warranty
-// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-// General Lesser Public License for more details. You should have
-// received a copy of the GNU Lesser General Public License along with
-// hpp-manipulation. If not, see
-// <http://www.gnu.org/licenses/>.
-
-#ifndef HPP_MANIPULATION_GRIPPER_HH
-# define HPP_MANIPULATION_GRIPPER_HH
-
-# include <hpp/manipulation/handle.hh>
-
-namespace hpp {
-  namespace manipulation {
-    /// Constraint between the position of a robot joint and of an object handle
-    class HPP_MANIPULATION_DLLAPI Gripper
-    {
-    public:
-      /// Return a shared pointer to new instance
-      /// \param joint joint of the robot that will hold handles,
-      /// \param handlePositionInJoint handle position in the the grasping
-      ///        joint.
-      static GripperPtr_t create (const std::string& name, const JointPtr_t& joint,
-				const Transform3f& handlePositionInJoint)
-      {
-	Gripper* ptr = new Gripper (name, joint, handlePositionInJoint);
-	return GripperPtr_t (ptr);
-      }
-
-      /// Get joint that Grippers
-      const JointPtr_t& joint () const
-      {
-	return joint_;
-      }
-      /// Get handle position in the the Grippering joint
-      const Transform3f& handlePositionInJoint () const
-      {
-	return handlePositionInJoint_;
-      }
-      ///get name
-      const std::string& name () const
-      {
-	return name_;
-      }
-      /// Set name
-      void name (const std::string& n)
-      {
-	name_ = n;
-      }
-
-      
-      DifferentiableFunctionPtr_t createGrasp(HandlePtr_t& handle)
-      {
-        return handle->createGrasp(GripperPtr_t(this));
-      }
-
-    protected:
-      /// Constructor
-      /// \param joint joint of the robot that holds the handle,
-      /// \param handlePositionInJoint handle position in the the grasping
-      ///        joint.
-      Gripper (const std::string& name, const JointPtr_t& joint,
-	     const Transform3f& handlePositionInJoint) :
-        name_ (name),
-	joint_ (joint),
-	handlePositionInJoint_ (handlePositionInJoint)
-      {
-      }
-    private:
-      /// Joint of the robot that holds handles.
-      std::string name_;
-      JointPtr_t joint_;
-      Transform3f handlePositionInJoint_;
-    }; // class Gripper
-  } // namespace manipulation
-} // namespace hpp
-#endif // HPP_MANIPULATION_GRIPPER_HH
diff --git a/include/hpp/manipulation/handle.hh b/include/hpp/manipulation/handle.hh
index 4afd217..bbe58d2 100644
--- a/include/hpp/manipulation/handle.hh
+++ b/include/hpp/manipulation/handle.hh
@@ -93,6 +93,13 @@ namespace hpp {
       ///       rotation around x is not constrained.
       virtual DifferentiableFunctionPtr_t createGrasp
       (const GripperPtr_t& gripper) const;
+
+      static DifferentiableFunctionPtr_t createGrasp
+      (const GripperPtr_t& gripper,const HandlePtr_t& handle)
+      {
+        return handle->createGrasp(gripper);
+      }
+
       virtual std::ostream& print (std::ostream& os) const;
 
     protected:
diff --git a/src/axial-handle.cc b/src/axial-handle.cc
index 7f57d2f..07fd255 100644
--- a/src/axial-handle.cc
+++ b/src/axial-handle.cc
@@ -20,9 +20,9 @@
 #include <boost/assign/list_of.hpp>
 #include <fcl/math/transform.h>
 #include <hpp/model/joint.hh>
+#include <hpp/model/gripper.hh>
 #include <hpp/constraints/relative-transformation.hh>
 #include <hpp/manipulation/axial-handle.hh>
-#include <hpp/manipulation/gripper.hh>
 #include <hpp/manipulation/robot.hh>
 
 namespace hpp {
diff --git a/src/handle.cc b/src/handle.cc
index c66e2e7..af6da09 100644
--- a/src/handle.cc
+++ b/src/handle.cc
@@ -22,7 +22,7 @@
 #include <hpp/model/joint.hh>
 #include <hpp/constraints/relative-transformation.hh>
 #include <hpp/manipulation/handle.hh>
-#include <hpp/manipulation/gripper.hh>
+#include <hpp/model/gripper.hh>
 #include <hpp/manipulation/robot.hh>
 
 namespace hpp {
diff --git a/src/robot.cc b/src/robot.cc
index 410d963..15bff21 100644
--- a/src/robot.cc
+++ b/src/robot.cc
@@ -20,7 +20,7 @@
 #include <hpp/util/debug.hh>
 #include <hpp/model/object-factory.hh>
 #include <hpp/manipulation/robot.hh>
-#include <hpp/manipulation/gripper.hh>
+#include <hpp/model/gripper.hh>
 
 namespace hpp {
   namespace manipulation {
-- 
GitLab