API  4.3
For MATLAB, Python, Java, and C++ users
OpenSim::MocoTrack Class Reference
+ Inheritance diagram for OpenSim::MocoTrack:

OpenSim Properties, Sockets, Outputs, Inputs

Properties (single-value)
TableProcessor states_reference
 "States reference data to be tracked. If provided, a " "MocoStateTrackingGoal term is created and added to the internal " "MocoProblem." More...
 
double states_global_tracking_weight
 "The weight for the MocoStateTrackingGoal that applies to tracking " "errors for all states in the reference. Default: 1." More...
 
MocoWeightSet states_weight_set
 "A set of tracking weights for individual state variables. The " "weight names should match the names of the column labels in the " "file associated with the 'states_reference' property." More...
 
bool scale_state_weights_with_range
 "Use the range, or the distance between the maximum and minimum " "value, of each reference quantity to scale the weight " "for the associated tracking error in the cost. The scale is " "computed by the inverse of the range, so a reference quantity " "that changes less across the trajectory has a larger weight. " "Default: false." More...
 
bool track_reference_position_derivatives
 "Option to track the derivative of position-level state reference " "data if no velocity-level state reference data was included in " "the `states_reference`. If velocity-reference reference data was " "provided for some coordinates but not others, this option will " "only apply to the coordinates without speed reference data. " "Default: false." More...
 
TableProcessor markers_reference
 "Motion capture marker reference data to be tracked. The columns " "in the table should correspond to scalar x/y/z marker position " "values and the columns labels should have consistent suffixes " "appended to the model marker names. If provided, a " "MocoMarkerTrackingGoal term is created and added to the internal " "MocoProblem." More...
 
double markers_global_tracking_weight
 "The weight for the MocoMarkerTrackingGoal that applies to " "tracking errors for all markers in the reference. Default: 1." More...
 
MocoWeightSet markers_weight_set
 "A set of tracking weights for individual marker positions. The " "weight names should match the marker names in the " "file associated with the 'markers_reference' property." More...
 
bool allow_unused_references
 "Allow references to contain data not associated with any " "components in the model (such data would be ignored). " "Default: false." More...
 
std::string guess_file
 "Path to a STO file containing a guess for the problem. The path " "can be absolute or relative to the setup file. If no file is " "provided, then a guess constructed from the variable bounds " "midpoints will be used." More...
 
bool apply_tracked_states_to_guess
 "If a `states_reference` has been provided, use this setting to " "replace the states in the guess with the states reference data. " "This will override any guess information provided via " "`guess_file`. Default: false." More...
 
bool minimize_control_effort
 "Whether or not to minimize actuator control effort in the problem." "Default: true." More...
 
double control_effort_weight
 "The weight on the control effort minimization cost term, if it " "exists. Default: 0.001" More...
 
- OpenSim Properties, Sockets, Outputs, Inputs inherited from OpenSim::MocoTool
double initial_time
 "The start of the time interval. " "All data must start at or before this time. " "(default: earliest time available in all provided data)" More...
 
double final_time
 "The end of the time interval. " "All data must end at or after this time. " "(default: latest time available in all provided data)" More...
 
double mesh_interval
 "The time duration of each mesh interval " "(default: 0.020 seconds)." More...
 
bool clip_time_range
 "Set the time range to be 1e-3 shorter on both ends to leave space " "for finite difference estimates (default: false)." More...
 
ModelProcessor model
 "The musculoskeletal model to use." More...
 

Public Member Functions

 MocoTrack ()
 
void setStatesReference (TableProcessor states)
 Set the states reference TableProcessor. More...
 
void setMarkersReference (TableProcessor markers)
 Set the markers reference TableProcessor. More...
 
void setMarkersReferenceFromTRC (const std::string &filename, double lowpassFilterFreq=6.0)
 Set the markers reference directly from a TRC file. More...
 
MocoStudy initialize ()
 
MocoSolution solve ()
 Solve the MocoTrack problem and obtain the solution. More...
 
MocoSolution solveAndVisualize ()
 Solve the MocoTrack problem, visualize the solution, then obtain the solution. More...
 
Property-related functions
const TableProcessorget_states_reference () const
 Get the value of the states_reference property. More...
 
TableProcessorupd_states_reference ()
 Get a writable reference to the states_reference property. More...
 
void set_states_reference (const TableProcessor &value)
 Set the value of the states_reference property. More...
 
const double & get_states_global_tracking_weight () const
 Get the value of the states_global_tracking_weight property. More...
 
double & upd_states_global_tracking_weight ()
 Get a writable reference to the states_global_tracking_weight property. More...
 
void set_states_global_tracking_weight (const double &value)
 Set the value of the states_global_tracking_weight property. More...
 
const MocoWeightSetget_states_weight_set () const
 Get the value of the states_weight_set property. More...
 
MocoWeightSetupd_states_weight_set ()
 Get a writable reference to the states_weight_set property. More...
 
