...
To run any optimization, it's necessary to use SimTK::Optimizer and a class like FlippinFelinesOptimizerSystem. However, a class like FlippinFelinesOptimizerTool is not necessary; it's just something we've done to make it easier to run these optimizations. (TODO so we'll focus on the first 2).
Code Block | ||||
---|---|---|---|---|
| ||||
namespace OpenSim { // Manages inputs to the optimization via OpenSim's XML abilities. class FlippinFelinesOptimizerTool : public Object { // ********** PART B ********** }; } // end namespace OpenSim // Finds a control input that achieves flip, as determined by objective function. class FlippinFelinesOptimizerSystem : public SimTK::OptimizerSystem { // ... FlippinFelinesOptimizerSystem(OpenSim::FlippinFelinesOptimizerTool & tool) : _tool(tool), // ... { // ... } // ... // The meat of this class; this is called by the Optimizer that has this system. int objectiveFunc(const SimTK::Vector & parameters, bool new_parameters, SimTK::Real & f) const { // ... f = ...; // ... } // ... // Reference to the FlippinFelinesOptimizerTool. OpenSim::FlippinFelinesOptimizerTool & _tool; // ... }; |
...
Compare your results to those in the References folder of the 'Tutorial' code. TODO. You can do the same for the second optimization, if counterrotation_variableinertia_setup.xml and counterrotation_variableinertia_initial_parameters.xml are in the directory.
...