hpp-pinocchio  6.0.0
Wrapping of the kinematic/dynamic chain Pinocchio for HPP.
frame.hh
Go to the documentation of this file.
1 //
2 // Copyright (c) 2017 CNRS
3 // Author: Joseph Mirabel
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_FRAME_HH
32 #define HPP_PINOCCHIO_FRAME_HH
33 
34 #include <cstddef>
35 #include <hpp/pinocchio/config.hh>
37 #include <hpp/pinocchio/fwd.hh>
38 
39 namespace hpp {
40 namespace pinocchio {
43  public:
46 
51  Frame(DeviceWkPtr_t device, FrameIndex indexInFrameList);
52 
53  ~Frame() {}
55  // -----------------------------------------------------------------------
58 
60  const std::string& name() const;
61 
63  // -----------------------------------------------------------------------
66 
69 
72 
77  JointJacobian_t jacobian() const { return jacobian(data()); }
78 
79  JointJacobian_t jacobian(const DeviceData& data) const;
80 
82  // -----------------------------------------------------------------------
85 
87  bool isFixed() const;
88 
90  JointPtr_t joint() const;
91 
94  Frame parentFrame() const;
95 
97  bool isRootFrame() const;
98 
99  const std::vector<FrameIndex>& children() {
100  setChildList();
101  return children_;
102  }
103 
106 
109 
113 
114  public:
115  // -----------------------------------------------------------------------
116 
119  selfAssert();
120  return devicePtr_.lock();
121  }
124  selfAssert();
125  return devicePtr_.lock();
126  }
127 
129  virtual std::ostream& display(std::ostream& os) const;
130 
133 
134  const FrameIndex& index() const { return frameIndex_; }
135 
136  const ::pinocchio::Frame& pinocchio() const;
137 
139 
140  private:
141  DeviceWkPtr_t devicePtr_;
142  FrameIndex frameIndex_;
143  std::vector<FrameIndex> children_;
144 
146 
148  void setChildList();
149  Model& model();
150  const Model& model() const;
151  DeviceData& data() const;
152 
154  void selfAssert() const;
155 }; // class Frame
156 
157 inline std::ostream& operator<<(std::ostream& os, const Frame& frame) {
158  return frame.display(os);
159 }
160 
161 } // namespace pinocchio
162 } // namespace hpp
163 
164 #endif // HPP_PINOCCHIO_FRAME_HH
Robot frame.
Definition: frame.hh:42
Frame parentFrame() const
const FrameIndex & index() const
Definition: frame.hh:134
bool isFixed() const
Returns true if the frame type is ::pinocchio::FIXED_JOINT.
Transform3s currentTransformation() const
Frame transformation.
JointJacobian_t jacobian() const
Definition: frame.hh:77
const ::pinocchio::Frame & pinocchio() const
const std::string & name() const
Get name.
DevicePtr_t robot()
Access robot owning the object.
Definition: frame.hh:123
Frame(DeviceWkPtr_t device, FrameIndex indexInFrameList)
bool isRootFrame() const
Returns true if this frame is the universe frame.
JointJacobian_t jacobian(const DeviceData &data) const
const std::vector< FrameIndex > & children()
Definition: frame.hh:99
DeviceConstPtr_t robot() const
Access robot owning the object.
Definition: frame.hh:118
virtual std::ostream & display(std::ostream &os) const
Display frame.
void positionInParentFrame(const Transform3s &p)
Set position of frame in parent frame.
Transform3s currentTransformation(const DeviceData &data) const
Frame transformation.
const Transform3s & positionInParentJoint() const
Get (constant) placement of frame in parent joint.
Transform3s positionInParentFrame() const
Get (constant) placement of frame in parent frame.
JointPtr_t joint() const
Returns the joint associated to this frame.
~Frame()
Definition: frame.hh:53
#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::ModelTpl< value_type, 0, JointCollectionTpl > Model
Definition: fwd.hh:77
::pinocchio::FrameIndex FrameIndex
Definition: fwd.hh:75
std::ostream & operator<<(std::ostream &os, const hpp::pinocchio::Device &device)
Definition: device.hh:366
Eigen::Matrix< value_type, 6, Eigen::Dynamic > JointJacobian_t
Definition: fwd.hh:101
::pinocchio::SE3 Transform3s
Definition: fwd.hh:81
shared_ptr< const Device > DeviceConstPtr_t
Definition: fwd.hh:119
Utility functions.
Definition: body.hh:39
Definition: collision-object.hh:40
Definition: device-data.hh:51