OpenSim::CMC_Task Class Reference

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

#include <CMC_Task.h>

Inheritance diagram for OpenSim::CMC_Task:
OpenSim::Object OpenSim::CMC_Joint OpenSim::CMC_Orientation OpenSim::CMC_Point OpenSim::SMC_Joint

List of all members.

Public Member Functions

 CMC_Task ()
 Construct a default track object for a specified model.
 CMC_Task (const CMC_Task &aTaskObject)
 Copy constructor.
virtual ~CMC_Task ()
 Destructor.
virtual Objectcopy () const =0
 Construct and return a copy of this object.
CMC_Taskoperator= (const CMC_Task &aTaskObject)
 Assignment operator.
virtual void setModel (Model &aModel)
 Set the model to which this track object applies.
ModelgetModel () 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.
void setWRTBodyName (std::string aBodyName)
 Set the body with respect to (WRT) which the track goals are specified.
std::string getWRTBodyName () const
 Get the body with respect to (WRT) which the track goals are specified.
void setExpressBodyName (std::string aBodyName)
 Set the body in which the track goals are expressed.
std::string getExpressBodyName () 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 SimTK::Vec3 &aR)
 Set the direction of track goal 0.
void getDirection_0 (SimTK::Vec3 &rR) const
 Get the direction of track goal 0.
void setDirection_1 (const SimTK::Vec3 &aR)
 Set the direction of track goal 1.
void getDirection_1 (SimTK::Vec3 &rR) const
 Get the direction of track goal 1.
void setDirection_2 (const SimTK::Vec3 &aR)
 Set the direction of track goal 2.
void getDirection_2 (SimTK::Vec3 &rR) const
 Get the direction of track goal 2.
int getNumTaskFunctions () const
 Get the number of position track functions.
void setTaskFunctions (Function *aF0, Function *aF1=NULL, Function *aF2=NULL)
 Set the track functions.
FunctiongetTaskFunction (int aWhich) const
 Get a specified track function.
void setTaskFunctionsForVelocity (Function *aF0, Function *aF1=NULL, Function *aF2=NULL)
 Set the velocity track functions.
FunctiongetTaskFunctionForVelocity (int aWhich) const
 Get a specified velocity track function.
void setTaskFunctionsForAcceleration (Function *aF0, Function *aF1=NULL, Function *aF2=NULL)
 Set the acceleration track functions.
