An abstract base class for specifying a task objective for a dynamic simulation. More...
#include <CMC_Task.h>
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 Object * | copy () const =0 |
Construct and return a copy of this object. | |
CMC_Task & | operator= (const CMC_Task &aTaskObject) |
Assignment operator. | |
virtual void | setModel (Model &aModel) |
Set the model to which this track object applies. | |
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. | |
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. | |
Function * | getTaskFunction (int aWhich) const |
Get a specified track function. | |
void | setTaskFunctionsForVelocity (Function *aF0, Function *aF1=NULL, Function *aF2=NULL) |
Set the velocity track functions. | |
Function * | getTaskFunctionForVelocity (int aWhich) const |
Get a specified velocity track function. | |
void | setTaskFunctionsForAcceleration (Function *aF0, Function *aF1=NULL, Function *aF2=NULL) |
Set the acceleration track functions. | |
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 (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. |
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.
CMC_Task::CMC_Task | ( | ) |
Construct a default track object for a specified model.
CMC_Task::CMC_Task | ( | const CMC_Task & | aTask | ) |
Copy constructor.
aTask | Task object to be copied. |
CMC_Task::~CMC_Task | ( | ) | [virtual] |
Destructor.
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] |
Implemented in OpenSim::CMC_Joint, OpenSim::CMC_Point, and OpenSim::SMC_Joint.
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.
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.
aWhich | Specifies which track goal (0, 1, or 2). |
bool CMC_Task::getActive | ( | int | aWhich | ) | const |
Get whether a specified track goal is active.
aWhich | Number of the track goal in question. |
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.
aWhich | Specifies which track goal (0, 1, or 2). |
void CMC_Task::getDirection_0 | ( | SimTK::Vec3 & | rR | ) | const |
Get the direction of track goal 0.
aR | Direction. |
void CMC_Task::getDirection_1 | ( | SimTK::Vec3 & | rR | ) | const |
Get the direction of track goal 1.
aR | Direction. |
void CMC_Task::getDirection_2 | ( | SimTK::Vec3 & | rR | ) | const |
Get the direction of track goal 2.
aR | Direction. |
std::string CMC_Task::getExpressBodyName | ( | ) | const |
Get the body in which the track goals are expressed.
double CMC_Task::getKA | ( | int | aWhich | ) | const |
Get the acceleration gain for a specified track goal.
aWhich | Number of the track goal in question. |
double CMC_Task::getKP | ( | int | aWhich | ) | const |
Get the position gain for a specified track goal.
aWhich | Number of the track goal in question. |
double CMC_Task::getKV | ( | int | aWhich | ) | const |
Get the velocity gain for a specified track goal.
aWhich | Number of the track goal in question. |
Model * CMC_Task::getModel | ( | ) | const |
Get the model to which this track object applies.
int CMC_Task::getNumTaskFunctions | ( | ) | const |
Get the number of position track functions.
bool CMC_Task::getOn | ( | ) | const |
Get whether or not this track object is on.
double CMC_Task::getPositionError | ( | int | aWhich | ) | const |
Get the position track error of a specified track goal.
aWhich | Specifies which track goal (0, 1, or 2). |
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.
aWhich | Specifies which track goal (0, 1, or 2). |
double CMC_Task::getTaskAcceleration | ( | int | aWhich, | |
double | aT | |||
) | const |
Get the task acceleration.
aWhich | Specifies which task goal (0, 1, or 2). | |
aT | Time (in real time units). |
Exception | for an invalid task. |
OpenSim::Function * CMC_Task::getTaskFunction | ( | int | aWhich | ) | const |
Get a specified track function.
aWhich | Specifies which track function (0, 1, or 2). |
OpenSim::Function * CMC_Task::getTaskFunctionForAcceleration | ( | int | aWhich | ) | const |
Get a specified acceleration track function.
aWhich | Specifies which track function (0, 1, or 2). |
OpenSim::Function * CMC_Task::getTaskFunctionForVelocity | ( | int | aWhich | ) | const |
Get a specified velocity track function.
aWhich | Specifies which track function (0, 1, or 2). |
double CMC_Task::getTaskPosition | ( | int | aWhich, | |
double | aT | |||
) | const |
Get the task position.
aWhich | Specifies which task goal (0, 1, or 2). | |
aT | Time (in real time units). |
Exception | for an invalid task. |
double CMC_Task::getTaskVelocity | ( | int | aWhich, | |
double | aT | |||
) | const |
Get the task velocity.
aWhich | Specifies which task goal (0, 1, or 2). | |
aT | Time (in real time units). |
Exception | for an invalid task. |
double CMC_Task::getVelocityError | ( | int | aWhich | ) | const |
Get the velocity track error of a specified track goal.
aWhich | Specifies which track goal (0, 1, or 2). |
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.
aWhich | Specifies which track goal (0, 1, or 2). |
double CMC_Task::getWeight | ( | int | aWhich | ) | const |
Get the weight of each track goal.
aWhich | Number of the track goal in question. |
std::string CMC_Task::getWRTBodyName | ( | ) | const |
Get the body with respect to (WRT) which the track goals are specified.
Assignment operator.
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.
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.
aR | Direction. This vector is normalized. |
void CMC_Task::setDirection_1 | ( | const SimTK::Vec3 & | aR | ) |
Set the direction of track goal 1.
aR | Direction. This vector is normalized. |
void CMC_Task::setDirection_2 | ( | const SimTK::Vec3 & | aR | ) |
Set the direction of track goal 2.
aR | Direction. This vector is normalized. |
void CMC_Task::setExpressBodyName | ( | std::string | aBodyName | ) |
void CMC_Task::setKA | ( | double | aK0, | |
double | aK1 = 0.0 , |
|||
double | aK2 = 0.0 | |||
) |
Set the acceleration gains for each track goal.
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.
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.
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.
aModel | Model. |
Reimplemented in OpenSim::CMC_Joint, and OpenSim::CMC_Point.
void CMC_Task::setOn | ( | bool | aTrueFalse | ) |
Turn this track object on or off.
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.
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 | |||
) |
void CMC_Task::setTaskFunctionsForAcceleration | ( | OpenSim::Function * | aF0, | |
OpenSim::Function * | aF1 = NULL , |
|||
OpenSim::Function * | aF2 = NULL | |||
) |
void CMC_Task::setTaskFunctionsForVelocity | ( | OpenSim::Function * | aF0, | |
OpenSim::Function * | aF1 = NULL , |
|||
OpenSim::Function * | aF2 = NULL | |||
) |
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.
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.
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 | ) |
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.
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.
Function* OpenSim::CMC_Task::_aTrk[3] [protected] |
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.
Model* OpenSim::CMC_Task::_model [protected] |
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.
PropertyBoolArray OpenSim::CMC_Task::_propActive [protected] |
Property to specify the active task goals.
PropertyStr OpenSim::CMC_Task::_propExpressBodyName [protected] |
Body frame in which the task goals are expressed.
PropertyDblArray OpenSim::CMC_Task::_propKA [protected] |
Feedforward acceleration gain.
PropertyDblArray OpenSim::CMC_Task::_propKP [protected] |
Position error feedback gain.
PropertyDblArray OpenSim::CMC_Task::_propKV [protected] |
Velocity error feedback gain.
PropertyBool OpenSim::CMC_Task::_propOn [protected] |
Property to indicate on or off state.
PropertyDblVec3 OpenSim::CMC_Task::_propR0 [protected] |
Directions of the task goal 0.
PropertyDblVec3 OpenSim::CMC_Task::_propR1 [protected] |
Directions of the task goal 1.
PropertyDblVec3 OpenSim::CMC_Task::_propR2 [protected] |
Directions of the task goal 2.
PropertyDblArray OpenSim::CMC_Task::_propW [protected] |
Weights of the task goals.
PropertyStr OpenSim::CMC_Task::_propWRTBodyName [protected] |
Body with respect to which the task goals are specified.
Function* OpenSim::CMC_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.
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.
Function* OpenSim::CMC_Task::_vTrk[3] [protected] |
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.