hpp-pinocchio  6.0.0
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 
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_PINOCCHIO_GRIPPER_HH
32 #define HPP_PINOCCHIO_GRIPPER_HH
33 
34 #include <hpp/pinocchio/config.hh>
35 #include <hpp/pinocchio/fwd.hh>
36 
37 namespace hpp {
38 namespace pinocchio {
49  public:
53  static GripperPtr_t create(const std::string& name,
54  const DeviceWkPtr_t& device) {
55  Gripper* ptr = new Gripper(name, device);
56  GripperPtr_t shPtr(ptr);
57  ptr->init(shPtr);
58  return shPtr;
59  }
60 
61  static GripperPtr_t createCopy(const GripperPtr_t& gripper,
62  const DeviceWkPtr_t& otherDevice) {
63  Gripper* ptr = new Gripper(gripper->name(), otherDevice);
64  ptr->clearance(gripper->clearance());
65  GripperPtr_t shPtr(ptr);
66  ptr->init(shPtr);
67  return shPtr;
68  }
69 
71  const JointPtr_t& joint() const { return joint_; }
72 
74  const FrameIndex& frameId() const { return fid_; }
75 
78 
80  const std::string& name() const { return name_; }
81 
88  value_type clearance() const { return clearance_; }
89 
92  void clearance(const value_type& clearance) { clearance_ = clearance; }
93 
95 
96  std::ostream& print(std::ostream& os) const;
97 
98  protected:
104  Gripper(const std::string& name, const DeviceWkPtr_t& device);
105 
106  void init(GripperWkPtr_t weakPtr) { weakPtr_ = weakPtr; }
107 
108  private:
109  inline DevicePtr_t device() const;
110 
111  std::string name_;
112  DeviceWkPtr_t device_;
114  JointPtr_t joint_;
115  mutable FrameIndex fid_;
117  value_type clearance_;
119  GripperWkPtr_t weakPtr_;
120 }; // class Gripper
121 
122 inline std::ostream& operator<<(std::ostream& os, const Gripper& gripper) {
123  return gripper.print(os);
124 }
125 } // namespace pinocchio
126 } // namespace hpp
127 
128 #endif // HPP_PINOCCHIO_GRIPPER_HH
Definition: gripper.hh:48
static GripperPtr_t create(const std::string &name, const DeviceWkPtr_t &device)
Definition: gripper.hh:53
const Transform3s & objectPositionInJoint() const
Get handle position in the the Grippering joint.
Gripper(const std::string &name, const DeviceWkPtr_t &device)
GripperPtr_t clone() const
const JointPtr_t & joint() const
Get joint to which the gripper is attached.
Definition: gripper.hh:71
const FrameIndex & frameId() const
Get the frame Id of the gripper in the vector of frame of the Model.
Definition: gripper.hh:74
void clearance(const value_type &clearance)
Definition: gripper.hh:92
const std::string & name() const
get name
Definition: gripper.hh:80
value_type clearance() const
Definition: gripper.hh:88
static GripperPtr_t createCopy(const GripperPtr_t &gripper, const DeviceWkPtr_t &otherDevice)
Definition: gripper.hh:61
void init(GripperWkPtr_t weakPtr)
Definition: gripper.hh:106
std::ostream & print(std::ostream &os) const
#define HPP_PINOCCHIO_DLLAPI
Definition: config.hh:88
shared_ptr< Device > DevicePtr_t
Definition: fwd.hh:118
shared_ptr< Joint > JointPtr_t
Definition: fwd.hh:123
::pinocchio::FrameIndex FrameIndex
Definition: fwd.hh:75
std::ostream & operator<<(std::ostream &os, const hpp::pinocchio::Device &device)
Definition: device.hh:366
::pinocchio::SE3 Transform3s
Definition: fwd.hh:81
double value_type
Definition: fwd.hh:51
shared_ptr< Gripper > GripperPtr_t
Definition: fwd.hh:125
Utility functions.
Definition: body.hh:39
Definition: collision-object.hh:40