Drake
Transform< T > Class Template Reference

This class represents a rigid transform between two frames, which can be regarded in two ways. More...

#include <drake/math/transform.h>

## Public Member Functions

Transform ()
Constructs the Transform that corresponds to aligning the two frames so unit vectors Ax = Bx, Ay = By, Az = Bz and point Ao is coincident with Bo. More...

Transform (const RotationMatrix< T > &R, const Vector3< T > &p)
Constructs a Transform from a rotation matrix and a position vector. More...

Transform (const Isometry3< T > &pose)
Constructs a Transform from an Eigen Isometry3. More...

template<typename U >
Transform< U > cast () const
Creates a Transform templatized on a scalar type U from a Transform templatized on scalar type T. More...

const RotationMatrix< T > & rotation () const
Returns R_AB, the rotation matrix portion of this transform. More...

void set_rotation (const RotationMatrix< T > &R)
Sets the RotationMatrix portion of this transform. More...

const Vector3< T > & translation () const
Returns p_AoBo_A, the position vector portion of this transform. More...

void set_translation (const Vector3< T > &p)
Sets the position vector portion of this transform. More...

Matrix4< T > GetAsMatrix4 () const
Returns the 4x4 matrix associated with this Transform. More...

Isometry3< T > GetAsIsometry3 () const
Returns the Isometry associated with a Transform. More...

const Transform< T > & SetIdentity ()
Sets this Transform so it corresponds to aligning the two frames so unit vectors Ax = Bx, Ay = By, Az = Bz and point Ao is coincident with Bo. More...

bool IsExactlyIdentity () const
Returns true if this is exactly the identity transform. More...

bool IsIdentityToEpsilon (double translation_tolerance) const
Returns true if this is within tolerance of the identity transform. More...

Transform< T > inverse () const
Calculates X_BA = X_AB⁻¹, the inverse of this Transform. More...

Transform< T > & operator*= (const Transform< T > &other)
In-place multiply of this transform X_AB by other transform X_BC. More...

Transform< T > operator* (const Transform< T > &other) const
Calculates this transform X_AB multiplied by other transform X_BC. More...

Vector3< T > operator* (const Vector3< T > &p_BoQ_B) const
Calculates this transform X_AB multiplied by the position vector 'p_BoQ_B which is from Bo (B's origin) to an arbitrary point Q. More...

bool IsNearlyEqualTo (const Transform< T > &other, double tolerance) const
Compares each element of this to the corresponding element of other to check if they are the same to within a specified tolerance. More...

GetMaximumAbsoluteDifference (const Transform< T > &other) const
Computes the infinity norm of this - other (i.e., the maximum absolute value of the difference between the elements of this and other). More...

GetMaximumAbsoluteTranslationDifference (const Transform< T > &other) const
Returns the maximum absolute value of the difference in the position vectors (translation) in this and other. More...

Implements CopyConstructible, CopyAssignable, MoveConstructible, MoveAssignable
Transform (const Transform &)=default

Transformoperator= (const Transform &)=default

Transform (Transform &&)=default

Transformoperator= (Transform &&)=default

## Static Public Member Functions

static const Transform< T > & Identity ()
Returns the identity Transform (which corresponds to coincident frames). More...

## Friends

template<typename U >
class Transform

## Detailed Description

### template<typename T> class drake::math::Transform< T >

This class represents a rigid transform between two frames, which can be regarded in two ways.

It can be regarded as a distance-preserving linear operator (i.e., one that rotates and/or translates) which (for example) can add one position vector to another and express the result in a particular basis as p_AoQ_A = X_AB * p_BoQ_B (Q is any point). Alternately, a rigid transform describes the pose between two frames A and B (i.e., the relative orientation and position of A to B). Herein, the terms rotation/orientation and translation/position are used interchangeably. The class stores a RotationMatrix that relates right-handed orthogonal unit vectors Ax, Ay, Az fixed in frame A to right-handed orthogonal unit vectors Bx, By, Bz fixed in frame B. The class also stores a position vector from Ao (the origin of frame A) to Bo (the origin of frame B). The position vector is expressed in frame A. The monogram notation for the transform relating frame A to B is X_AB. The monogram notation for the rotation matrix relating A to B is R_AB. The monogram notation for the position vector from Ao to Bo is p_AoBo_A. See Multibody Quantities for monogram notation for dynamics.

