Page 1 of 1

Forward dynamics using ID/RRA

Posted: Thu Nov 10, 2016 5:15 am
by danielfng
Hello,

I was wondering if it's possible to compute forward dynamics using joint torques rather than muscle activations, using either the output from the inverse dynamics tool or the RRA tool (substituting the RRA actuators/controls/states file in place of the usual CMC files). I had assumed this would be possible but am unable to produce a stable simulation using these inputs, while inputs from CMC work fine. I'll describe what I've tried to do below so that the problem is clear.

I'm using the 23 dof 54 muscle model and I have walking data and ground reaction forces. I scale the model and compute an IK solution, then perform RRA. The RRA residuals look reasonable. I then compute CMC from the RRA results. Then, I feed both the RRA and the CMC in to a forward dynamic simulation (separately).

Using the CMC controls/states as input results in a stable forward simulation of 1.5s. Using the RRA controls/states etc the simulation 'goes crazy' after just a few time steps. This doesn't really make sense to me, since the CMC is calculated from the RRA, so they should result in the same effect when simulated forward?

Also, just to note, I've tried changing the integrator settings but to no avail. Even at the finest of settings the forward simulation using RRA becomes unstable almost immediately.

Any help you could provide would be much appreciated.

Cheers,

Daniel

Re: Forward dynamics using ID/RRA

Posted: Tue Nov 15, 2016 11:47 am
by jimmy
For the Fwd-RRA, are you including the initial states from the RRA results?

Re: Forward dynamics using ID/RRA

Posted: Mon Nov 21, 2016 9:39 am
by danielfng
Hi, sorry for the delayed response.

Yes, I am including the RRA states. For the default data available as part of the gait2354 model, I select the forward dynamics setup file, and replace the CMC control file, CMC states file and CMC actuator file with the corresponding RRA versions, and in addition switch from 'append' to 'replace' regarding the actuators. We do have our own data which we've collected but I'm working with the example data just to get something up and running.

Any ideas what I'm doing wrong?

Also I had another question (if you/anyone has time to answer - don't want to be a nuisance): when running tools which take external forces as input, like ground reaction forces, how does the simulator handle the differences in collection frequencies of the data?

For example, kinematics may be measured from marker data at 100Hz, ground reaction forces at 600Hz, and the integrator from RRA might output states/torques at 1000Hz. Is there some background interpolation of the marker data/ground reaction forces going on?

Cheers,

Daniel

Re: Forward dynamics using ID/RRA

Posted: Wed Nov 30, 2016 7:31 am
by m.mauersberger
Hi there,

I have the same problem using the results from Inverse Dynamics to calculate a Forward Dynamics simulation with GRF.
Therefore I added some actuators to the Forward Dynamics Tool having the same name as the columns in my "inverse_dynamics.sto" file. I guess then that Forward Dynamics uses these columns to look for actuators with the same name in the model.

That's my first question: Is this correct? Can I use the results of Inverse Dynamics as a control file for corresponding (coordinate) actuators in Forward Dynamics?

When I do this way my model goes crazy, both with GRF and without GRF. Maybe it is a bug in OpenSim? :?

I would be glad if you helped us.

Best regards

Michael

Re: Forward dynamics using ID/RRA

Posted: Wed Nov 30, 2016 11:30 am
by tkuchida
If you compute joint torques using an inverse analysis and then apply these torques to the model in an open-loop forward dynamic simulation, you should not expect to see the same motion. In general, unstable systems must be stabilized using controllers; otherwise, even very small numerical differences will snowball. Also see viewtopicPhpbb.php?f=91&t=5103

Re: Forward dynamics using ID/RRA

Posted: Thu Dec 01, 2016 12:13 am
by m.mauersberger
Thank you for your quick reply. In the linked topic there is said something about tracking optimization. So can I assume that it does the same as RRA, where a desired motion ist tracked as good as possible to get Forward Simulation kinematic data?

Then there is again the question if I can use RRA data directly for an uncontrolled Forward Simulation, or is this not really possible in a stable way like simulation from Inverse Dynamics data?

Re: Forward dynamics using ID/RRA

Posted: Thu Dec 01, 2016 12:49 pm
by tkuchida
In the linked topic, Ton is referring to the general strategy of repeatedly running forward dynamic simulations and adjusting controls until the desired trajectory is obtained (which is not what RRA does). Regardless, even if you took this approach, the system could still diverge from the expected trajectory if there were any numerical perturbation in the solution (e.g., if the integration tolerance were tightened). In general, unstable systems must be stabilized using controllers. In practice, you may be able to get away with just applying torques to a model in an open-loop forward simulation, depending on the error that can be tolerated; the amount of divergence will depend on the stability characteristics of the system, the length of the simulation, etc.