|
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 finds the maximum value of a coordinate over the motion. More...
#include <MocoMaxCoordinateGoal.h>

Public Member Functions | |
| void | setStateName (const std::string refCoordName) |
| Set the name of the coordinate whose maximum value should be found. | |
| MocoMaxCoordinateGoal () | |
| MocoMaxCoordinateGoal (std::string name) | |
| MocoMaxCoordinateGoal (std::string name, double weight) | |
| void | setDivideByDisplacement (bool tf) |
| bool | getDivideByDisplacement () const |
| void | setStateName (const std::string refCoordName) |
Constructors | |
| MocoMaxCoordinateGoal () | |
| Default constructor. | |
| MocoMaxCoordinateGoal (std::string name) | |
| Constructor with name. | |
| MocoMaxCoordinateGoal (std::string name, double weight) | |
| Constructor with name and weight. | |
Protected Member Functions | |
| 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 |
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. | |
Private Member Functions | |
| OpenSim_DECLARE_CONCRETE_OBJECT (MocoMaxCoordinateGoal, MocoGoal) | |
| void | constructProperties () |
| Initialize the goal's properties. | |
| OpenSim_DECLARE_CONCRETE_OBJECT (MocoMaxCoordinateGoal, MocoGoal) | |
| OpenSim_DECLARE_PROPERTY (divide_by_displacement, bool, "Divide by the model's displacement over the phase (default: " "false)") | |
| void | constructProperties () |
Properties | |
| 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 | |
| StatesTrajectory | st |
| std::vector< double > | inte |
| Vector for storing intermediate values. | |
| double | coord_max |
| Maximum coordinate value found. | |
| double | v |
| Current coordinate value. | |
| int | m_state_index |
| Index of the coordinate state. | |
| std::string | m_state_name |
| Name of the coordinate state. | |
| std::function< double(const double &)> | m_power_function |
| Function to compute power of coordinate values. | |
Goal that finds the maximum value of a coordinate over the motion.
This goal computes the maximum value that a specified coordinate achieves during the motion. The goal value is:
![\[
\max_{t \in [t_i, t_f]} |q(t)|^p
\]](form_8.png)
where 



This goal can be useful for:
|
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 |
|
inline |
|
inline |
|
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 |
|
overrideprotected |
|
private |
Initialize the goal's properties.
|
private |
|
inlineoverrideprotected |
Get the default mode for this goal.
|
inlineoverrideprotected |
|
inline |
|
inlineoverrideprotected |
Whether this goal supports endpoint constraint mode.
|
inlineoverrideprotected |
|
overrideprotected |
Initialize the goal with the model.
|
overrideprotected |
|
private |
|
private |
|
private |
|
private |
|
inline |

|
inline |
Set the name of the coordinate whose maximum value should be found.
| refCoordName | Name of the coordinate in the model. Should be a state variable path (e.g., '/jointset/knee_r/knee_angle_r') |
|
inline |
|
mutableprivate |
Maximum coordinate value found.
|
mutableprivate |
Vector for storing intermediate values.
|
mutableprivate |
Function to compute power of coordinate values.
|
mutableprivate |
Index of the coordinate state.
|
mutableprivate |
Name of the coordinate state.
|
mutableprivate |
States trajectory for computing maximum
|
mutableprivate |
Current coordinate value.