Note
This class does not store the frames associated with the transform and cannot enforce proper usage of this class. For example, it makes sense to multiply transforms as X_AB * X_BC, but not X_AB * X_CB.
This class is not a 4x4 transformation matrix – even though its operator*() methods act like 4x4 matrix multiplication. Instead, this class contains a rotation matrix class as well as a 3x1 position vector. To form a 4x4 matrix, use GetAsMatrix(). GetAsIsometry() is treated similarly.
Template Parameters
 T The underlying scalar type. Must be a valid Eigen scalar.

## Constructor & Destructor Documentation

 Transform ( const Transform< T > & )
default
 Transform ( Transform< T > && )
default
 Transform ( )
inline

Constructs the Transform that corresponds to aligning the two frames so unit vectors Ax = Bx, Ay = By, Az = Bz and point Ao is coincident with Bo.

Hence, the constructed Transform contains an identity RotationMatrix and a zero position vector.

Here is the call graph for this function:

 Transform ( const RotationMatrix< T > & R, const Vector3< T > & p )
inline

Constructs a Transform from a rotation matrix and a position vector.

Parameters
 [in] R rotation matrix relating frames A and B (e.g., R_AB). [in] p position vector from frame A's origin to frame B's origin, expressed in frame A. In monogram notation p is denoted p_AoBo_A.
 Transform ( const Isometry3< T > & pose )
inlineexplicit

Constructs a Transform from an Eigen Isometry3.

Parameters
 [in] pose Isometry3 that contains an allegedly valid rotation matrix R_AB and also contains a position vector p_AoBo_A from frame A's origin to frame B's origin. p_AoBo_A must be expressed in frame A.
Exceptions
 std::logic_error in debug builds if R_AB is not a proper orthonormal 3x3 rotation matrix.
Note
no attempt is made to orthogonalize the 3x3 rotation matrix part of pose. As needed, use RotationMatrix::ProjectToRotationMatrix().

## Member Function Documentation

 Transform cast ( ) const
inline

Creates a Transform templatized on a scalar type U from a Transform templatized on scalar type T.

For example,

Transform<double> source = Transform<double>::Identity();
Transform<AutoDiffXd> foo = source.cast<AutoDiffXd>();
Template Parameters
 U Scalar type on which the returned Transform is templated.
Note
Transform<From>::cast<To>() creates a new Transform<To> from a Transform<From> but only if type To is constructible from type From. This cast method works in accordance with Eigen's cast method for Eigen's objects that underlie this Transform. For example, Eigen currently allows cast from type double to AutoDiffXd, but not vice-versa.
 Isometry3 GetAsIsometry3 ( ) const
inline

Returns the Isometry associated with a Transform.

Returns
the Isometry associated with a Transform.

Here is the call graph for this function:

 Matrix4 GetAsMatrix4 ( ) const
inline

Returns the 4x4 matrix associated with this Transform.

Returns
the 4x4 matrix associated with this Transform, i.e., returns X_AB ┌ ┐ │ R_AB p_AoBo_A │ │ │ │ 0 1 │ └ ┘

Here is the call graph for this function:

 T GetMaximumAbsoluteDifference ( const Transform< T > & other ) const
inline

Computes the infinity norm of this - other (i.e., the maximum absolute value of the difference between the elements of this and other).

Parameters
 [in] other Transform to subtract from this.
Returns
this - other‖∞

Here is the call graph for this function:

Here is the caller graph for this function:

 T GetMaximumAbsoluteTranslationDifference ( const Transform< T > & other ) const
inline

Returns the maximum absolute value of the difference in the position vectors (translation) in this and other.

In other words, returns the infinity norm of the difference in the position vectors.

Parameters
 [in] other Transform whose position vector is subtracted from the position vector in this.

Here is the call graph for this function:

Here is the caller graph for this function:

 static const Transform& Identity ( )
inlinestatic

Returns the identity Transform (which corresponds to coincident frames).

Returns
the Transform that corresponds to aligning the two frames so unit vectors Ax = Bx, Ay = By, Az = Bz and point Ao is coincident with Bo. Hence, the returned Transform contains a 3x3 identity matrix and a zero position vector.

Here is the call graph for this function:

 Transform inverse ( ) const
inline

Calculates X_BA = X_AB⁻¹, the inverse of this Transform.