void set_states_weight_set (const MocoWeightSet &value)
 Set the value of the states_weight_set property. More...
 
const bool & get_scale_state_weights_with_range () const
 Get the value of the scale_state_weights_with_range property. More...
 
bool & upd_scale_state_weights_with_range ()
 Get a writable reference to the scale_state_weights_with_range property. More...
 
void set_scale_state_weights_with_range (const bool &value)
 Set the value of the scale_state_weights_with_range property. More...
 
const bool & get_track_reference_position_derivatives () const
 Get the value of the track_reference_position_derivatives property. More...
 
bool & upd_track_reference_position_derivatives ()
 Get a writable reference to the track_reference_position_derivatives property. More...
 
void set_track_reference_position_derivatives (const bool &value)
 Set the value of the track_reference_position_derivatives property. More...
 
const TableProcessorget_markers_reference () const
 Get the value of the markers_reference property. More...
 
TableProcessorupd_markers_reference ()
 Get a writable reference to the markers_reference property. More...
 
void set_markers_reference (const TableProcessor &value)
 Set the value of the markers_reference property. More...
 
const double & get_markers_global_tracking_weight () const
 Get the value of the markers_global_tracking_weight property. More...
 
double & upd_markers_global_tracking_weight ()
 Get a writable reference to the markers_global_tracking_weight property. More...
 
void set_markers_global_tracking_weight (const double &value)
 Set the value of the markers_global_tracking_weight property. More...
 
const MocoWeightSetget_markers_weight_set () const
 Get the value of the markers_weight_set property. More...
 
MocoWeightSetupd_markers_weight_set ()
 Get a writable reference to the markers_weight_set property. More...
 
void set_markers_weight_set (const MocoWeightSet &value)
 Set the value of the markers_weight_set property. More...
 
const bool & get_allow_unused_references () const
 Get the value of the allow_unused_references property. More...
 
bool & upd_allow_unused_references ()
 Get a writable reference to the allow_unused_references property. More...
 
void set_allow_unused_references (const bool &value)
 Set the value of the allow_unused_references property. More...
 
const std::string & get_guess_file () const
 Get the value of the guess_file property. More...
 
std::string & upd_guess_file ()
 Get a writable reference to the guess_file property. More...
 
void set_guess_file (const std::string &value)
 Set the value of the guess_file property. More...
 
const bool & get_apply_tracked_states_to_guess () const
 Get the value of the apply_tracked_states_to_guess property. More...
 
bool & upd_apply_tracked_states_to_guess ()
 Get a writable reference to the apply_tracked_states_to_guess property. More...
 
void set_apply_tracked_states_to_guess (const bool &value)
 Set the value of the apply_tracked_states_to_guess property. More...
 
const bool & get_minimize_control_effort () const
 Get the value of the minimize_control_effort property. More...
 
bool & upd_minimize_control_effort ()
 Get a writable reference to the minimize_control_effort property. More...
 
void set_minimize_control_effort (const bool &value)
 Set the value of the minimize_control_effort property. More...
 
const double & get_control_effort_weight () const
 Get the value of the control_effort_weight property. More...
 
double & upd_control_effort_weight ()
 Get a writable reference to the control_effort_weight property. More...
 
void set_control_effort_weight (const double &value)
 Set the value of the control_effort_weight property. More...
 
- Public Member Functions inherited from OpenSim::MocoTool
 MocoTool ()
 
void setModel (ModelProcessor model)
 
const double & get_initial_time () const
 Get the value of the initial_time property. More...
 
double & upd_initial_time ()
 Get a writable reference to the initial_time property. More...
 
void set_initial_time (const double &value)
 Set the value of the initial_time property. More...
 
const double & get_final_time () const
 Get the value of the final_time property. More...
 
double & upd_final_time ()
 Get a writable reference to the final_time property. More...
 
void set_final_time (const double &value)
 Set the value of the final_time property. More...
 
const double & get_mesh_interval () const
 Get the value of the mesh_interval property. More...
 
double & upd_mesh_interval ()
 Get a writable reference to the mesh_interval property. More...
 
void set_mesh_interval (const double &value)
 Set the value of the mesh_interval property. More...
 
const bool & get_clip_time_range () const
 Get the value of the clip_time_range property. More...
 
bool & upd_clip_time_range ()
 Get a writable reference to the clip_time_range property. More...
 
void set_clip_time_range (const bool &value)
 Set the value of the clip_time_range property. More...
 
const ModelProcessorget_model () const
 Get the value of the model property. More...
 
ModelProcessorupd_model ()
 Get a writable reference to the model property. More...
 
void set_model (const ModelProcessor &value)
 Set the value of the model property. More...
 
- Public Member Functions inherited from OpenSim::Object
virtual ~Object ()
 Virtual destructor for cleanup. More...
 
bool isEqualTo (const Object &aObject) const
 Equality operator wrapper for use from languages not supporting operator overloading. More...
 
Objectoperator= (const Object &aObject)
 Copy assignment copies he base class fields, including the properties. More...
 
