11 #ifndef ATTITUDE_CONVERSION_H
12 #define ATTITUDE_CONVERSION_H
15 #include <Eigen/Dense>
31 Attitude(
const Eigen::Vector3d& vec,
const std::string& order =
"XYZ")
34 using AAd = Eigen::AngleAxisd;
35 using v3d = Eigen::Vector3d;
40 quaternion_ = AAd(vec(0), v3d::UnitX()) * AAd(vec(1), v3d::UnitY()) * AAd(vec(2), v3d::UnitZ());
42 else if (order ==
"ZYX")
44 quaternion_ = AAd(vec(2), v3d::UnitZ()) * AAd(vec(1), v3d::UnitY()) * AAd(vec(0), v3d::UnitX());
58 return { rpy(0), rpy(1) };
static Eigen::Vector3d RPYFromRotMat(const Eigen::Matrix3d &rot_mat)
RPYFromRotMat derives the roll pitch and yaw angle from a rotation matrix (in that order)
The Attitude struct.
Definition: attitude_conversion.h:23
Eigen::Matrix3d get_rotation_matrix()
Definition: attitude_conversion.h:50
Attitude(const Eigen::Vector3d &vec, const std::string &order="XYZ")
Definition: attitude_conversion.h:31
Attitude(const Eigen::Quaterniond &quaternion)
Definition: attitude_conversion.h:25
Eigen::Quaterniond quaternion_
Definition: attitude_conversion.h:48
friend std::ostream & operator<<(std::ostream &out, const Attitude &attitude)
Attitude(const Eigen::Matrix3d &rotation_matrix)
Definition: attitude_conversion.h:28
Eigen::Vector2d get_rp()
Definition: attitude_conversion.h:55