API  4.3
For MATLAB, Python, Java, and C++ users
OpenSim::MocoKinematicConstraint Class Reference

A model kinematic constraint to be enforced in the optimal control problem. More...

Public Member Functions

const MocoConstraintInfogetConstraintInfo () const
 
void setConstraintInfo (const MocoConstraintInfo &cInfo)
 
SimTK::ConstraintIndex getSimbodyConstraintIndex () const
 Get the SimTK::ConstraintIndex associated with this MocoKinematicConstraint. More...
 
int getNumPositionEquations () const
 Get the number of scalar constraint equations at each kinematic level. More...
 
int getNumVelocityEquations () const
 
int getNumAccelerationEquations () const
 
std::vector< KinematicLevelgetKinematicLevels () const
 Get a vector of enums specifying the kinematic level of each scalar constraint equation in the associated model constraint, as each equation may need to be treated differently in a solver (e.g. More...
 
void calcKinematicConstraintErrors (const Model &model, const SimTK::State &state, SimTK::Vector &errors) const
 Convenience method for calculating constraint errors given a SimTK::State object. More...
 

Detailed Description

A model kinematic constraint to be enforced in the optimal control problem.

Objects of this class can only be instantiated by a MocoPhase, since information from each constraint in the model is required to ensure that the correct values are assigned to internal variables during construction.

Member Function Documentation

◆ calcKinematicConstraintErrors()

void OpenSim::MocoKinematicConstraint::calcKinematicConstraintErrors ( const Model model,
const SimTK::State &  state,
SimTK::Vector &  errors 
) const

Convenience method for calculating constraint errors given a SimTK::State object.

This may not be the most efficient solution for solvers, but could be useful for a quick implementation or for debugging model constraints causing issues in an optimal control problem.

Precondition(s):
The errors vector passed must be consistent with the number of scalar constraint equations associated with this MocoKinematicConstraint.

◆ getConstraintInfo()

const MocoConstraintInfo& OpenSim::MocoKinematicConstraint::getConstraintInfo ( ) const
inline

◆ getKinematicLevels()

std::vector<KinematicLevel> OpenSim::MocoKinematicConstraint::getKinematicLevels ( ) const
inline

Get a vector of enums specifying the kinematic level of each scalar constraint equation in the associated model constraint, as each equation may need to be treated differently in a solver (e.g.

don't add Lagrange multipliers for derivatives of position or velocity constraint equations when looping through all scalar constraint equations).

◆ getNumAccelerationEquations()

int OpenSim::MocoKinematicConstraint::getNumAccelerationEquations ( ) const
inline

◆ getNumPositionEquations()

int OpenSim::MocoKinematicConstraint::getNumPositionEquations ( ) const
inline

Get the number of scalar constraint equations at each kinematic level.

Note that the total number of scalar constraint equations enforced is NOT equal to the sum of each of these values – you must include the first and second derivatives of the position equations and the first derivatives of the velocity equations into that count as well (this value can be obtained by calling getNumEquations()).

◆ getNumVelocityEquations()

int OpenSim::MocoKinematicConstraint::getNumVelocityEquations ( ) const
inline

◆ getSimbodyConstraintIndex()

SimTK::ConstraintIndex OpenSim::MocoKinematicConstraint::getSimbodyConstraintIndex ( ) const
inline

Get the SimTK::ConstraintIndex associated with this MocoKinematicConstraint.

Note that a SimTK::ConstraintIndex is different from what is returned from MocoPathConstraint::getPathConstraintIndex(): the former is an index to a model constraint, whereas the latter is an index to the path constraint errors vector in a MocoProblem.

◆ setConstraintInfo()

void OpenSim::MocoKinematicConstraint::setConstraintInfo ( const MocoConstraintInfo cInfo)
inline

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