Namespaces | Functions
pinocchio::quaternion Namespace Reference

Quaternion operations. More...

Namespaces

 internal
 

Functions

template<typename D1 , typename D2 >
D1::Scalar angleBetweenQuaternions (const Eigen::QuaternionBase< D1 > &q1, const Eigen::QuaternionBase< D2 > &q2)
 Compute the minimal angle between q1 and q2. More...
 
template<typename D , typename Matrix3 >
void assignQuaternion (Eigen::QuaternionBase< D > &quat, const Eigen::MatrixBase< Matrix3 > &R)
 
template<typename D1 , typename D2 >
bool defineSameRotation (const Eigen::QuaternionBase< D1 > &q1, const Eigen::QuaternionBase< D2 > &q2, const typename D1::RealScalar &prec=Eigen::NumTraits< typename D1::Scalar >::dummy_precision())
 Check if two quaternions define the same rotations. More...
 
template<typename Vector3Like >
Eigen::Quaternion< typename Vector3Like::Scalar, PINOCCHIO_EIGEN_PLAIN_TYPE(Vector3Like)::Optionsexp3 (const Eigen::MatrixBase< Vector3Like > &v)
 Exp: so3 -> SO3 (quaternion) More...
 
template<typename Vector3Like , typename QuaternionLike >
void exp3 (const Eigen::MatrixBase< Vector3Like > &v, Eigen::QuaternionBase< QuaternionLike > &quat_out)
 Exp: so3 -> SO3 (quaternion) More...
 
template<typename Vector6Like >
Eigen::Matrix< typename Vector6Like::Scalar, 7, 1, PINOCCHIO_EIGEN_PLAIN_TYPE(Vector6Like)::Optionsexp6 (const Eigen::MatrixBase< Vector6Like > &vec6)
 The se3 -> SE3 exponential map, using quaternions to represent the output rotation. More...
 
template<typename Vector6Like , typename Config_t >
void exp6 (const Eigen::MatrixBase< Vector6Like > &vec6, Eigen::MatrixBase< Config_t > &qout)
 The se3 -> SE3 exponential map, using quaternions to represent the output rotation. More...
 
template<typename MotionDerived >
Eigen::Matrix< typename MotionDerived::Scalar, 7, 1, PINOCCHIO_EIGEN_PLAIN_TYPE(typename MotionDerived::Vector3)::Optionsexp6 (const MotionDense< MotionDerived > &motion)
 The se3 -> SE3 exponential map, using quaternions to represent the output rotation. More...
 
template<typename MotionDerived , typename Config_t >
void exp6 (const MotionDense< MotionDerived > &motion, Eigen::MatrixBase< Config_t > &qout)
 The se3 -> SE3 exponential map, using quaternions to represent the output rotation. More...
 
template<typename D >
void firstOrderNormalize (const Eigen::QuaternionBase< D > &q)
 
template<typename Quaternion >
bool isNormalized (const Eigen::QuaternionBase< Quaternion > &quat, const typename Quaternion::Coefficients::RealScalar &prec=Eigen::NumTraits< typename Quaternion::Coefficients::RealScalar >::dummy_precision())
 Check whether the input quaternion is Normalized within the given precision. More...
 
template<typename Vector3Like , typename Matrix43Like >
void Jexp3CoeffWise (const Eigen::MatrixBase< Vector3Like > &v, const Eigen::MatrixBase< Matrix43Like > &Jexp)
 Derivative of $ q = \exp{\mathbf{v} + \delta\mathbf{v}} $ where $ \delta\mathbf{v} $ is a small perturbation of $ \mathbf{v} $ at identity. More...
 
template<typename QuaternionLike , typename Matrix3Like >
void Jlog3 (const Eigen::QuaternionBase< QuaternionLike > &quat, const Eigen::MatrixBase< Matrix3Like > &Jlog)
 Computes the Jacobian of log3 operator for a unit quaternion. More...
 
