Hello everyone,
I've been trying to run a model simulation in Matlab, but I keep getting this error:
Exception caught in Millard2012EquilibriumMuscle::calcMuscleDynamicsInfo from DELT1
Exception caught in Millard2012EquilibriumMuscle::calcFiberVelocityInfo from DELT1
SimTK Exception thrown at MuscleFixedWidthPennationModel.cpp:169:
Error detected by Simbody method MuscleFixedWidthPennationModel::calcPennationAngularVelocity: Fiber length cannot be zero.
(Required condition 'fiberLength > 0' was not met.)
I'm trying to mimic the "build_and_simulate_simple_arm.m" example given in the files, but with our model instead of building one. I talked to my professor and she said the code could be reading the fiber length as NaN.
Here is the test code we're trying to run:
clc;clear;
import org.opensim.modeling.*
modelFile = 'MOBL_ARMS_6_29_18_4.1.osim';
model = Model(modelFile);
muscles = model.getMuscles();
BIClong = muscles.get("BIClong");
elb = model.getJointSet().get('elbow') ;
elbflex = elb.getCoordinate();
reporter = ConsoleReporter();
reporter.set_report_time_interval(1.0);
reporter.addToReport(BIClong.getOutput('fiber_force'));
reporter.addToReport(elb.getCoordinate().getOutput('value'), 'elbow_angle');
model.addComponent(reporter);
state = model.initSystem();
model.equilibrateMuscles(state);
elbflex.setSpeedValue(state,0);
elbflex.setValue(state,90*pi/180);
manager = Manager(model);
manager.initialize(state)
state = manager.integrate(10);
Any guidance would be helpful.
Thanks.
Matlab Simulation Error
- Mikael Koeneke
- Posts: 4
- Joined: Wed Jul 10, 2019 10:23 am
- Thomas Uchida
- Posts: 1793
- Joined: Wed May 16, 2012 11:40 am
Re: Matlab Simulation Error
You might try plotting the muscle fiber length to get a sense of what's going on and diagnose the issue (e.g., using the MuscleAnalysis, https://simtk.org/api_docs/opensim/api_ ... lysis.html). You could also check the publication accompanying the model to ensure you aren't using it beyond the range of motion for which it was designed.