wuzp
Wrong Unit? Zero Points! Compile-time checks for units, coordinate systems and points vs. vectors.
Loading...
Searching...
No Matches
wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ > Class Template Reference

An active rotation in its coordinate system: the dimensionless linear transformation x -> R x whose matrix R is orthogonal with determinant 1, R R^T = I and det(R) = 1. More...

#include <wuzp/trafo/ActiveSpatialRotation.hpp>

Inherits wuzp::ActiveTransformation< ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ > >.

Public Types

using LinearTransformationT
 The active linear transformation with the matrix of the rotation, whose transformations the rotation shares.
using ValueT = ValueT_
using ValuesT = typename LinearTransformationT::ValuesT
using UnitsT = typename LinearTransformationT::UnitsT
using QuantitiesT = typename LinearTransformationT::QuantitiesT
using CoordinateSystemT = CoordinateSystemT_
using TensorT = typename LinearTransformationT::TensorT
using QuaternionT = typename ParameterizationsT::QuaternionT
 A unit quaternion (w, x, y, z) = (cos(angle / 2), sin(angle / 2) n) of the rotation by an angle around the unit axis n, in the convention of Hamilton, ij = k, with the real part w first, like Eigen's Quaternion(w, x, y, z) and kindr's RotationQuaternion(w, x, y, z), but unlike the storage order (x, y, z, w) of Eigen's coeffs().
using QuaternionDerivativeT = typename ParameterizationsT::QuaternionDerivativeT
 The derivative dq/dt of a quaternion with respect to time, in the unit of an angular velocity.
using AngleT = typename ParameterizationsT::AngleT
 An angle, e.g. of a rotation around its axis, or between two rotations.
using AxisT = typename ParameterizationsT::template AxisT<CoordinateSystemT_>
 The unit axis of a rotation, expressed in the coordinate system.
using AngleAxisT = std::pair<AngleT, AxisT>
 The angle and the unit axis of a rotation.
using RotationVectorT = typename ParameterizationsT::template RotationVectorT<CoordinateSystemT_>
 A rotation vector angle * axis, expressed in the coordinate system, e.g. the logarithm of a rotation or an increment of boxPlus().
using EulerAnglesT = typename ParameterizationsT::EulerAnglesT
 Three Euler angles, in the order of the axes in their name, e.g. (yaw, pitch, roll) for ZYX.
using EulerAnglesDerivativeT = typename ParameterizationsT::EulerAnglesDerivativeT
 The derivatives of three Euler angles with respect to time.
using AngularVelocityT = typename ParameterizationsT::template AngularVelocityT<CoordinateSystemT_>
 The angular velocity w of a rotation R, dR/dt = [w]x R, expressed in the coordinate system.
using MatrixDerivativeT = typename ParameterizationsT::MatrixDerivativeT
 The derivative dR/dt of the matrix of a rotation with respect to time.

Public Member Functions

 ActiveSpatialRotation ()
 The identity.
template<typename... Args>
requires (sizeof...(Args) > 0 && !CopiesOrMoves<ActiveSpatialRotation, Args...>)
 ActiveSpatialRotation (Args &&... args)
 The rotation whose matrix is constructed from the arguments, e.g. its elements row by row, or its quantities.
const QuantitiesT & getQuantities () const
 The matrix R, which transforms a vector v into R v.
TensorT getTensor () const
 The matrix as a linear map, a tensor with an upper and a lower index.
ActiveSpatialRotation inverse () const
 The inverse rotation, whose matrix is the transpose R^T = R^-1: it needs no matrix inverse.
bool isValid (const ValueT tolerance=ValidityTolerance< ValueT >::value()) const
 Whether the matrix is a rotation: max_ij |(R R^T - I)_ij| <= tolerance, and det(R) > 0 (see internal::isRotation()).
template<template< typename, int, int > typename ValuesOtherT_, typename ValueOtherT_, typename CoordinateSystemOtherT_, int DimensionOtherV_>
bool isApprox (const ActiveSpatialRotation< ValuesOtherT_, ValueOtherT_, CoordinateSystemOtherT_, DimensionOtherV_ > &other, const ValueT precision=Precision< ValueT >::value()) const
 Whether both rotations, which must be expressed in the same coordinate system, are approximately equal: their matrices are compared like the components of tensors (see Tensor::isApprox()).
QuaternionT toQuaternion () const
 The unique unit quaternion of the rotation, whose first element that is not zero is positive, like kindr's RotationQuaternion::getUnique(): its real part w is not negative, so its angle is in [0, pi] (see internal::quaternionFromMatrix()).
