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))
139 public:
void SetToIdentity() GAZEBO_DEPRECATED(8.0);
143 public:
Quaternion GetLog() const GAZEBO_DEPRECATED(8.0);
147 public:
Quaternion GetExp() const GAZEBO_DEPRECATED(8.0);
150 public:
void Normalize() GAZEBO_DEPRECATED(8.0);
157 public:
void SetFromAxis(
double _x,
double _y,
double _z,
double _a)
158 GAZEBO_DEPRECATED(8.0);
163 public:
void SetFromAxis(const
Vector3 &_axis,
double _a)
164 GAZEBO_DEPRECATED(8.0);
171 public:
void Set(
double _u,
double _x,
double _y,
double _z)
172 GAZEBO_DEPRECATED(8.0);
179 public:
void SetFromEuler(const
Vector3 &_vec) GAZEBO_DEPRECATED(8.0);
185 public:
void SetFromEuler(
double _roll,
double _pitch,
double _yaw)
186 GAZEBO_DEPRECATED(8.0);
190 public:
Vector3 GetAsEuler() const
191 GAZEBO_DEPRECATED(8.0);
197 GAZEBO_DEPRECATED(8.0);
204 public: static
Quaternion EulerToQuaternion(
double _x,
207 GAZEBO_DEPRECATED(8.0);
211 public:
double GetRoll() GAZEBO_DEPRECATED(8.0);
215 public:
double GetPitch() GAZEBO_DEPRECATED(8.0);
219 public:
double GetYaw() GAZEBO_DEPRECATED(8.0);
224 public:
void GetAsAxis(
Vector3 &_axis,
double &_angle) const
225 GAZEBO_DEPRECATED(8.0);
229 public:
void Scale(
double _scale) GAZEBO_DEPRECATED(8.0);
235 GAZEBO_DEPRECATED(8.0);
241 GAZEBO_DEPRECATED(8.0);
247 GAZEBO_DEPRECATED(8.0);
253 GAZEBO_DEPRECATED(8.0);
259 GAZEBO_DEPRECATED(8.0)
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;
300 public:
Quaternion operator-() const GAZEBO_DEPRECATED(8.0);
306 GAZEBO_DEPRECATED(8.0)
309 tmp = (*this) * (tmp * this->GetInverse());
321 public:
bool IsFinite() const GAZEBO_DEPRECATED(8.0);
324 public: inline
void Correct() GAZEBO_DEPRECATED(8.0)
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))
346 public:
Matrix3 GetAsMatrix3() const GAZEBO_DEPRECATED(8.0);
350 public:
Matrix4 GetAsMatrix4() const GAZEBO_DEPRECATED(8.0);
354 public:
Vector3 GetXAxis() const GAZEBO_DEPRECATED(8.0);
358 public:
Vector3 GetYAxis() const GAZEBO_DEPRECATED(8.0);
362 public:
Vector3 GetZAxis() const GAZEBO_DEPRECATED(8.0);
366 public:
void Round(
int _precision) GAZEBO_DEPRECATED(8.0);
371 public:
double Dot(const
Quaternion &_q) const
372 GAZEBO_DEPRECATED(8.0);
386 const
Quaternion &_rkQ,
bool _shortestPath = false)
387 GAZEBO_DEPRECATED(8.0);
398 const
Quaternion &_rkQ,
bool _shortestPath = false)
399 GAZEBO_DEPRECATED(8.0);
408 const
double _deltaT) const
409 GAZEBO_DEPRECATED(8.0);
427 public: friend std::ostream &operator<<(std::ostream &_out,
429 GAZEBO_DEPRECATED(8.0)
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
The Vector3 class represents the generic vector containing 3 elements.
Definition: Vector3.hh:44
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
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
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