pinocchio  UNKNOWN
frame.hpp
1 //
2 // Copyright (c) 2016 CNRS
3 //
4 // This file is part of Pinocchio
5 // Pinocchio is free software: you can redistribute it
6 // and/or modify it under the terms of the GNU Lesser General Public
7 // License as published by the Free Software Foundation, either version
8 // 3 of the License, or (at your option) any later version.
9 //
10 // Pinocchio is distributed in the hope that it will be
11 // useful, but WITHOUT ANY WARRANTY; without even the implied warranty
12 // of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 // General Lesser Public License for more details. You should have
14 // received a copy of the GNU Lesser General Public License along with
15 // Pinocchio If not, see
16 // <http://www.gnu.org/licenses/>.
17 
18 #ifndef __se3_frame_hpp__
19 #define __se3_frame_hpp__
20 
21 #include "pinocchio/spatial/se3.hpp"
22 #include "pinocchio/multibody/fwd.hpp"
23 
24 #include <string>
25 
26 namespace se3
27 {
31  enum FrameType
32  {
33  OP_FRAME = 0x1 << 0, // operational frame type
34  JOINT = 0x1 << 1, // joint frame type
35  FIXED_JOINT = 0x1 << 2, // fixed joint frame type
36  BODY = 0x1 << 3, // body frame type
37  SENSOR = 0x1 << 4 // sensor frame type
38  };
39 
43  template<typename _Scalar, int _Options>
44  struct FrameTpl
45  {
46  EIGEN_MAKE_ALIGNED_OPERATOR_NEW
47  typedef se3::JointIndex JointIndex;
48  enum { Options = _Options };
49  typedef _Scalar Scalar;
51 
55  FrameTpl() : name(), parent(), placement(), type() {} // needed by std::vector
56 
66  FrameTpl(const std::string & name,
67  const JointIndex parent,
68  const FrameIndex previousFrame,
69  const SE3 & frame_placement,
70  const FrameType type)
71  : name(name)
72  , parent(parent)
73  , previousFrame(previousFrame)
74  , placement(frame_placement)
75  , type(type)
76  {}
77 
83  template<typename S2, int O2>
84  bool operator == (const FrameTpl<S2,O2> & other) const
85  {
86  return name == other.name && parent == other.parent
87  && previousFrame == other.previousFrame
88  && placement == other.placement
89  && type == other.type ;
90  }
91 
93  std::string name;
94 
96  JointIndex parent;
97 
99  FrameIndex previousFrame;
100 
103 
106 
107  }; // struct FrameTpl
108 
109  template<typename Scalar, int Options>
110  inline std::ostream & operator << (std::ostream& os, const FrameTpl<Scalar,Options> & f)
111  {
112  os
113  << "Frame name: "
114  << f.name
115  << " paired to (parent joint/ previous frame)"
116  << "(" <<f.parent << "/" << f.previousFrame << ")"
117  << std::endl
118  << "with relative placement wrt parent joint:\n" <<
119  f.placement
120  << std::endl;
121 
122  return os;
123  }
124 
125 } // namespace se3
126 
127 #endif // ifndef __se3_frame_hpp__
JointIndex parent
Index of the parent joint.
Definition: frame.hpp:96
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:66
FrameType type
Type of the frame.
Definition: frame.hpp:105
bool operator==(const FrameTpl< S2, O2 > &other) const
Definition: frame.hpp:84
A Plucker coordinate frame attached to a parent joint inside a kinematic tree.
Definition: frame.hpp:44
FrameIndex previousFrame
Index of the previous frame.
Definition: frame.hpp:99
FrameType
Enum on the possible types of frame.
Definition: frame.hpp:31
FrameTpl()
Default constructor of a frame.
Definition: frame.hpp:55
std::string name
Name of the frame.
Definition: frame.hpp:93
SE3 placement
Placement of the frame wrt the parent joint.
Definition: frame.hpp:102