Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

rdCMC_Task Class Reference

An abstract base class for specifying a task objective for a dynamic simulation. More...

#include <rdCMC_Task.h>

Inheritance diagram for rdCMC_Task:

rdCMC_Joint rdCMC_Orientation rdCMC_Point List of all members.

Public Member Functions

 rdCMC_Task ()
 Construct a default track object for a specified model.
 rdCMC_Task (DOMElement *aElement)
 Construct a track object from an XML Element.
 rdCMC_Task (const rdCMC_Task &aTaskObject)
 Copy constructor.
virtual ~rdCMC_Task ()
 Destructor.
virtual OpenSim::Object * copy () const =0
virtual OpenSim::Object * copy (DOMElement *aElement) const =0
rdCMC_Taskoperator= (const rdCMC_Task &aTaskObject)
 Assignment operator.
void setModel (OpenSim::Model *aModel)
 Set the model to which this track object applies.
OpenSim::Model * getModel () const
 Get the model to which this track object applies.
void setOn (bool aTrueFalse)
 Turn this track object on or off.
bool getOn () const
 Get whether or not this track object is on.
virtual void setParametersBasedOnName ()=0
void setWRTBody (int aBody)
 Set the body with respect to (WRT) which the track goals are specified.
int getWRTBody () const
 Get the body with respect to (WRT) which the track goals are specified.
void setExpressBody (int aBody)
 Set the body in which the track goals are expressed.
int getExpressBody () const
 Get the body in which the track goals are expressed.
void setActive (bool a0, bool a1=false, bool a2=false)
 Set whether or not track goals are active.
bool getActive (int aWhich) const
 Get whether a specified track goal is active.
void setWeight (double aW0, double aW1=0.0, double aW2=0.0)
 Set the weight of each track goal.
double getWeight (int aWhich) const
 Get the weight of each track goal.
void setKP (double aK0, double aK1=0.0, double aK2=0.0)
 Set the position gains for each track goal.
double getKP (int aWhich) const
 Get the position gain for a specified track goal.
void setKV (double aK0, double aK1=0.0, double aK2=0.0)
 Set the velocity gains for each track goal.
double getKV (int aWhich) const
 Get the velocity gain for a specified track goal.
void setKA (double aK0, double aK1=0.0, double aK2=0.0)
 Set the acceleration gains for each track goal.
double getKA (int aWhich) const
 Get the acceleration gain for a specified track goal.
void setDirection_0 (const double aR[3])
 Set the direction of track goal 0.
void getDirection_0 (double rR[3]) const
 Get the direction of track goal 0.
void setDirection_1 (const double aR[3])
 Set the direction of track goal 1.
void getDirection_1 (double rR[3]) const
 Get the direction of track goal 1.
void setDirection_2 (const double aR[3])
 Set the direction of track goal 2.
void getDirection_2 (double rR[3]) const
 Get the direction of track goal 2.
int getNumTaskFunctions () const
 Get the number of position track functions.
void setTaskFunctions (OpenSim::Function *aF0, OpenSim::Function *aF1=NULL, OpenSim::Function *aF2=NULL)
 Set the track functions.
OpenSim::Function * getTaskFunction (int aWhich) const
 Get a specified track function.
void setTaskFunctionsForVelocity (OpenSim::Function *aF0, OpenSim::Function *aF1=NULL, OpenSim::Function *aF2=NULL)
 Set the velocity track functions.
OpenSim::Function * getTaskFunctionForVelocity (int aWhich) const
 Get a specified velocity track function.
void setTaskFunctionsForAcceleration (OpenSim::Function *aF0, OpenSim::Function *aF1=NULL, OpenSim::Function *aF2=NULL)
 Set the acceleration track functions.
OpenSim::Function * getTaskFunctionForAcceleration (int aWhich) const
 Get a specified acceleration track function.
double getTaskPosition (int aWhich, double aT) const
 Get the task position.
