chrono::ChFrameMoving< Real > Class Template Reference

Description

template<class Real = double>
class chrono::ChFrameMoving< Real >

ChFrameMoving: a class for coordinate systems in 3D space.

A 'frame' coordinate system has a translation and a rotation respect to a 'parent' coordinate system, usually the absolute (world) coordinates.

Differently from a simple ChCoordsys() object, however, the ChFrame implements some optimizations because each ChFrame stores also a 3x3 rotation matrix, which can speed up coordinate transformations when a large amount of vectors must be transformed by the same coordinate frame.

Further info at the Coordinate transformations manual page.

#include <ChFrameMoving.h>

Inheritance diagram for chrono::ChFrameMoving< Real >:
Collaboration diagram for chrono::ChFrameMoving< Real >:

Public Member Functions

 ChFrameMoving (const ChVector< Real > &mv=ChVector< Real >(0, 0, 0), const ChQuaternion< Real > &mq=ChQuaternion< Real >(1, 0, 0, 0))
 Construct from pos and rot (as a quaternion)
 
 ChFrameMoving (const ChVector< Real > &mv, const ChMatrix33< Real > &ma)
 Construct from pos and rotation (as a 3x3 matrix)
 
 ChFrameMoving (const ChCoordsys< Real > &mc)
 Construct from a coordsys.
 
 ChFrameMoving (const ChFrame< Real > &mc)
 Construct from a frame.
 
 ChFrameMoving (const ChFrameMoving< Real > &other)
 Copy constructor, build from another moving frame.
 
virtual ~ChFrameMoving ()
 Destructor.
 
ChFrameMoving< Real > & operator= (const ChFrameMoving< Real > &other)
 Assignment operator: copy from another moving frame.
 
ChFrameMoving< Real > & operator= (const ChFrame< Real > &other)
 Assignment operator: copy from another frame.
 
bool operator== (const ChFrameMoving< Real > &other) const
 Returns true for identical frames.
 
bool operator!= (const ChFrameMoving< Real > &other) const
 Returns true for different frames.
 
ChFrameMoving< Real > operator>> (const ChFrameMoving< Real > &Fb) const
 The '>>' operator transforms a coordinate system, so transformations can be represented with this syntax: new_frame = old_frame >> tr_frame; For a sequence of transformations, i.e. More...
 
ChFrameMoving< Real > operator* (const ChFrameMoving< Real > &Fb) const
 The '*' operator transforms a coordinate system, so transformations can be represented with this syntax: new_frame = tr_frame * old_frame; For a sequence of transformations, i.e. More...
 
ChFrameMoving< Real > & operator>>= (const ChFrameMoving< Real > &T)
 Performs pre-multiplication of this frame by another frame, for example: A>>=T means A'=T*A ; or A'=A >> T.
 
ChFrameMoving< Real > & operator%= (const ChFrameMoving< Real > &T)
 Performs pre-multiplication of this frame by another frame, for example: A%=T means A'=T*A ; or A'=A >> T Note: DEPRECATED, use >>= instead.
 
ChFrameMoving< Real > & operator*= (const ChFrameMoving< Real > &T)
 Performs post-multiplication of this frame by another frame, for example: A*=T means A'=A*T ; or A'=T >> A.
 
ChFrameMoving< Real > & operator>>= (const ChVector< Real > &D)
 Performs pre-multiplication of this frame by a vector D, to 'move' by a displacement D:
 
ChFrameMoving< Real > & operator>>= (const ChQuaternion< Real > &R)
 Performs pre-multiplication of this frame by a quaternion R, to 'rotate' it by R:
 
ChFrameMoving< Real > & operator>>= (const ChCoordsys< Real > &F)
 Performs pre-multiplication of this frame by a ChCoordsys F:
 
ChFrameMoving< Real > & operator>>= (const ChFrame< Real > &F)
 Performs pre-multiplication of this frame by a ChFrame F:
 
ChCoordsys< Real > & GetCoord_dt ()
 Return both current rotation and translation speeds as a coordsystem object, with vector and quaternion.
 
const ChCoordsys< Real > & GetCoord_dt () const
 
ChCoordsys< Real > & GetCoord_dtdt ()
 Return both current rotation and translation accelerations as a coordsystem object, with vector and quaternion.
 
const ChCoordsys< Real > & GetCoord_dtdt () const
 
ChVector< Real > & GetPos_dt ()
 Return the current speed as a 3d vector.
 
