Page 1 of 1

Issue with using SIMTKArrayCoordinateReference and InverseKinematicSolver

Posted: Wed Jul 05, 2023 8:29 am
by rachela1234
I am currently trying to set up a multimodal inverse kinematics tracking using marker locations, coordinates and IMUs. For this purpose, I had originally used the two classes IMUInverseKinematicsTool and InverseKinematicsTool, which worked pretty well using .sto files as input.

However, I have now tried to track all three modalities together through the InverseKinematicsSolver. To start off, I attempted to use the constructor which uses the model, markersReference, coordinateReferences and a constraint weight. My attempts have been unsuccessful so far, and I believe it is due to the CoordinateReferences Array.

At first, I tried to simply create an Array and fill that with CoordinateReferences, but that did not match the constructor signature. I then tried to create an object from the class SimTKArrayCoordinateReference(). Unfortunately, there is no documentation on this class in the API. To fill the Array with data, I attempted to use the method adoptData, but it has not worked either. What long is one supposed to use when filling the SIMTKArray?

Does anyone have any experience with using the InverseKinematicsSolver or the SIMTKArrayCoordinateReference? I would greatly appreciate any further insight or information :)

Re: Issue with using SIMTKArrayCoordinateReference and InverseKinematicSolver

Posted: Tue Sep 05, 2023 11:04 am
by ongcf
There may not be any examples doing this in MATLAB, but there are some uses in the C++ tests. In particular, this might be helpful: https://github.com/opensim-org/opensim- ... r.cpp#L295

Code: Select all

SimTK::Array_<CoordinateReference> coordRefs;
Constant coordRefFunc(refVal);
CoordinateReference coordRef(coord.getName(), coordRefFunc);
coordRef.setWeight(1.0);
coordRefs.push_back(coordRef);
Looks like one way to go is to use `push_back()` to add individual `CoordinateReference` objects to the array.