I am trying to change the name of a coordinate in my model via Matlab. I want some of the coordinate names shown in the GUI in the coordinates window to be more "understandable".
Here is my code:
Code: Select all
pelvis_ground = preparedModel.getJointSet().get('ground_pelvis');
for i = 0 : pelvis_ground.numCoordinates()-1
coord = pelvis_ground.upd_coordinates(i);
if strcmp(coord.getName(), "pelvis_list")
coord.setName("pelvis_list_newName");
end
end
pelvis_ground.finalizeFromProperties();
Java exception occurred:
java.lang.RuntimeException: SimTK Exception thrown at joint.cpp:142:
Internal bug detected: Joint::constructCoordinate() must be passed enumerations in the same order as the enumerations have been defined
(Assertion 'static_cast<unsigned>(cix) == idx' failed).
Please file an Issue at https://github.com/simbody/simbody/issues.
Include the above information and anything else needed to reproduce the problem.
at org.opensim.modeling.opensimCommonJNI.Component_finalizeFromProperties(Native Method)
at org.opensim.modeling.Component.finalizeFromProperties(Component.java:66)
I also tried to access the coordinate directly via the coordinate set (example with another coordinate):
Code: Select all
coordinates = preparedModel.updCoordinateSet(); // or .getCoordinateSet()
for a= 0: coordinates.getSize()-1
coordinate = coordinates.get(a);
name = coordinate.getName();
if strcmp( name, "flexion_r")
coordinate.setName("hand_flexion_r")
end
Additionally, I tried to change a name of a coordinate directly in the osim file. To do so, I searched the osim file and changed the name of the coordinate in every case it was mentioned. But if I open this osim file in the GUI after saving the changes, the coordinate is still shown with its old name.
Probably I am doing something wrong, maybe you have an hint?
Thank you
Ruth Meissner