Drake
QuaternionBallJoint Class Reference

## Detailed Description

Defines a 3 dof tree joint (mobilizer) that uses a unit quaternion as the generalized orientation coordinates.

### Generalized coordinates (configuration variables)

There are 4 generalized coordinates q, organized as a quaternion. A tree joint connects an inboard (parent) body P to an outboard (child) body B. In those terms this joint's generalized coordinates are:

------------- T
q = |    q_PB     |
-------------  4×1
qw qx qy qz

where q_PB is the quaternion that is equivalent to the rotation matrix R_PB. The second line shows the 4 generalized coordinate scalars in order. Note that qw is the scalar part of the quaternion while [qx qy qz] is the vector part. See Spatial Pose and Transform for more information about this notation.

The time derivatives qdot of the generalized coordinates, not to be confused with the generalized velocity variables v, are:

------------- T
qdot = |   qdot_PB   |
-------------  4×1

where qdot_PB = d/dt q_PB is the time derivative of the quaternion.

### Generalized velocity

There are 3 generalized velocity variables v, organized as follows:

--------- T
v = | ω_PB_B  |
--------- 3×1

where ω_PB_B is B's angular velocity in P, expressed in B.

Note that The time derivatives of the generalized velocities are:

--------- T
vdot = | α_PB_B  |
--------- 3×1

where α_PB_B is B's angular acceleration in P, expressed in B.

#include <drake/attic/multibody/joints/quaternion_ball_joint.h>

## Public Member Functions

QuaternionBallJoint (const std::string &name, const Eigen::Isometry3d &transform_to_parent_body)

virtual ~QuaternionBallJoint ()

template<typename DerivedQ >
Eigen::Transform< typename DerivedQ::Scalar, 3, Eigen::Isometry > jointTransform (const Eigen::MatrixBase< DerivedQ > &q) const
Returns the transform X_PB(q) where P is the parent body and B the child body connected by this joint. More...

template<typename DerivedQ , typename DerivedMS >
void motionSubspace (const Eigen::MatrixBase< DerivedQ > &q, Eigen::MatrixBase< DerivedMS > &motion_subspace, typename drake::math::Gradient< DerivedMS, Eigen::Dynamic >::type *dmotion_subspace=nullptr) const

template<typename DerivedQ , typename DerivedV >
void motionSubspaceDotTimesV (const Eigen::MatrixBase< DerivedQ > &q, const Eigen::MatrixBase< DerivedV > &v, Eigen::Matrix< typename DerivedQ::Scalar, 6, 1 > &motion_subspace_dot_times_v, typename drake::math::Gradient< Eigen::Matrix< typename DerivedQ::Scalar, 6, 1 >, Eigen::Dynamic >::type *dmotion_subspace_dot_times_vdq=nullptr, typename drake::math::Gradient< Eigen::Matrix< typename DerivedQ::Scalar, 6, 1 >, Eigen::Dynamic >::type *dmotion_subspace_dot_times_vdv=nullptr) const

template<typename DerivedQ >
void qdot2v (const Eigen::MatrixBase< DerivedQ > &q, Eigen::Matrix< typename DerivedQ::Scalar, Eigen::Dynamic, Eigen::Dynamic, 0, DrakeJoint::MAX_NUM_VELOCITIES, DrakeJoint::MAX_NUM_POSITIONS > &qdot_to_v, Eigen::Matrix< typename DerivedQ::Scalar, Eigen::Dynamic, Eigen::Dynamic > *dqdot_to_v) const
For the QuaternionBallJoint, computes the matrix N⁺(q)∊ℝ³ˣ⁴ that maps generalized coordinate time derivatives qdot to generalized velocities v, with v=N⁺ qdot. More...

