OpenSim::CMC 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 <CMC.h>

Inheritance diagram for OpenSim::CMC:
OpenSim::TrackingController OpenSim::Controller OpenSim::ModelComponent OpenSim::Object

List of all members.

Public Member Functions

 CMC ()
 Default Constructor.
 CMC (Model *aModel, CMC_TaskSet *aTaskSet)
 Contructor.
 CMC (const CMC &aCmc)
 Copy constructor.
 CMC (const std::string &aFileName, bool aUpdateFromXMLNode=true)
 Constructor from an XML Document.
virtual ~CMC ()
 Destructor.
void setNull ()
 Set NULL values for all member variables.
CMCoperator= (const CMC &aCmc)
 Assignment operator.
void copyData (const CMC &aCmc)
 Copy the member variables of the specified controller.
virtual Objectcopy () const
 Copy this CMC controller and return a pointer to the copy.
Array< int > * getParameterList ()
 Get the list of parameters in the control set that the controller is using to control the simulation.
SimTK::Optimizer * getOptimizer () const
 Get the optimizer.
OptimizationTargetsetOptimizationTarget (OptimizationTarget *aTarget, SimTK::Optimizer *aOptimizer)
 Set the optimization target for this controller.
OptimizationTargetgetOptimizationTarget () 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 (VectorFunctionForActuators *aPredictor)
 Set the predictor for actuator forces.
VectorFunctionForActuatorsgetActuatorForcePredictor ()
 Get the predictor for actuator forces.
StoragegetPositionErrorStorage () const
 Get the storage object for position errors.
StoragegetVelocityErrorStorage () const
 Get the storage object for velocity errors.
StoragegetStressTermWeightStorage () const
 Get the storage object for stress term weights.
bool getUseReflexes () const
void setUseVerbosePrinting (bool aTrueFalse)
 Set whether or not to use verbose printing.
bool getUseVerbosePrinting () const
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.
const CMC_TaskSetgetTaskSet () const
CMC_TaskSetupdTaskSet () const
ControlSetupdControlSet ()
void restoreConfiguration (SimTK::State &s, const SimTK::State &initialState)
 A utility method used to restore the coordinates and speeds to initial values.
void obtainActuatorEquilibrium (SimTK::State &s, double tiReal, double dtReal, const Array< double > &x, bool hold)
 Obtain actuator equilibrium.
virtual void computeInitialStates (SimTK::State &s, double &rTI)
 Compute the initial states for a simulation.
virtual void computeControls (SimTK::State &s, ControlSet &rX)
 Compute the controls for a simulation.
virtual double computeControl (const SimTK::State &s, int index) const
 Note that this method is "pure virtual", which means that the Controller class does not implement it, and that subclasses must implement it.
virtual void setActuators (Set< Actuator > &actuators)
virtual void setup (Model &model)
virtual void setupProperties ()
 Connect properties to local pointers.
virtual void setupSystem (SimTK::MultibodySystem &system)
virtual void initState (SimTK::State &s)

Static Public Member Functions

static void FilterControls (const SimTK::State &s, const ControlSet &aControlSet, double aDT, OpenSim::Array< double > &rControls, bool aVerbosePrinting)
 Filter the controls.

Protected Attributes

SimTK::Optimizer * _optimizer
 Optimizer.
OptimizationTarget_target
 Optimization target for computing the controls.
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.
Storage_pErrStore
 Storage object for the position errors.
Storage_vErrStore
 Storage object for the velocity errors.
Storage_stressTermWeightStore
 Storage object for the stress term weight.
ControlSet _controlSet
Array< int > _paramList
 List of parameters in the control set that are serving as the controls in the optimization problem.
bool _verbose
 Flag to indicate whether to use verbose printing.
bool _useCurvatureFilter
CMC_TaskSet_taskSet
VectorFunctionForActuators_predictor
 Vector function for estimating actuator forces over a specified time interval.
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

CMC::CMC (  ) 

Default Constructor.

CMC::CMC ( Model aModel,
CMC_TaskSet aTaskSet 
)

Contructor.

Parameters:
aModel Model that is to be controlled.
aTaskSet Set of tracking tasks.
CMC::CMC ( const CMC aCmc  ) 

Copy constructor.

CMC::CMC ( const std::string &  aFileName,
bool  aUpdateFromXMLNode = true 
)

Constructor from an XML Document.

CMC::~CMC (  )  [virtual]

Destructor.


Member Function Documentation

double CMC::computeControl ( const SimTK::State &  s,
int  index 
) const [virtual]

Note that this method is "pure virtual", which means that the Controller class does not implement it, and that subclasses must implement it.

Parameters:
s system state
rControlSet Control set used for the simulation. This method alters the control set in order to control the simulation.

Implements OpenSim::TrackingController.

void CMC::computeControls ( SimTK::State &  s,
ControlSet controlSet 
) [virtual]

Compute the controls for a simulation.

The caller should send in an initial guess.