const ChVector< Real > & GetPos_dt () const
 
ChVector< Real > & GetPos_dtdt ()
 Return the current acceleration as a 3d vector.
 
const ChVector< Real > & GetPos_dtdt () const
 
ChQuaternion< Real > & GetRot_dt ()
 Return the current rotation speed as a quaternion.
 
const ChQuaternion< Real > & GetRot_dt () const
 
ChQuaternion< Real > & GetRot_dtdt ()
 Return the current rotation acceleration as a quaternion.
 
const ChQuaternion< Real > & GetRot_dtdt () const
 
ChVector< Real > GetWvel_loc () const
 Computes the actual angular speed (expressed in local coords)
 
ChVector< Real > GetWvel_par () const
 Computes the actual angular speed (expressed in parent coords)
 
ChVector< Real > GetWacc_loc () const
 Computes the actual angular acceleration (expressed in local coords)
 
ChVector< Real > GetWacc_par () const
 Computes the actual angular acceleration (expressed in parent coords)
 
virtual void SetCoord_dt (const ChCoordsys< Real > &mcoord_dt)
 Set both linear speed and rotation speed as a single ChCoordsys derivative.
 
virtual void SetPos_dt (const ChVector< Real > &mvel)
 Set the linear speed.
 
virtual void SetRot_dt (const ChQuaternion< Real > &mrot_dt)
 Set the rotation speed as a quaternion. More...
 
virtual void SetWvel_loc (const ChVector< Real > &wl)
 Set the rotation speed from given angular speed (expressed in local csys)
 
virtual void SetWvel_par (const ChVector< Real > &wp)
 Set the rotation speed from given angular speed (expressed in parent csys)
 
virtual void SetCoord_dtdt (const ChCoordsys< Real > &mcoord_dtdt)
 Set both linear acceleration and rotation acceleration as a single ChCoordsys derivative.
 
virtual void SetPos_dtdt (const ChVector< Real > &macc)
 Set the linear acceleration.
 
virtual void SetRot_dtdt (const ChQuaternion< Real > &mrot_dtdt)
 Set the rotation acceleration as a quaternion derivative. More...
 
virtual void SetWacc_loc (const ChVector< Real > &al)
 Set the rotation acceleration from given angular acceleration (expressed in local csys)
 
virtual void SetWacc_par (const ChVector< Real > &ap)
 Set the rotation speed from given angular speed (expressed in parent csys)
 
void Compute_Adt (ChMatrix33< Real > &mA_dt) const
 Computes the time derivative of rotation matrix, mAdt.
 
void Compute_Adtdt (ChMatrix33< Real > &mA_dtdt)
 Computes the 2nd time derivative of rotation matrix, mAdtdt.
 
ChMatrix33< Real > GetA_dt ()
 Computes and returns an Adt matrix (-note: prefer using Compute_Adt() directly for better performance)
 
ChMatrix33< Real > GetA_dtdt ()
 Computes and returns an Adt matrix (-note: prefer using Compute_Adtdt() directly for better performance)
 
void ConcatenatePreTransformation (const ChFrameMoving< Real > &T)
 Apply a transformation (rotation and translation) represented by another ChFrameMoving T. More...
 
void ConcatenatePostTransformation (const ChFrameMoving< Real > &T)
 Apply a transformation (rotation and translation) represented by another ChFrameMoving T in local coordinate. More...
 
ChVector< Real > PointSpeedLocalToParent (const ChVector< Real > &localpos) const
 Given the position of a point in local frame coords, and assuming it is sticky to frame, return the speed in parent coords.
 
ChVector< Real > PointSpeedLocalToParent (const ChVector< Real > &localpos, const ChVector< Real > &localspeed) const
 Given the position localpos of a point in the local reference frame, assuming that the point moves in the local reference frame with localspeed, return the speed in the parent reference frame.
 
ChVector< Real > PointAccelerationLocalToParent (const ChVector< Real > &localpos) const
 Given the position of a point in local frame coords, and assuming it is sticky to frame, return the acceleration in parent coords.
 
ChVector< Real > PointAccelerationLocalToParent (const ChVector< Real > &localpos, const ChVector< Real > &localspeed, const ChVector< Real > &localacc) const
 Given the position of a point in local frame coords, and assuming it has a frame-relative speed localspeed and frame-relative acceleration localacc, return the acceleration in parent coords.
 
