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

rdCMC Class Reference

Computed Muscle Control (CMC) is an optimization-based control technique designed specifically for controlling dynamic models that are actuated by redundant sets of actuators whose force-generating properties may be nonlinear and goverend by differential equaitions (as so have delays in force production). More...

#include <rdCMC.h>

List of all members.

Public Member Functions

 rdCMC (OpenSim::Model *aModel, rdCMC_TaskSet *aSet)
 Contructor.
virtual ~rdCMC ()
 Destructor.
void setNull ()
 Set NULL values for all member variables.
void setControlConstraints (OpenSim::ControlSet *aCcontrolSet)
 Set the control set that is used for placing constraints on the controls.
OpenSim::ControlSet * getControlConstraints ()
 Get the control set that is used for placing constraints on the controls.
OpenSim::ControlSet * getControlSet () const
 Get the control set that the controller is using to control the simulation.
rdCMC_TaskSetgetTaskSet () const
 Get the task set for this controller.
OpenSim::Array< int > * getParameterList ()
 Get the list of parameters in the control set that the controller is using to control the simulation.
OpenSim::rdFSQP * getOptimizer () const
 Get the optimizer.
OpenSim::rdOptimizationTarget * setOptimizationTarget (OpenSim::rdOptimizationTarget *aTarget)
 Set the optimization target for this controller.
OpenSim::rdOptimizationTarget * getOptimizationTarget () const
 Get the optimization target for this controller.
void setDT (double aDT)
 Set the requested integrator time step size.
double getDT () const
 Get the requested integrator time step size.
void setTargetTime (double aTime)
 Set the target time (or final time) for the controller.
double getTargetTime () const
 Get the target time.
void setTargetDT (double aDT)
 Set the target time step size.
double getTargetDT () const
 Get the target time step size.
void setCheckTargetTime (bool aTrueFalse)
 Set whether or not to check the target time.
bool getCheckTargetTime () const
 Get whether or not to check the target time.
void setActuatorForcePredictor (OpenSim::VectorFunctionForActuators *aPredictor)
 Set the predictor for actuator forces.
OpenSim::VectorFunctionForActuators * getActuatorForcePredictor ()
 Get the predictor for actuator forces.
OpenSim::Storage * getPositionErrorStorage () const
 Get the storage object for position errors.
OpenSim::Storage * getVelocityErrorStorage () const
 Get the storage object for velocity errors.
OpenSim::Storage * getStressTermWeightStorage () const
 Get the storage object for stress term weights.
void setUseCurvatureFilter (bool aTrueFalse)
 Set whether or not a curvature filter should be applied to the controls.
bool getUseCurvatureFilter () const
 Get whether or not a curvature filter should be applied to the controls.
void setUseReflexes (bool aTrueFalse)
 Set whether or not to use reflexes to constrain the controls.
bool getUseReflexes () const
 Get whether or not to use reflexes to constrain the controls.
virtual void constrainControlsBasedOnReflexes (double time, OpenSim::Array< double > &xmin, OpenSim::Array< double > &xmax)
 Constrain the controls based on reflexes.
void restoreConfiguration (int nqnu, const double *yi, double *y)
 A utility method used to restore the coordinates and speeds to initial values.
void obtainActuatorEquilibrium (double tiReal, double dtReal, OpenSim::Array< double > &x, OpenSim::Array< double > &y, bool hold)
 Obtain actuator equilibrium.
virtual void computeInitialStates (double &rTI, double *rYI)
 Compute the initial states for a simulation.
virtual void computeControls (double &rDT, double aT, const double *aY, OpenSim::ControlSet &rX)
 Compute the controls for a simulation.

Static Public Member Functions

void FilterControls (const OpenSim::ControlSet &aControlSet, double aDT, double aT, OpenSim::Array< double > &rControls)
 Filter the controls.

Protected Attributes

OpenSim::rdFSQP * _sqp
 Optimizer.
OpenSim::rdOptimizationTarget * _target
 Optimization target for computing the controls.
rdCMC_TaskSet_taskSet
 Set of cmc tasks.
double _dt
 Next integration step size that is to be taken by the integrator.
double _lastDT
 Last integration step size that was taken before a new integration step size was set in order to step exactly to the target time.
bool _restoreDT
 Flag indicating when the last integration step size should be restored.
double _tf
 The target time is the time in the future (in normalized units) for which the controls have been calculated.
double _targetDT
 The step size used to generate a new target time, once the old target time has been reached.
bool _checkTargetTime
 Whether or not to check the target time.
OpenSim::Storage * _pErrStore
 Storage object for the position errors.
OpenSim::Storage * _vErrStore
 Storage object for the velocity errors.
OpenSim::Storage * _stressTermWeightStore
 Storage object for the stress term weight.
