8 #pragma GCC diagnostic push 9 #pragma GCC diagnostic ignored "-Wunused-parameter" 10 #pragma GCC diagnostic ignored "-Wunused-value" 12 #pragma GCC diagnostic pop 28 template <
typename SCALAR =
double>
32 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
84 const Eigen::Matrix<SCALAR, 3, 1>&
position,
95 position_(homTransform.template topRightCorner<3, 1>())
97 kindr::RotationMatrix<SCALAR> rotMat(homTransform.template topLeftCorner<3, 3>());
103 : storage_(arg.storage_), quat_(arg.quat_), euler_(arg.euler_), position_(arg.position_)
113 position().toImplementation().isApprox(rhs.
position().toImplementation(), tol);
127 return kindr::EulerAnglesXyz<SCALAR>(quat_);
138 return kindr::RotationQuaternion<SCALAR>(euler_);
154 Eigen::AngleAxis<SCALAR> rollAngle(euler_.toImplementation()(0), Eigen::Matrix<SCALAR, 3, 1>::UnitX());
155 Eigen::AngleAxis<SCALAR> pitchAngle(euler_.toImplementation()(1), Eigen::Matrix<SCALAR, 3, 1>::UnitY());
156 Eigen::AngleAxis<SCALAR> yawAngle(euler_.toImplementation()(2), Eigen::Matrix<SCALAR, 3, 1>::UnitZ());
157 Eigen::Quaternion<SCALAR> q = rollAngle * pitchAngle * yawAngle;
158 return kindr::RotationMatrix<SCALAR>(q.matrix());
164 return kindr::RotationMatrix<SCALAR>(quat_);
175 euler_.toImplementation() = eulerAngles.toImplementation();
190 euler_.toImplementation() = eulerAngles;
194 quat_ = kindr::EulerAnglesXyz<SCALAR>(eulerAngles);
220 euler_ = kindr::EulerAnglesXyz<SCALAR>(kindr::RotationQuaternion<SCALAR>(quat));
224 quat_ = kindr::RotationQuaternion<SCALAR>(quat);
235 euler_ = kindr::EulerAnglesXyz<SCALAR>(rotMat);
239 quat_ = kindr::RotationQuaternion<SCALAR>(rotMat);
258 if (ref_frame.storedAsEuler() && storedAsEuler())
263 else if (ref_frame.storedAsEuler() && !storedAsEuler())
268 else if (!ref_frame.storedAsEuler() && storedAsEuler())
283 template <
class Vector3s>
293 Eigen::Matrix<SCALAR, 3, 1> vec_temp;
294 vec_temp << vector(0), vector(1), vector(2);
296 Eigen::Matrix<SCALAR, 3, 1> result = rotationMatrix.toImplementation() * vec_temp;
297 out = (Vector3s)result;
303 out = quat_.rotate(vector);
316 return rotMat.toImplementation() * mat;
325 kindr::RotationQuaternion<SCALAR> result;
328 result = kindr::RotationQuaternion<SCALAR>(euler_) * q;
338 template <
class Vector3s>
347 return kindr::RotationMatrix<SCALAR>(euler_).transposed().rotate(vector);
351 return quat_.inverseRotate(vector);
360 throw std::runtime_error(
"get homogeneous transform not implemented");
382 Eigen::Matrix<SCALAR, 6, 1> gravityWout(Eigen::Matrix<SCALAR, 6, 1>::Zero());
392 euler_.setIdentity();
401 position().toImplementation().setRandom();
407 bool storedAsEuler()
const 409 if (storage_ ==
EULER)
417 kindr::RotationQuaternion<SCALAR> quat_;
418 kindr::EulerAnglesXyz<SCALAR> euler_;
RigidBodyPose< SCALAR > inReferenceFrame(const RigidBodyPose< SCALAR > &ref_frame) const
This method returns the Base frame in a custom Frame specified in the Inertia Frame.
Definition: RigidBodyPose.h:256
Eigen::Matrix< double, 3, 3 > Matrix3Tpl
Definition: RigidBodyPose.h:46
RigidBodyPose(const RigidBodyPose< SCALAR > &arg)
copy-constructor for a RigidBodyPose
Definition: RigidBodyPose.h:102
STORAGE_TYPE
the orientation can either be stored as EulerAngles or as quaternion.
Definition: RigidBodyPose.h:38
Eigen::Matrix< SCALAR, 6, 1 > computeGravityB6D(const Vector3Tpl &gravityW=gravity3DW()) const
This methods returns the 6D gravity vector expressed in the Base frame.
Definition: RigidBodyPose.h:380
RigidBodyPose(const Matrix4Tpl &homTransform, STORAGE_TYPE storage=EULER)
construct a RigidBodyPose from a homogeneous transformation matrix
Definition: RigidBodyPose.h:91
Pose of a single rigid body.
Definition: RigidBodyPose.h:29
Vector3Tpl computeGravityB(const Vector3Tpl &gravityW=gravity3DW()) const
This methods returns the 3D gravity vector expressed in the Base frame.
Definition: RigidBodyPose.h:372
const Position3Tpl & position() const
This method returns the position of the Base frame in the inertia frame.
Definition: RigidBodyPose.h:246
void setFromRotationQuaternion(const kindr::RotationQuaternion< SCALAR > &quat)
This method sets the quaternion angles rotation (X,Y,Z / roll,pitch,yaw) from a kindr quaternion type...
Definition: RigidBodyPose.h:201
void setRandom()
Definition: RigidBodyPose.h:397
HomogeneousTransform getHomogeneousTransform() const
This methods returns the Homogeneous transform from the Base frame to the inertia frame...
Definition: RigidBodyPose.h:358
RigidBodyPose(const kindr::RotationQuaternion< SCALAR > &orientationQuat, const Position3Tpl &position, STORAGE_TYPE storage=EULER)
construct a RigidBodyPose from a rotation quaternion and a position vector
Definition: RigidBodyPose.h:71
Vector3s rotateInertiaToBase(const Vector3s &vector) const
This methods rotates a 3D vector expressed in Inertia frame to Base Frame.
Definition: RigidBodyPose.h:339
kindr::RotationQuaternion< SCALAR > rotateBaseToInertiaQuaternion(const kindr::RotationQuaternion< SCALAR > &q) const
This methods rotates a quaternion expressed in Base frame to Inertia Frame.
Definition: RigidBodyPose.h:323
kindr::EulerAnglesXyz< SCALAR > getEulerAnglesXyz() const
This method returns the Euler angles rotation (X,Y,Z / roll,pitch,yaw).
Definition: RigidBodyPose.h:119
CppAD::AD< CppAD::cg::CG< double > > SCALAR
kindr::HomogeneousTransformationPosition3RotationQuaternion< double > HomogeneousTransform
Definition: RigidBodyPose.h:44
STORAGE_TYPE getStorageType() const
Definition: RigidBodyPose.h:404
void setFromRotationQuaternion(const Eigen::Quaterniond &quat)
This method sets the quaternion angles rotation (X,Y,Z / roll,pitch,yaw) from an Eigen quaternion...
Definition: RigidBodyPose.h:216
Eigen::Matrix< double, 3, 1 > Vector3Tpl
Definition: RigidBodyPose.h:48
~RigidBodyPose()=default
destructor for a rigid body pose
void setIdentity()
Sets orientation to identity and position to (0, 0, 0)
Definition: RigidBodyPose.h:390
bool isNear(const RigidBodyPose &rhs, const double &tol=1e-10) const
Definition: RigidBodyPose.h:110
kindr::RotationQuaternion< SCALAR > getRotationQuaternion() const
This method returns the quaternion rotation.
Definition: RigidBodyPose.h:134
Eigen::Matrix< double, 4, 4 > Matrix4Tpl
Definition: RigidBodyPose.h:45
RigidBodyPose(const Eigen::Quaternion< SCALAR > &orientationQuat, const Eigen::Matrix< SCALAR, 3, 1 > &position, STORAGE_TYPE storage=EULER)
construct a RigidBodyPose from a rotation quaternion and a position vector
Definition: RigidBodyPose.h:83
Definition: RigidBodyPose.h:41
Position3Tpl & position()
This method returns the position of the Base frame in the inertia frame.
Definition: RigidBodyPose.h:251
kindr::RotationMatrix< SCALAR > getRotationMatrix() const
This method returns the rotation matrix from base to inertia frame. This method returns which is the...
Definition: RigidBodyPose.h:150
kindr::Position< double, 3 > Position3Tpl
Definition: RigidBodyPose.h:47
static Vector3Tpl gravity3DW(SCALAR g=SCALAR(-9.81))
Definition: RigidBodyPose.h:368
RigidBodyPose(STORAGE_TYPE storage=EULER)
default construct a RigidBodyPose
Definition: RigidBodyPose.h:51
Matrix3Tpl rotateBaseToInertiaMat(const Matrix3Tpl &mat) const
This methods rotates a 3D matrix expressed in Base frame to Inertia Frame.
Definition: RigidBodyPose.h:313
RigidBodyPose(const kindr::EulerAnglesXyz< SCALAR > &orientationEulerXyz, const Position3Tpl &position, STORAGE_TYPE storage=EULER)
construct a RigidBodyPose from Euler Angles and a position vector
Definition: RigidBodyPose.h:59
Definition: RigidBodyPose.h:40
Vector3s rotateBaseToInertia(const Vector3s &vector) const
This methods rotates a 3D vector expressed in Base frame to Inertia Frame.
Definition: RigidBodyPose.h:284
void setFromEulerAnglesXyz(const Vector3Tpl &eulerAngles)
This method sets the Euler angles rotation (X,Y,Z / roll,pitch,yaw) from a kindr type.
Definition: RigidBodyPose.h:186
void setFromRotationMatrix(const kindr::RotationMatrix< SCALAR > &rotMat)
This method sets the quaternion angles rotation from a kindr rotation matrix.
Definition: RigidBodyPose.h:231
void setFromEulerAnglesXyz(const kindr::EulerAnglesXyz< SCALAR > &eulerAngles)
This method sets the Euler angles rotation (X,Y,Z / roll,pitch,yaw) from a kindr type.
Definition: RigidBodyPose.h:171