multibody/frame.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2016-2021 CNRS INRIA
3 //
4 
5 #ifndef __pinocchio_multibody_frame_hpp__
6 #define __pinocchio_multibody_frame_hpp__
7 
12 
13 #include <string>
14 
15 namespace pinocchio
16 {
31  enum FrameType
32  {
33  OP_FRAME = 0x1 << 0,
34  JOINT = 0x1 << 1,
35  FIXED_JOINT = 0x1 << 2,
36  BODY =
37  0x1 << 3,
38  SENSOR = 0x1 << 4
39  };
40 
41  template<typename _Scalar, int _Options>
42  struct traits<FrameTpl<_Scalar, _Options>>
43  {
44  typedef _Scalar Scalar;
45  enum
46  {
47  Options = _Options
48  };
49  };
50 
54  template<typename _Scalar, int _Options>
55  struct FrameTpl : ModelItem<FrameTpl<_Scalar, _Options>>
56  {
57  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
60  enum
61  {
63  };
65 
69 
76  : Base()
79  , type()
80  , inertia(Inertia::Zero())
81  {
82  } // needed by std::vector
84 
97  const std::string & name,
98  const JointIndex parentJoint,
99  const SE3 & frame_placement,
100  const FrameType type,
101  const Inertia & inertia = Inertia::Zero())
102  : Base(name, parentJoint, 0, frame_placement)
105  , type(type)
106  , inertia(inertia)
107  {
108  }
110 
124  const std::string & name,
125  const JointIndex parent_joint,
126  const FrameIndex parent_frame,
127  const SE3 & frame_placement,
128  const FrameType type,
129  const Inertia & inertia = Inertia::Zero())
130  : Base(name, parent_joint, parent_frame, frame_placement)
133  , type(type)
134  , inertia(inertia)
135  {
136  }
138 
146  FrameTpl(const FrameTpl & other)
147  : Base(other.name, other.parentJoint, other.parentFrame, other.placement)
150  , type(other.type)
151  , inertia(other.inertia)
152  {
153  }
155 
163  template<typename S2, int O2>
164  explicit FrameTpl(const FrameTpl<S2, O2> & other)
165  : Base(
166  other.name, other.parentJoint, other.parentFrame, other.placement.template cast<Scalar>())
169  , type(other.type)
170  , inertia(other.inertia.template cast<Scalar>())
171  {
172  }
174 
181 
183  {
184  name = other.name;
185  parentJoint = other.parentJoint;
186  parentFrame = other.parentFrame;
187  placement = other.placement;
188  type = other.type;
189  inertia = other.inertia;
190  return *this;
191  }
192 
200  template<typename S2, int O2>
201  bool operator==(const FrameTpl<S2, O2> & other) const
202  {
203  return name == other.name && parentJoint == other.parentJoint
204  && parentFrame == other.parentFrame && placement == other.placement
205  && type == other.type && inertia == other.inertia;
206  }
207 
211  template<typename S2, int O2>
212  bool operator!=(const FrameTpl<S2, O2> & other) const
213  {
214  return !(*this == other);
215  }
216 
218  template<typename NewScalar>
220  {
221  typedef FrameTpl<NewScalar, Options> ReturnType;
222  ReturnType res(
223  name, parentJoint, parentFrame, placement.template cast<NewScalar>(), type,
224  inertia.template cast<NewScalar>());
225  return res;
226  }
227 
228  // data
231  PINOCCHIO_DEPRECATED JointIndex & parent;
232 
235  PINOCCHIO_DEPRECATED FrameIndex & previousFrame;
236 
237  using Base::name;
238  using Base::parentFrame;
239  using Base::parentJoint;
240  using Base::placement;
241 
244 
249 
250  }; // struct FrameTpl
251 
252  template<typename Scalar, int Options>
253  inline std::ostream & operator<<(std::ostream & os, const FrameTpl<Scalar, Options> & f)
254  {
255  os << "Frame name: " << f.name << " paired to (parent joint/ parent frame)"
256  << "(" << f.parentJoint << "/" << f.parentFrame << ")" << std::endl
257  << "with relative placement wrt parent joint:\n"
258  << f.placement << "containing inertia:\n"
259  << f.inertia << std::endl;
260 
261  return os;
262  }
263 
264 } // namespace pinocchio
265 
266 #endif // ifndef __pinocchio_multibody_frame_hpp__
pinocchio::InertiaTpl< Scalar, Options >
pinocchio::FrameTpl::operator!=
bool operator!=(const FrameTpl< S2, O2 > &other) const
Definition: multibody/frame.hpp:212
pinocchio::traits< FrameTpl< _Scalar, _Options > >::Scalar
_Scalar Scalar
Definition: multibody/frame.hpp:44
pinocchio::FrameIndex
Index FrameIndex
Definition: multibody/fwd.hpp:28
pinocchio::FrameTpl::ModelItemDerived
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef FrameTpl< _Scalar, _Options > ModelItemDerived
Definition: multibody/frame.hpp:58
pinocchio::ModelItem< FrameTpl< _Scalar, _Options > >::parentJoint
JointIndex parentJoint
Index of the parent joint.
Definition: model-item.hpp:28
pinocchio::FrameTpl::operator==
bool operator==(const FrameTpl< S2, O2 > &other) const
Equality comparison operator.
Definition: multibody/frame.hpp:201
pinocchio::Options
Options
Definition: joint-configuration.hpp:1116
pinocchio::FrameType
FrameType
Enum on the possible types of frames.
Definition: multibody/frame.hpp:31
pinocchio::SE3Tpl< Scalar, Options >
pinocchio::SENSOR
@ SENSOR
sensor frame: defined in a sensor element
Definition: multibody/frame.hpp:38
pinocchio::FrameTpl::Options
@ Options
Definition: multibody/frame.hpp:62
inertia.hpp
PINOCCHIO_COMPILER_DIAGNOSTIC_POP
#define PINOCCHIO_COMPILER_DIAGNOSTIC_POP
Definition: include/pinocchio/macros.hpp:131
pinocchio::FrameTpl::parent
PINOCCHIO_DEPRECATED JointIndex & parent
Index of the parent joint.
Definition: multibody/frame.hpp:231
pinocchio::FrameTpl::FrameTpl
PINOCCHIO_COMPILER_DIAGNOSTIC_POP PINOCCHIO_COMPILER_DIAGNOSTIC_PUSH PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS FrameTpl(const FrameTpl &other)
Copy constructor.
Definition: multibody/frame.hpp:146
pinocchio::FrameTpl::placement
SE3 placement
Position of kinematic element in parent joint frame.
Definition: model-item.hpp:39
pinocchio::ModelItem
Definition: model-item.hpp:13
pinocchio::res
ReturnType res
Definition: spatial/classic-acceleration.hpp:57
autodiff-rnea.f
f
Definition: autodiff-rnea.py:24
pinocchio::FrameTpl::FrameTpl
PINOCCHIO_COMPILER_DIAGNOSTIC_POP PINOCCHIO_COMPILER_DIAGNOSTIC_PUSH PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS FrameTpl(const std::string &name, const JointIndex parent_joint, const FrameIndex parent_frame, const SE3 &frame_placement, const FrameType type, const Inertia &inertia=Inertia::Zero())
Builds a frame defined by its name, its joint parent id, its placement and its type.
Definition: multibody/frame.hpp:123
pinocchio::FrameTpl::operator=
PINOCCHIO_COMPILER_DIAGNOSTIC_POP FrameTpl< Scalar, Options > & operator=(const FrameTpl< Scalar, Options > &other)
Copy assignment operator. It needs to be user-define because references cannot be re-assigned during ...
Definition: multibody/frame.hpp:182
pinocchio::FrameTpl
A Plucker coordinate frame attached to a parent joint inside a kinematic tree.
Definition: multibody/frame.hpp:55
pinocchio::FrameTpl::JointIndex
pinocchio::JointIndex JointIndex
Definition: multibody/frame.hpp:68
pinocchio::FrameTpl::inertia
Inertia inertia
Inertia information attached to the frame. This inertia will be appended to the inertia supported by ...
Definition: multibody/frame.hpp:248
pinocchio::InertiaTpl< Scalar, Options >::Zero
static InertiaTpl Zero()
Definition: spatial/inertia.hpp:332
pinocchio::ModelItem< FrameTpl< _Scalar, _Options > >::placement
SE3 placement
Position of kinematic element in parent joint frame.
Definition: model-item.hpp:39
pinocchio::ModelItem< FrameTpl< _Scalar, _Options > >::parentFrame
FrameIndex parentFrame
Index of the parent frame.
Definition: model-item.hpp:36
pinocchio::FrameTpl::Inertia
InertiaTpl< Scalar, Options > Inertia
Definition: multibody/frame.hpp:67
pinocchio::FrameTpl::Scalar
traits< ModelItemDerived >::Scalar Scalar
Definition: multibody/frame.hpp:59
se3.hpp
pinocchio::FrameTpl::SE3
SE3Tpl< Scalar, Options > SE3
Definition: multibody/frame.hpp:66
PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS
#define PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS
Definition: include/pinocchio/macros.hpp:132
PINOCCHIO_COMPILER_DIAGNOSTIC_PUSH
#define PINOCCHIO_COMPILER_DIAGNOSTIC_PUSH
macros for pragma push/pop/ignore deprecated warnings
Definition: include/pinocchio/macros.hpp:130
pinocchio::operator<<
std::ostream & operator<<(std::ostream &os, const FrameTpl< Scalar, Options > &f)
Definition: multibody/frame.hpp:253
pinocchio::FrameTpl::FrameTpl
PINOCCHIO_COMPILER_DIAGNOSTIC_POP PINOCCHIO_COMPILER_DIAGNOSTIC_PUSH PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS FrameTpl(const FrameTpl< S2, O2 > &other)
Copy constructor by casting.
Definition: multibody/frame.hpp:164
pinocchio::JOINT
@ JOINT
joint frame: attached to the child body of a joint (a.k.a. child frame)
Definition: multibody/frame.hpp:34
pinocchio::FrameTpl::previousFrame
PINOCCHIO_DEPRECATED FrameIndex & previousFrame
Index of the previous frame.
Definition: multibody/frame.hpp:235
pinocchio::OP_FRAME
@ OP_FRAME
operational frame: user-defined frames that are defined at runtime
Definition: multibody/frame.hpp:33
pinocchio::FrameTpl::parentFrame
FrameIndex parentFrame
Index of the parent frame.
Definition: model-item.hpp:36
model-item.hpp
pinocchio::FrameTpl::cast
FrameTpl< NewScalar, Options > cast() const
Definition: multibody/frame.hpp:219
pinocchio::FIXED_JOINT
@ FIXED_JOINT
fixed joint frame: joint frame but for a fixed joint
Definition: multibody/frame.hpp:35
pinocchio::JointIndex
Index JointIndex
Definition: multibody/fwd.hpp:26
pinocchio::FrameTpl::type
FrameType type
Type of the frame.
Definition: multibody/frame.hpp:243
pinocchio::FrameTpl::name
std::string name
Name of the kinematic element.
Definition: model-item.hpp:25
pinocchio::FrameTpl::FrameTpl
PINOCCHIO_COMPILER_DIAGNOSTIC_PUSH PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS FrameTpl()
Default constructor of a frame.
Definition: multibody/frame.hpp:75
pinocchio::traits
Common traits structure to fully define base classes for CRTP.
Definition: fwd.hpp:71
pinocchio::FrameTpl::Base
ModelItem< ModelItemDerived > Base
Definition: multibody/frame.hpp:64
pinocchio::BODY
@ BODY
body frame: attached to the collision, inertial or visual properties of a link
Definition: multibody/frame.hpp:36
fwd.hpp
pinocchio::ModelItem< FrameTpl< _Scalar, _Options > >::name
std::string name
Name of the kinematic element.
Definition: model-item.hpp:25
pinocchio::FrameTpl::parentJoint
JointIndex parentJoint
Index of the parent joint.
Definition: model-item.hpp:28
pinocchio
Main pinocchio namespace.
Definition: timings.cpp:27
pinocchio::FrameTpl::FrameTpl
PINOCCHIO_COMPILER_DIAGNOSTIC_POP PINOCCHIO_COMPILER_DIAGNOSTIC_PUSH PINOCCHIO_COMPILER_DIAGNOSTIC_IGNORED_DEPRECECATED_DECLARATIONS FrameTpl(const std::string &name, const JointIndex parentJoint, const SE3 &frame_placement, const FrameType type, const Inertia &inertia=Inertia::Zero())
Builds a frame defined by its name, its joint parent id, its placement and its type.
Definition: multibody/frame.hpp:96


pinocchio
Author(s):
autogenerated on Sat Jun 22 2024 02:41:46