template<typename QuaternionLike >
Eigen::Matrix< typename QuaternionLike::Scalar, 3, 1, PINOCCHIO_EIGEN_PLAIN_TYPE(typename QuaternionLike::Vector3)::Optionslog3 (const Eigen::QuaternionBase< QuaternionLike > &quat)
 Log: SO3 -> so3. More...
 
template<typename QuaternionLike >
Eigen::Matrix< typename QuaternionLike::Scalar, 3, 1, PINOCCHIO_EIGEN_PLAIN_TYPE(typename QuaternionLike::Vector3)::Optionslog3 (const Eigen::QuaternionBase< QuaternionLike > &quat, typename QuaternionLike::Scalar &theta)
 Same as log3 but with a unit quaternion as input. More...
 
template<typename Quaternion >
void normalize (const Eigen::QuaternionBase< Quaternion > &quat)
 Normalize the input quaternion. More...
 
template<typename Scalar , typename QuaternionIn1 , typename QuaternionIn2 , typename QuaternionOut >
void slerp (const Scalar &u, const Eigen::QuaternionBase< QuaternionIn1 > &quat0, const Eigen::QuaternionBase< QuaternionIn2 > &quat1, const Eigen::QuaternionBase< QuaternionOut > &res)
 
template<typename Derived >
void uniformRandom (Eigen::QuaternionBase< Derived > &q)
 Uniformly random quaternion sphere. More...
 

Detailed Description

Quaternion operations.

Function Documentation

◆ angleBetweenQuaternions()

template<typename D1 , typename D2 >
D1::Scalar pinocchio::quaternion::angleBetweenQuaternions ( const Eigen::QuaternionBase< D1 > &  q1,
const Eigen::QuaternionBase< D2 > &  q2 
)

Compute the minimal angle between q1 and q2.

Parameters
[in]q1input quaternion.
[in]q2input quaternion.
Returns
angle between the two quaternions

Definition at line 34 of file math/quaternion.hpp.

◆ assignQuaternion()

template<typename D , typename Matrix3 >
void pinocchio::quaternion::assignQuaternion ( Eigen::QuaternionBase< D > &  quat,
const Eigen::MatrixBase< Matrix3 > &  R 
)

Definition at line 214 of file math/quaternion.hpp.

◆ defineSameRotation()

template<typename D1 , typename D2 >
bool pinocchio::quaternion::defineSameRotation ( const Eigen::QuaternionBase< D1 > &  q1,
const Eigen::QuaternionBase< D2 > &  q2,
const typename D1::RealScalar &  prec = Eigen::NumTraits<typename D1::Scalar>::dummy_precision() 
)

Check if two quaternions define the same rotations.

Note
Two quaternions define the same rotation iff q1 == q2 OR q1 == -q2.
Parameters
[in]q1input quaternion.
[in]q2input quaternion.
Returns
Return true if the two input quaternions define the same rotation.

Definition at line 57 of file math/quaternion.hpp.

◆ exp3() [1/2]

template<typename Vector3Like >
Eigen:: Quaternion<typename Vector3Like::Scalar, PINOCCHIO_EIGEN_PLAIN_TYPE(Vector3Like)::Options> pinocchio::quaternion::exp3 ( const Eigen::MatrixBase< Vector3Like > &  v)

Exp: so3 -> SO3 (quaternion)

Returns
the integral of the velocity vector as a quaternion.
Parameters
[in]vThe angular velocity vector.

Definition at line 75 of file explog-quaternion.hpp.

◆ exp3() [2/2]

template<typename Vector3Like , typename QuaternionLike >
void pinocchio::quaternion::exp3 ( const Eigen::MatrixBase< Vector3Like > &  v,
Eigen::QuaternionBase< QuaternionLike > &  quat_out 
)

Exp: so3 -> SO3 (quaternion)

Returns
the integral of the velocity vector as a quaternion.
Parameters
[in]vThe angular velocity vector.
[out]qoutThe quaternion where the result is stored.

Definition at line 27 of file explog-quaternion.hpp.