FunctiongetTaskFunctionForAcceleration (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 (const SimTK::State &s, double aT)=0
virtual void computeDesiredAccelerations (const SimTK::State &s, double aT)=0
virtual void computeDesiredAccelerations (const SimTK::State &s, double aTI, double aTF)=0
virtual void computeAccelerations (const SimTK::State &s)=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

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

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

CMC_Task::CMC_Task (  ) 

Construct a default track object for a specified model.

CMC_Task::CMC_Task ( const CMC_Task aTask  ) 

Copy constructor.

Parameters:
aTask Task object to be copied.
CMC_Task::~CMC_Task (  )  [virtual]

Destructor.


Member Function Documentation

virtual void OpenSim::CMC_Task::computeAccelerations ( const SimTK::State &  s  )  [pure virtual]

Implemented in OpenSim::CMC_Joint, and OpenSim::CMC_Point.

virtual void OpenSim::CMC_Task::computeDesiredAccelerations ( const SimTK::State &  s,
double  aTI,
double  aTF 
) [pure virtual]

Implemented in OpenSim::CMC_Joint, and OpenSim::CMC_Point.

virtual void OpenSim::CMC_Task::computeDesiredAccelerations ( const SimTK::State &  s,
double  aT 
) [pure virtual]
void CMC_Task::computeEffectiveMassMatrix (  )  [virtual]

Compute the effective mass matrix.

Reimplemented in OpenSim::CMC_Orientation.

virtual void OpenSim::CMC_Task::computeErrors ( const SimTK::State &  s,
double  aT 
) [pure virtual]

Implemented in OpenSim::CMC_Joint, and OpenSim::CMC_Point.

void CMC_Task::computeJacobian (  )  [virtual]

Compute the Jacobian.

Reimplemented in OpenSim::CMC_Orientation.

virtual Object* OpenSim::CMC_Task::copy (  )  const [pure virtual]

Construct and return a copy of this object.

The object is allocated using the new operator, so the caller is responsible for deleting the returned object.

Returns:
Copy of this object.

Reimplemented from OpenSim::Object.

Implemented in OpenSim::CMC_Joint, OpenSim::CMC_Point, and OpenSim::SMC_Joint.

double CMC_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. SimTK::NaN is returned on an error.
bool CMC_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 CMC_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. SimTK::NaN is returned on an error.
void CMC_Task::getDirection_0 ( SimTK::Vec3 &  rR  )  const

Get the direction of track goal 0.

Parameters:
aR Direction.
void CMC_Task::getDirection_1 ( SimTK::Vec3 &  rR  )  const

Get the direction of track goal 1.

Parameters:
aR Direction.
void CMC_Task::getDirection_2 ( SimTK::Vec3 &  rR  )  const

Get the direction of track goal 2.

Parameters:
aR Direction.
std::string CMC_Task::getExpressBodyName (  )  const

Get the body in which the track goals are expressed.

Returns:
Body ID.
double CMC_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 CMC_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 CMC_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 * CMC_Task::getModel (  )  const

Get the model to which this track object applies.

Returns:
Pointer to the model.
int CMC_Task::getNumTaskFunctions (  )  const

Get the number of position track functions.

Returns:
Number of position track functions.
bool CMC_Task::getOn (  )  const

Get whether or not this track object is on.

Returns:
True if on, false if off.
double CMC_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 CMC_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 CMC_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.
OpenSim::Function * CMC_Task::getTaskFunction ( int  aWhich  )  const

Get a specified track function.

Parameters:
aWhich Specifies which track function (0, 1, or 2).
Returns:
Function.
OpenSim::Function * CMC_Task::getTaskFunctionForAcceleration ( int  aWhich  )  const

Get a specified acceleration track function.

Parameters:
aWhich Specifies which track function (0, 1, or 2).
Returns:
Function.
OpenSim::Function * CMC_Task::getTaskFunctionForVelocity ( int  aWhich  )  const

Get a specified velocity track function.

Parameters:
aWhich Specifies which track function (0, 1, or 2).
Returns:
Function.
double CMC_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 CMC_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 CMC_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 CMC_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 CMC_Task::getWeight ( int  aWhich  )  const

Get the weight of each track goal.

Parameters:
aWhich Number of the track goal in question.
Returns:
Weight.
std::string CMC_Task::getWRTBodyName (  )  const

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

Returns:
Body ID.
CMC_Task & CMC_Task::operator= ( const CMC_Task aTask  ) 

Assignment operator.

Returns:
Reference to the altered object.

Reimplemented from OpenSim::Object.

Reimplemented in OpenSim::CMC_Joint, OpenSim::CMC_Point, and OpenSim::SMC_Joint.

void CMC_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 CMC_Task::setDirection_0 ( const SimTK::Vec3 &  aR  ) 

Set the direction of track goal 0.

Parameters:
aR Direction. This vector is normalized.
void CMC_Task::setDirection_1 ( const SimTK::Vec3 &  aR  ) 

Set the direction of track goal 1.

Parameters:
aR Direction. This vector is normalized.
void CMC_Task::setDirection_2 ( const SimTK::Vec3 &  aR  ) 

Set the direction of track goal 2.

Parameters:
aR Direction. This vector is normalized.
void CMC_Task::setExpressBodyName ( std::string  aBodyName  ) 

Set the body in which the track goals are expressed.

Parameters:
aBody Body ID.
void CMC_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 CMC_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 CMC_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 CMC_Task::setModel ( Model aModel  )  [virtual]

Set the model to which this track object applies.

Parameters:
aModel Model.

Reimplemented in OpenSim::CMC_Joint, and OpenSim::CMC_Point.

void CMC_Task::setOn ( bool  aTrueFalse  ) 

Turn this track object on or off.

Parameters:
aTureFalse Turns analysis on if "true" and off if "false".
void CMC_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 CMC_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 CMC_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 CMC_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 CMC_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 CMC_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 CMC_Task::setWRTBodyName ( std::string  aBodyName  ) 

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

Parameters:
aBody Body ID.
void CMC_Task::updateFromXMLNode (  )  [virtual]

Update this object based on its XML node.

Reimplemented from OpenSim::Object.

Reimplemented in OpenSim::CMC_Joint, and OpenSim::CMC_Point.


Member Data Documentation

SimTK::Vec3 OpenSim::CMC_Task::_a [protected]

Accelerations.

Array<bool>& OpenSim::CMC_Task::_active [protected]

Reference to the value of the Active property.

SimTK::Vec3 OpenSim::CMC_Task::_aDes [protected]

Desired accelerations.

Acceleration task functions.

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

std::string& OpenSim::CMC_Task::_expressBodyName [protected]

Reference to the value of the ExpressBody property.

double* OpenSim::CMC_Task::_j [protected]

Jacobian.

Array<double>& OpenSim::CMC_Task::_ka [protected]

Reference to the value of the KA property.

Array<double>& OpenSim::CMC_Task::_kp [protected]

Reference to the value of the KP property.

Array<double>& OpenSim::CMC_Task::_kv [protected]

Reference to the value of the KV property.

double* OpenSim::CMC_Task::_m [protected]

Effective mass matrix.

int OpenSim::CMC_Task::_nTrk [protected]

Number of task functions.

bool& OpenSim::CMC_Task::_on [protected]

Reference to the value of the on property.

SimTK::Vec3 OpenSim::CMC_Task::_pErr [protected]

Position error.

SimTK::Vec3 OpenSim::CMC_Task::_pErrLast [protected]

Last position error.

Property to specify the active task goals.

Body frame in which the task goals are expressed.

Feedforward acceleration gain.

Position error feedback gain.

Velocity error feedback gain.

Property to indicate on or off state.

Directions of the task goal 0.

Directions of the task goal 1.

Directions of the task goal 2.

Weights of the task goals.

Body with respect to which the task goals are specified.

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.

SimTK::Vec3& OpenSim::CMC_Task::_r0 [protected]

Reference to the value of the R0 property.

SimTK::Vec3& OpenSim::CMC_Task::_r1 [protected]

Reference to the value of the R1 property.

SimTK::Vec3& OpenSim::CMC_Task::_r2 [protected]

Reference to the value of the R2 property.

SimTK::Vec3 OpenSim::CMC_Task::_vErr [protected]

Velocity error.

SimTK::Vec3 OpenSim::CMC_Task::_vErrLast [protected]

Last velocity error.

Velocity task functions.

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

Array<double>& OpenSim::CMC_Task::_w [protected]

Reference to the value of the Weight property.

std::string& OpenSim::CMC_Task::_wrtBodyName [protected]

Reference to the value of the WRTBody property.


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

Generated on Wed Dec 16 15:03:49 2009 for OpenSim by  doxygen 1.6.1