AngleAxisT toAngleAxis () const
 The angle in [0, pi] and the unit axis of the rotation.
RotationVectorT toRotationVector () const
 The logarithmic map Log(R), the rotation vector of the rotation, whose norm, the angle, is in [0, pi], like kindr's logarithmicMap().
EulerAnglesT toEulerAnglesZyx () const
 The Euler angles ZYX (yaw, pitch, roll) of the rotation (see fromEulerAnglesZyx()), with yaw and roll in [-pi, pi) and pitch in [-pi/2, pi/2].
EulerAnglesT toEulerAnglesXyz () const
 The Euler angles XYZ (a0, a1, a2) of the rotation (see fromEulerAnglesXyz()), with a0 and a2 in [-pi, pi) and a1 in [-pi/2, pi/2] (see internal::eulerAnglesXyzFromMatrix()).
template<AnyTensor RotationVectorOtherT_>
ActiveSpatialRotation boxPlus (const RotationVectorOtherT_ &rotationVector) const
 The rotation R (+) v = Exp(v) R, rotated further by the rotation vector v, which is expressed in the coordinate system: the left plus of Solà et al.
template<typename CoordinateSystemOtherT_>
RotationVectorT boxMinus (const ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemOtherT_, DimensionV_ > &other) const
 The rotation vector R (-) S = Log(R S^T), expressed in the coordinate system, which rotates the other rotation S into this one: other.boxPlus(boxMinus(other)) is this rotation.
template<typename CoordinateSystemOtherT_>
AngleT angularDistance (const ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemOtherT_, DimensionV_ > &other) const
 The angle in [0, pi] of the rotation between this and the other rotation, the norm of boxMinus(other), like kindr's getDisparityAngle() and Eigen's Quaternion::angularDistance().
template<AnyTensor AngularVelocityOtherT_>
MatrixDerivativeT matrixDerivative (const AngularVelocityOtherT_ &angularVelocity) const
 The derivative dR/dt = [w]x R of the matrix for the angular velocity w, like kindr's RotationMatrixDiff.
template<AnyQuantities MatrixDerivativeOtherT_>
AngularVelocityT angularVelocityFromMatrixDerivative (const MatrixDerivativeOtherT_ &derivative) const
 The angular velocity w of the derivative dR/dt of the matrix, [w]x = dR/dt R^T, the inverse of matrixDerivative().
Public Member Functions inherited from wuzp::ActiveTransformation< ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ > >
auto transform (ObjectT_ &&object) const
 The transformed object. A temporary is passed on as one, like with PassiveTransformation::transform().

Static Public Member Functions

template<typename... Args>
static ActiveSpatialRotation makeUnchecked (Args &&... args)
 The rotation whose matrix is constructed from the arguments, without checking it, like Drake's RotationMatrix::MakeUnchecked(): the caller guarantees that the matrix is a rotation, e.g. a product of rotations.
template<typename... Args>
static ActiveSpatialRotation projectToRotation (Args &&... args)
 The rotation nearest to the matrix constructed from the arguments, e.g. to a rotation whose rounding errors accumulated, by the Newton-Schulz iteration (see internal::projectToRotation()).
template<AnyQuantities QuaternionOtherT_>
static ActiveSpatialRotation fromQuaternion (const QuaternionOtherT_ &quaternion)
 The rotation of a unit quaternion q (see QuaternionT), whose matrix is that of Eigen's Quaternion::toRotationMatrix().
template<AnyQuantities AngleOtherT_, AnyTensor AxisOtherT_>
static ActiveSpatialRotation fromAngleAxis (const AngleOtherT_ &angle, const AxisOtherT_ &axis)
 The right-handed rotation by an angle around a unit axis, which is expressed in the coordinate system, like Eigen's AngleAxis.
template<AnyTensor RotationVectorOtherT_>
static ActiveSpatialRotation fromRotationVector (const RotationVectorOtherT_ &rotationVector)
 The exponential map Exp(v) of a rotation vector v, which is expressed in the coordinate system: the rotation by the angle |v| around the axis v / |v|, like kindr's RotationVector and exponentialMap().
template<AnyQuantities EulerAnglesOtherT_>
static ActiveSpatialRotation fromEulerAnglesZyx (const EulerAnglesOtherT_ &angles)
 The rotation of the Euler angles ZYX (yaw, pitch, roll), intrinsic: by yaw around z, then by pitch around the new y, then by roll around the newest x, R = R_z(yaw) R_y(pitch) R_x(roll), like kindr's EulerAnglesZyx and Eigen's eulerAngles(2, 1, 0).
