pinocchio  2.5.6
A fast and flexible implementation of Rigid Body Dynamics algorithms and their analytical derivatives
frame.hpp
1 //
2 // Copyright (c) 2016,2018 CNRS
3 //
4 
5 #ifndef __pinocchio_frame_hpp__
6 #define __pinocchio_frame_hpp__
7 
8 #include "pinocchio/spatial/se3.hpp"
9 #include "pinocchio/multibody/fwd.hpp"
10 
11 #include <string>
12 
13 namespace pinocchio
14 {
18  enum FrameType
19  {
20  OP_FRAME = 0x1 << 0, // operational frame type
21  JOINT = 0x1 << 1, // joint frame type
22  FIXED_JOINT = 0x1 << 2, // fixed joint frame type
23  BODY = 0x1 << 3, // body frame type
24  SENSOR = 0x1 << 4 // sensor frame type
25  };
26 
30  template<typename _Scalar, int _Options>
31  struct FrameTpl
32  {
33  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
34  typedef pinocchio::JointIndex JointIndex;
35  enum { Options = _Options };
36  typedef _Scalar Scalar;
38 
42  FrameTpl() : name(), parent(), placement(), type() {} // needed by std::vector
43 
53  FrameTpl(const std::string & name,
54  const JointIndex parent,
55  const FrameIndex previousFrame,
56  const SE3 & frame_placement,
57  const FrameType type)
58  : name(name)
59  , parent(parent)
61  , placement(frame_placement)
62  , type(type)
63  {}
64 
72  template<typename S2, int O2>
73  bool operator == (const FrameTpl<S2,O2> & other) const
74  {
75  return name == other.name
76  && parent == other.parent
77  && previousFrame == other.previousFrame
78  && placement == other.placement
79  && type == other.type ;
80  }
81 
85  template<typename S2, int O2>
86  bool operator != (const FrameTpl<S2,O2> & other) const
87  {
88  return !(*this == other);
89  }
90 
92  template<typename NewScalar>
94  {
95  typedef FrameTpl<NewScalar,Options> ReturnType;
96  ReturnType res(name,
97  parent,
99  placement.template cast<NewScalar>(),
100  type);
101  return res;
102  }
103 
104  // data
105 
107  std::string name;
108 
110  JointIndex parent;
111 
113  FrameIndex previousFrame;
114 
117 
120 
121  }; // struct FrameTpl
122 
123  template<typename Scalar, int Options>
124  inline std::ostream & operator << (std::ostream& os, const FrameTpl<Scalar,Options> & f)
125  {
126  os
127  << "Frame name: "
128  << f.name
129  << " paired to (parent joint/ previous frame)"
130  << "(" <<f.parent << "/" << f.previousFrame << ")"
131  << std::endl
132  << "with relative placement wrt parent joint:\n" <<
133  f.placement
134  << std::endl;
135 
136  return os;
137  }
138 
139 } // namespace pinocchio
140 
141 #endif // ifndef __pinocchio_frame_hpp__
pinocchio::FrameTpl::type
FrameType type
Type of the frame.
Definition: frame.hpp:119
pinocchio::FrameTpl::FrameTpl
FrameTpl()
Default constructor of a frame.
Definition: frame.hpp:42
pinocchio::SE3Tpl< Scalar, Options >
pinocchio::FrameTpl
A Plucker coordinate frame attached to a parent joint inside a kinematic tree.
Definition: frame.hpp:31
pinocchio::FrameTpl::operator==
bool operator==(const FrameTpl< S2, O2 > &other) const
Equality comparison operator.
Definition: frame.hpp:73
pinocchio::FrameTpl::placement
SE3 placement
Placement of the frame wrt the parent joint.
Definition: frame.hpp:116
pinocchio::FrameTpl::parent
JointIndex parent
Index of the parent joint.
Definition: frame.hpp:110
pinocchio::FrameTpl::cast
FrameTpl< NewScalar, Options > cast() const
Definition: frame.hpp:93
pinocchio::FrameTpl::name
std::string name
Name of the frame.
Definition: frame.hpp:107
pinocchio::FrameTpl::previousFrame
FrameIndex previousFrame
Index of the previous frame.
Definition: frame.hpp:113
pinocchio::FrameTpl::FrameTpl
FrameTpl(const std::string &name, const JointIndex parent, const FrameIndex previousFrame, const SE3 &frame_placement, const FrameType type)
Builds a frame defined by its name, its joint parent id, its placement and its type.
Definition: frame.hpp:53
pinocchio::FrameType
FrameType
Enum on the possible types of frame.
Definition: frame.hpp:18
pinocchio::FrameTpl::operator!=
bool operator!=(const FrameTpl< S2, O2 > &other) const
Definition: frame.hpp:86
pinocchio
Main pinocchio namespace.
Definition: treeview.dox:24