ChVector< Real > PointSpeedParentToLocal (const ChVector< Real > &parentpos, const ChVector< Real > &parentspeed) const
 Given the position of a point in parent frame coords, and assuming it has an absolute speed parentspeed, return the speed in local coords.
 
ChVector< Real > PointAccelerationParentToLocal (const ChVector< Real > &parentpos, const ChVector< Real > &parentspeed, const ChVector< Real > &parentacc) const
 Given the position of a point in parent frame coords, and assuming it has an absolute speed parentspeed and absolute acceleration parentacc, return the acceleration in local coords.
 
void TransformLocalToParent (const ChFrameMoving< Real > &local, ChFrameMoving< Real > &parent) const
 This function transforms a frame from 'this' local coordinate system to parent frame coordinate system, and also transforms the speed and acceleration of the frame. More...
 
void TransformParentToLocal (const ChFrameMoving< Real > &parent, ChFrameMoving< Real > &local) const
 This function transforms a frame from the parent coordinate system to 'this' local frame coordinate system. More...
 
bool Equals (const ChFrameMoving< Real > &other) const
 Returns true if coordsys is identical to other coordsys.
 
bool Equals (const ChFrameMoving< Real > &other, Real tol) const
 Returns true if coordsys is equal to other coordsys, within a tolerance 'tol'.
 
virtual void Invert () override
 The transformation (also for speeds, accelerations) is inverted in place. More...
 
ChFrameMoving< Real > GetInverse () const
 
virtual void ArchiveOUT (ChArchiveOut &marchive) override
 Method to allow serialization of transient data to archives.
 
virtual void ArchiveIN (ChArchiveIn &marchive) override
 Method to allow de serialization of transient data from archives.
 
- Public Member Functions inherited from chrono::ChFrame< Real >
 ChFrame (const ChVector< Real > &mv=ChVector< Real >(0, 0, 0), const ChQuaternion< Real > &mq=ChQuaternion< Real >(1, 0, 0, 0))
 Default constructor, or construct from pos and rot (as a quaternion)
 
 ChFrame (const ChVector< Real > &mv, const ChMatrix33< Real > &ma)
 Construct from pos and rotation (as a 3x3 matrix)
 
 ChFrame (const ChCoordsys< Real > &mc)
 Construct from a coordsys.
 
 ChFrame (const ChVector< Real > &mv, const Real alpha, const ChVector< Real > &mu)
 Construct from position mv and rotation of angle alpha around unit vector mu.
 
 ChFrame (const ChFrame< Real > &other)
 Copy constructor, build from another frame.
 
ChFrame< Real > & operator= (const ChFrame< Real > &other)
 Assignment operator: copy from another frame.
 
virtual bool operator== (const ChFrame< Real > &other) const
 Returns true for identical frames.
 
virtual bool operator!= (const ChFrame< Real > &other) const
 Returns true for different frames.
 
ChFrame< Real > operator>> (const ChFrame< Real > &Fb) const
 The '>>' operator transforms a coordinate system, so transformations can be represented with this syntax: new_frame = old_frame >> tr_frame; For a sequence of transformations, i.e. More...
 
ChFrame< Real > operator* (const ChFrame< Real > &Fb) const
 The '>>' operator transforms a vector, so transformations can be represented with this syntax: new_v = old_v >> tr_frame; For a sequence of transformations, i.e. More...
 
ChVector< Real > operator* (const ChVector< Real > &V) const
 The '*' operator transforms a vector, so transformations can be represented with this syntax: new_v = tr_frame * old_v; For a sequence of transformations, i.e. More...
 
ChVector< Real > operator/ (const ChVector< Real > &V) const
 The '/' is like the '*' operator (see), but uses the inverse transformation for A, in A/b. More...
 
ChFrame< Real > & operator>>= (const ChFrame< Real > &T)
 Performs pre-multiplication of this frame by another frame, for example: A>>=T means A'=T*A ; or A'=A >> T.
 
ChFrame< Real > & operator%= (const ChFrame< Real > &T)
 Performs pre-multiplication of this frame by another frame, for example: A%=T means A'=T*A ; or A'=A >> T Note: DEPRECATED, use >>= instead.
 
ChFrame< Real > & operator*= (const ChFrame< Real > &T)
 Performs post-multiplication of this frame by another frame, for example: A*=T means A'=A*T ; or A'=T >> A.
 
