opensim-org / opensim-core

SimTK OpenSim C++ libraries and command-line applications, and Java/Python wrapping.
https://opensim.stanford.edu
Apache License 2.0
800 stars 323 forks source link

`InverseKinematicsSolver::computeCurrentMarkerError()` might crash due to incorrect handling of marker list order #3951

Open carmichaelong opened 4 weeks ago

carmichaelong commented 4 weeks ago

InverseKinematicsSolver::computeCurrentMarkerError() crashes when used, and will crash at different times when using either the function that refers to markers by integer and by string. It doesn't look like a test uses this, but there's a test that uses the very closely named InverseKinematicsSolver::computeCurrentMarkerErrors() (note the extra s at the end).

There are similarly named functions (e.g., computeCurrentMarkerLocation(), computeCurrentSquaredMarkerError()) that may have the same issues.

See zip for Python code and data for testing.

test_computeCurrentMarkerError.zip

aymanhab commented 6 days ago

Model has 50 markers while trc file has only 46, how are these consolidated? you should not iterate through the model markers and assume data exists in trc file since trying to compute errors will crash.

markerList[14] is r_mknee which is not in the trc file