virtual bool operator== (const Object &aObject) const
 Determine if two objects are equal. More...
 
virtual bool operator< (const Object &aObject) const
 Provide an ordering for objects so they can be put in sorted containers. More...
 
void setName (const std::string &name)
 Set the name of the Object. More...
 
const std::string & getName () const
 Get the name of this Object. More...
 
void setDescription (const std::string &description)
 Set description, a one-liner summary. More...
 
const std::string & getDescription () const
 Get description, a one-liner summary. More...
 
const std::string & getAuthors () const
 Get Authors of this Object. More...
 
void setAuthors (const std::string &authors)
 Set Authors of this object. More...
 
const std::string & getReferences () const
 Get references or publications to cite if using this object. More...
 
void setReferences (const std::string &references)
 Set references or publications to cite if using this object. More...
 
int getNumProperties () const
 Determine how many properties are stored with this Object. More...
 
const AbstractPropertygetPropertyByIndex (int propertyIndex) const
 Get a const reference to a property by its index number, returned as an AbstractProperty. More...
 
AbstractPropertyupdPropertyByIndex (int propertyIndex)
 Get a writable reference to a property by its index number, returned as an AbstractProperty. More...
 
bool hasProperty (const std::string &name) const
 Return true if this Object has a property of any type with the given name, which must not be empty. More...
 
const AbstractPropertygetPropertyByName (const std::string &name) const
 Get a const reference to a property by its name, returned as an AbstractProperty. More...
 
AbstractPropertyupdPropertyByName (const std::string &name)
 Get a writable reference to a property by its name, returned as an AbstractProperty. More...
 
template<class T >
bool hasProperty () const
 Return true if this Object contains an unnamed, one-object property that contains objects of the given template type T. More...
 
template<class T >
const Property< T > & getProperty (const PropertyIndex &index) const
 Get property of known type Property<T> as a const reference; the property must be present and have the right type. More...
 
template<class T >
Property< T > & updProperty (const PropertyIndex &index)
 Get property of known type Property<T> as a writable reference; the property must be present and have the right type. More...
 
bool isObjectUpToDateWithProperties () const
 Returns true if no property's value has changed since the last time setObjectIsUpToDateWithProperties() was called. More...
 
void readObjectFromXMLNodeOrFile (SimTK::Xml::Element &objectElement, int versionNumber)
 We're given an XML element from which we are to populate this Object. More...
 
virtual void updateFromXMLNode (SimTK::Xml::Element &objectElement, int versionNumber)
 Use this method to deserialize an object from a SimTK::Xml::Element. More...
 
void updateXMLNode (SimTK::Xml::Element &parent, const AbstractProperty *prop=nullptr) const
 Serialize this object into the XML node that represents it. More...
 
bool getInlined () const
 Inlined means an in-memory Object that is not associated with an XMLDocument. More...
 
void setInlined (bool aInlined, const std::string &aFileName="")
 Mark this as inlined or not and optionally provide a file name to associate with the new XMLDocument for the non-inline case. More...
 
std::string getDocumentFileName () const
 If there is a document associated with this object then return the file name maintained by the document. More...
 
int getDocumentFileVersion () const
 If there is a document associated with this object then return its version number. More...
 
void setAllPropertiesUseDefault (bool aUseDefault)
 
bool print (const std::string &fileName) const
 Write this Object into an XML file of the given name; conventionally the suffix to use is ".osim". More...
 
std::string dump () const
 dump the XML representation of this Object into an std::string and return it. More...
 
virtual bool isA (const char *type) const
 The default implementation returns true only if the supplied string is "Object"; each Object-derived class overrides this to match its own class name. More...
 
const std::string & toString () const
 Wrapper to be used on Java side to display objects in tree; this returns just the object's name. More...
 
PropertySetgetPropertySet ()
 OBSOLETE: Get a reference to the PropertySet maintained by the Object. More...
 
const PropertySetgetPropertySet () const
 

Auto-generated functions

static MocoTracksafeDownCast (OpenSim::Object *obj)
 For use in MATLAB and Python to access the concrete class. More...
 
static const std::string & getClassName ()
 This returns "MocoTrack". More...
 
MocoTrackclone () const override
 Create a new heap-allocated copy of the concrete object to which this Object refers. More...
 
const std::string & getConcreteClassName () const override
 Returns the class name of the concrete Object-derived class of the actual object referenced by this Object, as a string. More...
 

Additional Inherited Members

- Static Public Member Functions inherited from OpenSim::MocoTool
static MocoToolsafeDownCast (OpenSim::Object *obj)
 For use in MATLAB and Python to access the concrete class. More...
 
static const std::string & getClassName ()
 This returns "MocoTool". More...
 
- Static Public Member Functions inherited from OpenSim::Object
static void registerType (const Object &defaultObject)
 Register an instance of a class; if the class is already registered it will be replaced. More...
 