template<AnyQuantities EulerAnglesOtherT_>
static ActiveSpatialRotation fromEulerAnglesXyz (const EulerAnglesOtherT_ &angles)
 The rotation of the Euler angles XYZ (a0, a1, a2), intrinsic: by a0 around x, then by a1 around the new y, then by a2 around the newest z, R = R_x(a0) R_y(a1) R_z(a2), like kindr's EulerAnglesXyz and Eigen's eulerAngles(0, 1, 2).
template<AnyTensor FromVectorT_, AnyTensor ToVectorT_>
static ActiveSpatialRotation fromTwoVectors (const FromVectorT_ &from, const ToVectorT_ &to)
 The rotation with the smallest angle that rotates the direction of the vector from into the direction of the vector to, both expressed in the coordinate system: transform(from) has the direction of to, like Eigen's Quaternion::FromTwoVectors() and kindr's setFromVectors().
template<AnyTensor RotationVectorOtherT_>
static TensorT exponentialMapJacobian (const RotationVectorOtherT_ &rotationVector)
 The Jacobian J of the exponential map at the rotation vector v, a linear map in the coordinate system: Exp(v + dv) = Exp(J dv) Exp(v) to first order, so that it maps the derivative of v to the angular velocity, w = J dv/dt, like kindr's getJacobianOfExponentialMap().
template<AnyQuantities QuaternionOtherT_, AnyTensor AngularVelocityOtherT_>
static QuaternionDerivativeT quaternionDerivative (const QuaternionOtherT_ &quaternion, const AngularVelocityOtherT_ &angularVelocity)
 The derivative dq/dt = (0, w) q / 2 of the unit quaternion q for the angular velocity w, like kindr's RotationQuaternionDiff of a GlobalAngularVelocity.
template<AnyQuantities QuaternionOtherT_, AnyQuantities QuaternionDerivativeOtherT_>
static AngularVelocityT angularVelocityFromQuaternionDerivative (const QuaternionOtherT_ &quaternion, const QuaternionDerivativeOtherT_ &derivative)
 The angular velocity w of the derivative dq/dt of the unit quaternion q, the vector part of 2 (dq/dt) q^*, the inverse of quaternionDerivative().
template<AnyQuantities EulerAnglesOtherT_, AnyTensor AngularVelocityOtherT_>
static EulerAnglesDerivativeT eulerAnglesZyxDerivative (const EulerAnglesOtherT_ &angles, const AngularVelocityOtherT_ &angularVelocity)
 The derivatives of the Euler angles ZYX (yaw, pitch, roll) for the angular velocity w, like kindr's EulerAnglesZyxDiff.
template<AnyQuantities EulerAnglesOtherT_, AnyQuantities EulerAnglesDerivativeOtherT_>
static AngularVelocityT angularVelocityFromEulerAnglesZyxDerivative (const EulerAnglesOtherT_ &angles, const EulerAnglesDerivativeOtherT_ &derivative)
 The angular velocity w of the derivatives of the Euler angles ZYX, w = dyaw/dt e_z + dpitch/dt R_z(yaw) e_y + droll/dt R_z(yaw) R_y(pitch) e_x, the inverse of eulerAnglesZyxDerivative().
template<AnyQuantities EulerAnglesOtherT_, AnyTensor AngularVelocityOtherT_>
static EulerAnglesDerivativeT eulerAnglesXyzDerivative (const EulerAnglesOtherT_ &angles, const AngularVelocityOtherT_ &angularVelocity)
 The derivatives of the Euler angles XYZ for the angular velocity w, like kindr's EulerAnglesXyzDiff.
template<AnyQuantities EulerAnglesOtherT_, AnyQuantities EulerAnglesDerivativeOtherT_>
static AngularVelocityT angularVelocityFromEulerAnglesXyzDerivative (const EulerAnglesOtherT_ &angles, const EulerAnglesDerivativeOtherT_ &derivative)
 The angular velocity w of the derivatives of the Euler angles XYZ, w = da0/dt e_x + da1/dt R_x(a0) e_y + da2/dt R_x(a0) R_y(a1) e_z, the inverse of eulerAnglesXyzDerivative().

Detailed Description

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
requires AnyValueMatrix<ValuesT_>
class wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >

An active rotation in its coordinate system: the dimensionless linear transformation x -> R x whose matrix R is orthogonal with determinant 1, R R^T = I and det(R) = 1.

