Hi all,
I am trying to add an external force perturbation to an OpenSim model. I was just wondering if there is an easy way to do this.
I am working with a modified version of this reflex-based OpenSim model in Python that was published for the NeurIPS 2019 Learn to Move - Walk Challenge.
https://github.com/stanfordnmbl/osim-rl ... roller1.py
This is forward dynamics predictive simulation. I am running it in 2D mode and it is using this "gait14dof22musc_planar_20170320.osim" model. Is there an easy way to add a time-varying external force to this model?
Thanks in advance.
Shakiba Rafiee
Apply External Force to OpenSim Model
- shakiba rafiee
- Posts: 6
- Joined: Thu Mar 26, 2015 2:19 pm
- shakiba rafiee
- Posts: 6
- Joined: Thu Mar 26, 2015 2:19 pm
Re: Apply External Force to OpenSim Model
I found this example:
https://github.com/mitkof6/OpenSim_API_ ... d_force.py
It should hopefully help solve the problem.
https://github.com/mitkof6/OpenSim_API_ ... d_force.py
It should hopefully help solve the problem.
- Samuele Gould
- Posts: 16
- Joined: Tue Nov 19, 2019 5:53 am
Re: Apply External Force to OpenSim Model
Hi Shakiba,
If you are running forward dynamics one option would be to apply an external force using an external load through the forward tool. Use an external loads .xml file to specify the bodies you apply the force to and a .mot file (experimental data but you can create your own) to specify the position and time varying properties of the load.
You can see an examples of these file and how to use them in the OpenSim tutorial for the tug of war model.
Best,
Samuele
If you are running forward dynamics one option would be to apply an external force using an external load through the forward tool. Use an external loads .xml file to specify the bodies you apply the force to and a .mot file (experimental data but you can create your own) to specify the position and time varying properties of the load.
You can see an examples of these file and how to use them in the OpenSim tutorial for the tug of war model.
Best,
Samuele
- shakiba rafiee
- Posts: 6
- Joined: Thu Mar 26, 2015 2:19 pm
Re: Apply External Force to OpenSim Model
Hi Samuele,
Thank you for the response.
It is good to know that I can modify the xml file. However, since I want to run the model several times (i.e. 100 times), I was hoping to avoid making several .mot files. I ended up using the opensim.PrescribedForce() function, and it seems to be working fine.
Best,
Shakiba
Thank you for the response.
It is good to know that I can modify the xml file. However, since I want to run the model several times (i.e. 100 times), I was hoping to avoid making several .mot files. I ended up using the opensim.PrescribedForce() function, and it seems to be working fine.
Best,
Shakiba