static void renameType (const std::string &oldTypeName, const std::string &newTypeName)
 Support versioning by associating the current Object type with an old name. More...
 
static const ObjectgetDefaultInstanceOfType (const std::string &concreteClassName)
 Return a pointer to the default instance of the registered (concrete) Object whose class name is given, or NULL if the type is not registered. More...
 
template<class T >
static bool isObjectTypeDerivedFrom (const std::string &concreteClassName)
 Return true if the given concrete object type represents a subclass of the template object type T, and thus could be referenced with a T*. More...
 
static ObjectnewInstanceOfType (const std::string &concreteClassName)
 Create a new instance of the concrete Object type whose class name is given as concreteClassName. More...
 
static void getRegisteredTypenames (Array< std::string > &typeNames)
 Retrieve all the typenames registered so far. More...
 
template<class T >
static void getRegisteredObjectsOfGivenType (ArrayPtrs< T > &rArray)
 Return an array of pointers to the default instances of all registered (concrete) Object types that derive from a given Object-derived type that does not have to be concrete. More...
 
static bool PrintPropertyInfo (std::ostream &os, const std::string &classNameDotPropertyName, bool printFlagInfo=true)
 Dump formatted property information to a given output stream, useful for creating a "help" facility for registered objects. More...
 
static bool PrintPropertyInfo (std::ostream &os, const std::string &className, const std::string &propertyName, bool printFlagInfo=true)
 Same as the other signature but the class name and property name are provided as two separate strings. More...
 
static ObjectmakeObjectFromFile (const std::string &fileName)
 Create an OpenSim object whose type is based on the tag at the root node of the XML file passed in. More...
 
static const std::string & getClassName ()
 Return the name of this class as a string; i.e., "Object". More...
 
static void setSerializeAllDefaults (bool shouldSerializeDefaults)
 Static function to control whether all registered objects and their properties are written to the defaults section of output files rather than only those values for which the default was explicitly overwritten when read in from an input file or set programmatically. More...
 
static bool getSerializeAllDefaults ()
 Report the value of the "serialize all defaults" flag. More...
 
static bool isKindOf (const char *type)
 Returns true if the passed-in string is "Object"; each Object-derived class defines a method of this name for its own class name. More...
 
static void setDebugLevel (int newLevel)
 Set the amount of logging output. More...
 
static int getDebugLevel ()
 Get the current setting of debug level. More...
 
static ObjectSafeCopy (const Object *aObject)
 Use the clone() method to duplicate the given object unless the pointer is null in which case null is returned. More...
 
static void RegisterType (const Object &defaultObject)
 OBSOLETE alternate name for registerType(). More...
 
static void RenameType (const std::string &oldName, const std::string &newName)
 OBSOLETE alternate name for renameType(). More...
 

Detailed Description

MocoTrack

This tool constructs problems in which state and/or marker trajectory data are tracked while solving for model kinematics and actuator controls. "Tracking" refers to cost terms that minimize the error between provided reference data and the associated model quantities (joint angles, joint velocities, marker positions, etc).

State and marker tracking

State reference data (joint angles and velocities), marker reference data (x/y/z marker motion capture trajectories), or both may be provided via the states_reference and markers_reference properties. For each set of reference data provided, a tracking cost term is added to the internal MocoProblem.

setMarkersReference() only accepts a scalar TimeSeriesTable (either directly or via a TableProcessor) containing x/y/z marker position values. A TimeSeriesTableVec3 of markers is not accepted, but you may use the flatten() method to convert to a scalar TimeSeriesTable:

MocoTrack track;
TimeSeriesTableVec3 markers = TRCFileAdapter("marker_trajectories.trc");
TimeSeriesTable markersFlat(markers.flatten());
track.setMarkersReference(TableProcessor(markersFlat));

If you wish to set the markers reference directly from a TRC file, use setMarkersReferenceFromTRC().

The states_global_tracking_weight and markers_global_tracking_weight properties apply a cost function weight to all tracking error associated provided reference data. The states_weight_set and markers_weight_set properties give you finer control over the tracking costs, letting you set weights for individual reference data tracking errors.

Control effort minimization

By default, a MocoControlCost term is added to the underlying problem with a weight of 0.001. Control effort terms often help smooth the problem solution controls, and minimally affect the states tracking solution with a sufficiently low weight. Use the minimize_control_effort and control_effort_weight properties to customize these settings.

Problem configuration options

A time range that is compatible with all reference data may be provided. If no time range is set, the widest time range that is compatible with all reference data will be used.

If you would like to track joint velocities but only have joint angles in your states reference, enable the track_reference_position_derivatives property. When enabled, the provided position-level states reference data will be splined in order to compute derivatives. If some velocity-level information exists in the reference, this option will fill in the missing data with position derivatives and leave the existing velocity data intact. This is not enabled by default, but is recommended for improving tracking performance and reducing convergence times.

