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
Table Reporter for Inverse Dynamics in MATLAB
- Ankit Verma
- Posts: 11
- Joined: Fri Feb 22, 2019 6:12 am
- Ayman Habib
- Posts: 2248
- Joined: Fri Apr 01, 2005 12:24 pm
Re: Table Reporter for Inverse Dynamics in MATLAB
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
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
- Ratna Sambhav
- Posts: 42
- Joined: Sat Jan 12, 2019 10:16 am
Re: Table Reporter for Inverse Dynamics in MATLAB
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
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