This is an example using the MocoTrack tool with a complex model to track walking.
#include <Moco/osimMoco.h>
#include <Actuators/CoordinateActuator.h>
void torqueDrivenMarkerTracking() {
track.setName("torque_driven_marker_tracking");
track.set_allow_unused_references(true);
track.set_markers_global_tracking_weight(10);
markerWeights.cloneAndAppend({"R.ASIS", 20});
markerWeights.cloneAndAppend({"L.ASIS", 20});
markerWeights.cloneAndAppend({"R.PSIS", 20});
markerWeights.cloneAndAppend({"L.PSIS", 20});
markerWeights.cloneAndAppend({"R.Knee", 10});
markerWeights.cloneAndAppend({"R.Ankle", 10});
markerWeights.cloneAndAppend({"R.Heel", 10});
markerWeights.cloneAndAppend({"R.MT5", 5});
markerWeights.cloneAndAppend({"R.Toe", 2});
markerWeights.cloneAndAppend({"L.Knee", 10});
markerWeights.cloneAndAppend({"L.Ankle", 10});
markerWeights.cloneAndAppend({"L.Heel", 10});
markerWeights.cloneAndAppend({"L.MT5", 5});
markerWeights.cloneAndAppend({"L.Toe", 2});
track.set_markers_weight_set(markerWeights);
track.set_initial_time(0.81);
track.set_final_time(1.65);
track.set_mesh_interval(0.05);
}
void muscleDrivenStateTracking() {
track.setName("muscle_driven_state_tracking");
track.setModel(modelProcessor);
track.set_states_global_tracking_weight(10);
track.set_allow_unused_references(true);
track.set_track_reference_position_derivatives(true);
track.set_initial_time(0.81);
track.set_final_time(1.65);
track.set_mesh_interval(0.08);
Model model = modelProcessor.
process();
for (const auto& coordAct : model.getComponentList<CoordinateActuator>()) {
auto coordPath = coordAct.getAbsolutePathString();
if (coordPath.find("pelvis") != std::string::npos) {
}
}
}
int main() {
torqueDrivenMarkerTracking();
muscleDrivenStateTracking();
return EXIT_SUCCESS;
}