Orthogonality is defined by the Euclidean metric, so the coordinate system must be Euclidean (EuclideanCoordinateSystem, see Metric); in a Minkowski coordinate system, a spatial rotation is a LorentzTransformation. It transforms the same tensors as the active linear transformation with its matrix (see ActiveLinearTransformation). It composes with rotations into rotations, with linear transformations into linear transformations, and with translations and proper rigid transformations into proper rigid transformations (see CompositionTraits). Its inverse is its transpose, which every value matrix backend provides, also for integer matrices, and with which it transforms covectors and tensors with lower indices. In debug builds, i.e. if NDEBUG is not defined, the constructors check that the matrix is a rotation (see isValid()), like Drake's RotationMatrix (https://drake.mit.edu/doxygen_cxx/classdrake_1_1math_1_1_rotation_matrix.html): they throw std::invalid_argument if it is not, e.g. for a shear, a scaling or a reflection. Release builds do not check. makeUnchecked() skips the check, e.g. in hot paths, and projectToRotation() computes the rotation nearest to a matrix, e.g. to one whose rounding errors accumulated. In three dimensions, a rotation converts from and to unit quaternions, angle-axis, rotation vectors and Euler angles ZYX and XYZ, has the manifold operations boxPlus(), boxMinus() and angularDistance(), and maps between its angular velocity w, dR/dt = [w]x R, which is expressed in its coordinate system, and the time derivatives of its matrix, its quaternion and its Euler angles (see "Parameterizations of rotations" in DESIGN.md and docs/conventions.md). These need floating-point values.

Definition at line 45 of file ActiveSpatialRotation.hpp.

Member Typedef Documentation

◆ AngleAxisT

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
using wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::AngleAxisT = std::pair<AngleT, AxisT>

The angle and the unit axis of a rotation.

Definition at line 72 of file ActiveSpatialRotation.hpp.

◆ AngleT

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
using wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::AngleT = typename ParameterizationsT::AngleT

An angle, e.g. of a rotation around its axis, or between two rotations.

Definition at line 68 of file ActiveSpatialRotation.hpp.

◆ AngularVelocityT

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
using wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::AngularVelocityT = typename ParameterizationsT::template AngularVelocityT<CoordinateSystemT_>

The angular velocity w of a rotation R, dR/dt = [w]x R, expressed in the coordinate system.

Definition at line 82 of file ActiveSpatialRotation.hpp.

◆ AxisT

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
using wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::AxisT = typename ParameterizationsT::template AxisT<CoordinateSystemT_>

The unit axis of a rotation, expressed in the coordinate system.

Definition at line 70 of file ActiveSpatialRotation.hpp.

◆ CoordinateSystemT

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
using wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::CoordinateSystemT = CoordinateSystemT_

Definition at line 57 of file ActiveSpatialRotation.hpp.

◆ EulerAnglesDerivativeT

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
using wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::EulerAnglesDerivativeT = typename ParameterizationsT::EulerAnglesDerivativeT

The derivatives of three Euler angles with respect to time.

Definition at line 80 of file ActiveSpatialRotation.hpp.

◆ EulerAnglesT

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
using wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::EulerAnglesT = typename ParameterizationsT::EulerAnglesT

Three Euler angles, in the order of the axes in their name, e.g. (yaw, pitch, roll) for ZYX.

They are not a vector, so they have no coordinate system.

Definition at line 78 of file ActiveSpatialRotation.hpp.

◆ LinearTransformationT

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
using wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::LinearTransformationT
Initial value:
ActiveLinearTransformation<ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_, DimensionV_,
The units for values of the arithmetic type ValueT_, e.g. double, specialized for AccessImplementatio...
Definition traits.hpp:338

The active linear transformation with the matrix of the rotation, whose transformations the rotation shares.

Definition at line 51 of file ActiveSpatialRotation.hpp.

◆ MatrixDerivativeT

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
using wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::MatrixDerivativeT = typename ParameterizationsT::MatrixDerivativeT

The derivative dR/dt of the matrix of a rotation with respect to time.

Definition at line 84 of file ActiveSpatialRotation.hpp.

◆ QuantitiesT

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
using wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::QuantitiesT = typename LinearTransformationT::QuantitiesT

Definition at line 56 of file ActiveSpatialRotation.hpp.

◆ QuaternionDerivativeT

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
using wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::QuaternionDerivativeT = typename ParameterizationsT::QuaternionDerivativeT

The derivative dq/dt of a quaternion with respect to time, in the unit of an angular velocity.

Definition at line 66 of file ActiveSpatialRotation.hpp.

◆ QuaternionT

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
using wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::QuaternionT = typename ParameterizationsT::QuaternionT

