From d29550a333aaeddf8072836839b57634c280b84a Mon Sep 17 00:00:00 2001
From: Florent Lamiraux <florent@laas.fr>
Date: Wed, 21 Oct 2015 21:26:49 +0200
Subject: [PATCH] Store grasp by NumericalConstraint instead of
 DifferentiableFunction

  in ProblemSolver map.
---
 include/hpp/manipulation/fwd.hh            |  2 +-
 include/hpp/manipulation/problem-solver.hh |  4 ++--
 src/problem-solver.cc                      | 14 +++++++-------
 3 files changed, 10 insertions(+), 10 deletions(-)

diff --git a/include/hpp/manipulation/fwd.hh b/include/hpp/manipulation/fwd.hh
index 7b17ee90..c9d1de0a 100644
--- a/include/hpp/manipulation/fwd.hh
+++ b/include/hpp/manipulation/fwd.hh
@@ -111,7 +111,7 @@ namespace hpp {
     typedef std::list < NumericalConstraintPtr_t > NumericalConstraints_t;
     typedef std::pair< GripperPtr_t, HandlePtr_t> Grasp_t;
     typedef boost::shared_ptr <Grasp_t> GraspPtr_t;
-    typedef std::map <DifferentiableFunctionPtr_t, GraspPtr_t> GraspsMap_t;
+    typedef std::map <NumericalConstraintPtr_t, GraspPtr_t> GraspsMap_t;
 
     typedef std::vector<core::vector3_t> Shape_t;
     typedef std::pair <JointPtr_t, Shape_t> JointAndShape_t;
diff --git a/include/hpp/manipulation/problem-solver.hh b/include/hpp/manipulation/problem-solver.hh
index 5d5b89f9..d3e77af4 100644
--- a/include/hpp/manipulation/problem-solver.hh
+++ b/include/hpp/manipulation/problem-solver.hh
@@ -70,7 +70,7 @@ namespace hpp {
         /// \}
 
         /// Add grasp
-        void addGrasp( const DifferentiableFunctionPtr_t& constraint,
+        void addGrasp (const NumericalConstraintPtr_t& constraint,
             const model::GripperPtr_t& gripper,
             const HandlePtr_t& handle)
         {
@@ -88,7 +88,7 @@ namespace hpp {
         /// get graps by name
         ///
         /// return NULL if no grasp named graspName
-        GraspPtr_t grasp(const DifferentiableFunctionPtr_t& constraint) const;
+        GraspPtr_t grasp(const NumericalConstraintPtr_t& constraint) const;
 
 	/// Create placement constraint
 	/// \param name name of the placement constraint,
diff --git a/src/problem-solver.cc b/src/problem-solver.cc
index 89754e49..5356b2ce 100644
--- a/src/problem-solver.cc
+++ b/src/problem-solver.cc
@@ -123,8 +123,8 @@ namespace hpp {
       return constraintGraph_;
     }
 
-    GraspPtr_t ProblemSolver::grasp (
-                      const DifferentiableFunctionPtr_t& constraint) const
+    GraspPtr_t ProblemSolver::grasp
+    (const NumericalConstraintPtr_t& constraint) const
     {
       GraspsMap_t::const_iterator it =
 	graspsMap_.find (constraint);
@@ -169,9 +169,10 @@ namespace hpp {
 	constraints.first->addFloor (ConvexShape (it->second, it->first));
       }
 
-      addNumericalConstraint (name, constraints.first);
-      addNumericalConstraint (complementName, constraints.second);
-      comparisonType (complementName, core::Equality::create ());
+      addNumericalConstraint (name, NumericalConstraint::create
+			      (constraints.first));
+      addNumericalConstraint (complementName, NumericalConstraint::create
+			      (constraints.second, core::Equality::create ()));
     }
 
 
@@ -201,8 +202,7 @@ namespace hpp {
     {
       core::ProblemSolver::addFunctionToConfigProjector (constraintName,
                                                          functionName);
-      DifferentiableFunctionPtr_t constraint =
-	numericalConstraint (functionName);
+      NumericalConstraintPtr_t constraint (numericalConstraint (functionName));
       if (GraspPtr_t g = grasp (constraint)) {
         GripperPtr_t gripper = g->first;
         HandlePtr_t handle = g->second;
-- 
GitLab