3D joint moment and power

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Mohammadreza Rezaie
Posts: 412
Joined: Fri Nov 24, 2017 12:48 am

3D joint moment and power

Post by Mohammadreza Rezaie » Thu Feb 24, 2022 7:14 am

Dear Experts,

I'm interested in calculating 3D moment and power for each joint in Inverse method even if no coordinate has been defined for two axes (e.g. ankle or knee joint). (I know how to define a new coordinate for each axis and get moment from ID, and calculate power by the product of joint moment and angular velocity)

I was directed to calcPower() and calcReactionOnChildExpressedInGround() functions. But I'm not familiar with them. Based on this example:
https://github.com/opensim-org/opensim- ... example.py

I got the state file from IK output using StateReporter tool and adjusted the script for my purpose as follows:

Code: Select all

model = osim.Model('subject_scaled_walk.osim')
joint = model.getJointSet().get('ankle_r')
statesTable = osim.TimeSeriesTable('subject_scale_walk_StatesReporter_states.sto')
statesTraj = osim.StatesTrajectory.createFromStatesTable(model, statesTable)
model.initSystem()
for i in range(statesTraj.getSize()):
    state = statesTraj[i]
    model.realizeAcceleration(state)
    reaction = joint.calcReactionOnParentExpressedInGround(state) # ([0]: moment, [1]: force)
    print(reaction.get(0))
The results are NaN for each frame.

My questions are: where should I add the external load file? Is it a correct way for my purpose?

Any help is much appreciated.

Best regards,
Mohammadreza

Tags:

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

Re: 3D joint moment and power

Post by Carmichael Ong » Mon Feb 28, 2022 11:21 am

For power, if there's no degree of freedom, then I would expect there to be 0 velocity for that coordinate and thus no power.

For moment, calcReactionOnChildExpressedInGround() should work. This is what JointReaction analysis does, so depending on your workflow, you could attach this analysis to get what you're looking for. If you're trying to implement this in the API for your own workflow, it might also be helpful to look at the code for JointReaction as well (though it's a bit more involved than the simpler example): https://github.com/opensim-org/opensim- ... n.cpp#L546

User avatar
Mohammadreza Rezaie
Posts: 412
Joined: Fri Nov 24, 2017 12:48 am

Re: 3D joint moment and power

Post by Mohammadreza Rezaie » Mon Feb 28, 2022 12:04 pm

Dear Dr. Ong,

Thanks for your reply.

I've just added a new post. The results of JRA are not identical with ID.
viewtopic.php?f=91&t=14425&sid=8e436d33 ... 3d12c24470

I would be grateful if you could help with this too.
Regards,
Mohammadreza

User avatar
Mohammadreza Rezaie
Posts: 412
Joined: Fri Nov 24, 2017 12:48 am

Re: 3D joint moment and power

Post by Mohammadreza Rezaie » Wed Mar 02, 2022 3:08 am

Hi again,

Following my previous post (viewtopicPhpbb.php?f=91&t=14425&p=0&sta ... 3d12c24470), I also tried OutputReporter to get 3D joint moment (e.g. ankle):
jointset/ankle_r|reaction_on_child

The results of both OutputReporter and JointReaction are identical but differ from ID. I only used IK output and external load file. Do these tools need any extra input in order to export identical output with ID?

Any help is much appreciated.
MrR

User avatar
Mohammadreza Rezaie
Posts: 412
Joined: Fri Nov 24, 2017 12:48 am

Re: 3D joint moment and power

Post by Mohammadreza Rezaie » Fri Mar 04, 2022 5:08 am

Any suggestion?

POST REPLY