A unit quaternion (w, x, y, z) = (cos(angle / 2), sin(angle / 2) n) of the rotation by an angle around the unit axis n, in the convention of Hamilton, ij = k, with the real part w first, like Eigen's Quaternion(w, x, y, z) and kindr's RotationQuaternion(w, x, y, z), but unlike the storage order (x, y, z, w) of Eigen's coeffs().

It rotates a vector v into q v q^*, and -q is the same rotation.

Definition at line 64 of file ActiveSpatialRotation.hpp.

◆ RotationVectorT

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
using wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::RotationVectorT = typename ParameterizationsT::template RotationVectorT<CoordinateSystemT_>

A rotation vector angle * axis, expressed in the coordinate system, e.g. the logarithm of a rotation or an increment of boxPlus().

Definition at line 75 of file ActiveSpatialRotation.hpp.

◆ TensorT

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
using wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::TensorT = typename LinearTransformationT::TensorT

Definition at line 58 of file ActiveSpatialRotation.hpp.

◆ UnitsT

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
using wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::UnitsT = typename LinearTransformationT::UnitsT

Definition at line 55 of file ActiveSpatialRotation.hpp.

◆ ValuesT

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
using wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::ValuesT = typename LinearTransformationT::ValuesT

Definition at line 54 of file ActiveSpatialRotation.hpp.

◆ ValueT

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
using wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::ValueT = ValueT_

Definition at line 53 of file ActiveSpatialRotation.hpp.

Constructor & Destructor Documentation

◆ ActiveSpatialRotation() [1/2]

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::ActiveSpatialRotation ( )
inline

The identity.

Definition at line 87 of file ActiveSpatialRotation.hpp.

◆ ActiveSpatialRotation() [2/2]

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
template<typename... Args>
requires (sizeof...(Args) > 0 && !CopiesOrMoves<ActiveSpatialRotation, Args...>)
wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::ActiveSpatialRotation ( Args &&... args)
inlineexplicit

The rotation whose matrix is constructed from the arguments, e.g. its elements row by row, or its quantities.

Copies and moves are left to the implicit constructors, see CopiesOrMoves.

Exceptions
std::invalid_argumentIn debug builds, if the matrix is not a rotation (see isValid()).

Definition at line 94 of file ActiveSpatialRotation.hpp.

Member Function Documentation

◆ angularDistance()

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
template<typename CoordinateSystemOtherT_>
AngleT wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::angularDistance ( const ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemOtherT_, DimensionV_ > & other) const
inline

The angle in [0, pi] of the rotation between this and the other rotation, the norm of boxMinus(other), like kindr's getDisparityAngle() and Eigen's Quaternion::angularDistance().

Definition at line 270 of file ActiveSpatialRotation.hpp.

◆ angularVelocityFromEulerAnglesXyzDerivative()

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
template<AnyQuantities EulerAnglesOtherT_, AnyQuantities EulerAnglesDerivativeOtherT_>
AngularVelocityT wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::angularVelocityFromEulerAnglesXyzDerivative ( const EulerAnglesOtherT_ & angles,
const EulerAnglesDerivativeOtherT_ & derivative )
inlinestatic

The angular velocity w of the derivatives of the Euler angles XYZ, w = da0/dt e_x + da1/dt R_x(a0) e_y + da2/dt R_x(a0) R_y(a1) e_z, the inverse of eulerAnglesXyzDerivative().

Definition at line 355 of file ActiveSpatialRotation.hpp.

◆ angularVelocityFromEulerAnglesZyxDerivative()

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
template<AnyQuantities EulerAnglesOtherT_, AnyQuantities EulerAnglesDerivativeOtherT_>
AngularVelocityT wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::angularVelocityFromEulerAnglesZyxDerivative ( const EulerAnglesOtherT_ & angles,
const EulerAnglesDerivativeOtherT_ & derivative )
inlinestatic

The angular velocity w of the derivatives of the Euler angles ZYX, w = dyaw/dt e_z + dpitch/dt R_z(yaw) e_y + droll/dt R_z(yaw) R_y(pitch) e_x, the inverse of eulerAnglesZyxDerivative().

Definition at line 336 of file ActiveSpatialRotation.hpp.

◆ angularVelocityFromMatrixDerivative()

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
template<AnyQuantities MatrixDerivativeOtherT_>
AngularVelocityT wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::angularVelocityFromMatrixDerivative ( const MatrixDerivativeOtherT_ & derivative) const
inline

The angular velocity w of the derivative dR/dt of the matrix, [w]x = dR/dt R^T, the inverse of matrixDerivative().

It takes the skew-symmetric part, which averages out rounding errors.

Definition at line 298 of file ActiveSpatialRotation.hpp.