Since the data in the provided references may be altered by TableProcessor operations or appended to by track_reference_position_derivatives, the tracked data is printed to file in addition to the problem solution. The tracked data files have the following format "<tool_name>_tracked_<data_type>.sto" (e.g. "MocoTool_tracked_states.sto").

Default solver settings

  • solver: MocoCasADiSolver
  • multibody_dynamics_mode: explicit
  • transcription_scheme: Hermite-Simpson
  • optim_convergence_tolerance: 1e-2
  • optim_constraint_tolerance: 1e-2
  • optim_sparsity_detection: random
  • optim_finite_difference_scheme: 'forward'

If you would like to use settings other than these defaults, see "Customizing a tracking problem" below.

Basic example

Construct a tracking problem by setting property values and calling solve():

MocoTrack track;
track.setName("states_tracking_with_reserves");
track.setModel(ModelProcessor("model_file.osim") |
ModOpAddExternalLoads("external_loads.xml") |
ModOpAddReserves());
track.setStatesReference("states_reference_file.sto");
track.set_track_reference_position_derivatives(true);
track.set_control_effort_weight(0.1);
MocoSolution solution = track.solve();

Customizing a tracking problem

If you wish to further customize the underlying MocoProblem before solving, instead of calling solve(), call initialize() which returns a pre-configured MocoStudy object:

MocoTrack track;
track.setName("track_and_minimize_hip_compressive_force");
track.setModel(ModelProcessor("model_file.xml") |
ModOpAddExternalLoads());
track.setStatesReference("states_reference_file.sto");
MocoStudy study = track.initialize();
auto& problem = study.updProblem();
auto* hipForceCost = problem.addGoal<MocoJointReactionCost>("hip_force");
hipForceCost->set_weight(10);
hipForceCost->setJointPath("/jointset/hip_r");
hipForceCost->setReactionMeasures({"force-y"});
auto& solver = study.updSolver<MocoCasADiSolver>();
solver.set_multibody_dynamics_mode("implicit");
MocoSolution solution = study.solve();
Note
This class is still under active development and should be used with caution.
Examples:
example2DWalking.cpp, example2DWalkingMetabolics.cpp, and exampleMocoTrack.cpp.

Constructor & Destructor Documentation

◆ MocoTrack()

OpenSim::MocoTrack::MocoTrack ( )
inline

Member Function Documentation

◆ clone()

MocoTrack* OpenSim::MocoTrack::clone ( ) const
inlineoverridevirtual

Create a new heap-allocated copy of the concrete object to which this Object refers.

It is up to the caller to delete the returned object when no longer needed. Every concrete object deriving from Object implements this pure virtual method automatically, via the declaration macro it invokes (e.g., OpenSim_DECLARE_CONCRETE_OBJECT()). Note that the concrete class overrides modify the return type to be a pointer to the concrete object; that still overrides the base class method because the return type is covariant with (that is, derives from) Object.

Implements OpenSim::MocoTool.

◆ get_allow_unused_references()

const bool& OpenSim::MocoTrack::get_allow_unused_references ( ) const
inline

Get the value of the allow_unused_references property.

◆ get_apply_tracked_states_to_guess()

const bool& OpenSim::MocoTrack::get_apply_tracked_states_to_guess ( ) const
inline

Get the value of the apply_tracked_states_to_guess property.

◆ get_control_effort_weight()

const double& OpenSim::MocoTrack::get_control_effort_weight ( ) const
inline

Get the value of the control_effort_weight property.

◆ get_guess_file()

const std::string& OpenSim::MocoTrack::get_guess_file ( ) const
inline

Get the value of the guess_file property.

◆ get_markers_global_tracking_weight()

const double& OpenSim::MocoTrack::get_markers_global_tracking_weight ( ) const
inline

Get the value of the markers_global_tracking_weight property.

◆ get_markers_reference()

const TableProcessor& OpenSim::MocoTrack::get_markers_reference ( ) const
inline

Get the value of the markers_reference property.

◆ get_markers_weight_set()

const MocoWeightSet& OpenSim::MocoTrack::get_markers_weight_set ( ) const
inline

Get the value of the markers_weight_set property.

◆ get_minimize_control_effort()

const bool& OpenSim::MocoTrack::get_minimize_control_effort ( ) const
inline

Get the value of the minimize_control_effort property.

◆ get_scale_state_weights_with_range()

const bool& OpenSim::MocoTrack::get_scale_state_weights_with_range ( ) const
inline

Get the value of the scale_state_weights_with_range property.

◆ get_states_global_tracking_weight()

const double& OpenSim::MocoTrack::get_states_global_tracking_weight ( ) const
inline

Get the value of the states_global_tracking_weight property.

◆ get_states_reference()

const TableProcessor& OpenSim::MocoTrack::get_states_reference ( ) const
inline

Get the value of the states_reference property.

◆ get_states_weight_set()

const MocoWeightSet& OpenSim::MocoTrack::get_states_weight_set ( ) const
inline

Get the value of the states_weight_set property.

◆ get_track_reference_position_derivatives()