OpenSim::ControlSet * _controlSet
 Control set for the simulation.
OpenSim::ControlSet * _controlConstraints
 Control set for constraining the values of the controls.
bool _useCurvatureFilter
 Flag indicating whether or not a curvature filter should be applied to the controls.
bool _useReflexes
 Flag indicating whether or not reflexes should be in effect.
OpenSim::ControlSet * _controlConstraintsFromReflexes
 Control set for constraining the controls based on reflexes.
OpenSim::Array< int > _paramList
 List of parameters in the control set that are serving as the controls in the optimization problem.
OpenSim::VectorFunctionForActuators * _predictor
 Vector function for estimating actuator forces over a specified time interval.
OpenSim::Array< double > _f
 Array of actuator forces for achieving the desired accelerations.


Detailed Description

Computed Muscle Control (CMC) is an optimization-based control technique designed specifically for controlling dynamic models that are actuated by redundant sets of actuators whose force-generating properties may be nonlinear and goverend by differential equaitions (as so have delays in force production).

The cannonical example of such a dynamic system is the musculoskeletal system (human or animal), hence the name Computed Muscle Control.

For a complete description of the CMC algorithm consult the following references:

Anderson FC (2004). Method and system for dynamically filtering the motion of articulated bodies. Realistic Dynamics, Inc., US Patent No. 6,750,866 (Issue date: June 15, 2004).


DG, Anderson FC (2006). Using computed muscle control to generate forward dynamic simulations of human walking from experimental data. J Biomech 39: 1107-15.


DG, Anderson FC, Delp SL (2003). Generating forward dynamic simulations of movement using computed muscle control. J Biomech 36: 321-8.

Author:
Frank C. Anderson
Version:
1.0


Constructor & Destructor Documentation

rdCMC::rdCMC OpenSim::Model *  aModel,
rdCMC_TaskSet aTaskSet
 

Contructor.

Parameters:
aModel Model that is to be controlled.
aTaskSet Set of tracking tasks.


Member Function Documentation

void rdCMC::computeControls double &  rDT,
double  aT,
const double *  aY,
OpenSim::ControlSet &  rX
[virtual]
 

Compute the controls for a simulation.

The caller should send in an initial guess.

Parameters:
rDT Integration time step in normalized time that is to be taken next. Note that the controller can change the value of rDT.
aT Current time in normalized time.
aY Current states of the model.
rControlSet Control set used for the simulation. This method alters the control set in order to control the simulation.

void rdCMC::computeInitialStates double &  rTI,
double *  rYI
[virtual]
 

Compute the initial states for a simulation.

The caller should send in an initial guess. The Qs and Us are set based on the desired trajectories. The actuator states are set by sovling for a desired set of actuator forces, and then letting the states come to equilibrium for those forces.

Parameters:
rTI Initial time in normalized time. Note this is changed to the time corresponding to the new initial states on return.
rYI Initial states.

void rdCMC::constrainControlsBasedOnReflexes double  t,
OpenSim::Array< double > &  xmin,
OpenSim::Array< double > &  xmax
[virtual]
 

Constrain the controls based on reflexes.

Parameters:
t Current time in the simulation in normalized time.
xmin Minimum allowed values for the controls.
xmax Maximum allowed values for the controls.

void rdCMC::FilterControls const OpenSim::ControlSet &  aControlSet,
double  aDT,
double  aT,
OpenSim::Array< double > &  rControls
[static]
 

Filter the controls.

This method was introduced as a means of attempting to reduce the sizes of residuals. Unfortunately, the approach was generally unsuccessful because the desired accelerations were not achieved.

Parameters:
aControlSet Set of controls computed by CMC.
aDT Current time window.
aT Current time
rControls Array of filtered controls.

bool rdCMC::getCheckTargetTime  )  const
 

Get whether or not to check the target time.

Returns:
True if the target time will be checked. False if the target time will not be checked.
See also:
setTargetTime()

ControlSet * rdCMC::getControlConstraints  ) 
 

Get the control set that is used for placing constraints on the controls.

Returns:
Constraint control set.

ControlSet * rdCMC::getControlSet  )  const
 

Get the control set that the controller is using to control the simulation.

Returns:
Control set.

double rdCMC::getDT  )  const
 

Get the requested integrator time step size.

Returns:
Step size.

rdOptimizationTarget * rdCMC::getOptimizationTarget  )  const
 

Get the optimization target for this controller.

Returns:
Current optimization target.

rdFSQP * rdCMC::getOptimizer  )  const
 

Get the optimizer.

Returns:
Optimizer.

Array< int > * rdCMC::getParameterList  ) 
 

Get the list of parameters in the control set that the controller is using to control the simulation.

Returns:
List of parameters in the control set serving as the controls.

