An class for holding and managing a set of tasks. More...
#include <CMC_TaskSet.h>
Public Member Functions | |
CMC_TaskSet () | |
Construct a default task set for a specified model. | |
CMC_TaskSet (const std::string &aFileName) | |
virtual | ~CMC_TaskSet () |
Destructor. | |
void | setModel (Model &aModel) |
Set the model for which the tracking is performed. | |
Model * | getModel () const |
Get the model for which the tracking is performed. | |
const std::string & | getDataFileName () const |
void | setFunctions (FunctionSet &aFuncSet) |
Set the functions for the tasks. | |
void | setFunctionsForVelocity (FunctionSet &aFuncSet) |
Set the velocity functions for the tasks. | |
void | setFunctionsForAcceleration (FunctionSet &aFuncSet) |
Set the acceleration functions for the tasks. | |
int | getNumActiveTaskFunctions () const |
Return number of active task functions. | |
Array< double > & | getTaskPositions (double aT) |
Get all active task positions. | |
Array< double > & | getTaskVelocities (double aT) |
Get all active task velocities. | |
Array< double > & | getTaskAccelerations (double aT) |
Get all active task accelerations. | |
Array< double > & | getPositionGains () |
Get all active gains for position errors. | |
Array< double > & | getVelocityGains () |
Get all active gains for velocity errors. | |
Array< double > & | getAccelerationGains () |
Get all active gains for acceleration errors. | |
Array< double > & | getPositionErrorsLast () |
Get the last position errors. | |
Array< double > & | getPositionErrors () |
Get the position errors. | |
Array< double > & | getVelocityErrorsLast () |
Get the last velocity errors. | |
Array< double > & | getVelocityErrors () |
Get the velocity errors. | |
Array< double > & | getWeights () |
Get the array of weights for the desired accelerations. | |
Array< double > & | getDesiredAccelerations () |
Get the desired accelerations. | |
Array< double > & | getAccelerations () |
Get the accelerations. | |
void | recordErrorsAsLastErrors () |
Record the current position errors of all tasks as the last errors that were achieved during a simulation. | |
void | computeErrors (const SimTK::State &s, double aT) |
Compute the errors for all tasks. | |
void | computeDesiredAccelerations (const SimTK::State &s, double aT) |
Compute the desired acceleration(s) for each task at a specified time. | |
void | computeDesiredAccelerations (const SimTK::State &s, double aTCurrent, double aTFuture) |
Compute the desired acceleration(s) for each task given a time interval over which the accelerations are to be achieved. | |
void | computeAccelerations (const SimTK::State &s) |
Compute the acceleration(s) for each task. | |
Protected Attributes | |
Model * | _model |
Model for which the tracking is conducted. | |
Array< double > | _pTask |
Array of task positions. | |
Array< double > | _vTask |
Array of task velocities. | |
Array< double > | _aTask |
Array of task accelerations. | |
Array< double > | _pErrLast |
Array of last position errors. | |
Array< double > | _pErr |
Array of position errors. | |
Array< double > | _vErrLast |
Array of last velocity errors. | |
Array< double > | _vErr |
Array of velocity errors. | |
Array< double > | _kp |
Array of gains for the position errors. | |
Array< double > | _kv |
Array of gains for the velocity errors. | |
Array< double > | _ka |
Array of gains for the acceleration errors. | |
Array< double > | _w |
Array of weights of the desired acceleration. | |
Array< double > | _aDes |
Array of desired accelerations. | |
Array< double > | _a |
Array of accelerations. | |
PropertyStr | _dataFileNameProp |
In case there're tracking targets loaded from file, the filename goes here and the column names go into individual targets. | |
std::string & | _dataFileName |
FunctionSet | _functions |
An class for holding and managing a set of tasks.
CMC_TaskSet::CMC_TaskSet | ( | ) |
Construct a default task set for a specified model.
aModel | Model for which tasks will be set. |
OpenSim::CMC_TaskSet::CMC_TaskSet | ( | const std::string & | aFileName | ) |
CMC_TaskSet::~CMC_TaskSet | ( | ) | [virtual] |
Destructor.
void CMC_TaskSet::computeAccelerations | ( | const SimTK::State & | s | ) |
Compute the acceleration(s) for each task.
Model::computeAccelerations must be called before this method is called for the results to be valid.
void CMC_TaskSet::computeDesiredAccelerations | ( | const SimTK::State & | s, | |
double | aTI, | |||
double | aTF | |||
) |
Compute the desired acceleration(s) for each task given a time interval over which the accelerations are to be achieved.
Currently, the algorithm is to compute the position and velocity error terms at the initial time and the acceleration term from the task set at the final time.
aTI | Initial time of the time interval in real time units. | |
aTF | Final time of the timer interval in real time units. |
void CMC_TaskSet::computeDesiredAccelerations | ( | const SimTK::State & | s, | |
double | aT | |||
) |
Compute the desired acceleration(s) for each task at a specified time.
aT | Time at which the desired accelerations are to be computed in real time units. |
void CMC_TaskSet::computeErrors | ( | const SimTK::State & | s, | |
double | aT | |||
) |
Compute the errors for all tasks.
aT | Time at which to compute the errors in real time units. |
OpenSim::Array< double > & CMC_TaskSet::getAccelerationGains | ( | ) |
Get all active gains for acceleration errors.
aT | Time (in real time units). |
OpenSim::Array< double > & CMC_TaskSet::getAccelerations | ( | ) |
Get the accelerations.
const std::string& OpenSim::CMC_TaskSet::getDataFileName | ( | ) | const [inline] |
OpenSim::Array< double > & CMC_TaskSet::getDesiredAccelerations | ( | ) |
Get the desired accelerations.
Model * CMC_TaskSet::getModel | ( | ) | const |
Get the model for which the tracking is performed.
int CMC_TaskSet::getNumActiveTaskFunctions | ( | ) | const |
Return number of active task functions.
OpenSim::Array< double > & CMC_TaskSet::getPositionErrors | ( | ) |
Get the position errors.
OpenSim::Array< double > & CMC_TaskSet::getPositionErrorsLast | ( | ) |
Get the last position errors.
OpenSim::Array< double > & CMC_TaskSet::getPositionGains | ( | ) |
Get all active gains for position errors.
aT | Time (in real time units). |
OpenSim::Array< double > & CMC_TaskSet::getTaskAccelerations | ( | double | aT | ) |
Get all active task accelerations.
aT | Time (in real time units). |
OpenSim::Array< double > & CMC_TaskSet::getTaskPositions | ( | double | aT | ) |
Get all active task positions.
aT | Time (in real time units). |
OpenSim::Array< double > & CMC_TaskSet::getTaskVelocities | ( | double | aT | ) |
Get all active task velocities.
aT | Time (in real time units). |
OpenSim::Array< double > & CMC_TaskSet::getVelocityErrors | ( | ) |
Get the velocity errors.
OpenSim::Array< double > & CMC_TaskSet::getVelocityErrorsLast | ( | ) |
Get the last velocity errors.
OpenSim::Array< double > & CMC_TaskSet::getVelocityGains | ( | ) |
Get all active gains for velocity errors.
aT | Time (in real time units). |
OpenSim::Array< double > & CMC_TaskSet::getWeights | ( | ) |
Get the array of weights for the desired accelerations.
void CMC_TaskSet::recordErrorsAsLastErrors | ( | ) |
Record the current position errors of all tasks as the last errors that were achieved during a simulation.
This method assumes that the position errors have already been computed.
void CMC_TaskSet::setFunctions | ( | FunctionSet & | aFuncSet | ) |
Set the functions for the tasks.
Functions are set based on the correspondence of the function and the task. For example, a task with the name "x" will search for a function or functions with the name "x". For tasks that require 3 functions, such as CMC_Point tasks, the assumption is that there will be three consecutive functions named "x" in the function set. If the correct number of functions is not found, the task is disabled.
aFuncSet | Function set. |
void CMC_TaskSet::setFunctionsForAcceleration | ( | FunctionSet & | aFuncSet | ) |
Set the acceleration functions for the tasks.
Functions are set based on the correspondence of the function and the task. For example, a task with the name "x" will search for a function or functions with the name "x". For tasks that require 3 functions, such as CMC_Point tasks, the assumption is that there will be three consecutive functions named "x" in the function set. If the correct number of functions is not found, the task is disabled.
aFuncSet | Function set. |
void CMC_TaskSet::setFunctionsForVelocity | ( | FunctionSet & | aFuncSet | ) |
Set the velocity functions for the tasks.
Functions are set based on the correspondence of the function and the task. For example, a task with the name "x" will search for a function or functions with the name "x". For tasks that require 3 functions, such as CMC_Point tasks, the assumption is that there will be three consecutive functions named "x" in the function set. If the correct number of functions is not found, the task is disabled.
aFuncSet | Function set. |
void CMC_TaskSet::setModel | ( | Model & | aModel | ) |
Array<double> OpenSim::CMC_TaskSet::_a [protected] |
Array of accelerations.
Array<double> OpenSim::CMC_TaskSet::_aDes [protected] |
Array of desired accelerations.
Array<double> OpenSim::CMC_TaskSet::_aTask [protected] |
Array of task accelerations.
std::string& OpenSim::CMC_TaskSet::_dataFileName [protected] |
PropertyStr OpenSim::CMC_TaskSet::_dataFileNameProp [protected] |
In case there're tracking targets loaded from file, the filename goes here and the column names go into individual targets.
FunctionSet OpenSim::CMC_TaskSet::_functions [protected] |
Array<double> OpenSim::CMC_TaskSet::_ka [protected] |
Array of gains for the acceleration errors.
Array<double> OpenSim::CMC_TaskSet::_kp [protected] |
Array of gains for the position errors.
Array<double> OpenSim::CMC_TaskSet::_kv [protected] |
Array of gains for the velocity errors.
Model* OpenSim::CMC_TaskSet::_model [protected] |
Model for which the tracking is conducted.
Array<double> OpenSim::CMC_TaskSet::_pErr [protected] |
Array of position errors.
Array<double> OpenSim::CMC_TaskSet::_pErrLast [protected] |
Array of last position errors.
Array<double> OpenSim::CMC_TaskSet::_pTask [protected] |
Array of task positions.
Array<double> OpenSim::CMC_TaskSet::_vErr [protected] |
Array of velocity errors.
Array<double> OpenSim::CMC_TaskSet::_vErrLast [protected] |
Array of last velocity errors.
Array<double> OpenSim::CMC_TaskSet::_vTask [protected] |
Array of task velocities.
Array<double> OpenSim::CMC_TaskSet::_w [protected] |
Array of weights of the desired acceleration.