Extracting model information during inverse kinematics?

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Mhairi McInnes
Posts: 6
Joined: Tue Oct 18, 2022 7:40 am

Extracting model information during inverse kinematics?

Post by Mhairi McInnes » Thu Mar 14, 2024 1:01 pm

Hello,

I'm trying to get the time-varying orientation of every body in my model, after running marker-based inverse kinematics. I'm getting the data I expect, but I'm not sure my process is very efficient...

My current system (using API through python scripting) is to:
1. Run the inverse kinematics which creates a coordinates .mot file
2. Use the Analyze tool to create a states .sto file from the coordinates .mot file
3. Create a StatesTrajectory from the states .sto file, then my code looks something like this:

Code: Select all

stateTrajectory = osim.StatesTrajectory.createFromStatesTable(model, states_table)
model.initSystem()
for row in range(stateTrajectory.getSize()):
    state = stateTrajectory.get(row)
    model.realizePosition(state)
    Rot = body.getTransformInGround(state).R()
But the step where I create the stateTrajectory from the states_table seems to take ages. Is there a better way of doing this? Can I somehow get the state of the model during the inverse kinematics?

Thanks in advance for any suggestions.

Mhairi

Tags:

User avatar
Carmichael Ong
Posts: 378
Joined: Fri Feb 24, 2012 11:50 am

Re: Extracting model information during inverse kinematics?

Post by Carmichael Ong » Fri Mar 29, 2024 4:12 pm

One way to do this could be using an OutputReporter (example). You can check out different outputs that you can get either in the GUI or in the documentation for the Body class.

POST REPLY