double getTaskVelocity (int aWhich, double aT) const
 Get the task velocity.
double getTaskAcceleration (int aWhich, double aT) const
 Get the task acceleration.
void setPositionErrorLast (double aE0, double aE1=0.0, double aE2=0.0)
 Set the last achieved position error.
double getPositionErrorLast (int aWhich) const
 Get the last achieved position error.
void setVelocityErrorLast (double aE0, double aE1=0.0, double aE2=0.0)
 Set the last achieved velocity error.
double getVelocityErrorLast (int aWhich) const
 Get the last achieved velocity error.
double getPositionError (int aWhich) const
 Get the position track error of a specified track goal.
double getVelocityError (int aWhich) const
 Get the velocity track error of a specified track goal.
double getDesiredAcceleration (int aWhich) const
 Get the desired acceleration of a specified track goal.
double getAcceleration (int aWhich) const
 Get the acceleration of a specified track goal.
virtual void computeErrors (double aT)=0
virtual void computeDesiredAccelerations (double aT)=0
virtual void computeDesiredAccelerations (double aTI, double aTF)=0
virtual void computeAccelerations ()=0
virtual void computeJacobian ()
 Compute the Jacobian.
virtual void computeEffectiveMassMatrix ()
 Compute the effective mass matrix.
virtual void updateFromXMLNode ()
 Update this object based on its XML node.

Protected Attributes

OpenSim::PropertyBool _propOn
 Property to indicate on or off state.
OpenSim::PropertyInt _propWRTBody
 Body with respect to which the task goals are specified.
OpenSim::PropertyInt _propExpressBody
 Body frame in which the task goals are expressed.
OpenSim::PropertyBoolArray _propActive
 Property to specify the active task goals.
OpenSim::PropertyDblArray _propW
 Weights of the task goals.
OpenSim::PropertyDblArray _propKP
 Position error feedback gain.
OpenSim::PropertyDblArray _propKV
 Velocity error feedback gain.
OpenSim::PropertyDblArray _propKA
 Feedforward acceleration gain.
OpenSim::PropertyDblArray _propR0
 Directions of the task goal 0.
OpenSim::PropertyDblArray _propR1
 Directions of the task goal 1.
OpenSim::PropertyDblArray _propR2
 Directions of the task goal 2.
bool & _on
 Reference to the value of the on property.
int & _wrtBody
 Reference to the value of the WRTBody property.
int & _expressBody
 Reference to the value of the ExpressBody property.
OpenSim::Array< bool > & _active
 Reference to the value of the Active property.
OpenSim::Array< double > & _w
 Reference to the value of the Weight property.
OpenSim::Array< double > & _kp
 Reference to the value of the KP property.
OpenSim::Array< double > & _kv
 Reference to the value of the KV property.
OpenSim::Array< double > & _ka
 Reference to the value of the KA property.
OpenSim::Array< double > & _r0
 Reference to the value of the R0 property.
OpenSim::Array< double > & _r1
 Reference to the value of the R1 property.
OpenSim::Array< double > & _r2
 Reference to the value of the R2 property.
OpenSim::Model * _model
 Model.
int _nTrk
 Number of task functions.
OpenSim::Function * _pTrk [3]
 Position task functions.
OpenSim::Function * _vTrk [3]
 Velocity task functions.
OpenSim::Function * _aTrk [3]
 Acceleration task functions.
double _pErrLast [3]
 Last position error.
double _pErr [3]
 Position error.
double _vErrLast [3]
 Last velocity error.
double _vErr [3]
 Velocity error.
double _aDes [3]
 Desired accelerations.
double _a [3]
 Accelerations.
double * _j
 Jacobian.
double * _m
 Effective mass matrix.

Private Member Functions

void setNull ()
 Set NULL values for all member variables.
void setupProperties ()
 Set up the properties.
void copyData (const rdCMC_Task &aTaskObject)
 Copy the member data for this class only.

Detailed Description