◆ exp6() [1/4]

template<typename Vector6Like >
Eigen:: Matrix<typename Vector6Like::Scalar, 7, 1, PINOCCHIO_EIGEN_PLAIN_TYPE(Vector6Like)::Options> pinocchio::quaternion::exp6 ( const Eigen::MatrixBase< Vector6Like > &  vec6)

The se3 -> SE3 exponential map, using quaternions to represent the output rotation.

Returns
the integral of the spatial velocity over unit time.
Parameters
[in]vec6the vector representing the spatial velocity.

Definition at line 184 of file explog-quaternion.hpp.

◆ exp6() [2/4]

template<typename Vector6Like , typename Config_t >
void pinocchio::quaternion::exp6 ( const Eigen::MatrixBase< Vector6Like > &  vec6,
Eigen::MatrixBase< Config_t > &  qout 
)

The se3 -> SE3 exponential map, using quaternions to represent the output rotation.

Returns
the integral of the spatial velocity over unit time.
Parameters
[in]vec6the vector representing the spatial velocity.
[out]qoutthe output transform in R^3 x S^3.

Definition at line 170 of file explog-quaternion.hpp.

◆ exp6() [3/4]

template<typename MotionDerived >
Eigen::Matrix< typename MotionDerived::Scalar, 7, 1, PINOCCHIO_EIGEN_PLAIN_TYPE(typename MotionDerived::Vector3)::Options> pinocchio::quaternion::exp6 ( const MotionDense< MotionDerived > &  motion)

The se3 -> SE3 exponential map, using quaternions to represent the output rotation.

Returns
the integral of the twist motion over unit time.
Parameters
[in]motionthe spatial motion.

Definition at line 149 of file explog-quaternion.hpp.

◆ exp6() [4/4]

template<typename MotionDerived , typename Config_t >
void pinocchio::quaternion::exp6 ( const MotionDense< MotionDerived > &  motion,
Eigen::MatrixBase< Config_t > &  qout 
)

The se3 -> SE3 exponential map, using quaternions to represent the output rotation.

Returns
the integral of the twist motion over unit time.
Parameters
[in]motionthe spatial motion.
[out]qthe output transform in $\mathbb{R}^3 x S^3$.

Definition at line 92 of file explog-quaternion.hpp.

◆ firstOrderNormalize()

template<typename D >
void pinocchio::quaternion::firstOrderNormalize ( const Eigen::QuaternionBase< D > &  q)

Approximately normalize by applying the first order limited development of the normalization function.

Only additions and multiplications are required. Neither square root nor division are used (except a division by 2). Let $ \delta = ||q||^2 - 1 $. Using the following limited development:

\[ \frac{1}{||q||} = (1 + \delta)^{-\frac{1}{2}} = 1 - \frac{\delta}{2} + \mathcal{O}(\delta^2) \]

The output is

\[ q_{out} = q \times \frac{3 - ||q_{in}||^2}{2} \]

The output quaternion is guaranted to statisfy the following:

\[ | ||q_{out}|| - 1 | \le \frac{M}{2} ||q_{in}|| ( ||q_{in}||^2 - 1 )^2 \]

where $ M = \frac{3}{4} (1 - \epsilon)^{-\frac{5}{2}} $ and $ \epsilon $ is the maximum tolerance of $ ||q_{in}||^2 - 1 $.

Warning
$ ||q||^2 - 1 $ should already be close to zero.
Note
See http://eigen.tuxfamily.org/dox/TopicFunctionTakingEigenTypes.html#title3 to know the reason why the argument is const.

Definition at line 89 of file math/quaternion.hpp.

◆ isNormalized()

template<typename Quaternion >
bool pinocchio::quaternion::isNormalized ( const Eigen::QuaternionBase< Quaternion > &  quat,
const typename Quaternion::Coefficients::RealScalar &  prec = Eigen::NumTraits<typename Quaternion::Coefficients::RealScalar>::dummy_precision() 
)
inline

