hpp-manipulation 6.0.0
Classes for manipulation planning.
Loading...
Searching...
No Matches
handle.hh
Go to the documentation of this file.
1
6
7// Redistribution and use in source and binary forms, with or without
8// modification, are permitted provided that the following conditions are
9// met:
10//
11// 1. Redistributions of source code must retain the above copyright
12// notice, this list of conditions and the following disclaimer.
13//
14// 2. Redistributions in binary form must reproduce the above copyright
15// notice, this list of conditions and the following disclaimer in the
16// documentation and/or other materials provided with the distribution.
17//
18// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22// HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
29// DAMAGE.
30
31#ifndef HPP_MANIPULATION_HANDLE_HH
32#define HPP_MANIPULATION_HANDLE_HH
33
36#include <pinocchio/spatial/se3.hpp>
37
38namespace hpp {
39namespace manipulation {
40typedef constraints::ImplicitPtr_t ImplicitPtr_t;
59 public:
60 static std::string className;
61 virtual ~Handle() {};
62
68 static HandlePtr_t create(const std::string& name,
69 const Transform3s& localPosition,
70 const DeviceWkPtr_t& robot,
71 const JointPtr_t& joint) {
72 Handle* ptr = new Handle(name, localPosition, robot, joint);
73 HandlePtr_t shPtr(ptr);
74 ptr->init(shPtr);
75 return shPtr;
76 }
78 virtual HandlePtr_t clone() const;
79
82
84 const std::string& name() const { return name_; }
86 void name(const std::string& n) { name_ = n; }
88
91
93 const JointPtr_t& joint() const { return joint_; }
95 void joint(const JointPtr_t& joint) { joint_ = joint; }
96
97 DevicePtr_t robot() const { return robot_.lock(); }
99
101 const Transform3s& localPosition() const { return localPosition_; }
102
104 void localPosition(const Transform3s& localPosition) {
105 localPosition_ = localPosition;
106 }
107
109 void mask(const std::vector<bool>& mask);
110
113 const std::vector<bool>& mask() const { return mask_; }
114
116 void maskComp(const std::vector<bool>& mask);
117
119 const std::vector<bool>& maskComp() const { return maskComp_; }
120
129 virtual ImplicitPtr_t createGrasp(const GripperPtr_t& gripper,
130 std::string name) const;
131
139 std::string name) const;
140
146 std::string name) const;
147
157 const value_type& shift,
158 std::string name) const;
159
166 value_type clearance() const { return clearance_; }
167
170 void clearance(const value_type& clearance) { clearance_ = clearance; }
171
172 protected:
178 Handle(const std::string& name, const Transform3s& localPosition,
179 const DeviceWkPtr_t& robot, const JointPtr_t& joint)
180 : name_(name),
181 localPosition_(localPosition),
182 joint_(joint),
183 robot_(robot),
184 clearance_(0),
185 mask_(6, true),
186 maskComp_(6, false),
187 weakPtr_() {}
188 void init(HandleWkPtr_t weakPtr) { weakPtr_ = weakPtr; }
189
190 virtual std::ostream& print(std::ostream& os) const;
191
192 private:
193 std::string name_;
195 Transform3s localPosition_;
197 JointPtr_t joint_;
199 DeviceWkPtr_t robot_;
201 value_type clearance_;
203 std::vector<bool> mask_;
205 std::vector<bool> maskComp_;
207 HandleWkPtr_t weakPtr_;
208
209 friend std::ostream& operator<<(std::ostream&, const Handle&);
210}; // class Handle
211
212std::ostream& operator<<(std::ostream& os, const Handle& handle);
213} // namespace manipulation
214} // namespace hpp
215
216#endif // HPP_MANIPULATION_HANDLE_HH
Definition handle.hh:58
static HandlePtr_t create(const std::string &name, const Transform3s &localPosition, const DeviceWkPtr_t &robot, const JointPtr_t &joint)
Definition handle.hh:68
void maskComp(const std::vector< bool > &mask)
Set mask of complement constraint.
friend std::ostream & operator<<(std::ostream &, const Handle &)
void clearance(const value_type &clearance)
Definition handle.hh:170
virtual ~Handle()
Definition handle.hh:61
static std::string className
Definition handle.hh:60
const std::vector< bool > & maskComp() const
Get mask of complement constraint.
Definition handle.hh:119
virtual ImplicitPtr_t createGrasp(const GripperPtr_t &gripper, std::string name) const
void joint(const JointPtr_t &joint)
Set joint to which the handle is linked.
Definition handle.hh:95
const std::vector< bool > & mask() const
Definition handle.hh:113
const Transform3s & localPosition() const
Get local position in joint frame.
Definition handle.hh:101
virtual ImplicitPtr_t createPreGrasp(const GripperPtr_t &gripper, const value_type &shift, std::string name) const
void init(HandleWkPtr_t weakPtr)
Definition handle.hh:188
const JointPtr_t & joint() const
Get joint to which the handle is linked.
Definition handle.hh:93
value_type clearance() const
Definition handle.hh:166
virtual HandlePtr_t clone() const
Return a pointer to the copy of this.
virtual ImplicitPtr_t createGraspComplement(const GripperPtr_t &gripper, std::string name) const
const std::string & name() const
Get name.
Definition handle.hh:84
virtual ImplicitPtr_t createGraspAndComplement(const GripperPtr_t &gripper, std::string name) const
void name(const std::string &n)
Set name.
Definition handle.hh:86
void mask(const std::vector< bool > &mask)
Set constraint mask.
void localPosition(const Transform3s &localPosition)
Set local position in joint frame.
Definition handle.hh:104
DevicePtr_t robot() const
Definition handle.hh:97
virtual std::ostream & print(std::ostream &os) const
Handle(const std::string &name, const Transform3s &localPosition, const DeviceWkPtr_t &robot, const JointPtr_t &joint)
Definition handle.hh:178
#define HPP_MANIPULATION_DLLAPI
Definition config.hh:88
pinocchio::JointPtr_t JointPtr_t
Definition fwd.hh:43
pinocchio::GripperPtr_t GripperPtr_t
Definition fwd.hh:51
constraints::ImplicitPtr_t ImplicitPtr_t
Definition fwd.hh:131
core::Transform3s Transform3s
Definition fwd.hh:91
core::value_type value_type
Definition fwd.hh:89
shared_ptr< Device > DevicePtr_t
Definition fwd.hh:40
shared_ptr< Handle > HandlePtr_t
Definition fwd.hh:58
std::ostream & operator<<(std::ostream &os, const Handle &handle)
Definition main.hh:1