Storage * rdCMC::getPositionErrorStorage  )  const
 

Get the storage object for position errors.

Returns:
Storage of position errors.

Storage * rdCMC::getStressTermWeightStorage  )  const
 

Get the storage object for stress term weights.

Returns:
Storage of stress term weights.

double rdCMC::getTargetDT  )  const
 

Get the target time step size.

The target time step size is the step size used to compute a new target time, once the former target time has been reached by the integrator.

Returns:
Target time step size.
See also:
setTargetTime()

double rdCMC::getTargetTime  )  const
 

Get the target time.

The target time is the time in the future for which the controls have been calculated. If an integrator is taking time steps prior to the target time, the controls should not have to be computed again.

Returns:
Time in the furture for which the controls have been computed.
See also:
getCheckTargetTime()

rdCMC_TaskSet * rdCMC::getTaskSet  )  const
 

Get the task set for this controller.

Returns:
Task set.

bool rdCMC::getUseCurvatureFilter  )  const
 

Get whether or not a curvature filter should be applied to the controls.

Returns:
True, if will filtered based on their curvature; false, if they will not be filtered.

bool rdCMC::getUseReflexes  )  const
 

Get whether or not to use reflexes to constrain the controls.

Returns:
If true, controls will be constrained based on reflexes. If false, they will not be constrained based on reflexes.

Storage * rdCMC::getVelocityErrorStorage  )  const
 

Get the storage object for velocity errors.

Returns:
Storage of velocity errors.

void rdCMC::obtainActuatorEquilibrium double  tiReal,
double  dtReal,
OpenSim::Array< double > &  x,
OpenSim::Array< double > &  y,
bool  hold
 

Obtain actuator equilibrium.

A series of long (e.g., 200 msec) integrations are performed to allow time-dependent actuators forces to reach equilibrium values.

Parameters:
tiReal Initial time expressed in real time units.
dtReal Duration of the time interval.
x Array of control values.
y Array of states.
hold Flag indicating whether or not to hold model coordinates constant (true) or let them change according to the desired trajectories (false).

void rdCMC::restoreConfiguration int  nqnu,
const double *  yi,
double *  y
 

A utility method used to restore the coordinates and speeds to initial values.

The states associated with actuators are not changed.

Parameters:
nqnu Sum of the number of coordinates and speeds (nq + nu).
yi Array of initial states.
y Array of states.

void rdCMC::setCheckTargetTime bool  aTrueFalse  ) 
 

Set whether or not to check the target time.

Parameters:
aTrueFalse If true, the target time will be checked. If false, the target time will not be checked.
See also:
setTargetTime()

void rdCMC::setControlConstraints OpenSim::ControlSet *  aCcontrolSet  ) 
 

Set the control set that is used for placing constraints on the controls.

Parameters:
Control set containint the constraints- max and minx.

void rdCMC::setDT double  aDT  ) 
 

Set the requested integrator time step size.

Parameters:
aDT Step size (0.0 <= aDT).

rdOptimizationTarget * rdCMC::setOptimizationTarget OpenSim::rdOptimizationTarget *  aTarget  ) 
 

Set the optimization target for this controller.

Parameters:
aTarget Optimization target.
Returns:
Previous optimization target.

void rdCMC::setTargetDT double  aDT  ) 
 

Set the target time step size.

The target time step size is the step size used to compute a new target time, once the former target time has been reached by the integrator.

Parameters:
aDT Target time step size. Must be greater than 1.0e-8.
See also:
setTargetTime()

void rdCMC::setTargetTime double  aTargetTime  ) 
 

Set the target time (or final time) for the controller.

The function of the controller is to compute a set of controls that are appropriate from the current time in a simulation to the target time of the controller. If an integrator is taking time steps prior to the target time, the controls should not have to be computed again.

Parameters:
aTargetTime Time in the furture for which the controls have been computed.
See also:
getCheckTargetTime()

void rdCMC::setUseCurvatureFilter bool  aTrueFalse  ) 
 

Set whether or not a curvature filter should be applied to the controls.

Parameters:
aTrueFalse If true, controls will filtered based on their curvature. If false, they will not be filtered.

void rdCMC::setUseReflexes bool  aTrueFalse  ) 
 

Set whether or not to use reflexes to constrain the controls.

Parameters:
aTrueFalse If true, controls will be constrained based on reflexes. If false, they will not be constrained based on reflexes.


Member Data Documentation

bool rdCMC::_restoreDT [protected]
 

Flag indicating when the last integration step size should be restored.

Normally it is restored only following a change to the integration step size that was made to step exactly to the end of a target interval.

double rdCMC::_tf [protected]
 

The target time is the time in the future (in normalized units) for which the controls have been calculated.

If an integrator is taking steps prior to the target time, the controls should not have to be computed again.


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