hpp-pinocchio  4.9.1
Wrapping of the kinematic/dynamic chain Pinocchio for HPP.
gripper.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2016 CNRS
3 // Authors: Joseph Mirabel from Florent Lamiraux
4 //
5 //
6 // This file is part of hpp-pinocchio.
7 // hpp-pinocchio 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-pinocchio 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-pinocchio. If not, see
18 // <http://www.gnu.org/licenses/>.
19 
20 #ifndef HPP_PINOCCHIO_GRIPPER_HH
21 # define HPP_PINOCCHIO_GRIPPER_HH
22 
23 # include <hpp/pinocchio/fwd.hh>
24 # include <hpp/pinocchio/config.hh>
25 
26 namespace hpp {
27  namespace pinocchio {
37  class HPP_PINOCCHIO_DLLAPI Gripper
38  {
39  public:
43  static GripperPtr_t create (const std::string& name,
44  const DeviceWkPtr_t& device)
45  {
46  Gripper* ptr = new Gripper (name, device);
47  GripperPtr_t shPtr (ptr);
48  ptr->init (shPtr);
49  return shPtr;
50  }
51 
52  static GripperPtr_t createCopy (const GripperPtr_t& gripper,
53  const DeviceWkPtr_t& otherDevice)
54  {
55  Gripper* ptr = new Gripper (gripper->name(), otherDevice);
56  ptr->clearance(gripper->clearance());
57  GripperPtr_t shPtr (ptr);
58  ptr->init (shPtr);
59  return shPtr;
60  }
61 
63  const JointPtr_t& joint () const
64  {
65  return joint_;
66  }
67 
69  const FrameIndex& frameId () const
70  {
71  return fid_;
72  }
73 
75  const Transform3f& objectPositionInJoint () const;
76 
78  const std::string& name () const
79  {
80  return name_;
81  }
82 
90  {
91  return clearance_;
92  }
93 
96  void clearance (const value_type& clearance)
97  {
98  clearance_ = clearance;
99  }
100 
101  GripperPtr_t clone () const;
102 
103  std::ostream& print (std::ostream& os) const;
104 
105  protected:
111  Gripper (const std::string& name, const DeviceWkPtr_t& device);
112 
113  void init (GripperWkPtr_t weakPtr)
114  {
115  weakPtr_ = weakPtr;
116  }
117 
118  private:
119  inline DevicePtr_t device() const;
120 
121  std::string name_;
122  DeviceWkPtr_t device_;
124  JointPtr_t joint_;
125  FrameIndex fid_;
127  value_type clearance_;
129  GripperWkPtr_t weakPtr_;
130  }; // class Gripper
131 
132  inline std::ostream& operator<< (std::ostream& os, const Gripper& gripper)
133  {
134  return gripper.print (os);
135  }
136  } // namespace pinocchio
137 } // namespace hpp
138 
139 #endif // HPP_PINOCCHIO_GRIPPER_HH
void clearance(const value_type &clearance)
Definition: gripper.hh:96
boost::shared_ptr< Device > DevicePtr_t
Definition: fwd.hh:104
Utility functions.
const JointPtr_t & joint() const
Get joint to which the gripper is attached.
Definition: gripper.hh:63
boost::shared_ptr< Gripper > GripperPtr_t
Definition: fwd.hh:111
Definition: gripper.hh:37
std::ostream & operator<<(std::ostream &os, const hpp::pinocchio::Device &device)
Definition: device.hh:344
::pinocchio::FrameIndex FrameIndex
Definition: fwd.hh:63
void init(GripperWkPtr_t weakPtr)
Definition: gripper.hh:113
double value_type
Definition: fwd.hh:40
::pinocchio::SE3 Transform3f
Definition: fwd.hh:69
const FrameIndex & frameId() const
Get the frame Id of the gripper in the vector of frame of the Model.
Definition: gripper.hh:69
std::ostream & print(std::ostream &os) const
value_type clearance() const
Definition: gripper.hh:89
const std::string & name() const
get name
Definition: gripper.hh:78
boost::shared_ptr< Joint > JointPtr_t
Definition: fwd.hh:109
static GripperPtr_t create(const std::string &name, const DeviceWkPtr_t &device)
Definition: gripper.hh:43
static GripperPtr_t createCopy(const GripperPtr_t &gripper, const DeviceWkPtr_t &otherDevice)
Definition: gripper.hh:52