Return values
 X_BA = X_AB⁻¹ the inverse of this Transform.
Note
The inverse of transform X_AB is X_BA, which contains the rotation matrix R_BA = R_AB⁻¹ = R_ABᵀ and the position vector p_BoAo_B_, (position from B's origin Bo to A's origin Ao, expressed in frame B).
: The square-root of the condition number for a Transform is roughly the magnitude of the position vector. The accuracy of the calculation for the inverse of a Transform drops off with the sqrt condition number.
 bool IsExactlyIdentity ( ) const
inline

Returns true if this is exactly the identity transform.

Returns
true if this is exactly the identity transform.
IsIdentityToEpsilon().

Here is the call graph for this function:

 bool IsIdentityToEpsilon ( double translation_tolerance ) const
inline

Returns true if this is within tolerance of the identity transform.

Returns
true if the RotationMatrix portion of this satisfies RotationMatrix::IsIdentityToInternalTolerance() and if the position vector portion of this is equal to zero vector within translation_tolerance.
Parameters
 [in] translation_tolerance a non-negative number. One way to choose translation_tolerance is to multiply a characteristic length (e.g., the magnitude of a characteristic position vector) by an epsilon (e.g., RotationMatrix::get_internal_tolerance_for_orthonormality()).
IsExactlyIdentity().

Here is the call graph for this function:

 bool IsNearlyEqualTo ( const Transform< T > & other, double tolerance ) const
inline

Compares each element of this to the corresponding element of other to check if they are the same to within a specified tolerance.

Parameters
 [in] other Transform to compare to this. [in] tolerance maximum allowable absolute difference between the elements in this and other.
Returns
true if ‖this.matrix() - other.matrix()‖∞ <= tolerance.
Note
Consider scaling tolerance with the largest of magA and magB, where magA and magB denoted the magnitudes of this position vector and other position vectors, respectively.

Here is the call graph for this function:

 Transform operator* ( const Transform< T > & other ) const
inline

Calculates this transform X_AB multiplied by other transform X_BC.

Parameters
 [in] other Transform that post-multiplies this.
Return values
 X_AC = X_AB * X_BC

Here is the call graph for this function:

 Vector3 operator* ( const Vector3< T > & p_BoQ_B ) const
inline

Calculates this transform X_AB multiplied by the position vector 'p_BoQ_B which is from Bo (B's origin) to an arbitrary point Q.

Parameters
 [in] p_BoQ_B position vector from Bo to Q, expressed in frame B.
Return values
 p_AoQ_A position vector from Ao to Q, expressed in frame A.
 Transform& operator*= ( const Transform< T > & other )
inline

In-place multiply of this transform X_AB by other transform X_BC.

Parameters
 [in] other Transform that post-multiplies this.
Returns
this transform which has been multiplied by other. On return, this = X_AC, where X_AC = X_AB * X_BC.

Here is the call graph for this function:

 Transform& operator= ( Transform< T > && )
default
 Transform& operator= ( const Transform< T > & )
default
 const RotationMatrix& rotation ( ) const
inline

Returns R_AB, the rotation matrix portion of this transform.

Return values
 R_AB the rotation matrix portion of this transform.

Here is the caller graph for this function:

 void set_rotation ( const RotationMatrix< T > & R )
inline

Sets the RotationMatrix portion of this transform.

Parameters
 [in] R rotation matrix relating frames A and B (e.g., R_AB).
 void set_translation ( const Vector3< T > & p )
inline

Sets the position vector portion of this transform.

Parameters
 [in] p position vector from Ao (frame A's origin) to Bo (frame B's origin) expressed in frame A. In monogram notation p is denoted p_AoBo_A.
 const Transform& SetIdentity ( )
inline

Sets this Transform so it corresponds to aligning the two frames so unit vectors Ax = Bx, Ay = By, Az = Bz and point Ao is coincident with Bo.

Hence, this Transform contains a 3x3 identity matrix and a zero position vector.

Here is the call graph for this function:

Here is the caller graph for this function:

 const Vector3& translation ( ) const
inline

Returns p_AoBo_A, the position vector portion of this transform.

Return values
 p_AoBo_A the position vector portion of this transform, i.e., the position vector from Ao (frame A's origin) to Bo (frame B's origin).

Here is the caller graph for this function:

## Friends And Related Function Documentation

 friend class Transform
friend

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