diff --git a/include/hpp/manipulation/axial-handle.hh b/include/hpp/manipulation/axial-handle.hh index 1f220e31d23e9f98814dd24fda57fa6758405ae5..590eb4404a03237923e29f221cace86ef7e14e87 100644 --- a/include/hpp/manipulation/axial-handle.hh +++ b/include/hpp/manipulation/axial-handle.hh @@ -70,13 +70,28 @@ namespace hpp { /// Create constraint that acts on the non-constrained axis of the /// constraint generated by Handle::createPreGrasp. + /// \warning {currently, the only constrained axis is x. The rotation + /// around the z-axis is not constrained.} + /// \param gripper object containing the gripper information + /// \return the constraint of relative position between the handle and + /// the gripper. + /// \note The translation along x-axis is constrained. + virtual DifferentiableFunctionPtr_t createPreGraspComplement + (const GripperPtr_t& gripper) const; + + /// Create constraint that acts on the non-constrained axis of the + /// constraint generated by Handle::createPreGrasp. + /// \warning {currently, the only constrained axis is x. The rotation + /// around the z-axis is not constrained.} /// \param gripper object containing the gripper information /// \param shift the target value along the x-axis /// \return the constraint of relative position between the handle and /// the gripper. - /// \note The translation along x-axis and the rotation around z-axis are constrained. + /// \note The translation along x-axis is constrained. + /// \deprecated Use createPreGraspComplement(const GripperPtr_t&) instead. virtual DifferentiableFunctionPtr_t createPreGraspComplement - (const GripperPtr_t& gripper, const value_type& shift) const; + (const GripperPtr_t& gripper, const value_type& shift) const + HPP_MANIPULATION_DEPRECATED; virtual std::ostream& print (std::ostream& os) const; protected: diff --git a/include/hpp/manipulation/handle.hh b/include/hpp/manipulation/handle.hh index ee1da30b10c7d3568822259af97e7df69db26c1a..3c7666473136a70f01dc20fbeccaf7999b73e32d 100644 --- a/include/hpp/manipulation/handle.hh +++ b/include/hpp/manipulation/handle.hh @@ -21,6 +21,7 @@ # define HPP_MANIPULATION_HANDLE_HH # include <hpp/fcl/math/transform.h> +# include <hpp/manipulation/deprecated.hh> # include <hpp/manipulation/config.hh> # include <hpp/manipulation/fwd.hh> @@ -107,6 +108,17 @@ namespace hpp { virtual DifferentiableFunctionPtr_t createPreGrasp (const GripperPtr_t& gripper) const; + /// Create constraint that acts on the non-constrained axis of the + /// constraint generated by Handle::createPreGrasp. + /// \param gripper object containing the gripper information + /// \return the constraint of relative position between the handle and + /// the gripper. + /// \note Only the x-axis of the relative transformation between the handle and the gripper + /// is constrained. The centers are shifted of + /// \f clearance () + gripper->clearance ()\f along the x-axis. + virtual DifferentiableFunctionPtr_t createPreGraspComplement + (const GripperPtr_t& gripper) const; + /// Create constraint that acts on the non-constrained axis of the /// constraint generated by Handle::createPreGrasp. /// \param gripper object containing the gripper information @@ -115,8 +127,10 @@ namespace hpp { /// the gripper. /// \note Only the x-axis of the relative transformation between the handle and the gripper /// is constrained. + /// \deprecated Use createPreGraspComplement(const GripperPtr_t&) instead. virtual DifferentiableFunctionPtr_t createPreGraspComplement - (const GripperPtr_t& gripper, const value_type& shift) const; + (const GripperPtr_t& gripper, const value_type& shift) const + HPP_MANIPULATION_DEPRECATED; static DifferentiableFunctionPtr_t createGrasp (const GripperPtr_t& gripper,const HandlePtr_t& handle) diff --git a/src/axial-handle.cc b/src/axial-handle.cc index 9e8cbfef738c0ec1b6bd56b3adfdc790f731bb9d..0ef632faddeb3ba7a731194cd7d7749476aabdd1 100644 --- a/src/axial-handle.cc +++ b/src/axial-handle.cc @@ -62,6 +62,19 @@ namespace hpp { inverse (localPosition()) * gripper->objectPositionInJoint (), mask); } + DifferentiableFunctionPtr_t AxialHandle::createPreGraspComplement + (const GripperPtr_t& gripper) const + { + using boost::assign::list_of; + std::vector <bool> mask = list_of (true)(false)(false); + Transform3f transform = inverse (localPosition()) * gripper->objectPositionInJoint (); + fcl::Vec3f target = transform.getTranslation () + + fcl::Vec3f (clearance () + gripper->clearance (),0,0); + return RelativePosition::create ("Position_(1,0,0)_" + name () + "_" + gripper->name (), + gripper->joint()->robot(), gripper->joint (), joint(), target, fcl::Vec3f (0,0,0), mask); + } + + DifferentiableFunctionPtr_t AxialHandle::createPreGraspComplement (const GripperPtr_t& gripper, const value_type& shift) const { diff --git a/src/handle.cc b/src/handle.cc index 8727e641b7366a405986bb0c8d1ff3044add7642..b456ea69e934f9d7bb541bc8e449ec940b1b5c71 100644 --- a/src/handle.cc +++ b/src/handle.cc @@ -62,6 +62,18 @@ namespace hpp { gripper->joint()->robot(), gripper->joint (), joint(), transform, mask); } + DifferentiableFunctionPtr_t Handle::createPreGraspComplement + (const GripperPtr_t& gripper) const + { + using boost::assign::list_of; + std::vector <bool> mask = list_of (true)(false)(false); + Transform3f transform = inverse (localPosition()) * gripper->objectPositionInJoint (); + fcl::Vec3f target = transform.getTranslation () + + fcl::Vec3f (clearance () + gripper->clearance (),0,0); + return RelativePosition::create ("Position_(1,0,0)_" + name () + "_" + gripper->name (), + gripper->joint()->robot(), gripper->joint (), joint(), target, fcl::Vec3f (0,0,0), mask); + } + DifferentiableFunctionPtr_t Handle::createPreGraspComplement (const GripperPtr_t& gripper, const value_type& shift) const {