◆ angularVelocityFromQuaternionDerivative()

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
template<AnyQuantities QuaternionOtherT_, AnyQuantities QuaternionDerivativeOtherT_>
AngularVelocityT wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::angularVelocityFromQuaternionDerivative ( const QuaternionOtherT_ & quaternion,
const QuaternionDerivativeOtherT_ & derivative )
inlinestatic

The angular velocity w of the derivative dq/dt of the unit quaternion q, the vector part of 2 (dq/dt) q^*, the inverse of quaternionDerivative().

Definition at line 316 of file ActiveSpatialRotation.hpp.

◆ boxMinus()

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
template<typename CoordinateSystemOtherT_>
RotationVectorT wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::boxMinus ( const ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemOtherT_, DimensionV_ > & other) const
inline

The rotation vector R (-) S = Log(R S^T), expressed in the coordinate system, which rotates the other rotation S into this one: other.boxPlus(boxMinus(other)) is this rotation.

The left minus of Solà et al. (eq. 28), like kindr's boxMinus().

Definition at line 261 of file ActiveSpatialRotation.hpp.

◆ boxPlus()

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
template<AnyTensor RotationVectorOtherT_>
ActiveSpatialRotation wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::boxPlus ( const RotationVectorOtherT_ & rotationVector) const
inline

The rotation R (+) v = Exp(v) R, rotated further by the rotation vector v, which is expressed in the coordinate system: the left plus of Solà et al.

(eq. 27), like kindr's boxPlus().

Definition at line 253 of file ActiveSpatialRotation.hpp.

◆ eulerAnglesXyzDerivative()

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
template<AnyQuantities EulerAnglesOtherT_, AnyTensor AngularVelocityOtherT_>
EulerAnglesDerivativeT wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::eulerAnglesXyzDerivative ( const EulerAnglesOtherT_ & angles,
const AngularVelocityOtherT_ & angularVelocity )
inlinestatic

The derivatives of the Euler angles XYZ for the angular velocity w, like kindr's EulerAnglesXyzDiff.

At the gimbal lock, cos(a1) = 0, they are not defined: the results are not finite or arbitrarily large.

Definition at line 346 of file ActiveSpatialRotation.hpp.

◆ eulerAnglesZyxDerivative()

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
template<AnyQuantities EulerAnglesOtherT_, AnyTensor AngularVelocityOtherT_>
EulerAnglesDerivativeT wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::eulerAnglesZyxDerivative ( const EulerAnglesOtherT_ & angles,
const AngularVelocityOtherT_ & angularVelocity )
inlinestatic

The derivatives of the Euler angles ZYX (yaw, pitch, roll) for the angular velocity w, like kindr's EulerAnglesZyxDiff.

They depend on the angles, not only on the rotation, so it takes the angles. At the gimbal lock, cos(pitch) = 0, they are not defined: the results are not finite or arbitrarily large.

Definition at line 327 of file ActiveSpatialRotation.hpp.

◆ exponentialMapJacobian()

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
template<AnyTensor RotationVectorOtherT_>
TensorT wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::exponentialMapJacobian ( const RotationVectorOtherT_ & rotationVector)
inlinestatic

The Jacobian J of the exponential map at the rotation vector v, a linear map in the coordinate system: Exp(v + dv) = Exp(J dv) Exp(v) to first order, so that it maps the derivative of v to the angular velocity, w = J dv/dt, like kindr's getJacobianOfExponentialMap().

It is the left Jacobian of SO(3) (see internal::exponentialMapJacobian()).

Definition at line 280 of file ActiveSpatialRotation.hpp.

◆ fromAngleAxis()

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
template<AnyQuantities AngleOtherT_, AnyTensor AxisOtherT_>
ActiveSpatialRotation wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::fromAngleAxis ( const AngleOtherT_ & angle,
const AxisOtherT_ & axis )
inlinestatic

The right-handed rotation by an angle around a unit axis, which is expressed in the coordinate system, like Eigen's AngleAxis.

Exceptions
std::invalid_argumentIn debug builds, if the axis does not have unit length, unless the angle is a multiple of 2 pi (see internal::checkedUnitQuaternion()), which normalizes the quaternion of the angle and the axis.

Definition at line 168 of file ActiveSpatialRotation.hpp.

◆ fromEulerAnglesXyz()

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
template<AnyQuantities EulerAnglesOtherT_>
ActiveSpatialRotation wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::fromEulerAnglesXyz ( const EulerAnglesOtherT_ & angles)
inlinestatic

The rotation of the Euler angles XYZ (a0, a1, a2), intrinsic: by a0 around x, then by a1 around the new y, then by a2 around the newest z, R = R_x(a0) R_y(a1) R_z(a2), like kindr's EulerAnglesXyz and Eigen's eulerAngles(0, 1, 2).

