Gazebo Common

API Reference

3.17.0
NodeAnimation Class Reference

Node animation. More...

#include <ignition/common/NodeAnimation.hh>

Public Member Functions

 NodeAnimation (const std::string &_name)
 constructor More...
 
 ~NodeAnimation ()
 Destructor. More...
 
void AddKeyFrame (const double _time, const math::Matrix4d &_trans)
 Adds a key frame at a specific time. More...
 
void AddKeyFrame (const double _time, const math::Pose3d &_pose)
 Adds a key frame at a specific time. More...
 
gz::math::Matrix4d FrameAt (const double _time, const bool _loop=true) const
 Returns a frame transformation at a specific time if a node does not exist at that time (with tolerance of 1e-6 sec), the transformation is interpolated. More...
 
unsigned int FrameCount () const
 Returns the number of key frames. More...
 
std::pair< double, math::Matrix4dKeyFrame (const unsigned int _i) const
 Returns a key frame using the index. Note the index of a key frame can change as frames are added. More...
 
void KeyFrame (const unsigned int _i, double &_time, math::Matrix4d &_trans) const
 Finds a key frame using the index. Note the index of a key frame can change as frames are added. More...
 
double Length () const
 Returns the duration of the animations. More...
 
std::string Name () const
 Returns the name. More...
 
void Scale (const double _scale)
 Scales each transformation in the key frames. This only affects the translational values. More...
 
void SetName (const std::string &_name)
 Changes the name of the animation. More...
 
double TimeAtX (const double _x) const
 Returns the time where a transformation's translational value along the X axis is equal to _x. When no transformation is found (within a tolerance of 1e-6), the time is interpolated. More...
 

Detailed Description

Node animation.

Constructor & Destructor Documentation

◆ NodeAnimation()

NodeAnimation ( const std::string _name)
explicit

constructor

Parameters
[in]_namethe name of the node

◆ ~NodeAnimation()

Destructor.

Member Function Documentation

◆ AddKeyFrame() [1/2]

void AddKeyFrame ( const double  _time,
const math::Matrix4d _trans 
)

Adds a key frame at a specific time.

Parameters
[in]_timethe time of the key frame
[in]_transthe transformation

◆ AddKeyFrame() [2/2]

void AddKeyFrame ( const double  _time,
const math::Pose3d _pose 
)

Adds a key frame at a specific time.

Parameters
[in]_timethe tiem of the key frame
[in]_posethe pose

◆ FrameAt()

gz::math::Matrix4d FrameAt ( const double  _time,
const bool  _loop = true 
) const

Returns a frame transformation at a specific time if a node does not exist at that time (with tolerance of 1e-6 sec), the transformation is interpolated.

Parameters
[in]_timethe time
[in]_loopwhen true, the time is divided by the duration (see GetLength)

◆ FrameCount()

unsigned int FrameCount ( ) const

Returns the number of key frames.

Returns
the count

◆ KeyFrame() [1/2]

std::pair<double, math::Matrix4d> KeyFrame ( const unsigned int  _i) const

Returns a key frame using the index. Note the index of a key frame can change as frames are added.

Parameters
[in]_ithe index
Returns
a pair that contains the time and transformation. Time is -1 if the index is out of bounds

◆ KeyFrame() [2/2]

void KeyFrame ( const unsigned int  _i,
double &  _time,
math::Matrix4d _trans 
) const

Finds a key frame using the index. Note the index of a key frame can change as frames are added.

Parameters
[in]_ithe index
[out]_timethe time of the frame, or -1 if the index id is out of bounds
[out]_transthe transformation for this key frame

◆ Length()

double Length ( ) const

Returns the duration of the animations.

Returns
the time of the last animation

◆ Name()

std::string Name ( ) const

Returns the name.

Returns
the name

◆ Scale()

void Scale ( const double  _scale)

Scales each transformation in the key frames. This only affects the translational values.

Parameters
[in]_scalethe scaling factor

◆ SetName()

void SetName ( const std::string _name)

Changes the name of the animation.

Parameters
[in]thenew name

◆ TimeAtX()

double TimeAtX ( const double  _x) const

Returns the time where a transformation's translational value along the X axis is equal to _x. When no transformation is found (within a tolerance of 1e-6), the time is interpolated.

Parameters
[in]_xthe value along x. You must ensure that _x is within a valid range.

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