From 38a7e7e2c2a06a264f247d89edacfd2701b23ba1 Mon Sep 17 00:00:00 2001
From: Joseph Mirabel <jmirabel@laas.fr>
Date: Fri, 4 Dec 2015 15:17:00 +0100
Subject: [PATCH] Add argument margin to
 ProblemSolver::createPlacementConstraint

---
 include/hpp/manipulation/problem-solver.hh | 4 +++-
 src/problem-solver.cc                      | 4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/include/hpp/manipulation/problem-solver.hh b/include/hpp/manipulation/problem-solver.hh
index d3e77af4..db2e558f 100644
--- a/include/hpp/manipulation/problem-solver.hh
+++ b/include/hpp/manipulation/problem-solver.hh
@@ -94,10 +94,12 @@ namespace hpp {
 	/// \param name name of the placement constraint,
 	/// \param triangleName name of the first list of triangles,
 	/// \param envContactName name of the second list of triangles.
+        /// \param margin see hpp::constraints::QPStaticStability constructor
 	/// 
 	void createPlacementConstraint (const std::string& name,
 					const std::string& surface1,
-					const std::string& surface2);
+					const std::string& surface2,
+                                        const value_type& margin = 1e-4);
 
         /// Reset constraint set and put back the disable collisions
         /// between gripper and handle
diff --git a/src/problem-solver.cc b/src/problem-solver.cc
index 5356b2ce..359e0a07 100644
--- a/src/problem-solver.cc
+++ b/src/problem-solver.cc
@@ -137,7 +137,7 @@ namespace hpp {
 
     void ProblemSolver::createPlacementConstraint
     (const std::string& name, const std::string& surface1,
-     const std::string& surface2)
+     const std::string& surface2, const value_type& margin)
     {
       if (!robot_) throw std::runtime_error ("No robot loaded");
       using constraints::ConvexShape;
@@ -169,6 +169,8 @@ namespace hpp {
 	constraints.first->addFloor (ConvexShape (it->second, it->first));
       }
 
+      constraints.first->setNormalMargin (margin);
+
       addNumericalConstraint (name, NumericalConstraint::create
 			      (constraints.first));
       addNumericalConstraint (complementName, NumericalConstraint::create
-- 
GitLab