15#ifndef TF2__IMPL__UTILS_HPP_
16#define TF2__IMPL__UTILS_HPP_
21#include <geometry_msgs/msg/quaternion.hpp>
22#include <geometry_msgs/msg/quaternion_stamped.hpp>
76 geometry_msgs::msg::QuaternionStamped>(t);
104 const double pi_2 = 1.57079632679489661923;
117 double sarg = -2 * (q.
x() * q.
z() - q.
w() * q.
y()) / (sqx + sqy + sqz + sqw);
118 if (sarg <= -0.99999) {
121 yaw = -2 * atan2(q.
y(), q.
x());
122 }
else if (sarg >= 0.99999) {
125 yaw = 2 * atan2(q.
y(), q.
x());
128 roll = atan2(2 * (q.
y() * q.
z() + q.
w() * q.
x()), sqw - sqx - sqy + sqz);
129 yaw = atan2(2 * (q.
x() * q.
y() + q.
w() * q.
z()), sqw + sqx - sqy - sqz);
156 double sarg = -2 * (q.
x() * q.
z() - q.
w() * q.
y()) / (sqx + sqy + sqz + sqw);
158 if (sarg <= -0.99999) {
159 yaw = -2 * atan2(q.
y(), q.
x());
160 }
else if (sarg >= 0.99999) {
161 yaw = 2 * atan2(q.
y(), q.
x());
163 yaw = atan2(2 * (q.
x() * q.
y() + q.
w() * q.
z()), sqw + sqx - sqy - sqz);
const tf2Scalar & y() const
Return the y value.
Definition QuadWord.hpp:77
const tf2Scalar & x() const
Return the x value.
Definition QuadWord.hpp:75
const tf2Scalar & w() const
Return the w value.
Definition QuadWord.hpp:81
const tf2Scalar & z() const
Return the z value.
Definition QuadWord.hpp:79
The Quaternion implements quaternion to perform linear algebra rotations in combination with Matrix3x...
Definition Quaternion.hpp:30
The data type which will be cross compatable with geometry_msgs This is the tf2 datatype equivilant o...
Definition transform_datatypes.hpp:49
Definition convert.hpp:35
void getEulerYPR(const tf2::Quaternion &q, double &yaw, double &pitch, double &roll)
Definition utils.hpp:102
double getYaw(const tf2::Quaternion &q)
Definition utils.hpp:140
tf2::Quaternion toQuaternion(const tf2::Quaternion &q)
Definition utils.hpp:39
Definition buffer_core.hpp:58
B toMsg(const A &a)
Function that converts from one type to a ROS message type. It has to be implemented by each data typ...
void fromMsg(const A &a, B &b)
Function that converts from a ROS message type to another type. It has to be implemented by each data...