Page 1 of 1

Inverse Dynamics with Python API

Posted: Wed Aug 02, 2023 7:27 am
by docvi
Hi OpenSim community,

I am trying to use the Python API to perform the inverse kinematics and inverse dynamics analysis on a subject walking on force plates.

I did manage to do the IK step so then I would like to perform the ID after that.
But there are not a lot of examples or guidelines on how to perform the inverse dynamics step.
I saw that one can use InverseDynamicTool but it requires to use a lot of external files which is not ideal.
I would therefore prefer to use InverseDynamicSolver but there are no good examples.
I saw one test case you wrote but it is not very clear what are the steps to perform: https://github.com/opensim-org/opensim- ... dy.py#L241

Would you be able to guide me to perform the ID step?

Thanks

Re: Inverse Dynamics with Python API

Posted: Fri Aug 25, 2023 5:09 pm
by ongcf
The doxygen page have some info that may be helpful: InverseDynamicsSolver doxygen page

There are a few other uses of the InverseDynamicsSolver in C++. While the syntax may look different than Python/Matlab, the calls should be very similar (since it calls the same code). A few places that might be helpful:

- The ID test case: https://github.com/opensim-org/opensim- ... D.cpp#L199
- How the InverseDynamicsTool uses the solver: https://github.com/opensim-org/opensim- ... l.cpp#L408

Re: Inverse Dynamics with Python API

Posted: Sat Aug 26, 2023 4:15 am
by docvi
Thank you for the links.
I already saw them but will will have a look at them again.