ChFrame< Real > & operator>>= (const ChVector< Real > &D)
 Performs pre-multiplication of this frame by a vector D, to 'move' by a displacement D:
 
ChFrame< Real > & operator>>= (const ChQuaternion< Real > &R)
 Performs pre-multiplication of this frame by a quaternion R, to 'rotate' it by R:
 
ChFrame< Real > & operator>>= (const ChCoordsys< Real > &F)
 Performs pre-multiplication of this frame by a ChCoordsys F, to transform it:
 
ChCoordsys< Real > & GetCoord ()
 Return both current rotation and translation as a coordsystem object, with vector and quaternion.
 
const ChCoordsys< Real > & GetCoord () const
 
ChVector< Real > & GetPos ()
 Return the current translation as a 3d vector.
 
const ChVector< Real > & GetPos () const
 
ChQuaternion< Real > & GetRot ()
 Return the current rotation as a quaternion.
 
const ChQuaternion< Real > & GetRot () const
 
ChMatrix33< Real > & GetA ()
 Return the current rotation as a 3x3 matrix.
 
const ChMatrix33< Real > & GetA () const
 
ChVector< Real > GetRotAxis ()
 Get axis of finite rotation, in parent space.
 
Real GetRotAngle ()
 Get angle of rotation about axis of finite rotation.
 
virtual void SetCoord (const ChCoordsys< Real > &mcoord)
 Impose both translation and rotation as a single ChCoordsys. More...
 
virtual void SetCoord (const ChVector< Real > &mv, const ChQuaternion< Real > &mq)
 Impose both translation and rotation. More...
 
virtual void SetRot (const ChQuaternion< Real > &mrot)
 Impose the rotation as a quaternion. More...
 
virtual void SetRot (const ChMatrix33< Real > &mA)
 Impose the rotation as a 3x3 matrix. More...
 
virtual void SetPos (const ChVector< Real > &mpos)
 Impose the translation.
 
void ConcatenatePreTransformation (const ChFrame< Real > &T)
 Apply a transformation (rotation and translation) represented by another ChFrame T. More...
 
void ConcatenatePostTransformation (const ChFrame< Real > &T)
 Apply a transformation (rotation and translation) represented by another ChFrame T in local coordinate. More...
 
void Move (const ChVector< Real > &V)
 An easy way to move the frame by the amount specified by vector V, (assuming V expressed in parent coordinates)
 
void Move (const ChCoordsys< Real > &VR)
 Apply both translation and rotation, assuming both expressed in parent coordinates, as a vector for translation and quaternion for rotation,.
 
virtual ChVector< Real > TransformLocalToParent (const ChVector< Real > &local) const
 This function transforms a point from the local frame coordinate system to the parent coordinate system. More...
 
virtual ChVector< Real > TransformPointLocalToParent (const ChVector< Real > &local) const
 
virtual ChVector< Real > TransformParentToLocal (const ChVector< Real > &parent) const
 This function transforms a point from the parent coordinate system to local frame coordinate system. More...
 
virtual ChVector< Real > TransformPointParentToLocal (const ChVector< Real > &parent) const
 
virtual void TransformLocalToParent (const ChFrame< Real > &local, ChFrame< Real > &parent) const
 This function transforms a frame from 'this' local coordinate system to parent frame coordinate system. More...
 
virtual void TransformParentToLocal (const ChFrame< Real > &parent, ChFrame< Real > &local) const
 This function transforms a frame from the parent coordinate system to 'this' local frame coordinate system. More...
 
virtual ChVector< Real > TransformDirectionParentToLocal (const ChVector< Real > &mdirection) const
 This function transforms a direction from 'this' local coordinate system to parent frame coordinate system. More...
 
virtual ChVector< Real > TransformDirectionLocalToParent (const ChVector< Real > &mdirection) const
 This function transforms a direction from the parent frame coordinate system to 'this' local coordinate system. More...
 
bool Equals (const ChFrame< Real > &other) const
 Returns true if coordsys is identical to other coordsys.
 
bool Equals (const ChFrame< Real > &other, Real tol) const
 Returns true if coordsys is equal to other coordsys, within a tolerance 'tol'.
 
void Normalize ()
 Normalize the rotation, so that quaternion has unit length.
 
virtual void SetIdentity ()
 Sets to no translation and no rotation.
 
ChFrame< Real > GetInverse () const
 

Public Attributes

ChCoordsys< Real > coord_dt
 Rotation and position speed, as vector+quaternion.
 
