13#include <geometry_msgs/msg/point.h>
14#include <geometry_msgs/msg/quaternion.h>
22 using vec_t = Eigen::Matrix<double, dims, 1>;
24 using pt2_t = vec_t<2>;
25 using vec2_t = vec_t<2>;
26 using pt3_t = vec_t<3>;
27 using vec3_t = vec_t<3>;
29 using mat3_t = Eigen::Matrix3d;
31 using quat_t = Eigen::Quaterniond;
32 using anax_t = Eigen::AngleAxisd;
35 vec_t<dims + 1> toHomogenous(
const vec_t<dims>& vec)
37 const Eigen::Matrix<double, dims + 1, 1> ret((Eigen::Matrix<double, dims + 1, 1>() << vec, 1).finished());
61 template <
typename OutRangeT = sradians>
64 const OutRangeT heading_enu(M_PI_2 - heading_ned);
65 return heading_enu.value();
85 template <
typename OutRangeT = radians>
88 const OutRangeT heading_ned(M_PI_2 - heading_enu);
89 return heading_ned.value();
106 template <
typename T>
109 const vec3_t rot_vec = rot * vec3_t::UnitX();
110 return std::atan2(rot_vec.y(), rot_vec.x());
129 double angleBetween(
const vec2_t& a,
const vec2_t& b);
143 double angleBetween(
const vec3_t& a,
const vec3_t& b);
196 Eigen::Matrix3d
rotationBetween(
const vec3_t& a,
const vec3_t& b,
const double tolerance = 1e-9);
209 double haversin(
const double angle);
237 double solidAngle(
double a,
double b,
double c);
293 double cross(
const vec2_t& a,
const vec2_t b);
307 double dist(
const vec2_t& a,
const vec2_t& b);
317 double dist(
const vec3_t& a,
const vec3_t& b);
332 double triangleArea(
const double a,
const double b,
const double c);
362 template <
typename T>
365 const mat3_t matrot(rot);
366 return matrot * cov * matrot.transpose();
Defines the cyclic class for calculations with cyclic quantities.
anax_t angleaxisBetween(const vec3_t &a, const vec3_t &b, const double tolerance=1e-9)
Returns the rotation between two vectors, represented as angle-axis.
double solidAngle(double a, double b, double c)
computes the solid angle for a spherical surface corresponding to a 'triangle' with edge lengths a,...
Definition misc.cpp:129
double dist(const vec2_t &a, const vec2_t &b)
distnace between two 2D Eigen vectors
Definition misc.cpp:169
double headingNEDtoENU(const double &heading_ned)
Converts the heading angle from the North-East-Down to the East-North-Up frame.
Definition misc.h:62
Eigen::Matrix3d rotationBetween(const vec3_t &a, const vec3_t &b, const double tolerance=1e-9)
Returns the rotation between two vectors, represented as a rotation matrix.
double invHaversin(const double value)
computes the inverse haversine angle for a given value
Definition misc.cpp:121
double haversin(const double angle)
computes the haversine (half of versine) for a given angle
Definition misc.cpp:112
double triangleArea(const double a, const double b, const double c)
uses Heron's formula to compute area of a given triangle using side lengths
Definition misc.cpp:139
double sphericalTriangleArea(Eigen::Vector3d a, Eigen::Vector3d b, Eigen::Vector3d c)
compute the area of a 'triangle' drawn on a spherical surface
Definition misc.cpp:148
quat_t quaternionFromHeading(const double heading)
create a quaternion from heading
Definition misc.cpp:91
double headingFromRot(const T &rot)
Returns the heading angle from the rotation.
Definition misc.h:107
quat_t quaternionFromEuler(double x, double y, double z)
create a quaternion from 3 provided Euler angles
Definition misc.cpp:79
double headingENUtoNED(const double &heading_enu)
Converts the heading angle from the East-North-Up to the North-East-Down frame.
Definition misc.h:86
mat3_t rotateCovariance(const mat3_t &cov, const T &rot)
Returns the covariance rotated using the specified rotation.
Definition misc.h:363
double cross(const vec2_t &a, const vec2_t b)
Implementation of cross product for 2D vectors.
Definition misc.cpp:19
quat_t quaternionBetween(const vec3_t &a, const vec3_t &b, const double tolerance=1e-9)
Returns the rotation between two vectors, represented as a quaternion.
All mrs_lib functions, classes, variables and definitions are contained in this namespace.
Definition attitude_converter.h:24