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 {
19  enum FrameType
20  {
21  OP_FRAME = 0x1 << 0, // operational frame type
22  JOINT = 0x1 << 1, // joint frame type
23  FIXED_JOINT = 0x1 << 2, // fixed joint frame type
24  BODY = 0x1 << 3, // body frame type
25  SENSOR = 0x1 << 4 // sensor frame type
26  };
27 
31  template<typename _Scalar, int _Options>
32  struct FrameTpl
33  {
34  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
36  enum { Options = _Options };
37  typedef _Scalar Scalar;
40 
45  : name()
46  , parent()
47  , placement()
48  , type()
49  , inertia(Inertia::Zero())
50  {} // needed by std::vector
51 
62  FrameTpl(const std::string & name,
63  const JointIndex parent,
65  const SE3 & frame_placement,
66  const FrameType type,
67  const Inertia & inertia = Inertia::Zero())
68  : name(name)
69  , parent(parent)
70  , previousFrame(previousFrame)
71  , placement(frame_placement)
72  , type(type)
73  , inertia(inertia)
74  {}
75 
83  template<typename S2, int O2>
84  bool operator == (const FrameTpl<S2,O2> & other) const
85  {
86  return name == other.name
87  && parent == other.parent
88  && previousFrame == other.previousFrame
89  && placement == other.placement
90  && type == other.type
91  && inertia == other.inertia;
92  }
93 
97  template<typename S2, int O2>
98  bool operator != (const FrameTpl<S2,O2> & other) const
99  {
100  return !(*this == other);
101  }
102 
104  template<typename NewScalar>
106  {
107  typedef FrameTpl<NewScalar,Options> ReturnType;
108  ReturnType res(name,
109  parent,
110  previousFrame,
111  placement.template cast<NewScalar>(),
112  type,
113  inertia.template cast<NewScalar>());
114  return res;
115  }
116 
117  // data
118 
120  std::string name;
121 
123  JointIndex parent;
124 
127 
130 
133 
137  Inertia inertia;
138 
139  }; // struct FrameTpl
140 
141  template<typename Scalar, int Options>
142  inline std::ostream & operator << (std::ostream& os,
143  const FrameTpl<Scalar,Options> & f)
144  {
145  os
146  << "Frame name: "
147  << f.name
148  << " paired to (parent joint/ previous frame)"
149  << "(" << f.parent << "/" << f.previousFrame << ")"
150  << std::endl
151  << "with relative placement wrt parent joint:\n"
152  << f.placement
153  << "containing inertia:\n"
154  << f.inertia
155  << std::endl;
156 
157  return os;
158  }
159 
160 } // namespace pinocchio
161 
162 #endif // ifndef __pinocchio_frame_hpp__
A Plucker coordinate frame attached to a parent joint inside a kinematic tree.
InertiaTpl< Scalar, Options > Inertia
JointIndex parent
Index of the parent joint.
FrameType type
Type of the frame.
FrameType
Enum on the possible types of frame.
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.
SE3 placement
Placement of the frame wrt the parent joint.
Main pinocchio namespace.
Definition: timings.cpp:30
res
Inertia inertia
Inertia information attached to the frame. This inertia will be appended to the inertia supported by ...
bool operator!=(const FrameTpl< S2, O2 > &other) const
std::string name
Name of the frame.
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
FrameTpl< NewScalar, Options > cast() const


pinocchio
Author(s):
autogenerated on Tue Jun 1 2021 02:45:03