perfanalytics / pose2sim

Markerless kinematics with any cameras — From 2D Pose estimation to 3D OpenSim motion
https://perfanalytics.github.io/pose2sim/
BSD 3-Clause "New" or "Revised" License
242 stars 46 forks source link

BodyKinematics #96

Closed lishuaifu closed 4 months ago

lishuaifu commented 5 months ago

Hello, I saw that you have consulted about Opensim’s BodyKinematics on Opensim. I want to use BodyKinematics to obtain the position of the center of mass of the body part throughout the experiment. How should I achieve this in python?

davidpagnon commented 5 months ago

Hi, this script might help you: https://github.com/perfanalytics/pose2sim/blob/main/Pose2Sim/Utilities/bodykin_from_mot_osim.py

This is actually what I use in Pose2Sim_Blender.

lishuaifu commented 5 months ago

Thank you very much, this problem is solved perfectly.I have another question. I can only get the flexion and extension angles using this. I want to change the model to calculate rotation and addition, but I can only calculate the addition at the moment. I want to calculate the rotation, but I don’t know how to modify osim.

davidpagnon commented 5 months ago

I'm not sure I understand so tell me if I answer off topic!

Using this script, you get all angles defined in your OpenSim model: if your shoulder has 3 degrees of freedom, you'll get flexion, adduction, and internal rotation. If your elbow has 1 single degree of freedom, you get only flexion.

Basically, it all depends on your OpenSim model. You can find and download different models depending on your needs, and you can also edit the osim files. But I can't explain it like that, I would recommend you to try their tutorials to understand better (introductory examples are enough).

davidpagnon commented 4 months ago

This issue has been closed as it is inactive. Don't hesitate to comment if you need further help and I will reopen it.