|
|
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...
|
|
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...
|
|
|
| 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...
|
|
|
const TableProcessor & | get_states_reference () const |
| Get the value of the states_reference property. More...
|
|
TableProcessor & | upd_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 MocoWeightSet & | get_states_weight_set () const |
| Get the value of the states_weight_set property. More...
|
|
MocoWeightSet & | upd_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 TableProcessor & | get_markers_reference () const |
| Get the value of the markers_reference property. More...
|
|
TableProcessor & | upd_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 MocoWeightSet & | get_markers_weight_set () const |
| Get the value of the markers_weight_set property. More...
|
|
MocoWeightSet & | upd_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...
|
|
| 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 ModelProcessor & | get_model () const |
| Get the value of the model property. More...
|
|
ModelProcessor & | upd_model () |
| Get a writable reference to the model property. More...
|
|
void | set_model (const ModelProcessor &value) |
| Set the value of the model property. More...
|
|
void | assign (Object &aObject) override |
| This allows copy assignment in the Java GUI. More...
|
|
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...
|
|
Object & | operator= (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 AbstractProperty & | getPropertyByIndex (int propertyIndex) const |
| Get a const reference to a property by its index number, returned as an AbstractProperty. More...
|
|
AbstractProperty & | updPropertyByIndex (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 AbstractProperty & | getPropertyByName (const std::string &name) const |
| Get a const reference to a property by its name, returned as an AbstractProperty. More...
|
|
AbstractProperty & | updPropertyByName (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 > |
const Property< T > & | getPropertyByName (const std::string &name) 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...
|
|
template<class T > |
Property< T > & | updPropertyByName (const std::string &name) |
| 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...
|
|
PropertySet & | getPropertySet () |
| OBSOLETE: Get a reference to the PropertySet maintained by the Object. More...
|
|
const PropertySet & | getPropertySet () const |
|
|
static MocoTool * | safeDownCast (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 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 Object * | getDefaultInstanceOfType (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 Object * | newInstanceOfType (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 Object * | makeObjectFromFile (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 Object * | SafeCopy (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...
|
|
static const std::string | DEFAULT_NAME |
| Name used for default objects when they are serialized. More...
|
|
void | updateTimeInfo (const std::string &dataLabel, const double &dataInitial, const double &dataFinal, TimeInfo &info) const |
| This function updates a TimeInfo so the initial and final times are within the data times provided. More...
|
|
std::string | getFilePath (const std::string &file) const |
| Get the canonicalized absolute pathname with respect to the setup file directory from a given pathname which can be relative or absolute. More...
|
|
std::string | getDocumentDirectory () const |
| Get the (canonicalized) absolute directory containing the file from which this tool was loaded. More...
|
|
| Object () |
| The default constructor is only for use by constructors of derived types. More...
|
|
| Object (const std::string &fileName, bool aUpdateFromXMLNode=true) |
| Constructor from a file, to be called from other constructors that take a file as input. More...
|
|
| Object (const Object &source) |
| Copy constructor is invoked automatically by derived classes with default copy constructors; otherwise it must be invoked explicitly. More...
|
|
| Object (SimTK::Xml::Element &aElement) |
| Construct the base class portion of an Object from a given Xml element that describes this Object. More...
|
|
template<class T > |
PropertyIndex | addProperty (const std::string &name, const std::string &comment, const T &value) |
| Define a new single-value property of known type T, with the given name, associated comment, and initial value. More...
|
|
template<class T > |
PropertyIndex | addOptionalProperty (const std::string &name, const std::string &comment) |
| Add an optional property, meaning it can contain either no value or a single value. More...
|
|
template<class T > |
PropertyIndex | addOptionalProperty (const std::string &name, const std::string &comment, const T &value) |
| Add an optional property, meaning it can contain either no value or a single value. More...
|
|
template<class T > |
PropertyIndex | addListProperty (const std::string &name, const std::string &comment, int minSize, int maxSize) |
| Define a new list-valued property of known type T, with the given name, associated comment, minimum (==0) and maximum (>0) allowable list lengths, and a zero-length initial value. More...
|
|
template<class T , template< class > class Container> |
PropertyIndex | addListProperty (const std::string &name, const std::string &comment, int minSize, int maxSize, const Container< T > &valueList) |
| Define a new list-valued property as above, but assigning an initial value via some templatized container class that supports size() and indexing. More...
|
|
PropertyIndex | getPropertyIndex (const std::string &name) const |
| Look up a property by name and return its PropertyIndex if it is found. More...
|
|
template<class T > |
PropertyIndex | getPropertyIndex () const |
| Look up an unnamed property by the type of object it contains, and return its PropertyIndex if it is found. More...
|
|
template<class T > |
void | checkPropertyValueIsPositive (const Property< T > &p) const |
| Throw an exception if any of the property's values are not positive. More...
|
|
template<class T > |
void | checkPropertyValueIsInSet (const Property< T > &p, const std::set< T > &set) const |
| Throw an exception if any of the property's values are not in the provided set. More...
|
|
template<class T > |
void | checkPropertyValueIsInRangeOrSet (const Property< T > &p, const T &lower, const T &upper, const std::set< T > &set) const |
| Throw an exception if any of the property's values are neither in the provided range nor in the provided set. More...
|
|
void | setObjectIsUpToDateWithProperties () |
| When an object is initialized using the current values of its properties, it can set a flag indicating that it is up to date. More...
|
|
void | clearObjectIsUpToDateWithProperties () |
| For testing or debugging purposes, manually clear the "object is up to
date with respect to properties" flag. More...
|
|
void | makeObjectNamesConsistentWithProperties () |
| Make sure the name of an object is consistent with its property type. More...
|
|
void | updateFromXMLDocument () |
| Use this method only if you're deserializing from a file and the object is at the top level; that is, primarily in constructors that take a file name as input. More...
|
|
void | setDocument (XMLDocument *doc) |
| Unconditionally set the XMLDocument associated with this object. More...
|
|
const XMLDocument * | getDocument () const |
| Get a const pointer to the document (if any) associated with this object. More...
|
|
XMLDocument * | updDocument () |
| Get a writable pointer to the document (if any) associated with this object. More...
|
|
PropertySet | _propertySet |
| OBSOLETE: Property_Deprecated set for serializable member variables of this and derived classes. More...
|
|
#define | OpenSim_DECLARE_CONCRETE_OBJECT(ConcreteClass, SuperClass) |
| Macro to be included as the first line of the class declaration for any non-templatized, concrete class that derives from OpenSim::Object. More...
|
|
#define | OpenSim_DECLARE_ABSTRACT_OBJECT(ConcreteClass, SuperClass) |
| Macro to be included as the first line of the class declaration for any still-abstract class that derives from OpenSim::Object. More...
|
|
#define | OpenSim_DECLARE_CONCRETE_OBJECT_T(ConcreteClass, TArg, SuperClass) |
| Macro to be included as the first line of the class declaration for any templatized, concrete class that derives from OpenSim::Object, like Set<T>. More...
|
|
#define | OpenSim_DECLARE_ABSTRACT_OBJECT_T(ConcreteClass, TArg, SuperClass) |
| Macro to be included as the first line of the class declaration for any templatized, still-abstract class that derives from OpenSim::Object. More...
|
|
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:
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():
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:
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.