8#ifndef RBDL_QUATERNION_H
9#define RBDL_QUATERNION_H
44 (*
this)[3] * q[0] + (*
this)[0] * q[3] + (*
this)[1] * q[2] - (*
this)[2] * q[1],
45 (*
this)[3] * q[1] + (*
this)[1] * q[3] + (*
this)[2] * q[0] - (*
this)[0] * q[2],
46 (*
this)[3] * q[2] + (*
this)[2] * q[3] + (*
this)[0] * q[1] - (*
this)[1] * q[0],
47 (*
this)[3] * q[3] - (*
this)[0] * q[0] - (*
this)[1] * q[1] - (*
this)[2] * q[2]
52 (*
this)[3] * q[0] + (*
this)[0] * q[3] + (*
this)[1] * q[2] - (*
this)[2] * q[1],
53 (*
this)[3] * q[1] + (*
this)[1] * q[3] + (*
this)[2] * q[0] - (*
this)[0] * q[2],
54 (*
this)[3] * q[2] + (*
this)[2] * q[3] + (*
this)[0] * q[1] - (*
this)[1] * q[0],
55 (*
this)[3] * q[3] - (*
this)[0] * q[0] - (*
this)[1] * q[1] - (*
this)[2] * q[2]
61 double st =
std::sin (angle * M_PI / 360.);
75 #ifndef RBDL_USE_CASADI_MATH
80#ifndef RBDL_USE_CASADI_MATH
91#ifdef RBDL_USE_CASADI_MATH
92 return Quaternion (casadi::MX::if_else(casadi::MX::lt(dot (quat), 0.),
94 Quaternion( ((*
this) * p0 + quat * p1) * d)) );
96 if (dot (quat) < 0.) {
97 return Quaternion( ((*
this) * p0 - quat * p1) * d);
99 return Quaternion( ((*
this) * p0 + quat * p1) * d);
118 (mat(1,2) - mat(2,1)) / (w * 4.),
119 (mat(2,0) - mat(0,2)) / (w * 4.),
120 (mat(0,1) - mat(1,0)) / (w * 4.),
185 Scalar omega_norm = omega.norm();
191 Quaternion vec_quat (vn[0], vn[1], vn[2], 0.f), res_quat;
193 res_quat = vec_quat * (*this);
196 return Vector3d (res_quat[0], res_quat[1], res_quat[2]);
210 m(0, 0) = (*this)[3]; m(0, 1) = -(*this)[2]; m(0, 2) = (*this)[1];
211 m(1, 0) = (*this)[2]; m(1, 1) = (*this)[3]; m(1, 2) = -(*this)[0];
212 m(2, 0) = -(*this)[1]; m(2, 1) = (*this)[0]; m(2, 2) = (*this)[3];
213 m(3, 0) = -(*this)[0]; m(3, 1) = -(*this)[1]; m(3, 2) = -(*this)[2];
Quaternion that are used for singularity free joints.
Vector4d omegaToQDot(const Vector3d &omega) const
Converts a 3d angular velocity vector into a 4d derivative of the components of the quaternion.
Quaternion timeStep(const Vector3d &omega, double dt)
static Quaternion fromYXZAngles(const Vector3d &yxz_angles)
Quaternion(Scalar x, Scalar y, Scalar z, Scalar w)
static Quaternion fromAxisAngle(const Vector3d &axis, Scalar angle_rad)
static Quaternion fromXYZAngles(const Vector3d &xyz_angles)
Quaternion & operator*=(const Quaternion &q)
static Quaternion fromMatrix(const Matrix3d &mat)
Matrix3d toMatrix() const
Quaternion conjugate() const
Vector3d rotate(const Vector3d &vec) const
static Quaternion fromZYXAngles(const Vector3d &zyx_angles)
Quaternion operator*(const double &s) const
Quaternion slerp(double alpha, const Quaternion &quat) const
Quaternion(const Vector4d &vec4)
static Quaternion fromGLRotate(double angle, double x, double y, double z)
void set(const double &v0, const double &v1, const double &v2, const double &v3)
bool isnan(const casadi::MX &x)
MX_Xd_scalar sqrt(const MX_Xd_scalar &x)
MX_Xd_scalar acos(const MX_Xd_scalar &x)
MX_Xd_scalar cos(const MX_Xd_scalar &x)
MX_Xd_scalar sin(const MX_Xd_scalar &x)