|
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
|
This goal minimizes the acceleration of specified coordinates in the model. More...
#include <MocoCoordinateAccelerationGoal.h>

Public Member Functions | |
| MocoCoordinateAccelerationGoal () | |
| Default constructor. | |
| MocoCoordinateAccelerationGoal (std::string name) | |
| Constructor with name. | |
| MocoCoordinateAccelerationGoal (std::string name, double weight) | |
| Constructor with name and weight. | |
| void | setStateNames (const std::vector< std::string > refCoordNames) |
| Set the names of coordinates whose accelerations should be minimized. | |
| void | setExponent (int ex) |
| Set the exponent for the acceleration 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. | |
| void | setStateNames (const std::vector< std::string > refCoordNames) |
| Set the coordinates to track for acceleration minimization. | |
Constructors | |
| MocoCoordinateAccelerationGoal () | |
| Default constructor. | |
| MocoCoordinateAccelerationGoal (std::string name) | |
| Constructor with name. | |
| MocoCoordinateAccelerationGoal (std::string name, double weight) | |
| Constructor with name and weight. | |
Protected Member Functions | |
Required implementations of virtual methods | |
| Mode | getDefaultModeImpl () const override |
| bool | getSupportsEndpointConstraintImpl () const override |
| void | initializeOnModelImpl (const Model &) const override |
| void | calcIntegrandImpl (const IntegrandInput &input, double &integrand) const override |
| void | calcGoalImpl (const GoalInput &input, SimTK::Vector &cost) const override |
| 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. | |
Private Member Functions | |
| OpenSim_DECLARE_CONCRETE_OBJECT (MocoCoordinateAccelerationGoal, MocoGoal) | |
| 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.") | |
| void | constructProperties () |
| OpenSim_DECLARE_CONCRETE_OBJECT (MocoCoordinateAccelerationGoal, 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::function< double(const double &)> | m_power_function |
| Function to compute power of acceleration values. | |
| std::vector< int > | m_sysYIndices |
| System Y indices for all states. | |
| std::vector< int > | m_state_indices |
| Indices of states we want to minimize acceleration for. | |
| std::vector< std::string > | m_state_names |
| Names of states for which we want to minimize acceleration. | |
This goal minimizes the acceleration of specified coordinates in the model.
Goal that minimizes the acceleration of specified coordinates.
The integrand is:
![\[
\sum_i |\ddot{q}_i|^p
\]](form_4.png)
where 

This goal can be useful for:
This goal minimizes the acceleration of selected model coordinates, integrated over the phase. This can help produce smoother, more natural motions by penalizing rapid changes in coordinate velocities.
The goal can be applied to any subset of model coordinates by specifying their names. For each coordinate, the squared acceleration is computed and can be raised to a specified power.
This goal can be useful for:
The goal 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 |
|
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 |
|
overrideprotected |
Calculate the goal value.
| input | Input data containing the integral |
| cost | Vector to store the calculated cost |
|
overrideprotected |
|
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 |
|
private |
Initialize the goal's properties.
|
inlineoverrideprotected |
|
inlineoverrideprotected |
Get the default mode for this goal.
|
inline |
Get whether the goal is divided by displacement.
|
inline |
Get the current exponent value.
|
inlineoverrideprotected |
|
inlineoverrideprotected |
Whether this goal supports endpoint constraint mode.
|
overrideprotected |
|
overrideprotected |
Initialize the goal with the model.
|
private |
|
private |
|
private |
|
private |
|
private |
|
inline |
Set whether to divide by displacement.
| tf | True to divide by displacement, false otherwise |

|
inline |
Set the exponent for the acceleration terms.
| ex | The exponent value |
|
inline |
Set the names of coordinates whose accelerations should be minimized.
| refCoordNames | Vector of coordinate names. Each name should be a state variable path (e.g., '/jointset/knee_r/knee_angle_r') |
|
inline |
Set the coordinates to track for acceleration minimization.
| refCoordNames | Vector of coordinate names to track |
The coordinate names should be state variable paths, e.g., '/jointset/knee_r/knee_angle_r'
|
mutableprivate |
Function to compute power of acceleration values.
Function to compute power of acceleration values
|
mutableprivate |
Indices of states we want to minimize acceleration for.
Indices of states in the state vector.
|
mutableprivate |
Names of states for which we want to minimize acceleration.
Names of coordinates to track.
|
mutableprivate |
System Y indices for all states.
System Y indices for state derivatives