Regarding the possibility of forward dynamic simulations of robots in OpenSim 4.1

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
User avatar
Carmichael Ong
Posts: 378
Joined: Fri Feb 24, 2012 11:50 am

Re: Regarding the possibility of forward dynamic simulations of robots in OpenSim 4.1

Post by Carmichael Ong » Thu Jul 16, 2020 12:46 pm

I'm not sure of the best way to hold onto previous states, but another example that could be helpful to look at is a simple example from the OpenSim Moco code (https://github.com/opensim-org/opensim- ... namics.cpp), where they use the state derivative as part of the calculations.

To your additional questions:
1. For any torque limits, I'd guess you'd want to imposed them within your own controller to make sure they're being enforced. Joint position and velocity constraints are not so easy to impose in a forward simulation. I think the best bet would be to look at the CoordinateLimitForce (https://simtk.org/api_docs/opensim/api_ ... Force.html). However the closer you make these to hard stops (i.e., the higher the stiffness), you may run into performance issues.
2. Some integrators can be run in fixed-step mode, and the Manager allows for some of this. As you pointed out, this would go against some of the positives that error-controlled methods have. You could get the best of both worlds by running the integrator (or Manager) in a loop where the final time is the next 1 ms. If the integrator can take the full 1 ms step, then it will do that and stop there, and if not, it will take multiple steps but still stop at 1 ms.

Tags:

User avatar
Carlos Gonçalves
Posts: 127
Joined: Wed Jun 08, 2016 4:56 am

Re: Regarding the possibility of forward dynamic simulations of robots in OpenSim 4.1

Post by Carlos Gonçalves » Thu Aug 20, 2020 8:04 pm

Hello Cheng, I am starting my research on forward simulations in OpenSim with custom controllers.

Maybe you already tried the solution in https://simtk-confluence.stanford.edu:8 ... alkerModel, but what I could understand is that the loop controller is defined by a function that is passed to the OpenSim integrator. Check files:

- Main_WalkerForwardSimWithControls.m
- IntegrateOpenSimPlant.m
- OpenSimPlantControlsFunction.m

To keep the fixed time-step, I already seem a solution in another project like this:

% only update control if sampling period has passed (with error margin)
if (thisTime - controlTime(controlIteration)) >= (Ts-.01*Ts)

Hope it helps.

Does anyone already tried this workflow in Python?

Best regards.

POST REPLY