Hi,
I was running an optimization with newly defined muscle actuators that had associated path points and got the following run-time error: "ModelComponent::isCacheVariableValid: ERR- name not found.
for component '' of type GeometryPath". The function isCacheVariableValid is called by the method 'updateGeomtry' of the GeometryPath class. The second argument of that call has the name: "current_display_path". Can anyone kindly point me in the direction on how to assign that name so that I will avoid this error?
Thanks.
Musa
isCacheVariableValid Error:
- Thomas Uchida
- Posts: 1792
- Joined: Wed May 16, 2012 11:40 am
Re: isCacheVariableValid Error:
I suggest looking at how other muscle classes (e.g., Millard2012EquilibriumMuscle) have been implemented to make sure you are satisfying the requirements of the API.
Re: isCacheVariableValid Error:
Thanks Tom. I followed your advise and picked one of the model files that came with OpenSim 3.3. I realized the error was arising when I tried to compute moment arms; and with the OpenSim model file also I got the same error! The following is a snippet of the code:
Model osimModel("gait10dof18musc.osim");
State& si = osimModel.initSystem();
const CoordinateSet& coords = osimModel.getCoordinateSet();
numGenCoords = coords.getSize();
for (int i = 0; i < numGenCoords; ++i)
{
coords.setValue(si, 0.0);
coords.setSpeedValue(si, 0.0);
}
const Set<Muscle> &muscleSet = osimModel.getMuscles();
for(int i=0; i< num_controls; ++i)
{
GeometryPath gp = muscleSet.getGeometryPath();
MomentArmSolver mas = MomentArmSolver(osimModel);
for(int j=0; j<numGenCoords; ++j)
momentArm[j] = mas.solve(si, coords[j], gp);
}
The error is triggered by one of the functions in the path pf mas.solve. It takes the form:
Loaded model gait10dof18musc.osim from file gait10dof18musc.osim
ModelComponent::isCacheVariableValid: ERR- name not found.
for component '' of type GeometryPath
Press any key to continue . . .
Any ideas?
Thanks.
Musa
Model osimModel("gait10dof18musc.osim");
State& si = osimModel.initSystem();
const CoordinateSet& coords = osimModel.getCoordinateSet();
numGenCoords = coords.getSize();
for (int i = 0; i < numGenCoords; ++i)
{
coords.setValue(si, 0.0);
coords.setSpeedValue(si, 0.0);
}
const Set<Muscle> &muscleSet = osimModel.getMuscles();
for(int i=0; i< num_controls; ++i)
{
GeometryPath gp = muscleSet.getGeometryPath();
MomentArmSolver mas = MomentArmSolver(osimModel);
for(int j=0; j<numGenCoords; ++j)
momentArm[j] = mas.solve(si, coords[j], gp);
}
The error is triggered by one of the functions in the path pf mas.solve. It takes the form:
Loaded model gait10dof18musc.osim from file gait10dof18musc.osim
ModelComponent::isCacheVariableValid: ERR- name not found.
for component '' of type GeometryPath
Press any key to continue . . .
Any ideas?
Thanks.
Musa
Re: isCacheVariableValid Error:
I solved this problem by replacing 'Muscle' with 'PathActuator'. I don't know why it did not work with muscle though.