Share 
Follow 
AboutDownloadsDocumentsForumsSource CodeIssuesNews
Date:
2016-02-17 20:52
Priority:
3
State:
Open
Submitted by:
Dries Mys (dries123mys)
Assigned to:
Ajay Seth (aseth)
Summary:
JointReaction(Model *aModel=0) is not correctly initialised

Detailed description
1) The constructor JointReaction(Model *aModel=0) should call setModel(Model& aModel) instead of forwarding the Model directly to the base class, otherwise the variables in JointReaction itself are not updated.

2) If the user calls setJointNames(Array< std::string > &jointNames) after the model is set, the operation has no effect, because the reaction list is only updated in setModel (Model& aModel). A solution is to call setupReactionList() and constructColumnLabels() and _Loads.setSize(9*numJoints) in begin(SimTK::State& s).

If the constructor JointReaction(Model *aModel=0) is used and setModel(Model& aModel) is not called, the output file will only contain a time field. (see basic example)
A workaround is to call setModel(Model& aModel) after all the parameters (like joinNames) are set.


see: https://github.com/opensim-org/opensim-core/blob/master/OpenSim/Analyses/JointReaction.cpp



basic example:

Model* osimModel = new Model (your_osim_filename);
SimTK& si = osimModel->initSystem();

JointReaction* jointReaction = new JointReaction(osimModel);
// jointReaction->setModel(osimModel); // workaround
osimModel->addAnalysis (jointReaction);

SimTK::RungeKuttaMersonIntegrator integrator(osimModel->getMultibodySystem());
Manager manager(osimModel, integrator);
manager.setInitialTime(0.0);
manager.setFinalTime(1.0);
manager.integrate(si);

jointReaction->printResults("JointReporter", your_output_folder);

Add A Comment: Notepad

No Comments Have Been Posted

No Changes Have Been Made to This Item

Feedback