opensim-org / opensim-core

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

`PrescribedController` bug fixes #3781

Closed nickbianco closed 1 month ago

nickbianco commented 1 month ago

Fixes issue #3749, #3750

Brief summary of changes

These changes fix bugs in PrescribedController recently introduced after converting Controller to support a list Socket to maintain actuator connections. This PR also changes the behavior of prescribeControlForActuator() by making a copy of the Function at the passed in Function pointer rather than taking ownership. This change protects users from possible crashes when Function ownership is passed to the controller (e.g., during garbage collection in Java/Matlab).

The main changes:

Testing I've completed

Looking for feedback on...

CHANGELOG.md (choose one)


This change is Reviewable

nickbianco commented 1 month ago

@carmichaelong this is now ready for review.

nickbianco commented 1 month ago

@carmichaelong ready for re-review.

nickbianco commented 1 month ago

Thank you @carmichaelong!