hpp-manipulation  4.14.0
Classes for manipulation planning.
handle.hh
Go to the documentation of this file.
1 
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 
35 #include <hpp/manipulation/fwd.hh>
36 #include <pinocchio/spatial/se3.hpp>
37 
38 namespace hpp {
39 namespace manipulation {
59  public:
60  static std::string className;
61  virtual ~Handle(){};
62 
68  static HandlePtr_t create(const std::string& name,
69  const Transform3f& 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 Transform3f& localPosition() const { return localPosition_; }
102 
104  void mask(const std::vector<bool>& mask);
105 
108  const std::vector<bool>& mask() const { return mask_; }
109 
111  void maskComp(const std::vector<bool>& mask);
112 
114  const std::vector<bool>& maskComp() const { return maskComp_; }
115 
124  virtual ImplicitPtr_t createGrasp(const GripperPtr_t& gripper,
125  std::string name) const;
126 
134  std::string name) const;
135 
141  std::string name) const;
142 
151  virtual ImplicitPtr_t createPreGrasp(const GripperPtr_t& gripper,
152  const value_type& shift,
153  std::string name) const;
154 
161  value_type clearance() const { return clearance_; }
162 
165  void clearance(const value_type& clearance) { clearance_ = clearance; }
166 
167  protected:
173  Handle(const std::string& name, const Transform3f& localPosition,
174  const DeviceWkPtr_t& robot, const JointPtr_t& joint)
175  : name_(name),
176  localPosition_(localPosition),
177  joint_(joint),
178  robot_(robot),
179  clearance_(0),
180  mask_(6, true),
181  weakPtr_() {}
182  void init(HandleWkPtr_t weakPtr) { weakPtr_ = weakPtr; }
183 
184  virtual std::ostream& print(std::ostream& os) const;
185 
186  private:
187  std::string name_;
189  Transform3f localPosition_;
191  JointPtr_t joint_;
193  DeviceWkPtr_t robot_;
195  value_type clearance_;
197  std::vector<bool> mask_;
199  std::vector<bool> maskComp_;
201  HandleWkPtr_t weakPtr_;
202 
203  friend std::ostream& operator<<(std::ostream&, const Handle&);
204 }; // class Handle
205 
206 std::ostream& operator<<(std::ostream& os, const Handle& handle);
207 } // namespace manipulation
208 } // namespace hpp
209 
210 #endif // HPP_MANIPULATION_HANDLE_HH
Definition: handle.hh:58
void maskComp(const std::vector< bool > &mask)
Set mask of complement constraint.
void clearance(const value_type &clearance)
Definition: handle.hh:165
virtual ~Handle()
Definition: handle.hh:61
static std::string className
Definition: handle.hh:60
virtual ImplicitPtr_t createGrasp(const GripperPtr_t &gripper, std::string name) const
const std::vector< bool > & maskComp() const
Get mask of complement constraint.
Definition: handle.hh:114
void joint(const JointPtr_t &joint)
Set joint to which the handle is linked.
Definition: handle.hh:95
const Transform3f & 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:182
value_type clearance() const
Definition: handle.hh:161
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
virtual ImplicitPtr_t createGraspAndComplement(const GripperPtr_t &gripper, std::string name) const
void name(const std::string &n)
Set name.
Definition: handle.hh:86
virtual std::ostream & print(std::ostream &os) const
static HandlePtr_t create(const std::string &name, const Transform3f &localPosition, const DeviceWkPtr_t &robot, const JointPtr_t &joint)
Definition: handle.hh:68
const std::vector< bool > & mask() const
Definition: handle.hh:108
Handle(const std::string &name, const Transform3f &localPosition, const DeviceWkPtr_t &robot, const JointPtr_t &joint)
Definition: handle.hh:173
void mask(const std::vector< bool > &mask)
Set constraint mask.
DevicePtr_t robot() const
Definition: handle.hh:97
friend std::ostream & operator<<(std::ostream &, const Handle &)
const std::string & name() const
Get name.
Definition: handle.hh:84
const JointPtr_t & joint() const
Get joint to which the handle is linked.
Definition: handle.hh:93
#define HPP_MANIPULATION_DLLAPI
Definition: config.hh:64
pinocchio::JointPtr_t JointPtr_t
Definition: fwd.hh:43
pinocchio::GripperPtr_t GripperPtr_t
Definition: fwd.hh:52
core::Transform3f Transform3f
Definition: fwd.hh:92
constraints::ImplicitPtr_t ImplicitPtr_t
Definition: fwd.hh:116
std::ostream & operator<<(std::ostream &os, const Handle &handle)
core::value_type value_type
Definition: fwd.hh:90
shared_ptr< Device > DevicePtr_t
Definition: fwd.hh:40
shared_ptr< Handle > HandlePtr_t
Definition: fwd.hh:59
Definition: main.hh:1