src/multibody/frame.hpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2016-2021 CNRS INRIA
3 //
4 
5 #ifndef __pinocchio_frame_hpp__
6 #define __pinocchio_frame_hpp__
7 
8 #include "pinocchio/spatial/se3.hpp"
9 #include "pinocchio/spatial/inertia.hpp"
10 #include "pinocchio/multibody/fwd.hpp"
11 
12 #include <string>
13 
14 namespace pinocchio
15 {
28  enum FrameType
29  {
30  OP_FRAME = 0x1 << 0,
31  JOINT = 0x1 << 1,
32  FIXED_JOINT = 0x1 << 2,
33  BODY = 0x1 << 3,
34  SENSOR = 0x1 << 4
35  };
36 
40  template<typename _Scalar, int _Options>
41  struct FrameTpl
42  {
43  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
45  enum { Options = _Options };
46  typedef _Scalar Scalar;
49 
54  : name()
55  , parent()
56  , placement()
57  , type()
58  , inertia(Inertia::Zero())
59  {} // needed by std::vector
60 
71  FrameTpl(const std::string & name,
72  const JointIndex parent,
74  const SE3 & frame_placement,
75  const FrameType type,
76  const Inertia & inertia = Inertia::Zero())
77  : name(name)
78  , parent(parent)
79  , previousFrame(previousFrame)
80  , placement(frame_placement)
81  , type(type)
82  , inertia(inertia)
83  {}
84 
92  template<typename S2, int O2>
93  bool operator == (const FrameTpl<S2,O2> & other) const
94  {
95  return name == other.name
96  && parent == other.parent
97  && previousFrame == other.previousFrame
98  && placement == other.placement
99  && type == other.type
100  && inertia == other.inertia;
101  }
102 
106  template<typename S2, int O2>
107  bool operator != (const FrameTpl<S2,O2> & other) const
108  {
109  return !(*this == other);
110  }
111 
113  template<typename NewScalar>
115  {
116  typedef FrameTpl<NewScalar,Options> ReturnType;
117  ReturnType res(name,
118  parent,
119  previousFrame,
120  placement.template cast<NewScalar>(),
121  type,
122  inertia.template cast<NewScalar>());
123  return res;
124  }
125 
126  // data
127 
129  std::string name;
130 
132  JointIndex parent;
133 
136 
139 
142 
146  Inertia inertia;
147 
148  }; // struct FrameTpl
149 
150  template<typename Scalar, int Options>
151  inline std::ostream & operator << (std::ostream& os,
152  const FrameTpl<Scalar,Options> & f)
153  {
154  os
155  << "Frame name: "
156  << f.name
157  << " paired to (parent joint/ previous frame)"
158  << "(" << f.parent << "/" << f.previousFrame << ")"
159  << std::endl
160  << "with relative placement wrt parent joint:\n"
161  << f.placement
162  << "containing inertia:\n"
163  << f.inertia
164  << std::endl;
165 
166  return os;
167  }
168 
169 } // namespace pinocchio
170 
171 #endif // ifndef __pinocchio_frame_hpp__
joint frame: attached to the child body of a joint (a.k.a. child frame)
A Plucker coordinate frame attached to a parent joint inside a kinematic tree.
InertiaTpl< Scalar, Options > Inertia
JointIndex parent
Index of the parent joint.
fixed joint frame: joint frame but for a fixed joint
bool operator!=(const FrameTpl< S2, O2 > &other) const
operational frame: user-defined frames that are defined at runtime
FrameType type
Type of the frame.
FrameType
Enum on the possible types of frames.
body frame: attached to the collision, inertial or visual properties of a link
EIGEN_MAKE_ALIGNED_OPERATOR_NEW typedef pinocchio::JointIndex JointIndex
std::ostream & operator<<(std::ostream &os, const FrameTpl< Scalar, Options > &f)
bool operator==(const FrameTpl< S2, O2 > &other) const
Equality comparison operator.
FrameTpl()
Default constructor of a frame.
FrameTpl< NewScalar, Options > cast() const
SE3 placement
Placement of the frame wrt the parent joint.
Main pinocchio namespace.
Definition: timings.cpp:28
res
Inertia inertia
Inertia information attached to the frame. This inertia will be appended to the inertia supported by ...
std::string name
Name of the frame.
sensor frame: defined in a sensor element
FrameTpl(const std::string &name, const JointIndex parent, const FrameIndex previousFrame, 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.
FrameIndex previousFrame
Index of the previous frame.
SE3Tpl< Scalar, Options > SE3


pinocchio
Author(s):
autogenerated on Fri Jun 23 2023 02:38:30