Input to coordinate actuator

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
User avatar
Michael Sherman
Posts: 801
Joined: Fri Apr 01, 2005 6:05 pm

Re: Input to coordinate actuator

Post by Michael Sherman » Wed Nov 12, 2014 5:07 pm

Ajay, shouldn't calcPower() work at Dynamics stage?
Nope, false alarm! I looked at the code. OpenSim::Joint::calcPower() invokes Simbody's Constraint::calcPower() method for which the documentation says Acceleration stage must be realized. The reason is that constraint forces (in this case the prescribed motion constraint) can't be determined until accelerations have been calculated.

The real problem is just that OpenSim::Joint::calcPower() doesn't document its requirements; I'll file an issue.

User avatar
Michael Sherman
Posts: 801
Joined: Fri Apr 01, 2005 6:05 pm

Re: Input to coordinate actuator

Post by Michael Sherman » Wed Nov 12, 2014 5:35 pm

I created a pull request to fix the documention.

User avatar
Nithin Kurup
Posts: 149
Joined: Sat Jan 18, 2014 5:13 am

Re: Input to coordinate actuator

Post by Nithin Kurup » Tue Nov 25, 2014 5:12 am

Dear sherman,

I tried to run the Muscle analysis (GUI) using just the new control and state files I have got from my FD simulation to check the muscle forces produced. But I ran into the same problem of velocity (stage). I didnt use the calPower() function in my c code, so used the
osimModel.getMultibodySystem().realize(s, Stage::Velocity); and got the following error in GUI.

Or, is it that I have to run MuscleAnalysis via coding to avoid this problem?

my inputs for testing:
Storage: file=C:\OpenSimWorkspace\sdk\APIExamples\Mult_prescribedC\New\Release\NewControls.sto (nr=973 nc=3)
Loading states from file C:\OpenSimWorkspace\sdk\APIExamples\Mult_prescribedC\New\Release\NewStates.sto.
Storage: file=C:\OpenSimWorkspace\sdk\APIExamples\Mult_prescribedC\New\Release\NewStates.sto (nr=973 nc=61)
Found 973 state vectors with time stamps ranging from 0 to 1.
Storage: file=C:\OpenSimWorkspace\sdk\APIExamples\Mult_prescribedC\New\Release\NewControls.sto (nr=973 nc=3)
No external loads will be applied (external loads file not specified).
Storage: file=C:\OpenSimWorkspace\sdk\APIExamples\Mult_prescribedC\New\Release\NewControls.sto (nr=973 nc=3)
Executing the analyses from 0 to 1...
WARNING- MuscleAnalysis::record() unable to evaluate muscle forces at time 0 for reason: SimTK Exception thrown at State.cpp:2069:
Expected stage to be at least Dynamics in StateImpl::getCacheEntry() but current stage was Velocity
WARNING- MuscleAnalysis::record() unable to evaluate muscle forces at time 1.322e-005 for reason: SimTK Exception thrown at State.cpp:2069:
Expected stage to be at least Dynamics in StateImpl::getCacheEntry() but current stage was Velocity
WARNING- MuscleAnalysis::record() unable to evaluate muscle forces at time 3.298e-005 for reason: SimTK Exception thrown at State.cpp:2069:
Expected stage to be at least Dynamics in StateImpl::getCacheEntry() but current stage was Velocity
The output I got:
MuscleAnalysis_ActiveFiberForce, MuscleAnalysis_ActiveFiberlength, length, Passivefibreforcealong tendon, tendonforce, tendonlength.

Didnt get:
Moment arms of muscles, moments, PennationAngular velocity, Non of the power components for tendon and muscle,

Then, I tried to run my FD with osimModel.getMultibodySystem().realize(s) [ Not needed since I am not measuring any power]; Eventhough I didnt get any error in the GUI as shown above still the Actuator power, moment etc were not calculated.
I tried to run the force reporter , it works -as attached.

Please let me know if I am doing something wrong.


Thanking you,

Nithin
Attachments
forcereporter.txt
(502.53 KiB) Downloaded 21 times

User avatar
Michael Sherman
Posts: 801
Joined: Fri Apr 01, 2005 6:05 pm

Re: Input to coordinate actuator

Post by Michael Sherman » Tue Nov 25, 2014 9:59 am

I don't know enough about MuscleAnalysis to answer your question. Hopefully someone with more specific knowledge will respond.

Sherm

User avatar
Nithin Kurup
Posts: 149
Joined: Sat Jan 18, 2014 5:13 am

Re: Input to coordinate actuator

Post by Nithin Kurup » Wed Nov 26, 2014 5:07 pm

Dear Mr. Sherman,

Thanks a lot for replying. I was trying to solve it but no luck. This might be a complete guess, but I think that the system dynamics for calculating muscle power etc are realised at dynamics stage ( in the muscle analysis tool). Since I have a joint, who's force can only be realised at acceleration stage, the tool might be showing error.

part from the analysis tool:
// state derivatives (activation rate and fiber velocity) evaluated at dynamics
_model->getMultibodySystem().realize(s,SimTK::Stage::Dynamics);
Hope someone could reply, so that I can correct my mistake,

Thanking you,

Nithin

POST REPLY