From 32c79c1de2e24b28f6244ae89209c2b28326b134 Mon Sep 17 00:00:00 2001 From: Joseph Mirabel <jmirabel@laas.fr> Date: Sat, 13 Feb 2016 09:23:46 +0100 Subject: [PATCH] Handle::createGraspComplement return a zero function --- src/handle.cc | 36 +++++++++++++++++++++++------------- 1 file changed, 23 insertions(+), 13 deletions(-) diff --git a/src/handle.cc b/src/handle.cc index 0bc20ccb..f68a5d0c 100644 --- a/src/handle.cc +++ b/src/handle.cc @@ -17,10 +17,10 @@ // hpp-manipulation. If not, see // <http://www.gnu.org/licenses/>. +#include <hpp/manipulation/handle.hh> + #include <hpp/util/debug.hh> #include <hpp/model/device.hh> -#include <hpp/core/explicit-numerical-constraint.hh> -#include <hpp/manipulation/handle.hh> #include <boost/assign/list_of.hpp> @@ -33,10 +33,24 @@ #include <hpp/constraints/relative-transformation.hh> #include <hpp/core/numerical-constraint.hh> +#include <hpp/core/explicit-numerical-constraint.hh> #include <hpp/core/explicit-relative-transformation.hh> namespace hpp { namespace manipulation { + namespace { + struct ZeroDiffFunc : public constraints::DifferentiableFunction { + ZeroDiffFunc (size_type sIn, size_type sInD, + std::string name=std::string("Empty function")) + : DifferentiableFunction (sIn, sInD, 0, 0, name) + { + context ("Grasp complement"); + } + + inline void impl_compute (vectorOut_t, vectorIn_t) const {} + inline void impl_jacobian (matrixOut_t, vectorIn_t) const {} + }; + } using core::ExplicitNumericalConstraint; using constraints::DifferentiableFunction; @@ -79,17 +93,13 @@ namespace hpp { NumericalConstraintPtr_t Handle::createGraspComplement (const GripperPtr_t& gripper) const { - using boost::assign::list_of; - std::vector <bool> mask = list_of (false)(false)(false)(false)(false) - (false); - return NumericalConstraintPtr_t - (NumericalConstraint::create (RelativeTransformation::create - ("Transformation_(0,0,0,0,0,0)_" + name () - + "_" + gripper->name (), - gripper->joint()->robot(), - gripper->joint (), joint (), - gripper->objectPositionInJoint (), - localPosition(), mask))); + core::DevicePtr_t robot = gripper->joint()->robot(); + return NumericalConstraint::create ( + boost::shared_ptr <ZeroDiffFunc> (new ZeroDiffFunc ( + robot->configSize(), robot->numberDof (), + "Transformation_(0,0,0,0,0,0)_" + name () + "_" + gripper->name () + )) + ); } NumericalConstraintPtr_t Handle::createPreGrasp -- GitLab