Parameters:
s state of system model
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.
rControlSet Control set used for the simulation. This method alters the control set in order to control the simulation.
void CMC::computeInitialStates ( SimTK::State &  s,
double &  rTI 
) [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.
s Initial states.
Object * CMC::copy (  )  const [virtual]

Copy this CMC controller and return a pointer to the copy.

The copy constructor for this class is used. This method is called when a description of this controller is read in from an XML file.

Returns:
Pointer to a copy of this CMC controller.

Reimplemented from OpenSim::Object.

void CMC::copyData ( const CMC aController  ) 

Copy the member variables of the specified controller.

This method is called by the copy constructor of the Controller class.

Parameters:
aController The controller whose data is to be copied.

Reimplemented from OpenSim::TrackingController.

void CMC::FilterControls ( const SimTK::State &  s,
const ControlSet aControlSet,
double  aDT,
OpenSim::Array< double > &  rControls,
bool  aVerbosePrinting 
) [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.
rControls Array of filtered controls.
VectorFunctionForActuators * CMC::getActuatorForcePredictor (  ) 

Get the predictor for actuator forces.

bool CMC::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()
double CMC::getDT (  )  const

Get the requested integrator time step size.

Returns:
Step size.
OptimizationTarget * CMC::getOptimizationTarget (  )  const

Get the optimization target for this controller.

Returns:
Current optimization target.
SimTK::Optimizer * CMC::getOptimizer (  )  const

Get the optimizer.

Returns:
Optimizer.
OpenSim::Array< int > * CMC::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 * CMC::getPositionErrorStorage (  )  const

Get the storage object for position errors.

Returns:
Storage of position errors.
Storage * CMC::getStressTermWeightStorage (  )  const

Get the storage object for stress term weights.

Returns:
Storage of stress term weights.
double CMC::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 CMC::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()
const CMC_TaskSet & CMC::getTaskSet (  )  const
bool CMC::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 OpenSim::CMC::getUseReflexes (  )  const
bool CMC::getUseVerbosePrinting (  )  const
Storage * CMC::getVelocityErrorStorage (  )  const

Get the storage object for velocity errors.

Returns:
Storage of velocity errors.
void CMC::initState ( SimTK::State &  s  )  [virtual]

Reimplemented from OpenSim::Controller.

void CMC::obtainActuatorEquilibrium ( SimTK::State &  s,
double  tiReal,
double  dtReal,
const Array< double > &  x,
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).
CMC & CMC::operator= ( const CMC TrackingController  ) 

Assignment operator.

Parameters:
aController The controller to be copied.
Returns:
Reference to the altered object.

Reimplemented from OpenSim::TrackingController.

void CMC::restoreConfiguration ( SimTK::State &  s,
const SimTK::State &  initialState 
)

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).
s current state.
initialState initial state to be restored.
void CMC::setActuatorForcePredictor ( VectorFunctionForActuators aPredictor  ) 

Set the predictor for actuator forces.

void CMC::setActuators ( Set< Actuator > &  actuators  )  [virtual]

Reimplemented from OpenSim::Controller.

void CMC::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 CMC::setDT ( double  aDT  ) 

Set the requested integrator time step size.

Parameters:
aDT Step size (0.0 <= aDT).
void CMC::setNull ( void   ) 

Set NULL values for all member variables.

Reimplemented from OpenSim::TrackingController.

OptimizationTarget * CMC::setOptimizationTarget ( OptimizationTarget aTarget,
SimTK::Optimizer *  aOptimizer 
)

Set the optimization target for this controller.

Parameters:
aTarget Optimization target.
Returns:
Previous optimization target.
void CMC::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 CMC::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 CMC::setup ( Model model  )  [virtual]

Reimplemented from OpenSim::Controller.

void CMC::setupProperties ( void   )  [virtual]

Connect properties to local pointers.

Reimplemented from OpenSim::TrackingController.

void CMC::setupSystem ( SimTK::MultibodySystem &  system  )  [virtual]

Reimplemented from OpenSim::Controller.

void CMC::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 CMC::setUseVerbosePrinting ( bool  aTrueFalse  ) 

Set whether or not to use verbose printing.

Parameters:
aTrueFalse If true, print verbose information. If false, print only critical information.
ControlSet& OpenSim::CMC::updControlSet (  )  [inline]
CMC_TaskSet & CMC::updTaskSet (  )  const

Member Data Documentation

Whether or not to check the target time.

double OpenSim::CMC::_dt [protected]

Next integration step size that is to be taken by the integrator.

Array<double> OpenSim::CMC::_f [protected]

Array of actuator forces for achieving the desired accelerations.

double OpenSim::CMC::_lastDT [protected]

Last integration step size that was taken before a new integration step size was set in order to step exactly to the target time.

SimTK::Optimizer* OpenSim::CMC::_optimizer [protected]

Optimizer.

Array<int> OpenSim::CMC::_paramList [protected]

List of parameters in the control set that are serving as the controls in the optimization problem.

Storage object for the position errors.

Vector function for estimating actuator forces over a specified time interval.

bool OpenSim::CMC::_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.

Storage object for the stress term weight.

Optimization target for computing the controls.

double OpenSim::CMC::_targetDT [protected]

The step size used to generate a new target time, once the old target time has been reached.

double OpenSim::CMC::_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.

bool OpenSim::CMC::_verbose [protected]

Flag to indicate whether to use verbose printing.

Storage object for the velocity errors.


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