template<typename DerivedQ >
void v2qdot (const Eigen::MatrixBase< DerivedQ > &q, Eigen::Matrix< typename DerivedQ::Scalar, Eigen::Dynamic, Eigen::Dynamic, 0, DrakeJoint::MAX_NUM_POSITIONS, DrakeJoint::MAX_NUM_VELOCITIES > &v_to_qdot, Eigen::Matrix< typename DerivedQ::Scalar, Eigen::Dynamic, Eigen::Dynamic > *dv_to_qdot) const
For the QuaternionBallJoint, computes the matrix N(q)∊ℝ⁴ˣ³ that maps generalized velocities v to generalized coordinate time derivatives qdot, with qdot=N v. More...

template<typename DerivedV >
Eigen::Matrix< typename DerivedV::Scalar, Eigen::Dynamic, 1 > frictionTorque (const Eigen::MatrixBase< DerivedV > &v) const

template<typename DerivedQ >
Eigen::Matrix< typename DerivedQ::Scalar, Eigen::Dynamic, 1 > SpringTorque (const Eigen::MatrixBase< DerivedQ > &q) const

bool is_floating () const override

bool isFloating () const override
(Deprecated.) More...

std::string get_position_name (int index) const override

std::string get_velocity_name (int index) const override

Eigen::VectorXd zeroConfiguration () const override

Eigen::VectorXd randomConfiguration (std::default_random_engine &generator) const override

std::string getPositionName (int index) const override
(Deprecated.) More...

std::string getVelocityName (int index) const override
(Deprecated.) More...

## Protected Member Functions

std::unique_ptr< DrakeJointDoClone () const final

void DoInitializeClone (DrakeJoint *) const final

## ◆ QuaternionBallJoint()

 QuaternionBallJoint ( const std::string & name, const Eigen::Isometry3d & transform_to_parent_body )

## ◆ ~QuaternionBallJoint()

 virtual ~QuaternionBallJoint ( )
virtual

## ◆ DoClone()

 std::unique_ptr< DrakeJoint > DoClone ( ) const
finalprotected

## ◆ DoInitializeClone()

 void DoInitializeClone ( DrakeJoint * ) const
finalprotected

## ◆ frictionTorque()

 Eigen::Matrix frictionTorque ( const Eigen::MatrixBase< DerivedV > & v ) const

## ◆ get_position_name()

 std::string get_position_name ( int index ) const
override

## ◆ get_velocity_name()

 std::string get_velocity_name ( int index ) const
override

## ◆ getPositionName()

 std::string getPositionName ( int index ) const
override

(Deprecated.)

Deprecated:
This will be removed from Drake on or after "2019-12-31" .

## ◆ getVelocityName()

 std::string getVelocityName ( int index ) const
override

(Deprecated.)

Deprecated:
This will be removed from Drake on or after "2019-12-31" .

## ◆ is_floating()

 bool is_floating ( ) const
override

## ◆ isFloating()

 bool isFloating ( ) const
override

(Deprecated.)

Deprecated:
This will be removed from Drake on or after "2019-12-31" .

## ◆ jointTransform()

 Eigen::Transform jointTransform ( const Eigen::MatrixBase< DerivedQ > & q ) const

Returns the transform X_PB(q) where P is the parent body and B the child body connected by this joint.

## ◆ motionSubspace()

 void motionSubspace ( const Eigen::MatrixBase< DerivedQ > & q, Eigen::MatrixBase< DerivedMS > & motion_subspace, typename drake::math::Gradient< DerivedMS, Eigen::Dynamic >::type * dmotion_subspace = nullptr ) const

## ◆ motionSubspaceDotTimesV()

 void motionSubspaceDotTimesV ( const Eigen::MatrixBase< DerivedQ > & q, const Eigen::MatrixBase< DerivedV > & v, Eigen::Matrix< typename DerivedQ::Scalar, 6, 1 > & motion_subspace_dot_times_v, typename drake::math::Gradient< Eigen::Matrix< typename DerivedQ::Scalar, 6, 1 >, Eigen::Dynamic >::type * dmotion_subspace_dot_times_vdq = nullptr, typename drake::math::Gradient< Eigen::Matrix< typename DerivedQ::Scalar, 6, 1 >, Eigen::Dynamic >::type * dmotion_subspace_dot_times_vdv = nullptr ) const