An abstract base class for specifying a task objective for a dynamic simulation.

This class supports joint, point, and orientation task objectives. Specfic implementations for these kinds of control tasks should inherit from this class.

Author:
Frank C. Anderson
Version:
1.0


Constructor & Destructor Documentation

rdCMC_Task::rdCMC_Task DOMElement *  aElement  ) 
 

Construct a track object from an XML Element.

Parameters:
aModel Model for which tracking is being conducted.
aElement XML element.

rdCMC_Task::rdCMC_Task const rdCMC_Task aTask  ) 
 

Copy constructor.

Parameters:
aTask Task object to be copied.


Member Function Documentation

void rdCMC_Task::copyData const rdCMC_Task aTask  )  [private]
 

Copy the member data for this class only.

Parameters:
aTask Object whose data is to be copied.

double rdCMC_Task::getAcceleration int  aWhich  )  const
 

Get the acceleration of a specified track goal.

The acceleration returned is the dot product of the appropriate track-goal direction and the acceleration of the point or orientation in question. In the case of generalized coordinates, the acceleration of the generalized coordinate is returned (i.e., a direction is not appropriate).

For the value returned by this method to be valid, the method computeAccelerations() must be called first.

Parameters:
aWhich Specifies which track goal (0, 1, or 2).
Returns:
Acceleration. rdMath::NAN is returned on an error.

bool rdCMC_Task::getActive int  aWhich  )  const
 

Get whether a specified track goal is active.

Parameters:
aWhich Number of the track goal in question.
Returns:
True if the specified track goal is active, false otherwise.

double rdCMC_Task::getDesiredAcceleration int  aWhich  )  const
 

Get the desired acceleration of a specified track goal.

The method computeDesiredAccelerations() must be called first for the values returned by this method to be valid.

Parameters:
aWhich Specifies which track goal (0, 1, or 2).
Returns:
Desired acceleration. rdMath::NAN is returned on an error.

void rdCMC_Task::getDirection_0 double  rR[3]  )  const
 

Get the direction of track goal 0.

Parameters:
aR Direction.

void rdCMC_Task::getDirection_1 double  rR[3]  )  const
 

Get the direction of track goal 1.

Parameters:
aR Direction.

void rdCMC_Task::getDirection_2 double  rR[3]  )  const
 

Get the direction of track goal 2.

Parameters:
aR Direction.

int rdCMC_Task::getExpressBody  )  const
 

Get the body in which the track goals are expressed.

Returns:
Body ID.

double rdCMC_Task::getKA int  aWhich  )  const
 

Get the acceleration gain for a specified track goal.

Parameters:
aWhich Number of the track goal in question.
Returns:
Acceleration gain.

double rdCMC_Task::getKP int  aWhich  )  const
 

Get the position gain for a specified track goal.

Parameters:
aWhich Number of the track goal in question.
Returns:
Position gain.

double rdCMC_Task::getKV int  aWhich  )  const
 

Get the velocity gain for a specified track goal.

Parameters:
aWhich Number of the track goal in question.
Returns:
Velocity gain.

Model * rdCMC_Task::getModel  )  const
 

Get the model to which this track object applies.

Returns:
Pointer to the model.

int rdCMC_Task::getNumTaskFunctions  )  const
 

Get the number of position track functions.

Returns:
Number of position track functions.

bool rdCMC_Task::getOn  )  const
 

Get whether or not this track object is on.

Returns:
True if on, false if off.

double rdCMC_Task::getPositionError int  aWhich  )  const
 

Get the position track error of a specified track goal.

Parameters:
aWhich Specifies which track goal (0, 1, or 2).
Returns:
Error

double rdCMC_Task::getPositionErrorLast int  aWhich  )  const
 

Get the last achieved position error.

This information is useful for checking that error dynamics are being followed.

Parameters:
aWhich Specifies which track goal (0, 1, or 2).
Returns:
Last position error.

