OpenSim Moco  0.4.0
Public Member Functions | Protected Member Functions | List of all members
OpenSim::MocoControlBoundConstraint Class Reference

Description

This class constrains any number of control signals from ScalarActautors to be between two time-based functions.

It is possible to constrain the control signal to be exactly to a provided function; see the equality_with_lower property.

If a function is a GCVSpline, we ensure that the spline covers the entire possible time range in the problem (using the problem's time bounds). We do not perform such a check for other types of functions.

Note
If you omit the lower and upper bounds, then this class will not constrain any control signals, even if you have provided control paths.
This class can only constrain control signals for ScalarActuators.
Inheritance diagram for OpenSim::MocoControlBoundConstraint:
OpenSim::MocoPathConstraint

#include <Moco/Moco/MocoControlBoundConstraint.h>

Public Member Functions

void setLowerBound (const Function &f)
 
void clearLowerBound ()
 
bool hasLowerBound () const
 
const Function & getLowerBound () const
 
void setUpperBound (const Function &f)
 
void clearUpperBound ()
 
bool hasUpperBound () const
 
const Function & getUpperBound () const
 
void setEqualityWithLower (bool v)
 Should the control be constrained to be equal to the lower bound (rather than an inequality constraint)? In this case, the upper bound must be unspecified. More...
 
bool getEqualityWithLower () const
 
Control paths

Set the control paths (absolute paths to actuators in the model) constrained by this class.

void addControlPath (std::string controlPath)
 
void setControlPaths (const std::vector< std::string > &controlPaths)
 
void clearControlPaths ()
 
std::vector< std::string > getControlPaths () const
 
- Public Member Functions inherited from OpenSim::MocoPathConstraint
const MocoConstraintInfogetConstraintInfo () const
 
MocoConstraintInfoupdConstraintInfo ()
 
void setConstraintInfo (const MocoConstraintInfo &cInfo)
 
int getPathConstraintIndex () const
 For use by solvers. More...
 
void calcPathConstraintErrors (const SimTK::State &state, SimTK::Vector &errors) const
 Calculate errors in the path constraint equations. More...
 
void initializeOnModel (const Model &model, const MocoProblemInfo &, const int &pathConstraintIndex) const
 For use by solvers. This also performs error checks on the Problem.
 

Protected Member Functions

void initializeOnModelImpl (const Model &model, const MocoProblemInfo &) const override
 Perform any caching. More...
 
void calcPathConstraintErrorsImpl (const SimTK::State &state, SimTK::Vector &errors) const override
 
- Protected Member Functions inherited from OpenSim::MocoPathConstraint
 OpenSim_DECLARE_UNNAMED_PROPERTY (MocoConstraintInfo, "The bounds and " "labels for this MocoPathConstraint.")
 
void setNumEquations (int numEqs) const
 Set the number of scalar equations for this MocoPathConstraint. More...
 
const Model & getModel () const
 For use within virtual function implementations.
 

Member Function Documentation

◆ calcPathConstraintErrorsImpl()

void OpenSim::MocoControlBoundConstraint::calcPathConstraintErrorsImpl ( const SimTK::State &  state,
SimTK::Vector &  errors 
) const
overrideprotectedvirtual
Precondition(s):
The state is realized to SimTK::Stage::Position. If you need access to the controls, you must realize to Velocity:
getModel().realizeVelocity(state);

Implements OpenSim::MocoPathConstraint.

◆ initializeOnModelImpl()

void OpenSim::MocoControlBoundConstraint::initializeOnModelImpl ( const Model &  ,
const MocoProblemInfo  
) const
overrideprotectedvirtual

Perform any caching.

The number of scalar constraint equations this MocoPathConstraint implements must be defined here (see setNumEquations() below).

Precondition(s):
The model is initialized (initSystem()) and getModel() is available. The passed-in model is equivalent to getModel(). Use this opportunity to check for errors in user input, in addition to the checks provided in initialize().

Implements OpenSim::MocoPathConstraint.

◆ setEqualityWithLower()

void OpenSim::MocoControlBoundConstraint::setEqualityWithLower ( bool  v)
inline

Should the control be constrained to be equal to the lower bound (rather than an inequality constraint)? In this case, the upper bound must be unspecified.


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