Page 6 of 6

Re: Using metabolics probe with DeGrooteFregly2016Muscle

Posted: Thu Sep 10, 2020 1:08 pm
by nbianco
The Muscle class has an Output for the active force-length multiplier (called 'active_force_length_multiplier'). So you can compute it with analyze() just like any other Output.

Re: Using metabolics probe with DeGrooteFregly2016Muscle

Posted: Wed Sep 23, 2020 8:13 am
by karthick_ganesan
I'm not sure what you mean. The output in MocoOutputGoal is included in the integrated cost function.
I mean, for example, is it possible to square the fiber power and then minimize it using MocoOutputGoal?
Thanks.

Re: Using metabolics probe with DeGrooteFregly2016Muscle

Posted: Wed Sep 23, 2020 11:20 am
by nbianco
Ah yes, the output value is included in the integrand without any modifications. You cannot change the power on the output value currently.

Re: Using metabolics probe with DeGrooteFregly2016Muscle

Posted: Thu Mar 04, 2021 10:13 am
by rosshm
Hi all,

Bumping this thread to ask a question about study.analyze:

Is there a way to use study.analyze to compute and report the joint reaction force(s) in a specified reference frame? Essentially I would like to calculate the output for MocoJointReactionGoal, e.g. knee compressive force (https://opensim-org.github.io/opensim-moco-site/docs/), but want to do it from a specified MocoTrajectory so that I can look at the time series of the knee compressive force.

Something like:

Code: Select all

outputPaths = StdVectorString();
outputPaths.add('path_to_this_output');
outputTable = study.analyze(soln, outputPaths);
Ross

Re: Using metabolics probe with DeGrooteFregly2016Muscle

Posted: Mon Mar 08, 2021 12:50 pm
by pvb
Hi Ross,

I think we're after the same goal (getting a time series of any given joint reaction force/moment from a MocoTrajectory). I tried the following:

Code: Select all

 
 JR_paths=StdVectorString();
 JR_paths.add('.*reaction_on_parent');
 JR_paths.add('.*reaction_on_child');
 
 
JR_outputs_table=study.analyze(mocoTrajectory, JR_paths);
JR_outputs=osimTableToStruct(JR_outputs_table);
This doesn't work, because the output of a joint reaction force/moment is of the type "SpacialVec", and the analyze tool ignores those outputs. Did you happen to find a way around this?

Re: Using metabolics probe with DeGrooteFregly2016Muscle

Posted: Mon Mar 08, 2021 2:39 pm
by rosshm
I have not. In reading over some posts on the main OpenSim forum it looks like the Analyze tool does not support SpatialVec so I think this would have to be addressed in a future version of OpenSim (outside the scope of Moco).

Ross

Re: Using metabolics probe with DeGrooteFregly2016Muscle

Posted: Mon Mar 08, 2021 2:49 pm
by nbianco
Hey guys,

In Matlab, you should be able to use analyzeSpatialVec() for calculating joint reaction forces like you would use analyze() to calculate scalar quantities.

Re: Using metabolics probe with DeGrooteFregly2016Muscle

Posted: Wed Jan 18, 2023 9:50 am
by kpariser
Hi,
I was wondering if either of you had figured out this problem? I am now trying to output joint moments from a Moco Trajectory and analyzeSpatialVec() doesn't appear to be an existing function. Is there another function I can use? Thank you for your help.

Kayla

Re: Using metabolics probe with DeGrooteFregly2016Muscle

Posted: Wed Jan 18, 2023 2:58 pm
by nbianco
Hi Kayla,

How are you calling analyzeSpatialVec()? To clarify, it is not a function on MocoStudy, but rather a utility function under SimulationUtilities. That means you should call using the 'opensimSimulation' prefix in Matlab:

Code: Select all

outputPaths = StdVectorString();
outputPaths.add('/path/to/output');
table = opensimSimulation.analyzeSpatialVec(model, ...
    solution.exportToStatesTable(), ...
    solution.exportToControlsTable(), ...
    outputPaths);
Hope that helps!

-Nick

Re: Using metabolics probe with DeGrooteFregly2016Muscle

Posted: Sat Jan 28, 2023 10:52 am
by pvb
Hi Kayla,

In addition to Nick's code suggestion, I've also posted a code implementation in this thread based on Nick working through this problem with me.
Maybe that helps?
Cheers,
Pasha