Check whether the input quaternion is Normalized within the given precision.

Parameters
[in]quatInput quaternion
[in]precRequired precision
Returns
true if quat is normalized within the precision prec.

Definition at line 229 of file math/quaternion.hpp.

◆ Jexp3CoeffWise()

template<typename Vector3Like , typename Matrix43Like >
void pinocchio::quaternion::Jexp3CoeffWise ( const Eigen::MatrixBase< Vector3Like > &  v,
const Eigen::MatrixBase< Matrix43Like > &  Jexp 
)

Derivative of $ q = \exp{\mathbf{v} + \delta\mathbf{v}} $ where $ \delta\mathbf{v} $ is a small perturbation of $ \mathbf{v} $ at identity.

Returns
The Jacobian of the quaternion components variation.

Definition at line 292 of file explog-quaternion.hpp.

◆ Jlog3()

template<typename QuaternionLike , typename Matrix3Like >
void pinocchio::quaternion::Jlog3 ( const Eigen::QuaternionBase< QuaternionLike > &  quat,
const Eigen::MatrixBase< Matrix3Like > &  Jlog 
)

Computes the Jacobian of log3 operator for a unit quaternion.

 

Parameters
[in]quatA unit quaternion representing the input rotation.
[out]JlogThe resulting Jacobian of the log operator.

Definition at line 332 of file explog-quaternion.hpp.

◆ log3() [1/2]

template<typename QuaternionLike >
Eigen::Matrix< typename QuaternionLike::Scalar, 3, 1, PINOCCHIO_EIGEN_PLAIN_TYPE(typename QuaternionLike::Vector3)::Options> pinocchio::quaternion::log3 ( const Eigen::QuaternionBase< QuaternionLike > &  quat)

Log: SO3 -> so3.

Pseudo-inverse of log from $ SO3 -> { v \in so3, ||v|| \le pi } $.

Parameters
[in]quatThe unit quaternion representing a certain rotation.
Returns
The angular velocity vector associated to the quaternion.

Definition at line 278 of file explog-quaternion.hpp.

◆ log3() [2/2]

template<typename QuaternionLike >
Eigen::Matrix< typename QuaternionLike::Scalar, 3, 1, PINOCCHIO_EIGEN_PLAIN_TYPE(typename QuaternionLike::Vector3)::Options> pinocchio::quaternion::log3 ( const Eigen::QuaternionBase< QuaternionLike > &  quat,
typename QuaternionLike::Scalar &  theta 
)

Same as log3 but with a unit quaternion as input.

Parameters
[in]quatthe unit quaternion.
[out]thetathe angle value (resuling from compurations).
Returns
The angular velocity vector associated to the rotation matrix.

Definition at line 211 of file explog-quaternion.hpp.

◆ normalize()

template<typename Quaternion >
void pinocchio::quaternion::normalize ( const Eigen::QuaternionBase< Quaternion > &  quat)
inline

Normalize the input quaternion.

Parameters
[in]quatInput quaternion

Definition at line 243 of file math/quaternion.hpp.

◆ slerp()

template<typename Scalar , typename QuaternionIn1 , typename QuaternionIn2 , typename QuaternionOut >
void pinocchio::quaternion::slerp ( const Scalar &  u,
const Eigen::QuaternionBase< QuaternionIn1 > &  quat0,
const Eigen::QuaternionBase< QuaternionIn2 > &  quat1,
const Eigen::QuaternionBase< QuaternionOut > &  res 
)
inline
Returns
the spherical linear interpolation between the two quaternions
Parameters
[in]uInterpolation factor
[in]quatInput quaternion

Definition at line 259 of file math/quaternion.hpp.

◆ uniformRandom()

template<typename Derived >
void pinocchio::quaternion::uniformRandom ( Eigen::QuaternionBase< Derived > &  q)

Uniformly random quaternion sphere.

Definition at line 114 of file math/quaternion.hpp.



pinocchio
Author(s):
autogenerated on Mon Dec 16 2024 03:41:09