const bool& OpenSim::MocoTrack::get_track_reference_position_derivatives ( ) const
inline

Get the value of the track_reference_position_derivatives property.

◆ getClassName()

static const std::string& OpenSim::MocoTrack::getClassName ( )
inlinestatic

This returns "MocoTrack".

See getConcreteClassName() if you want the class name of the underlying concrete object instead.

◆ getConcreteClassName()

const std::string& OpenSim::MocoTrack::getConcreteClassName ( ) const
inlineoverridevirtual

Returns the class name of the concrete Object-derived class of the actual object referenced by this Object, as a string.

This is the string that is used as the tag for this concrete object in an XML file. Every concrete class derived from Object automatically overrides this method via the declaration macro it uses. See getClassName() to get the class name of the referencing (possibly abstract) class rather than the concrete object.

See also
getClassName()

Implements OpenSim::MocoTool.

◆ initialize()

MocoStudy OpenSim::MocoTrack::initialize ( )

◆ safeDownCast()

static MocoTrack* OpenSim::MocoTrack::safeDownCast ( OpenSim::Object obj)
inlinestatic

For use in MATLAB and Python to access the concrete class.

Example: cObj = MocoTrack.safeDownCast(obj). This is equivalent to dynamic_cast<MocoTrack*>(obj) in C++.

◆ set_allow_unused_references()

void OpenSim::MocoTrack::set_allow_unused_references ( const bool &  value)
inline

Set the value of the allow_unused_references property.

Examples:
example2DWalking.cpp, example2DWalkingMetabolics.cpp, and exampleMocoTrack.cpp.

◆ set_apply_tracked_states_to_guess()

void OpenSim::MocoTrack::set_apply_tracked_states_to_guess ( const bool &  value)
inline

Set the value of the apply_tracked_states_to_guess property.

Examples:
example2DWalking.cpp, and example2DWalkingMetabolics.cpp.

◆ set_control_effort_weight()

void OpenSim::MocoTrack::set_control_effort_weight ( const double &  value)
inline

Set the value of the control_effort_weight property.

◆ set_guess_file()

void OpenSim::MocoTrack::set_guess_file ( const std::string &  value)
inline

Set the value of the guess_file property.

◆ set_markers_global_tracking_weight()

void OpenSim::MocoTrack::set_markers_global_tracking_weight ( const double &  value)
inline

Set the value of the markers_global_tracking_weight property.

Examples:
exampleMocoTrack.cpp.

◆ set_markers_reference()

void OpenSim::MocoTrack::set_markers_reference ( const TableProcessor value)
inline

Set the value of the markers_reference property.

◆ set_markers_weight_set()

void OpenSim::MocoTrack::set_markers_weight_set ( const MocoWeightSet value)
inline

Set the value of the markers_weight_set property.

Examples:
exampleMocoTrack.cpp.

◆ set_minimize_control_effort()

void OpenSim::MocoTrack::set_minimize_control_effort ( const bool &  value)
inline

Set the value of the minimize_control_effort property.

◆ set_scale_state_weights_with_range()

void OpenSim::MocoTrack::set_scale_state_weights_with_range ( const bool &  value)
inline

Set the value of the scale_state_weights_with_range property.

◆ set_states_global_tracking_weight()

void OpenSim::MocoTrack::set_states_global_tracking_weight ( const double &  value)
inline

Set the value of the states_global_tracking_weight property.

Examples:
example2DWalking.cpp, example2DWalkingMetabolics.cpp, and exampleMocoTrack.cpp.

◆ set_states_reference()

void OpenSim::MocoTrack::set_states_reference ( const TableProcessor value)
inline

Set the value of the states_reference property.

◆ set_states_weight_set()

void OpenSim::MocoTrack::set_states_weight_set ( const MocoWeightSet value)
inline

Set the value of the states_weight_set property.

◆ set_track_reference_position_derivatives()

void OpenSim::MocoTrack::set_track_reference_position_derivatives ( const bool &  value)
inline

Set the value of the track_reference_position_derivatives property.

Examples:
example2DWalking.cpp, example2DWalkingMetabolics.cpp, and exampleMocoTrack.cpp.

◆ setMarkersReference()

void OpenSim::MocoTrack::setMarkersReference ( TableProcessor  markers)
inline

Set the markers reference TableProcessor.

Note
Overrides any existing TableProcessor for 'markers_reference'.

◆ setMarkersReferenceFromTRC()

void OpenSim::MocoTrack::setMarkersReferenceFromTRC ( const std::string &  filename,
double  lowpassFilterFreq = 6.0 
)
inline

Set the markers reference directly from a TRC file.

By default, the marker data is lowpass filtered with a 6 Hz cutoff frequency, but you may set any frequency using the optional argument. If the markers data is in millimeters (detected via the 'Units' metadata tag), then it is converted to meters.

Note
Overrides any existing TableProcessor for 'markers_reference'.
Examples:
exampleMocoTrack.cpp.

