|
MocoExtendProblem: Interface Between OpenSim and MATLAB for Rapidly Developing Direct Collocation Goals in Moco 1.1.0
add custom Moco goals to existing matlab scripts
|
Goal that minimizes muscle strain during motion. More...
#include <MocoMuscleStrainGoal.h>

Public Member Functions | |
| void | setExponent (int ex) |
| Set the exponent for the strain terms. | |
| bool | getExponent () const |
| Get the current exponent value. | |
| void | setDivideByDisplacement (bool tf) |
| Set whether to divide by displacement. | |
| bool | getDivideByDisplacement () const |
| Get whether the goal is divided by displacement. | |
Constructors | |
| MocoMuscleStrainGoal () | |
| Default constructor. | |
| MocoMuscleStrainGoal (std::string name) | |
| Constructor with name. | |
| MocoMuscleStrainGoal (std::string name, double weight) | |
| Constructor with name and weight. | |
Protected Member Functions | |
Required implementations of virtual methods | |
| Mode | getDefaultModeImpl () const override |
| Get the default mode for this goal. | |
| bool | getSupportsEndpointConstraintImpl () const override |
| Whether this goal supports endpoint constraint mode. | |
| void | initializeOnModelImpl (const Model &) const override |
| Initialize the goal with the model. | |
| void | calcIntegrandImpl (const IntegrandInput &input, double &integrand) const override |
| Calculate the integrand value for the cost function. | |
| void | calcGoalImpl (const GoalInput &input, SimTK::Vector &cost) const override |
| Calculate the goal value. | |
| SimTK::Matrix | FlattenSpatialVec (const SimTK::SpatialVec &S) const |
| Convert a spatial vector to a matrix representation. | |
Private Member Functions | |
| OpenSim_DECLARE_CONCRETE_OBJECT (MocoMuscleStrainGoal, MocoGoal) | |
| void | constructProperties () |
| Initialize the goal's properties. | |
Properties | |
| OpenSim_DECLARE_PROPERTY (divide_by_displacement, bool, "Divide by the model's displacement over the phase (default: " "false)") | |
| OpenSim_DECLARE_PROPERTY (exponent, int, "The exponent applied to the output value in the integrand. " "The output can take on negative values in the integrand when the " "exponent is set to 1 (the default value). When the exponent is " "set to a value greater than 1, the absolute value function is " "applied to the output (before the exponent is applied), meaning " "that odd numbered exponents (greater than 1) do not take on " "negative values.") | |
Private Attributes | |
Internal working variables | |
| std::vector< std::string > | m_force_names |
| std::function< double(const double &)> | m_power_function |
| Function to compute power of values. | |
| std::vector< int > | m_act_indices |
| Indices of muscle activation states. | |
| std::vector< double > | m_Fiso |
| Maximum isometric forces for each muscle. | |
| std::vector< double > | m_Lopt |
| Optimal fiber lengths for each muscle. | |
| std::vector< double > | m_Vol |
| Muscle volumes. | |
Goal that minimizes muscle strain during motion.
This goal minimizes the strain experienced by muscles during the motion, integrated over the phase. The strain is computed based on the muscle's current length relative to its optimal fiber length.
The goal accounts for:
This goal can be useful for:
The strain values can be raised to a specified power using the exponent property, and can optionally be divided by the total displacement of the model during the phase to make the cost invariant to the distance traveled.
|
inline |
Default constructor.
|
inline |
Constructor with name.
| name | The name of the goal |
|
inline |
Constructor with name and weight.
| name | The name of the goal |
| weight | Weight for this goal term in the optimization |
|
overrideprotected |
Calculate the goal value.
| input | Input data containing the integral |
| cost | Vector to store the calculated cost |
|
overrideprotected |
Calculate the integrand value for the cost function.
| input | Input data for the current state |
| integrand | Reference to store the calculated integrand value |
|
private |
Initialize the goal's properties.
|
protected |
Convert a spatial vector to a matrix representation.
| S | Spatial vector to flatten |
|
inlineoverrideprotected |
Get the default mode for this goal.
|
inline |
Get whether the goal is divided by displacement.
|
inline |
Get the current exponent value.
|
inlineoverrideprotected |
Whether this goal supports endpoint constraint mode.
|
overrideprotected |
Initialize the goal with the model.
|
private |
|
private |
|
private |
|
inline |
Set whether to divide by displacement.
| tf | True to divide by displacement, false otherwise |
|
inline |
Set the exponent for the strain terms.
| ex | The exponent value |
|
mutableprivate |
Indices of muscle activation states.
|
mutableprivate |
Maximum isometric forces for each muscle.
|
mutableprivate |
Names of forces used in calculations
|
mutableprivate |
Optimal fiber lengths for each muscle.
|
mutableprivate |
Function to compute power of values.
|
mutableprivate |
Muscle volumes.