Definition at line 219 of file ActiveSpatialRotation.hpp.

◆ fromEulerAnglesZyx()

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
template<AnyQuantities EulerAnglesOtherT_>
ActiveSpatialRotation wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::fromEulerAnglesZyx ( const EulerAnglesOtherT_ & angles)
inlinestatic

The rotation of the Euler angles ZYX (yaw, pitch, roll), intrinsic: by yaw around z, then by pitch around the new y, then by roll around the newest x, R = R_z(yaw) R_y(pitch) R_x(roll), like kindr's EulerAnglesZyx and Eigen's eulerAngles(2, 1, 0).

These are the extrinsic rotations by roll around x, by pitch around y and by yaw around z.

Definition at line 203 of file ActiveSpatialRotation.hpp.

◆ fromQuaternion()

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
template<AnyQuantities QuaternionOtherT_>
ActiveSpatialRotation wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::fromQuaternion ( const QuaternionOtherT_ & quaternion)
inlinestatic

The rotation of a unit quaternion q (see QuaternionT), whose matrix is that of Eigen's Quaternion::toRotationMatrix().

The quaternion is normalized, after it is checked to have unit length up to the tolerance of the validity checks.

Exceptions
std::invalid_argumentIn debug builds, if the quaternion does not have unit length, |1 - |q|^2| > ValidityTolerance (see internal::checkedUnitQuaternion()), like kindr's assertion. Normalize it first, e.g. after integrating its derivative.

Definition at line 147 of file ActiveSpatialRotation.hpp.

◆ fromRotationVector()

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
template<AnyTensor RotationVectorOtherT_>
ActiveSpatialRotation wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::fromRotationVector ( const RotationVectorOtherT_ & rotationVector)
inlinestatic

The exponential map Exp(v) of a rotation vector v, which is expressed in the coordinate system: the rotation by the angle |v| around the axis v / |v|, like kindr's RotationVector and exponentialMap().

Definition at line 187 of file ActiveSpatialRotation.hpp.

◆ fromTwoVectors()

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
template<AnyTensor FromVectorT_, AnyTensor ToVectorT_>
ActiveSpatialRotation wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::fromTwoVectors ( const FromVectorT_ & from,
const ToVectorT_ & to )
inlinestatic

The rotation with the smallest angle that rotates the direction of the vector from into the direction of the vector to, both expressed in the coordinate system: transform(from) has the direction of to, like Eigen's Quaternion::FromTwoVectors() and kindr's setFromVectors().

Only their directions matter, so their units may differ, but the components of each must have the same unit. If they are opposite, it rotates by pi around an axis perpendicular to them (see internal::quaternionFromTwoVectors()).

Exceptions
std::invalid_argumentIn debug builds, if a vector is zero, so that it has no direction (see isValid()).

Definition at line 240 of file ActiveSpatialRotation.hpp.

◆ getQuantities()

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
const QuantitiesT & wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::getQuantities ( ) const
inline

The matrix R, which transforms a vector v into R v.

Definition at line 115 of file ActiveSpatialRotation.hpp.

◆ getTensor()

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
TensorT wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::getTensor ( ) const
inline

The matrix as a linear map, a tensor with an upper and a lower index.

Definition at line 117 of file ActiveSpatialRotation.hpp.

◆ inverse()

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
ActiveSpatialRotation wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::inverse ( ) const
inline

The inverse rotation, whose matrix is the transpose R^T = R^-1: it needs no matrix inverse.

Definition at line 120 of file ActiveSpatialRotation.hpp.

◆ isApprox()

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
template<template< typename, int, int > typename ValuesOtherT_, typename ValueOtherT_, typename CoordinateSystemOtherT_, int DimensionOtherV_>
bool wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::isApprox ( const ActiveSpatialRotation< ValuesOtherT_, ValueOtherT_, CoordinateSystemOtherT_, DimensionOtherV_ > & other,
const ValueT precision = Precision<ValueT>::value() ) const
inline

Whether both rotations, which must be expressed in the same coordinate system, are approximately equal: their matrices are compared like the components of tensors (see Tensor::isApprox()).

Definition at line 132 of file ActiveSpatialRotation.hpp.

◆ isValid()

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
bool wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::isValid ( const ValueT tolerance = ValidityTolerance<ValueT>::value()) const
inline

Whether the matrix is a rotation: max_ij |(R R^T - I)_ij| <= tolerance, and det(R) > 0 (see internal::isRotation()).

