Biorbd Release_1.13.0
Loading...
Searching...
No Matches
Rotation.h
1#ifndef BIORBD_UTILS_ROTATION_H
2#define BIORBD_UTILS_ROTATION_H
3
4#include "biorbdConfig.h"
5
6#include <memory>
7#include <vector>
8
9#include "Utils/Matrix3d.h"
10
11namespace BIORBD_NAMESPACE {
12namespace rigidbody {
13class NodeSegment;
14}
15
16namespace utils {
18class String;
19class Vector;
20class Vector3d;
21
25#ifdef SWIG
26class BIORBD_API Rotation
27#else
28class BIORBD_API Rotation : public Matrix3d
29#endif
30{
31 public:
36 Rotation(const Matrix3d& matrix = Matrix3d::Identity());
37
38#ifdef BIORBD_USE_EIGEN3_MATH
43 template <typename OtherDerived>
44 Rotation(const Eigen::MatrixBase<OtherDerived>& other) : Matrix3d(other) {
46 }
47#endif
48#ifdef BIORBD_USE_CASADI_MATH
53 Rotation(const RBDLCasadiMath::MX_Xd_static<3, 3>& other);
54
59 Rotation(const RBDLCasadiMath::MX_Xd_SubMatrix& other);
60#endif
61
75 const Scalar& v00,
76 const Scalar& v01,
77 const Scalar& v02,
78 const Scalar& v10,
79 const Scalar& v11,
80 const Scalar& v12,
81 const Scalar& v20,
82 const Scalar& v21,
83 const Scalar& v22);
84
93 Rotation(const Vector& rotation, const String& rotationSequence);
94
100
106 Vector3d axe(size_t idx) const;
107
114
124 static Rotation fromEulerAngles(const Vector& rot, const String& seq);
125
139 const std::pair<rigidbody::NodeSegment, rigidbody::NodeSegment>&
140 axis1markers,
141 const std::pair<rigidbody::NodeSegment, rigidbody::NodeSegment>&
142 axis2markers,
143 const std::pair<String, String>& axesNames,
144 const String& axisToRecalculate);
145
158 static Rotation fromMarkers(
159 const std::pair<rigidbody::NodeSegment, rigidbody::NodeSegment>&
160 axis1markers,
161 const std::pair<rigidbody::NodeSegment, rigidbody::NodeSegment>&
162 axis2markers,
163 const std::pair<String, String>& axesNames,
164 const String& axisToRecalculate);
165
176 static Vector toEulerAngles(const Rotation& r, const String& seq);
177
178#ifndef BIORBD_USE_CASADI_MATH
184 static utils::Rotation mean(const std::vector<utils::Rotation>& mToMean);
185#endif
186
187#ifndef SWIG
188#ifdef BIORBD_USE_EIGEN3_MATH
193 template <typename OtherDerived>
194 Rotation& operator=(const Eigen::MatrixBase<OtherDerived>& other) {
195 Eigen::Matrix3d::operator=(other);
196 return *this;
197 }
198#endif
199#ifdef BIORBD_USE_CASADI_MATH
204 void operator=(const RBDLCasadiMath::MX_Xd_static<3, 3>& other);
205
210 void operator=(const RBDLCasadiMath::MX_Xd_SubMatrix& other);
211#endif
212#endif
213
214 protected:
220 void checkUnitary();
221};
222
223} // namespace utils
224} // namespace BIORBD_NAMESPACE
225
226#ifndef SWIG
232std::ostream& operator<<(
233 std::ostream& os,
235#endif
236
237#endif // BIORBD_UTILS_ROTO_TRANS_H
A point attached to a segment, generally speaking a skin marker.
Definition NodeSegment.h:20
Matrix3d()
Construct matrix.
Definition Matrix3d.cpp:9
static utils::Rotation mean(const std::vector< utils::Rotation > &mToMean)
Get the mean of the Rotation matrices.
Definition Rotation.cpp:275
static Rotation fromMarkersNonNormalized(const std::pair< rigidbody::NodeSegment, rigidbody::NodeSegment > &axis1markers, const std::pair< rigidbody::NodeSegment, rigidbody::NodeSegment > &axis2markers, const std::pair< String, String > &axesNames, const String &axisToRecalculate)
fromMarkers Creates a system of axes from two axes defined by markers
Definition Rotation.cpp:89
static Rotation fromEulerAngles(const Vector &rot, const String &seq)
Create a Rotation from Euler angles.
Definition Rotation.cpp:57
void checkUnitary()
Check if the Rotation is a unitary matrix of rotation.
Definition Rotation.cpp:297
Vector3d axe(size_t idx) const
Get a particular axis of the Rotation matrix.
Definition Rotation.cpp:47
static Rotation fromSpatialTransform(const utils::SpatialTransform &st)
set the Rotation from a spatial transform
Definition Rotation.cpp:52
static Vector toEulerAngles(const Rotation &r, const String &seq)
Return extracted angles from the rotation matrix into Euler angles using the provided sequence.
Definition Rotation.cpp:187
static Rotation fromMarkers(const std::pair< rigidbody::NodeSegment, rigidbody::NodeSegment > &axis1markers, const std::pair< rigidbody::NodeSegment, rigidbody::NodeSegment > &axis2markers, const std::pair< String, String > &axesNames, const String &axisToRecalculate)
fromMarkers Creates a system of axes from two axes defined by markers
Definition Rotation.cpp:168
Rotation(const Matrix3d &matrix=Matrix3d::Identity())
Construct Rotation matrix.
Definition Rotation.cpp:13
Wrapper of the SpatialTransform (rotation and translation).
Wrapper around the std::string class with augmented functionality.
Definition String.h:18
Wrapper around Eigen Vector3d and attach it to a parent.
Definition Vector3d.h:27
Wrapper of the Eigen VectorXd.
Definition Vector.h:21