References OpenSim::DataTable_< ETX, ETY >::flatten(), OpenSim::AbstractDataTable::getTableMetaDataAsString(), OpenSim::AbstractDataTable::hasTableMetaDataKey(), and OpenSim::DataTable_< ETX, ETY >::updMatrix().

◆ setStatesReference()

void OpenSim::MocoTrack::setStatesReference ( TableProcessor  states)
inline

Set the states reference TableProcessor.

Note
Overrides any existing TableProcessor for 'states_reference'.
Examples:
example2DWalking.cpp, example2DWalkingMetabolics.cpp, and exampleMocoTrack.cpp.

◆ solve()

MocoSolution OpenSim::MocoTrack::solve ( )
inline

Solve the MocoTrack problem and obtain the solution.

◆ solveAndVisualize()

MocoSolution OpenSim::MocoTrack::solveAndVisualize ( )
inline

Solve the MocoTrack problem, visualize the solution, then obtain the solution.

Examples:
exampleMocoTrack.cpp.

◆ upd_allow_unused_references()

bool& OpenSim::MocoTrack::upd_allow_unused_references ( )
inline

Get a writable reference to the allow_unused_references property.

◆ upd_apply_tracked_states_to_guess()

bool& OpenSim::MocoTrack::upd_apply_tracked_states_to_guess ( )
inline

Get a writable reference to the apply_tracked_states_to_guess property.

◆ upd_control_effort_weight()

double& OpenSim::MocoTrack::upd_control_effort_weight ( )
inline

Get a writable reference to the control_effort_weight property.

◆ upd_guess_file()

std::string& OpenSim::MocoTrack::upd_guess_file ( )
inline

Get a writable reference to the guess_file property.

◆ upd_markers_global_tracking_weight()

double& OpenSim::MocoTrack::upd_markers_global_tracking_weight ( )
inline

Get a writable reference to the markers_global_tracking_weight property.

◆ upd_markers_reference()

TableProcessor& OpenSim::MocoTrack::upd_markers_reference ( )
inline

Get a writable reference to the markers_reference property.

◆ upd_markers_weight_set()

MocoWeightSet& OpenSim::MocoTrack::upd_markers_weight_set ( )
inline

Get a writable reference to the markers_weight_set property.

◆ upd_minimize_control_effort()

bool& OpenSim::MocoTrack::upd_minimize_control_effort ( )
inline

Get a writable reference to the minimize_control_effort property.

◆ upd_scale_state_weights_with_range()

bool& OpenSim::MocoTrack::upd_scale_state_weights_with_range ( )
inline

Get a writable reference to the scale_state_weights_with_range property.

◆ upd_states_global_tracking_weight()

double& OpenSim::MocoTrack::upd_states_global_tracking_weight ( )
inline

Get a writable reference to the states_global_tracking_weight property.

◆ upd_states_reference()

TableProcessor& OpenSim::MocoTrack::upd_states_reference ( )
inline

Get a writable reference to the states_reference property.

◆ upd_states_weight_set()

MocoWeightSet& OpenSim::MocoTrack::upd_states_weight_set ( )
inline

Get a writable reference to the states_weight_set property.

◆ upd_track_reference_position_derivatives()

bool& OpenSim::MocoTrack::upd_track_reference_position_derivatives ( )
inline

Get a writable reference to the track_reference_position_derivatives property.

OpenSim Property, Socket, Output, Input Documentation

◆ allow_unused_references

bool OpenSim::MocoTrack::allow_unused_references

"Allow references to contain data not associated with any " "components in the model (such data would be ignored). " "Default: false."

This property appears in XML files under the tag <allow_unused_references>. This property was generated with the OpenSim_DECLARE_PROPERTY macro; see Property to learn about the property system.

See also
get_allow_unused_references(), upd_allow_unused_references(), set_allow_unused_references()

◆ apply_tracked_states_to_guess

bool OpenSim::MocoTrack::apply_tracked_states_to_guess

"If a `states_reference` has been provided, use this setting to " "replace the states in the guess with the states reference data. " "This will override any guess information provided via " "`guess_file`. Default: false."

This property appears in XML files under the tag <apply_tracked_states_to_guess>. This property was generated with the OpenSim_DECLARE_PROPERTY macro; see Property to learn about the property system.

See also
get_apply_tracked_states_to_guess(), upd_apply_tracked_states_to_guess(), set_apply_tracked_states_to_guess()

◆ control_effort_weight

double OpenSim::MocoTrack::control_effort_weight

"The weight on the control effort minimization cost term, if it " "exists. Default: 0.001"

This property appears in XML files under the tag <control_effort_weight>. This property was generated with the OpenSim_DECLARE_PROPERTY macro; see Property to learn about the property system.

See also
get_control_effort_weight(), upd_control_effort_weight(), set_control_effort_weight()

◆ guess_file

std::string OpenSim::MocoTrack::guess_file

"Path to a STO file containing a guess for the problem. The path " "can be absolute or relative to the setup file. If no file is " "provided, then a guess constructed from the variable bounds " "midpoints will be used."