The constructors check it in debug builds, with the tolerance ValidityTolerance.

Definition at line 124 of file ActiveSpatialRotation.hpp.

◆ makeUnchecked()

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
template<typename... Args>
ActiveSpatialRotation wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::makeUnchecked ( Args &&... args)
inlinestatic

The rotation whose matrix is constructed from the arguments, without checking it, like Drake's RotationMatrix::MakeUnchecked(): the caller guarantees that the matrix is a rotation, e.g. a product of rotations.

Definition at line 101 of file ActiveSpatialRotation.hpp.

◆ matrixDerivative()

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
template<AnyTensor AngularVelocityOtherT_>
MatrixDerivativeT wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::matrixDerivative ( const AngularVelocityOtherT_ & angularVelocity) const
inline

The derivative dR/dt = [w]x R of the matrix for the angular velocity w, like kindr's RotationMatrixDiff.

Definition at line 290 of file ActiveSpatialRotation.hpp.

◆ projectToRotation()

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
template<typename... Args>
ActiveSpatialRotation wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::projectToRotation ( Args &&... args)
inlinestatic

The rotation nearest to the matrix constructed from the arguments, e.g. to a rotation whose rounding errors accumulated, by the Newton-Schulz iteration (see internal::projectToRotation()).

Exceptions
std::invalid_argumentIn every build, if the matrix A is not close enough to a rotation, i.e. ||I - A^T A|| is not smaller than 1 in the Frobenius norm, or if its determinant is not positive.

Definition at line 110 of file ActiveSpatialRotation.hpp.

◆ quaternionDerivative()

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
template<AnyQuantities QuaternionOtherT_, AnyTensor AngularVelocityOtherT_>
QuaternionDerivativeT wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::quaternionDerivative ( const QuaternionOtherT_ & quaternion,
const AngularVelocityOtherT_ & angularVelocity )
inlinestatic

The derivative dq/dt = (0, w) q / 2 of the unit quaternion q for the angular velocity w, like kindr's RotationQuaternionDiff of a GlobalAngularVelocity.

It depends on the sign of q, so it takes the quaternion rather than the rotation.

Definition at line 307 of file ActiveSpatialRotation.hpp.

◆ toAngleAxis()

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
AngleAxisT wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::toAngleAxis ( ) const
inline

The angle in [0, pi] and the unit axis of the rotation.

The axis of the identity is arbitrary: the x axis (see internal::angleAxisFromQuaternion()).

Definition at line 178 of file ActiveSpatialRotation.hpp.

◆ toEulerAnglesXyz()

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
EulerAnglesT wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::toEulerAnglesXyz ( ) const
inline

The Euler angles XYZ (a0, a1, a2) of the rotation (see fromEulerAnglesXyz()), with a0 and a2 in [-pi, pi) and a1 in [-pi/2, pi/2] (see internal::eulerAnglesXyzFromMatrix()).

Definition at line 226 of file ActiveSpatialRotation.hpp.

◆ toEulerAnglesZyx()

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
EulerAnglesT wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::toEulerAnglesZyx ( ) const
inline

The Euler angles ZYX (yaw, pitch, roll) of the rotation (see fromEulerAnglesZyx()), with yaw and roll in [-pi, pi) and pitch in [-pi/2, pi/2].

At the gimbal lock, a pitch of +-pi/2, only the sum or the difference of yaw and roll is defined (see internal::eulerAnglesZyxFromMatrix()).

Definition at line 211 of file ActiveSpatialRotation.hpp.

◆ toQuaternion()

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
QuaternionT wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::toQuaternion ( ) const
inline

The unique unit quaternion of the rotation, whose first element that is not zero is positive, like kindr's RotationQuaternion::getUnique(): its real part w is not negative, so its angle is in [0, pi] (see internal::quaternionFromMatrix()).

Like every choice of one of q and -q, it jumps close to an angle of pi, where w changes its sign: compare rotations with isApprox() or angularDistance(), not with their quaternions.

Definition at line 158 of file ActiveSpatialRotation.hpp.

◆ toRotationVector()

template<template< typename, int, int > typename ValuesT_, typename ValueT_, EuclideanCoordinateSystem CoordinateSystemT_, int DimensionV_>
RotationVectorT wuzp::ActiveSpatialRotation< ValuesT_, ValueT_, CoordinateSystemT_, DimensionV_ >::toRotationVector ( ) const
inline

The logarithmic map Log(R), the rotation vector of the rotation, whose norm, the angle, is in [0, pi], like kindr's logarithmicMap().

Definition at line 194 of file ActiveSpatialRotation.hpp.


The documentation for this class was generated from the following file: