hpp-manipulation  4.9.0
Classes for manipulation planning.
handle.hh
Go to the documentation of this file.
1 // This file is part of hpp-manipulation.
7 // hpp-manipulation is free software: you can redistribute it
8 // and/or modify it under the terms of the GNU Lesser General Public
9 // License as published by the Free Software Foundation, either version
10 // 3 of the License, or (at your option) any later version.
11 //
12 // hpp-manipulation is distributed in the hope that it will be
13 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
14 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Lesser Public License for more details. You should have
16 // received a copy of the GNU Lesser General Public License along with
17 // hpp-manipulation. If not, see
18 // <http://www.gnu.org/licenses/>.
19 
20 #ifndef HPP_MANIPULATION_HANDLE_HH
21 # define HPP_MANIPULATION_HANDLE_HH
22 
23 # include <pinocchio/spatial/se3.hpp>
24 
25 # include <hpp/manipulation/fwd.hh>
26 # include <hpp/manipulation/config.hh>
27 
28 namespace hpp {
29  namespace manipulation {
32  class HPP_MANIPULATION_DLLAPI Handle
33  {
34  public:
35  static std::string className;
36  virtual ~Handle () {};
37 
43  static HandlePtr_t create (const std::string& name,
44  const Transform3f& localPosition,
45  const DeviceWkPtr_t& robot,
46  const JointPtr_t& joint)
47  {
48  Handle* ptr = new Handle (name, localPosition, robot, joint);
49  HandlePtr_t shPtr (ptr);
50  ptr->init (shPtr);
51  return shPtr;
52  }
54  virtual HandlePtr_t clone () const;
55 
58 
60  const std::string& name () const
61  {
62  return name_;
63  }
65  void name (const std::string& n)
66  {
67  name_ = n;
68  }
70 
73 
75  const JointPtr_t& joint () const
76  {
77  return joint_;
78  }
80  void joint (const JointPtr_t& joint)
81  {
82  joint_ = joint;
83  }
84 
85  DevicePtr_t robot () const
86  {
87  return robot_.lock();
88  }
90 
92  const Transform3f& localPosition () const
93  {
94  return localPosition_;
95  }
96 
98  void mask (const std::vector<bool>& mask);
99 
102  const std::vector<bool>& mask () const
103  { return mask_; }
104 
113  virtual ImplicitPtr_t createGrasp
114  (const GripperPtr_t& gripper, std::string name) const;
115 
122  virtual ImplicitPtr_t createGraspComplement
123  (const GripperPtr_t& gripper, std::string name) const;
124 
129  virtual ImplicitPtr_t createGraspAndComplement
130  (const GripperPtr_t& gripper, std::string name) const;
131 
139  virtual ImplicitPtr_t createPreGrasp
140  (const GripperPtr_t& gripper, const value_type& shift, std::string name) const;
141 
149  {
150  return clearance_;
151  }
152 
155  void clearance (const value_type& clearance)
156  {
157  clearance_ = clearance;
158  }
159 
160  protected:
166  Handle (const std::string& name, const Transform3f& localPosition,
167  const DeviceWkPtr_t& robot, const JointPtr_t& joint) :
168  name_ (name), localPosition_ (localPosition), joint_ (joint),
169  robot_ (robot), clearance_ (0), mask_ (6, true), weakPtr_ ()
170  {
171  }
172  void init (HandleWkPtr_t weakPtr)
173  {
174  weakPtr_ = weakPtr;
175  }
176 
177  virtual std::ostream& print (std::ostream& os) const;
178 
179  private:
180  std::string name_;
182  Transform3f localPosition_;
184  JointPtr_t joint_;
188  value_type clearance_;
190  std::vector<bool> mask_;
192  HandleWkPtr_t weakPtr_;
193 
194  friend std::ostream& operator<< (std::ostream&, const Handle&);
195  }; // class Handle
196 
197  std::ostream& operator<< (std::ostream& os, const Handle& handle);
198  } // namespace manipulation
199 } // namespace hpp
200 
201 #endif // HPP_MANIPULATION_HANDLE_HH
void name(const std::string &n)
Set name.
Definition: handle.hh:65
void clearance(const value_type &clearance)
Definition: handle.hh:155
Vec3f n
DevicePtr_t robot_
Handle(const std::string &name, const Transform3f &localPosition, const DeviceWkPtr_t &robot, const JointPtr_t &joint)
Definition: handle.hh:166
pinocchio::DeviceWkPtr_t DeviceWkPtr_t
const JointPtr_t & joint() const
Get joint to which the handle is linked.
Definition: handle.hh:75
Part of an object that is aimed at being grasped.
Definition: handle.hh:32
pinocchio::JointPtr_t JointPtr_t
Definition: fwd.hh:32
core::value_type value_type
Definition: fwd.hh:79
std::ostream & operator<<(std::ostream &os, const Handle &handle)
void init(HandleWkPtr_t weakPtr)
Definition: handle.hh:172
virtual ~Handle()
Definition: handle.hh:36
boost::shared_ptr< Device > DevicePtr_t
Definition: fwd.hh:29
const std::string & name() const
Get name.
Definition: handle.hh:60
boost::shared_ptr< Handle > HandlePtr_t
Definition: fwd.hh:48
const std::vector< bool > & mask() const
Definition: handle.hh:102
DevicePtr_t robot() const
Definition: handle.hh:85
constraints::ImplicitPtr_t ImplicitPtr_t
Definition: fwd.hh:105
value_type clearance() const
Definition: handle.hh:148
core::Transform3f Transform3f
Definition: fwd.hh:81
static HandlePtr_t create(const std::string &name, const Transform3f &localPosition, const DeviceWkPtr_t &robot, const JointPtr_t &joint)
Definition: handle.hh:43
boost::shared_ptr< Implicit > ImplicitPtr_t
const Transform3f & localPosition() const
Get local position in joint frame.
Definition: handle.hh:92
pinocchio::GripperPtr_t GripperPtr_t
Definition: fwd.hh:41
static std::string className
Definition: handle.hh:35
void joint(const JointPtr_t &joint)
Set joint to which the handle is linked.
Definition: handle.hh:80