## ◆ qdot2v()

 void qdot2v ( const Eigen::MatrixBase< DerivedQ > & q, Eigen::Matrix< typename DerivedQ::Scalar, Eigen::Dynamic, Eigen::Dynamic, 0, DrakeJoint::MAX_NUM_VELOCITIES, DrakeJoint::MAX_NUM_POSITIONS > & qdot_to_v, Eigen::Matrix< typename DerivedQ::Scalar, Eigen::Dynamic, Eigen::Dynamic > * dqdot_to_v ) const

For the QuaternionBallJoint, computes the matrix N⁺(q)∊ℝ³ˣ⁴ that maps generalized coordinate time derivatives qdot to generalized velocities v, with v=N⁺ qdot.

The name signifies that N⁺=pinv(N) where N(q) is the matrix that maps v to qdot with qdot=N v and pinv() is the pseudoinverse (in this case the left pseudoinverse).

See the class description for precise definitions of the generalized coordinates and velocities. Because the velocities are not the time derivatives of the coordinates, rotations and translations are reversed, and different expressed-in frames are employed, N⁺ has the following elaborate structure:

-----------
N⁺ = | Nq⁺_PB_B  |
----------- 3×4

where Nq_PB_B is the matrix that maps angular velocity ω_PB_B to quaternion time derivative qdot_PB such that qdot_PB=Nq_PB_B*ω_PB_B, and Nq⁺_PB_B is the left pseudoinverse of Nq_PB_B.

Parameters
 [in] q The 4-element generalized configuration variable. See the class documentation for details. See warning below regarding the effect if the contained quaternion is not normalized. [out] qdot_to_v The matrix N⁺. dqdot_to_v Unused, must be nullptr on entry.
Warning
Let s be the norm of the quaternion in q. If s ≠ 1, then we will calculate s*Nq⁺_PB_B so the resulting angular velocity vector will be scaled by s as well. This method neither performs a normalization check nor normalizes the quaternion orientation parameters. Implications for integration techniques must be carefully considered.

## ◆ randomConfiguration()

 VectorXd randomConfiguration ( std::default_random_engine & generator ) const
override

## ◆ SpringTorque()

 Eigen::Matrix SpringTorque ( const Eigen::MatrixBase< DerivedQ > & q ) const

## ◆ v2qdot()

 void v2qdot ( const Eigen::MatrixBase< DerivedQ > & q, Eigen::Matrix< typename DerivedQ::Scalar, Eigen::Dynamic, Eigen::Dynamic, 0, DrakeJoint::MAX_NUM_POSITIONS, DrakeJoint::MAX_NUM_VELOCITIES > & v_to_qdot, Eigen::Matrix< typename DerivedQ::Scalar, Eigen::Dynamic, Eigen::Dynamic > * dv_to_qdot ) const

For the QuaternionBallJoint, computes the matrix N(q)∊ℝ⁴ˣ³ that maps generalized velocities v to generalized coordinate time derivatives qdot, with qdot=N v.

See the class description for precise definitions of the generalized coordinates and velocities. Because the velocities are not the time derivatives of the coordinates, rotations and translations are reversed, and different expressed-in frames are employed, N has the following elaborate structure:

-------
N = |Nq_PB_B|
------- 4×3

where Nq_PB_B is the matrix that maps angular velocity ω_PB_B to quaternion time derivative qdot_PB such that qdot_PB=Nq_PB_B*ω_PB_B.

Parameters
 [in] q The 4-element generalized configuration variable. See the class documentation for details. See warning below regarding the effect if the contained quaternion is not normalized. [out] v_to_qdot The matrix N. dv_to_qdot Unused, must be nullptr on entry.
Warning
Let s be the norm of the quaternion in q. If s ≠ 1, then we will calculate s*Nq_PB_B so the resulting quaternion derivative will be scaled by s as well. This method neither performs a normalization check nor normalizes the quaternion orientation parameters. Implications for integration techniques must be carefully considered.

## ◆ zeroConfiguration()

 VectorXd zeroConfiguration ( ) const
override

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