double rdCMC_Task::getTaskAcceleration int  aWhich,
double  aT
const
 

Get the task acceleration.

Parameters:
aWhich Specifies which task goal (0, 1, or 2).
aT Time (in real time units).
Returns:
Task acceleration.
Exceptions:
Exception for an invalid task.

Function * rdCMC_Task::getTaskFunction int  aWhich  )  const
 

Get a specified track function.

Parameters:
aWhich Specifies which track function (0, 1, or 2).
Returns:
Function.

Function * rdCMC_Task::getTaskFunctionForAcceleration int  aWhich  )  const
 

Get a specified acceleration track function.

Parameters:
aWhich Specifies which track function (0, 1, or 2).
Returns:
Function.

Function * rdCMC_Task::getTaskFunctionForVelocity int  aWhich  )  const
 

Get a specified velocity track function.

Parameters:
aWhich Specifies which track function (0, 1, or 2).
Returns:
Function.

double rdCMC_Task::getTaskPosition int  aWhich,
double  aT
const
 

Get the task position.

Parameters:
aWhich Specifies which task goal (0, 1, or 2).
aT Time (in real time units).
Returns:
Task position.
Exceptions:
Exception for an invalid task.

double rdCMC_Task::getTaskVelocity int  aWhich,
double  aT
const
 

Get the task velocity.

Parameters:
aWhich Specifies which task goal (0, 1, or 2).
aT Time (in real time units).
Returns:
Task velocity.
Exceptions:
Exception for an invalid task.

double rdCMC_Task::getVelocityError int  aWhich  )  const
 

Get the velocity track error of a specified track goal.

Parameters:
aWhich Specifies which track goal (0, 1, or 2).
Returns:
Error

double rdCMC_Task::getVelocityErrorLast int  aWhich  )  const
 

Get the last achieved velocity error.

This information is useful for checking that error dynamics are being followed.

Parameters:
aWhich Specifies which track goal (0, 1, or 2).
Returns:
Last velocity error.

double rdCMC_Task::getWeight int  aWhich  )  const
 

Get the weight of each track goal.

Parameters:
aWhich Number of the track goal in question.
Returns:
Weight.

int rdCMC_Task::getWRTBody  )  const
 

Get the body with respect to (WRT) which the track goals are specified.

Returns:
Body ID.

rdCMC_Task & rdCMC_Task::operator= const rdCMC_Task aTask  ) 
 

Assignment operator.

Returns:
Reference to the altered object.

void rdCMC_Task::setActive bool  a0,
bool  a1 = false,
bool  a2 = false
 

Set whether or not track goals are active.

Parameters:
a0 Active flag for track goal 0-- true means active.
a1 Active flag for track goal 1-- true means active.
a2 Active flag for track goal 2-- true means active.

void rdCMC_Task::setDirection_0 const double  aR[3]  ) 
 

Set the direction of track goal 0.

Parameters:
aR Direction. This vector is normalized.

void rdCMC_Task::setDirection_1 const double  aR[3]  ) 
 

Set the direction of track goal 1.

Parameters:
aR Direction. This vector is normalized.

void rdCMC_Task::setDirection_2 const double  aR[3]  ) 
 

Set the direction of track goal 2.

Parameters:
aR Direction. This vector is normalized.

void rdCMC_Task::setExpressBody int  aBody  ) 
 

Set the body in which the track goals are expressed.

Parameters:
aBody Body ID.

void rdCMC_Task::setKA double  aK0,
double  aK1 = 0.0,
double  aK2 = 0.0
 

Set the acceleration gains for each track goal.

Parameters:
aK0 Gain for track goal 0.
aK1 Gain for track goal 1.
aK2 Gain for track goal 2.

void rdCMC_Task::setKP double  aK0,
double  aK1 = 0.0,
double  aK2 = 0.0
 

Set the position gains for each track goal.

Parameters:
aK0 Gain for track goal 0.
aK1 Gain for track goal 1.
aK2 Gain for track goal 2.

