opensim-org / opensim-core

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

[WIP] Fix Real Time IK #3705

Open RTnhN opened 4 months ago

RTnhN commented 4 months ago

Fixes issue #3415

Brief summary of changes

The inverseKinematicsSolver for real time applications was not working. This is a work in progress to try to get it working again. This branch currently has debug code that I will remove in the final version.

Testing I've completed

Right now, I am just using the RealTimeKin repo to test to see if it works. Once I get that to work, I will run through the other tests to make sure that I did not break anything else.

Looking for feedback on...

See the linked issue for most of the conversation. I recently fixed the binding interface by including the namespace, so it compiles and has the BufferedOrientationsReference as a smart pointer. It still seems to have a different instance for the object when the PutValues method is called and when the GetValueAtTime method is called in the InverseKinematicsSolver. The data queue has data after I put the data and is empty when I go to get a value.

The really hacky way that I have been able to get the real time ik working is with just moving the method that adds data to the queue up to the IKSolver class, but this is not ideal.

CHANGELOG.md (choose one)


This change is Reviewable

RTnhN commented 4 months ago

Note to self: I think the reason why the build is failing is due to shared pointers of base and derived classes. I discuss it here: https://github.com/opensim-org/opensim-core/issues/3415#issuecomment-1933420220. I thought that using the namespace would fix it, but I think it needs the full inheritance chain (both all derived and all base) to be defined as shared pointers using the macro as discussed in the docs for SWIG. This is not workable since the most base class is the Object class that is the base of so many classes.