18 #ifndef _GAZEBO_MATH_QUATERNION_HH_ 19 #define _GAZEBO_MATH_QUATERNION_HH_ 24 #include <ignition/math/Helpers.hh> 25 #include <ignition/math/Quaternion.hh> 35 #pragma GCC diagnostic push 36 #pragma GCC diagnostic ignored "-Wdeprecated-declarations" 58 public:
Quaternion(
const double &_w,
const double &_x,
const double &_y,
65 public:
Quaternion(
const double &_roll,
const double &_pitch,
84 public:
Quaternion(
const ignition::math::Quaterniond &_qt)
97 public: ignition::math::Quaterniond Ign()
const 103 public:
Quaternion &operator =(
const ignition::math::Quaterniond &_v)
114 Quaternion q(this->w, this->x, this->y, this->z);
117 s = q.
w * q.
w + q.
x * q.
x + q.
y * q.
y + q.
z * q.
z;
119 if (ignition::math::equal(s, 0.0))
157 public:
void SetFromAxis(
double _x,
double _y,
double _z,
double _a)
163 public:
void SetFromAxis(const
Vector3 &_axis,
double _a)
171 public:
void Set(
double _u,
double _x,
double _y,
double _z)
185 public:
void SetFromEuler(
double _roll,
double _pitch,
double _yaw)
190 public:
Vector3 GetAsEuler() const
204 public: static
Quaternion EulerToQuaternion(
double _x,
224 public:
void GetAsAxis(
Vector3 &_axis,
double &_angle) const
262 this->w*_q.w - this->x*_q.x - this->y*_q.y - this->z*_q.z,
263 this->w*_q.x + this->x*_q.w + this->y*_q.z - this->z*_q.y,
264 this->w*_q.y - this->x*_q.z + this->y*_q.w + this->z*_q.x,
265 this->w*_q.z + this->x*_q.y - this->y*_q.x + this->z*_q.w);
271 public:
Quaternion operator*(
const double &_f)
const 290 public:
bool operator ==(
const Quaternion &_qt)
const;
296 public:
bool operator!=(
const Quaternion &_qt)
const;
309 tmp = (*this) * (tmp * this->GetInverse());
326 if (!std::isfinite(this->x))
328 if (!std::isfinite(this->y))
330 if (!std::isfinite(this->z))
332 if (!std::isfinite(this->w))
335 if (ignition::math::equal(this->w, 0.0) &&
336 ignition::math::equal(this->x, 0.0) &&
337 ignition::math::equal(this->y, 0.0) &&
338 ignition::math::equal(this->z, 0.0))
371 public:
double Dot(const
Quaternion &_q) const
386 const
Quaternion &_rkQ,
bool _shortestPath = false)
398 const
Quaternion &_rkQ,
bool _shortestPath = false)
408 const
double _deltaT) const
427 public: friend
std::ostream &operator<<(
std::ostream &_out,
432 _out << precision(v.x, 6) <<
" " << precision(v.y, 6) <<
" " 433 << precision(v.z, 6);
445 double roll, pitch, yaw;
448 _in.setf(std::ios_base::skipws);
449 _in >> roll >> pitch >> yaw;
451 _q.SetFromEuler(
Vector3(roll, pitch, yaw));
460 #pragma GCC diagnostic pop
Forward declarations for the common classes.
Definition: Animation.hh:33
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:44
A 3x3 matrix class.
Definition: Matrix4.hh:40
double y
y value of the quaternion
Definition: Quaternion.hh:418
friend std::istream & operator>>(std::istream &_in, gazebo::math::Quaternion &_q) GAZEBO_DEPRECATED(8.0)
Stream extraction operator.
Definition: Quaternion.hh:441
double w
w value of the quaternion
Definition: Quaternion.hh:412
A 3x3 matrix class.
Definition: Matrix3.hh:40
A quaternion class.
Definition: Quaternion.hh:48
static const double GAZEBO_DEPRECATED(8.0) MAX_D
Double maximum value. This value will be similar to 1.79769e+308.
Definition: Helpers.hh:140
GAZEBO_VISIBLE void Set(common::Image &_img, const msgs::Image &_msg)
Convert a msgs::Image to a common::Image.
double x
x value of the quaternion
Definition: Quaternion.hh:415
Quaternion GetInverse() const GAZEBO_DEPRECATED(8.0)
Get the inverse of this quaternion.
Definition: Quaternion.hh:111
double z
z value of the quaternion
Definition: Quaternion.hh:421