This property appears in XML files under the tag <guess_file>. This property was generated with the OpenSim_DECLARE_PROPERTY macro; see Property to learn about the property system.

See also
get_guess_file(), upd_guess_file(), set_guess_file()

◆ markers_global_tracking_weight

double OpenSim::MocoTrack::markers_global_tracking_weight

"The weight for the MocoMarkerTrackingGoal that applies to " "tracking errors for all markers in the reference. Default: 1."

This property appears in XML files under the tag <markers_global_tracking_weight>. This property was generated with the OpenSim_DECLARE_PROPERTY macro; see Property to learn about the property system.

See also
get_markers_global_tracking_weight(), upd_markers_global_tracking_weight(), set_markers_global_tracking_weight()

◆ markers_reference

TableProcessor OpenSim::MocoTrack::markers_reference

"Motion capture marker reference data to be tracked. The columns " "in the table should correspond to scalar x/y/z marker position " "values and the columns labels should have consistent suffixes " "appended to the model marker names. If provided, a " "MocoMarkerTrackingGoal term is created and added to the internal " "MocoProblem."

This property appears in XML files under the tag <markers_reference>. This property was generated with the OpenSim_DECLARE_PROPERTY macro; see Property to learn about the property system.

See also
get_markers_reference(), upd_markers_reference(), set_markers_reference()

◆ markers_weight_set

MocoWeightSet OpenSim::MocoTrack::markers_weight_set

"A set of tracking weights for individual marker positions. The " "weight names should match the marker names in the " "file associated with the 'markers_reference' property."

This property appears in XML files under the tag <markers_weight_set>. This property was generated with the OpenSim_DECLARE_PROPERTY macro; see Property to learn about the property system.

See also
get_markers_weight_set(), upd_markers_weight_set(), set_markers_weight_set()

◆ minimize_control_effort

bool OpenSim::MocoTrack::minimize_control_effort

"Whether or not to minimize actuator control effort in the problem." "Default: true."

This property appears in XML files under the tag <minimize_control_effort>. This property was generated with the OpenSim_DECLARE_PROPERTY macro; see Property to learn about the property system.

See also
get_minimize_control_effort(), upd_minimize_control_effort(), set_minimize_control_effort()

◆ scale_state_weights_with_range

bool OpenSim::MocoTrack::scale_state_weights_with_range

"Use the range, or the distance between the maximum and minimum " "value, of each reference quantity to scale the weight " "for the associated tracking error in the cost. The scale is " "computed by the inverse of the range, so a reference quantity " "that changes less across the trajectory has a larger weight. " "Default: false."

This property appears in XML files under the tag <scale_state_weights_with_range>. This property was generated with the OpenSim_DECLARE_PROPERTY macro; see Property to learn about the property system.

See also
get_scale_state_weights_with_range(), upd_scale_state_weights_with_range(), set_scale_state_weights_with_range()

◆ states_global_tracking_weight

double OpenSim::MocoTrack::states_global_tracking_weight

"The weight for the MocoStateTrackingGoal that applies to tracking " "errors for all states in the reference. Default: 1."

This property appears in XML files under the tag <states_global_tracking_weight>. This property was generated with the OpenSim_DECLARE_PROPERTY macro; see Property to learn about the property system.

See also
get_states_global_tracking_weight(), upd_states_global_tracking_weight(), set_states_global_tracking_weight()

◆ states_reference

TableProcessor OpenSim::MocoTrack::states_reference

"States reference data to be tracked. If provided, a " "MocoStateTrackingGoal term is created and added to the internal " "MocoProblem."

This property appears in XML files under the tag <states_reference>. This property was generated with the OpenSim_DECLARE_PROPERTY macro; see Property to learn about the property system.

See also
get_states_reference(), upd_states_reference(), set_states_reference()

◆ states_weight_set

MocoWeightSet OpenSim::MocoTrack::states_weight_set

"A set of tracking weights for individual state variables. The " "weight names should match the names of the column labels in the " "file associated with the 'states_reference' property."

This property appears in XML files under the tag <states_weight_set>. This property was generated with the OpenSim_DECLARE_PROPERTY macro; see Property to learn about the property system.

See also
get_states_weight_set(), upd_states_weight_set(), set_states_weight_set()

◆ track_reference_position_derivatives

bool OpenSim::MocoTrack::track_reference_position_derivatives

"Option to track the derivative of position-level state reference " "data if no velocity-level state reference data was included in " "the `states_reference`. If velocity-reference reference data was " "provided for some coordinates but not others, this option will " "only apply to the coordinates without speed reference data. " "Default: false."

This property appears in XML files under the tag <track_reference_position_derivatives>. This property was generated with the OpenSim_DECLARE_PROPERTY macro; see Property to learn about the property system.

See also
get_track_reference_position_derivatives(), upd_track_reference_position_derivatives(), set_track_reference_position_derivatives()

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