Scale Tool: Manually setting marker weights (3.3)
Posted: Fri Oct 26, 2018 8:58 am
Hi,
I've been trying to make the scale tool work within my c++ code.
I've managed to make a simple example work by feeding an OpenSim generated scale file (.xml) to the Scale Tool. This scale file loads the .trc and applies correctly to the .osim model.
Now, I had to remove that .xml scale file dependency and replace it with extra code, which essentially just sets weights for every marker:
... but when I run , I get the following error:
I tried to load the exact same model + .trc file inside OpenSim's Scale Tool (without specifying a .xml scale file) and it runs! Is there anything more I need to do?
I've been trying to make the scale tool work within my c++ code.
I've managed to make a simple example work by feeding an OpenSim generated scale file (.xml) to the Scale Tool. This scale file loads the .trc and applies correctly to the .osim model.
Now, I had to remove that .xml scale file dependency and replace it with extra code, which essentially just sets weights for every marker:
Code: Select all
OpenSim::Set<OpenSim::MarkerWeight> markerWeights;
markerWeights.setSize(3);
scaleTool.getMarkerPlacer().getIKTaskSet().createMarkerWeightSet(markerWeights);
OpenSim::MarkerWeight markerWeight1;
markerWeight.setName("Marker1");
markerWeight.setWeight(1);
markerWeights.set(0, markerWeight1, false);
OpenSim::MarkerWeight markerWeight2;
markerWeight.setName("Marker2");
markerWeight.setWeight(2);
markerWeights.set(1, markerWeight2, false);
OpenSim::MarkerWeight markerWeight3;
markerWeight.setName("Marker3");
markerWeight.setWeight(2);
markerWeights.set(2, markerWeight3, false);
Code: Select all
scaleTool.getMarkerPlacer().processModel(myState, &myModel, folder_containing_files);
Code: Select all
AssemblySolver::assemble() Failed: SimTK Exception thrown at assembler.cpp:227:
Error detected by Simbody method AssemblerSystem::objectiveFunc(): calcGoal() method of assembly condition Markers returned a negative or non-finite value -nan(ind).
(Required condition 'goalValue >= 0' was not met.)