OpenSim v.2.3.1

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
User avatar
Dimitar Stanev
Posts: 1096
Joined: Fri Jan 31, 2014 5:14 am

Re: OpenSim v.2.3.1

Post by Dimitar Stanev » Wed Aug 17, 2016 11:22 pm

Joint torque is not a state variable but an input or an output depending your simulation. You can run inverse dynamics (ID) on your motion file + any external force and compute the joint torques. Otherwise if you perform forward dynamics you can also run ID on the simulated movement afterwards.

User avatar
sariah Mghames
Posts: 23
Joined: Thu Jun 30, 2016 5:56 am

Re: OpenSim v.2.3.1

Post by sariah Mghames » Thu Aug 18, 2016 9:59 am

Yes, in fact I am performing Forward dynamics with already built S function to be used in Simulink. The output state vector contains joints position and velocity.

I was trying to avoid running inverse dynamics tool to get the joint torques out of: position, velocities, accelerations. But as you said it seems there is no other solution.

The inverseDynamicsTool of opensim takes as input the motion file containing the joint trajectories. But I am working in simulink , so I want to perform real time inverse dynamics. The problem is that I can call the inverseDynamicsTool in simulink but I can't input a motion file to it, since I have real time output trajectories generating.

I am not sure till now if I can call the ID Tool from Simulink matlab function and tell it to get the input trajectories from the input port of the block instead of specifying a .mot file to the Tool

Thanks again

User avatar
jimmy d
Posts: 1375
Joined: Thu Oct 04, 2007 11:51 pm

Re: OpenSim v.2.3.1

Post by jimmy d » Thu Aug 18, 2016 11:27 am

You don't necessarily have to use the IDTool. You can try and use the InverseDynamicsSolver directly.

User avatar
sariah Mghames
Posts: 23
Joined: Thu Jun 30, 2016 5:56 am

Re: OpenSim v.2.3.1

Post by sariah Mghames » Fri Aug 19, 2016 4:25 am

Thanks for pointing me out IDSolver()

by taking a look at it, the function solve:

virtual SimTK::Vector solve(SimTK::State &s, const SimTK::Vector &udot = SimTK::Vector(0))

It takes state ( position, velocity, time) and acceleration as input principally and gives torque as output

The acceleration is defibìned to be a variable sized vector and the output torque also. But since I am working in simulink the acceleration should be 1 dimensional at each time step( real time simulation) and the torque output also. As I understood from defining acceleration udot as Vector(0) it should be Ok my case of having acceleration as 1 dimensional and getting 1 dimensional torque as output.

Any idea If what I am saying is right ?

POST REPLY