API
4.5.1
For C++ developers
|
Public Member Functions | |
template<typename MocoTrajectoryType , typename tropIterateType > | |
MocoTrajectoryType | convertIterateTropterToMoco (const tropIterateType &tropSol, std::vector< int > inputControlIndexes={}) const |
MocoTrajectory | convertToMocoTrajectory (const tropter::Iterate &tropSol, std::vector< int > inputControlIndexes={}) const |
MocoSolution | convertToMocoSolution (const tropter::Solution &tropSol, std::vector< int > inputControlIndexes={}) const |
tropter::Iterate | convertToTropterIterate (const MocoTrajectory &mocoIter, std::vector< int > inputControlIndexes={}) const |
Protected Member Functions | |
TropterProblemBase (const MocoTropterSolver &solver, bool implicit=false) | |
void | addStateVariables () |
void | addControlVariables () |
void | addCosts () |
void | addKinematicConstraints () |
void | addGenericPathConstraints () |
Add any generic path constraints included in the problem. More... | |
void | addParameters () |
void | initialize_on_iterate (const Eigen::VectorXd ¶meters) const override final |
void | setSimTKTimeAndStates (const T &time, Eigen::Ref< const tropter::VectorX< T >> states, SimTK::State &simTKState) const |
void | setSimTKState (const tropter::Input< T > &in) const |
void | setSimTKStateForCostInitial (const tropter::CostInput< T > &in) const |
void | setSimTKStateForCostFinal (const tropter::CostInput< T > &in) const |
void | setSimTKState (const T &time, const Eigen::Ref< const tropter::VectorX< T >> &states, const Eigen::Ref< const tropter::VectorX< T >> &controls, const Eigen::Ref< const tropter::VectorX< T >> &adjuncts, int stateDisConIndex=0) const |
Use stateDisConIndex to specify which of the two stateDisabledConstraints from MocoProblemRep to update. More... | |
void | calc_cost_integrand (int cost_index, const tropter::Input< T > &in, T &integrand) const override |
void | calc_cost (int cost_index, const tropter::CostInput< T > &in, T &cost_value) const override |
void | applyParametersToModelProperties (const tropter::VectorX< T > ¶meters) const |
Apply parameters to properties in m_modelBase and m_modelDisabledConstraints . More... | |
void | calcAndApplyKinematicConstraintForces (const tropter::VectorX< T > &adjuncts, const SimTK::State &stateBase, SimTK::State &stateDisabledConstraints) const |
void | calcKinematicConstraintErrors (const SimTK::Vector &udot, tropter::Output< T > &out) const |
void | calcPathConstraintErrors (const SimTK::State &state, tropter::Output< T > &out) const |
Protected Attributes | |
const MocoTropterSolver & | m_mocoTropterSolver |
const MocoProblemRep & | m_mocoProbRep |
const Model & | m_modelBase |
SimTK::State & | m_stateBase |
const Model & | m_modelDisabledConstraints |
SimTK::State & | m_stateDisabledConstraints |
const bool | m_implicit |
int | m_multiplierCostIndex = -1 |
std::unique_ptr< FileDeletionThrower > | m_fileDeletionThrower |
std::vector< std::string > | m_svNamesInSysOrder |
std::unordered_map< int, int > | m_yIndexMap |
std::vector< int > | m_modelControlIndices |
SimTK::Vector_< SimTK::SpatialVec > | m_constraintBodyForces |
SimTK::Vector | m_constraintMobilityForces |
SimTK::Vector | qdot |
SimTK::Vector | qdotCorr |
int | m_total_mp = 0 |
int | m_total_mv = 0 |
int | m_total_ma = 0 |
int | m_numMultipliers = 0 |
SimTK::Vector | m_pvaerr |
int | m_numKinematicConstraintEquations = 0 |
int | m_numPathConstraintEquations = 0 |
|
inlineprotected |
References OpenSim::MocoTropterSolver::TropterProblemBase< T >::addControlVariables(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::addCosts(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::addGenericPathConstraints(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::addKinematicConstraints(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::addParameters(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::addStateVariables(), OpenSim::MocoProblemRep::createStateVariableNamesInSystemOrder(), OpenSim::getFormattedDateTime(), OpenSim::Model::getMatterSubsystem(), OpenSim::MocoProblemRep::getName(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_fileDeletionThrower, OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_mocoProbRep, OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_modelBase, OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_stateBase, OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_svNamesInSysOrder, and OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_yIndexMap.
|
inlineprotected |
References OpenSim::convertBounds(), OpenSim::MocoProblemRep::getControlDistributorDisabledConstraints(), OpenSim::ControlDistributor::getControlNamesInOrder(), OpenSim::MocoProblemRep::getSolverControlInfo(), and OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_mocoProbRep.
Referenced by OpenSim::MocoTropterSolver::TropterProblemBase< T >::TropterProblemBase().
|
inlineprotected |
References OpenSim::MocoProblemRep::createCostNames(), OpenSim::MocoDirectCollocationSolver::get_minimize_lagrange_multipliers(), OpenSim::MocoProblemRep::getCost(), OpenSim::MocoProblemRep::getNumEndpointConstraints(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_mocoProbRep, OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_mocoTropterSolver, and OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_multiplierCostIndex.
Referenced by OpenSim::MocoTropterSolver::TropterProblemBase< T >::TropterProblemBase().
|
inlineprotected |
Add any generic path constraints included in the problem.
References OpenSim::convertBounds(), OpenSim::MocoProblemRep::createPathConstraintNames(), OpenSim::MocoPathConstraint::getConstraintInfo(), OpenSim::MocoConstraintInfo::getConstraintLabels(), OpenSim::MocoProblemRep::getNumPathConstraintEquations(), OpenSim::MocoProblemRep::getPathConstraint(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_mocoProbRep, and OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_numPathConstraintEquations.
Referenced by OpenSim::MocoTropterSolver::TropterProblemBase< T >::TropterProblemBase().
|
inlineprotected |
References OpenSim::Acceleration, OpenSim::convertBounds(), OpenSim::MocoProblemRep::createKinematicConstraintNames(), OpenSim::MocoDirectCollocationSolver::get_enforce_constraint_derivatives(), OpenSim::MocoDirectCollocationSolver::get_minimize_lagrange_multipliers(), OpenSim::MocoDirectCollocationSolver::get_velocity_correction_bounds(), OpenSim::MocoProblemRep::getKinematicConstraint(), OpenSim::MocoProblemRep::getMultiplierInfos(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_mocoProbRep, OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_mocoTropterSolver, OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_numKinematicConstraintEquations, OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_numMultipliers, OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_total_ma, OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_total_mp, OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_total_mv, OpenSim::Position, and OpenSim::Velocity.
Referenced by OpenSim::MocoTropterSolver::TropterProblemBase< T >::TropterProblemBase().
|
inlineprotected |
References OpenSim::convertBounds(), OpenSim::MocoProblemRep::createParameterNames(), OpenSim::MocoParameter::getBounds(), OpenSim::MocoProblemRep::getParameter(), and OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_mocoProbRep.
Referenced by OpenSim::MocoTropterSolver::TropterProblemBase< T >::TropterProblemBase().
|
inlineprotected |
References OpenSim::convertBounds(), OpenSim::MocoProblemRep::getStateInfo(), OpenSim::MocoProblemRep::getTimeFinalBounds(), OpenSim::MocoProblemRep::getTimeInitialBounds(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_mocoProbRep, and OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_svNamesInSysOrder.
Referenced by OpenSim::MocoTropterSolver::TropterProblemBase< T >::TropterProblemBase().
|
inlineprotected |
Apply parameters to properties in m_modelBase
and m_modelDisabledConstraints
.
References OpenSim::MocoProblemRep::applyParametersToModelProperties(), and OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_mocoProbRep.
Referenced by OpenSim::MocoTropterSolver::TropterProblemBase< T >::initialize_on_iterate().
|
inlineoverrideprotected |
References OpenSim::MocoGoal::calcGoal(), OpenSim::MocoProblemRep::getControls(), OpenSim::MocoProblemRep::getCostByIndex(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_mocoProbRep, OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_multiplierCostIndex, OpenSim::MocoTropterSolver::TropterProblemBase< T >::setSimTKStateForCostFinal(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::setSimTKStateForCostInitial(), and OpenSim::MocoProblemRep::updStateDisabledConstraints().
|
inlineoverrideprotected |
References OpenSim::MocoGoal::calcIntegrand(), OpenSim::MocoDirectCollocationSolver::get_lagrange_multiplier_weight(), OpenSim::MocoProblemRep::getControls(), OpenSim::MocoProblemRep::getCostByIndex(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_mocoProbRep, OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_mocoTropterSolver, OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_multiplierCostIndex, OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_numMultipliers, OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_stateDisabledConstraints, and OpenSim::MocoTropterSolver::TropterProblemBase< T >::setSimTKState().
|
inlineprotected |
References OpenSim::MocoProblemRep::getConstraintForces(), OpenSim::Model::getMatterSubsystem(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_constraintBodyForces, OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_constraintMobilityForces, OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_mocoProbRep, OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_modelBase, OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_numMultipliers, OpenSim::Model::realizeVelocity(), and OpenSim::DiscreteForces::setAllForces().
Referenced by OpenSim::MocoTropterSolver::TropterProblemBase< T >::setSimTKState().
|
inlineprotected |
References OpenSim::MocoDirectCollocationSolver::get_enforce_constraint_derivatives(), OpenSim::Model::getMatterSubsystem(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_mocoTropterSolver, OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_modelBase, OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_numKinematicConstraintEquations, OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_pvaerr, OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_stateBase, OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_total_ma, OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_total_mp, and OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_total_mv.
Referenced by OpenSim::MocoTropterSolver::ExplicitTropterProblem< T >::calc_differential_algebraic_equations().
|
inlineprotected |
References OpenSim::MocoProblemRep::calcPathConstraintErrors(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_mocoProbRep, and OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_numKinematicConstraintEquations.
Referenced by OpenSim::MocoTropterSolver::ExplicitTropterProblem< T >::calc_differential_algebraic_equations(), and OpenSim::MocoTropterSolver::ImplicitTropterProblem< T >::calc_differential_algebraic_equations().
MocoTrajectoryType OpenSim::MocoTropterSolver::TropterProblemBase< T >::convertIterateTropterToMoco | ( | const tropIterateType & | tropSol, |
std::vector< int > | inputControlIndexes = {} |
||
) | const |
MocoSolution OpenSim::MocoTropterSolver::TropterProblemBase< T >::convertToMocoSolution | ( | const tropter::Solution & | tropSol, |
std::vector< int > | inputControlIndexes = {} |
||
) | const |
MocoTrajectory OpenSim::MocoTropterSolver::TropterProblemBase< T >::convertToMocoTrajectory | ( | const tropter::Iterate & | tropSol, |
std::vector< int > | inputControlIndexes = {} |
||
) | const |
tropter::Iterate OpenSim::MocoTropterSolver::TropterProblemBase< T >::convertToTropterIterate | ( | const MocoTrajectory & | mocoIter, |
std::vector< int > | inputControlIndexes = {} |
||
) | const |
|
inlinefinaloverrideprotected |
|
inlineprotected |
Referenced by OpenSim::MocoTropterSolver::TropterProblemBase< T >::calc_cost_integrand(), OpenSim::MocoTropterSolver::ExplicitTropterProblem< T >::calc_differential_algebraic_equations(), OpenSim::MocoTropterSolver::ImplicitTropterProblem< T >::calc_differential_algebraic_equations(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::setSimTKStateForCostFinal(), and OpenSim::MocoTropterSolver::TropterProblemBase< T >::setSimTKStateForCostInitial().
|
inlineprotected |
Use stateDisConIndex
to specify which of the two stateDisabledConstraints from MocoProblemRep to update.
References OpenSim::MocoTropterSolver::TropterProblemBase< T >::calcAndApplyKinematicConstraintForces(), OpenSim::MocoProblemRep::getAccelerationMotion(), OpenSim::MocoProblemRep::getControlDistributorDisabledConstraints(), OpenSim::MocoProblemRep::isPrescribedKinematics(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_implicit, OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_mocoProbRep, OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_modelDisabledConstraints, OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_numKinematicConstraintEquations, OpenSim::MocoTropterSolver::TropterProblemBase< T >::m_stateBase, OpenSim::MocoTropterSolver::TropterProblemBase< T >::setSimTKTimeAndStates(), OpenSim::AccelerationMotion::setUDot(), OpenSim::ControlDistributor::updControls(), and OpenSim::MocoProblemRep::updStateDisabledConstraints().
|
inlineprotected |
|
inlineprotected |
|
inlineprotected |
|
mutableprotected |
|
mutableprotected |
|
protected |
|
protected |
|
protected |
Referenced by OpenSim::MocoTropterSolver::TropterProblemBase< T >::addControlVariables(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::addCosts(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::addGenericPathConstraints(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::addKinematicConstraints(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::addParameters(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::addStateVariables(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::applyParametersToModelProperties(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::calc_cost(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::calc_cost_integrand(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::calcAndApplyKinematicConstraintForces(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::calcPathConstraintErrors(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::setSimTKState(), and OpenSim::MocoTropterSolver::TropterProblemBase< T >::TropterProblemBase().
|
protected |
Referenced by OpenSim::MocoTropterSolver::TropterProblemBase< T >::addCosts(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::addKinematicConstraints(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::calc_cost_integrand(), and OpenSim::MocoTropterSolver::TropterProblemBase< T >::calcKinematicConstraintErrors().
|
protected |
Referenced by OpenSim::MocoTropterSolver::ExplicitTropterProblem< T >::calc_differential_algebraic_equations(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::calcAndApplyKinematicConstraintForces(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::calcKinematicConstraintErrors(), and OpenSim::MocoTropterSolver::TropterProblemBase< T >::TropterProblemBase().
|
protected |
|
protected |
|
protected |
|
mutableprotected |
Referenced by OpenSim::MocoTropterSolver::TropterProblemBase< T >::addKinematicConstraints(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::calcKinematicConstraintErrors(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::calcPathConstraintErrors(), and OpenSim::MocoTropterSolver::TropterProblemBase< T >::setSimTKState().
|
mutableprotected |
|
mutableprotected |
|
mutableprotected |
|
protected |
Referenced by OpenSim::MocoTropterSolver::ExplicitTropterProblem< T >::calc_differential_algebraic_equations(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::calcKinematicConstraintErrors(), OpenSim::MocoTropterSolver::TropterProblemBase< T >::setSimTKState(), and OpenSim::MocoTropterSolver::TropterProblemBase< T >::TropterProblemBase().
|
protected |
Referenced by OpenSim::MocoTropterSolver::TropterProblemBase< T >::calc_cost_integrand(), OpenSim::MocoTropterSolver::ExplicitTropterProblem< T >::calc_differential_algebraic_equations(), OpenSim::MocoTropterSolver::ImplicitTropterProblem< T >::calc_differential_algebraic_equations(), and OpenSim::MocoTropterSolver::ImplicitTropterProblem< T >::ImplicitTropterProblem().
|
protected |
|
mutableprotected |
|
mutableprotected |
|
mutableprotected |
|
protected |
|
mutableprotected |
|
mutableprotected |