Page 1 of 1

Table Reporter for Inverse Dynamics in MATLAB

Posted: Mon Jan 27, 2020 12:15 am
by anki08
Hi Everyone
I was performing Inverse Dynamics simulation to calculate the joint torque required for a trajectory in MATLAB. I have run the Inverse Dynamics Simulation using MATLAB but i not able to export the data to tablereporter. Can someone tell me how to use reporter.

code I am using for running Inverse Dynamics
model.realizeVelocity(state);
appliedMobilityForces = Vector();
appliedBodyForces = VectorOfSpatialVec();
knownUdot = Vector(state.getNU(), 0.0);
knownUdot.set(0, 1.0);
knownLambda = Vector();
residualMobilityForces = Vector();
smss = model.getMatterSubsystem();
smss.calcResidualForce(state, appliedMobilityForces, appliedBodyForces, ...
knownUdot, knownLambda, residualMobilityForces);


How can I export the result (joint forces/torque) into .sto file

Re: Table Reporter for Inverse Dynamics in MATLAB

Posted: Mon Jan 27, 2020 11:54 am
by aymanh
Hi Ankit,

If the plan is to generate a sto file with inverseDynamics output then you may be better off using the InverseDynamicsTool that handles the files reading/writing for you at a higher level. If however you need to use the results from inverse dynamics live then it makes sense to use the low level simbody calls as shown in your code.

TableReporters report values of outputs from the model, the test case below from our code base should give you an idea how to wire it
https://github.com/opensim-org/opensim- ... orter.java

Hope this helps,
-Ayman

Re: Table Reporter for Inverse Dynamics in MATLAB

Posted: Thu May 14, 2020 8:05 pm
by sambhav.ratna
Hi Ayman Habib,

You said that this code can be used to calculate joint moment live.
I have angle and speed values of both the joints of arm26 model saved in an excel file. Can that be used to calculate the value of joint moment at every instance?
Do I need to calculate mass matrix and other jacobians separately, and use them to calculate elbow joint moment, or does the InverseDynamicsSolver (or any other) will be able to do that internally after I assign these values to the state of the model.

Thanks
Ratna Sambhav