void rdCMC_Task::setKV double  aK0,
double  aK1 = 0.0,
double  aK2 = 0.0
 

Set the velocity gains for each track goal.

Parameters:
aK0 Gain for track goal 0.
aK1 Gain for track goal 1.
aK2 Gain for track goal 2.

void rdCMC_Task::setModel OpenSim::Model *  aModel  ) 
 

Set the model to which this track object applies.

Parameters:
aModel Model.

void rdCMC_Task::setOn bool  aTrueFalse  ) 
 

Turn this track object on or off.

Parameters:
aTureFalse Turns analysis on if "true" and off if "false".

void rdCMC_Task::setPositionErrorLast double  aE0,
double  aE1 = 0.0,
double  aE2 = 0.0
 

Set the last achieved position error.

This information is useful for checking that error dynamics are being followed.

Parameters:
aE0 Last position error for track goal 0.
aE1 Last position error for track goal 1.
aE2 Last position error for track goal 2.

void rdCMC_Task::setTaskFunctions OpenSim::Function *  aF0,
OpenSim::Function *  aF1 = NULL,
OpenSim::Function *  aF2 = NULL
 

Set the track functions.

Note that this method makes copies of the specified track functions, so the caller may use the specified functions for whatever purposes.

Parameters:
aF0 Function for track goal 0.
aF1 Function for track goal 1.
aF2 Function for track goal 2.

void rdCMC_Task::setTaskFunctionsForAcceleration OpenSim::Function *  aF0,
OpenSim::Function *  aF1 = NULL,
OpenSim::Function *  aF2 = NULL
 

Set the acceleration track functions.

Note that this method makes copies of the specified track functions, so the caller may use the specified functions for whatever purposes.

Parameters:
aF0 Function for track goal 0.
aF1 Function for track goal 1.
aF2 Function for track goal 2.

void rdCMC_Task::setTaskFunctionsForVelocity OpenSim::Function *  aF0,
OpenSim::Function *  aF1 = NULL,
OpenSim::Function *  aF2 = NULL
 

Set the velocity track functions.

Note that this method makes copies of the specified functions, so the caller may use the specified functions for whatever purposes.

Parameters:
aF0 Function for track goal 0.
aF1 Function for track goal 1.
aF2 Function for track goal 2.

void rdCMC_Task::setVelocityErrorLast double  aE0,
double  aE1 = 0.0,
double  aE2 = 0.0
 

Set the last achieved velocity error.

This information is useful for checking that error dynamics are being followed.

Parameters:
aE0 Last velocity error for track goal 0.
aE1 Last velocity error for track goal 1.
aE2 Last velocity error for track goal 2.

void rdCMC_Task::setWeight double  aW0,
double  aW1 = 0.0,
double  aW2 = 0.0
 

Set the weight of each track goal.

Parameters:
aW0 Weight for track goal 0.
aW1 Weight for track goal 1.
aW2 Weight for track goal 2.

void rdCMC_Task::setWRTBody int  aBody  ) 
 

Set the body with respect to (WRT) which the track goals are specified.

Parameters:
aBody Body ID.


Member Data Documentation

OpenSim::Function* rdCMC_Task::_aTrk[3] [protected]
 

Acceleration task functions.

If acceleration task functions are not specified, derivatives of the position task function are used.

OpenSim::Function* rdCMC_Task::_pTrk[3] [protected]
 

Position task functions.

Different types of tasks can require different numbers of task functions. For example, to track a joint angle, only one task function is needed. However, to track a position, up to three task functions may be needed.

OpenSim::Function* rdCMC_Task::_vTrk[3] [protected]
 

Velocity task functions.

If velocity task functions are not specified, derivatives of the position task function are used.


The documentation for this class was generated from the following files:
Generated on Wed Nov 1 16:04:32 2006 for Computed Muscle Control (CMC) API by doxygen 1.3.8