ChCoordsys< Real > coord_dtdt
 Rotation and position acceleration, as vector+quaternion.
 
- Public Attributes inherited from chrono::ChFrame< Real >
ChCoordsys< Real > coord
 Rotation and position, as vector+quaternion.
 
ChMatrix33< Real > Amatrix
 3x3 orthogonal rotation matrix
 

Member Function Documentation

◆ ConcatenatePostTransformation()

template<class Real = double>
void chrono::ChFrameMoving< Real >::ConcatenatePostTransformation ( const ChFrameMoving< Real > &  T)
inline

Apply a transformation (rotation and translation) represented by another ChFrameMoving T in local coordinate.

This is equivalent to post-multiply this frame by the other frame T: this'= this * T; or this' = T >> this

◆ ConcatenatePreTransformation()

template<class Real = double>
void chrono::ChFrameMoving< Real >::ConcatenatePreTransformation ( const ChFrameMoving< Real > &  T)
inline

Apply a transformation (rotation and translation) represented by another ChFrameMoving T.

This is equivalent to pre-multiply this frame by the other frame T: this'= T * this; or this' = this >> T

◆ Invert()

template<class Real = double>
virtual void chrono::ChFrameMoving< Real >::Invert ( )
inlineoverridevirtual

The transformation (also for speeds, accelerations) is inverted in place.

That is if w=A*v, then A.Invert();v=A*w;

Reimplemented from chrono::ChFrame< Real >.

◆ operator*()

template<class Real = double>
ChFrameMoving<Real> chrono::ChFrameMoving< Real >::operator* ( const ChFrameMoving< Real > &  Fb) const
inline

The '*' operator transforms a coordinate system, so transformations can be represented with this syntax: new_frame = tr_frame * old_frame; For a sequence of transformations, i.e.

a chain of coordinate systems, you can also write this (just like you would do with a sequence of Denavitt-Hartemberg matrix multiplications!) new_frame = frame1to0 * frame2to1 * frame3to2 * old_frame; This operation is not commutative. Also speeds and accelerations are transformed.

◆ operator>>()

template<class Real = double>
ChFrameMoving<Real> chrono::ChFrameMoving< Real >::operator>> ( const ChFrameMoving< Real > &  Fb) const
inline

The '>>' operator transforms a coordinate system, so transformations can be represented with this syntax: new_frame = old_frame >> tr_frame; For a sequence of transformations, i.e.

a chain of coordinate systems, you can also write this (like you would do with a sequence of Denavitt-Hartemberg matrix multiplications, but in the opposite order...) new_frame = old_frame >> frame3to2 >> frame2to1 >> frame1to0; This operation is not commutative. Also speeds and accelerations are transformed.

◆ SetRot_dt()

template<class Real = double>
virtual void chrono::ChFrameMoving< Real >::SetRot_dt ( const ChQuaternion< Real > &  mrot_dt)
inlinevirtual

Set the rotation speed as a quaternion.

Note: the quaternion must already satisfy dot(q,q_dt)=0

◆ SetRot_dtdt()

template<class Real = double>
virtual void chrono::ChFrameMoving< Real >::SetRot_dtdt ( const ChQuaternion< Real > &  mrot_dtdt)
inlinevirtual

Set the rotation acceleration as a quaternion derivative.

Note: the quaternion must already satisfy dot(q,q_dt)=0

◆ TransformLocalToParent()

template<class Real = double>
void chrono::ChFrameMoving< Real >::TransformLocalToParent ( const ChFrameMoving< Real > &  local,
ChFrameMoving< Real > &  parent 
) const
inline

This function transforms a frame from 'this' local coordinate system to parent frame coordinate system, and also transforms the speed and acceleration of the frame.

Parameters
localframe to transform, given in local frame coordinates
parenttransformed frame, in parent coordinates, will be stored here

◆ TransformParentToLocal()

template<class Real = double>
void chrono::ChFrameMoving< Real >::TransformParentToLocal ( const ChFrameMoving< Real > &  parent,
ChFrameMoving< Real > &  local 
) const
inline

This function transforms a frame from the parent coordinate system to 'this' local frame coordinate system.

Parameters
parentframe to transform, given in parent coordinates
localtransformed frame, in local coordinates, will be stored here

The documentation for this class was generated from the following file:
  • /builds/uwsbel/chrono/src/chrono/core/ChFrameMoving.h