V-ART
Classes | Public Member Functions | Protected Member Functions | Protected Attributes | Friends | List of all members
VART::JointAction Class Reference

A coordinated movement of joints in an articulated body. More...

#include <jointaction.h>

Inheritance diagram for VART::JointAction:
VART::BaseAction VART::XmlJointAction

Classes

class  Initializer
 

Public Member Functions

 JointAction ()
 
virtual ~JointAction ()
 
JointMoverAddJointMover (Joint *jointPtr, float newDuration, const Interpolator &interpolator)
 Adds a joint mover to the action. More...
 
JointMoverAddJointMover (Joint *jointPtr, JointMover *jointMover)
 Used to add a copy of jointMover, aplied to jointPtr. More...
 
void SetPriority (unsigned int newPriority)
 Sets the priority of an action. More...
 
void GetFinalTimes (std::list< float > *resultPtr)
 Returns a ordered list with all different final times for every dof mover. More...
 
void ModifyDofMovers (DMModifier &mod)
 Modifies dof movers. More...
 
DofMoverSearchDofMover (Joint *jointPtr, Joint::DofID dof)
 Returns a dof mover. More...
 
void GetJoints (std::list< Joint * > *listPtr)
 Returns a list of all target joints. More...
 
virtual void Activate ()
 Activates a JointAction. More...
 
- Public Member Functions inherited from VART::BaseAction
 BaseAction ()
 Creates an action with sane defaults. More...
 
virtual ~BaseAction ()
 
void SetSpeed (float newSpeed)
 
void SetDuration (float seconds)
 
void SetCyclic (bool value)
 
bool IsCyclic ()
 
bool IsActive () const
 
void Deactivate (float seconds)
 Mark for auto deactivation in given time. More...
 
virtual void Deactivate ()
 Deactivate now. More...
 

Protected Member Functions

virtual void Move ()
 Make the action update its targets. More...
 
void DeactivateDofMovers ()
 
void AddToActiveInstancesList ()
 Adds itself to list of active instances, in priority order. More...
 
- Protected Member Functions inherited from VART::BaseAction
virtual void ComputePositionIndex (bool *cycled)
 Computes current position index. More...
 

Protected Attributes

std::list< JointMover * > jointMoverList
 
unsigned int priority
 
- Protected Attributes inherited from VART::BaseAction
bool cyclic
 Whether the action restarts upon termination. More...
 
bool active
 Whether the action is currently active (changing its target). More...
 
float speedModifier
 Speed modifier. More...
 
float duration
 Duration in seconds. More...
 
float timeToLive
 Time (in seconds) to auto deactivate. More...
 
float positionIndex
 Current position index. More...
 
float lastPositionIndex
 Position index of last update. More...
 
Time lastUpdateTime
 Time of last update. More...
 

Friends

std::ostream & operator<< (std::ostream &output, const JointAction &action)
 

Additional Inherited Members

- Static Public Member Functions inherited from VART::BaseAction
static unsigned int MoveAllActive ()
 Moves all active actions. More...
 
- Public Attributes inherited from VART::BaseAction
std::string description
 
CallBackcallbackPtr
 Termination callback. More...
 
- Static Protected Attributes inherited from VART::BaseAction
static std::list< BaseAction * > activeInstances
 List of active actions. More...
 
static std::list< Initializer * > initializers
 List of action initializers. More...
 

Detailed Description

A coordinated movement of joints in an articulated body.

Actions represent simple tasks such as walking, waving or scratching the head. They may be thought as an integration of key poses, interpolation schemes and time control. When the time period for a non-cyclic action terminates, it is automatically deactivated. They are implementated as a collection of joint movers (see JointMover).

Definition at line 26 of file jointaction.h.

Constructor & Destructor Documentation

VART::JointAction::JointAction ( )

Definition at line 38 of file jointaction.cpp.

virtual VART::JointAction::~JointAction ( )
inlinevirtual

Definition at line 30 of file jointaction.h.

Member Function Documentation

void VART::JointAction::Activate ( )
virtual

Activates a JointAction.

Reimplemented from VART::BaseAction.

Definition at line 45 of file jointaction.cpp.

VART::JointMover * VART::JointAction::AddJointMover ( Joint jointPtr,
float  newDuration,
const Interpolator interpolator 
)

Adds a joint mover to the action.

Returns
A pointer to a newly created joint mover.
Parameters
[in]jointPtrA pointer to the joint that will be controlled by the new joint mover.
[in]newDurationDuration (in seconds) of the joint movement.
[in]interpolatorAn interpolator instance that will control motion.
Attention
Make sure that "interpolator" remains in its original memory space during lifetime of the joint mover. The joint mover will keep just a pointer to the interpolator.

Creates a new joint mover which is assigned to the action. The memory allocated by the joint mover will be deallocated by the action's destructor.

Definition at line 113 of file jointaction.cpp.

JointMover* VART::JointAction::AddJointMover ( Joint jointPtr,
JointMover jointMover 
)

Used to add a copy of jointMover, aplied to jointPtr.

void VART::JointAction::AddToActiveInstancesList ( )
protected

Adds itself to list of active instances, in priority order.

Definition at line 60 of file jointaction.cpp.

References priority.

void VART::JointAction::DeactivateDofMovers ( )
protected

Definition at line 90 of file jointaction.cpp.

void VART::JointAction::GetFinalTimes ( std::list< float > *  resultPtr)

Returns a ordered list with all different final times for every dof mover.

Definition at line 97 of file jointaction.cpp.

void VART::JointAction::GetJoints ( std::list< Joint * > *  listPtr)

Returns a list of all target joints.

Definition at line 105 of file jointaction.cpp.

void VART::JointAction::ModifyDofMovers ( DMModifier mod)

Modifies dof movers.

Definition at line 149 of file jointaction.cpp.

void VART::JointAction::Move ( )
protectedvirtual

Make the action update its targets.

Move is to be called from MoveAllActive.

Implements VART::BaseAction.

Definition at line 125 of file jointaction.cpp.

References VART::DofMover::cycle, VART::JointMover::goalTime, and VART::DofMover::priority.

VART::DofMover * VART::JointAction::SearchDofMover ( Joint jointPtr,
Joint::DofID  dof 
)

Returns a dof mover.

Searches for a DofMover that works on given joint and dof. Returns NULL if not found.

Definition at line 157 of file jointaction.cpp.

void VART::JointAction::SetPriority ( unsigned int  newPriority)
inline

Sets the priority of an action.

Definition at line 52 of file jointaction.h.

References priority.

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  output,
const JointAction action 
)
friend

Member Data Documentation

std::list<JointMover*> VART::JointAction::jointMoverList
protected

Definition at line 87 of file jointaction.h.

unsigned int VART::JointAction::priority
protected

Definition at line 88 of file jointaction.h.

Referenced by AddToActiveInstancesList(), and SetPriority().


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