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

Add bindings support, `analyze` utilities, and test coverage for `TimeSeriesTable_<SimTK::Rotation>` #3940

Closed nickbianco closed 1 month ago

nickbianco commented 1 month ago

Fixes issue #3925

Brief summary of changes

TimeSeriesTable_<SimTK::Rotation> is available in C++ API, but had limited support in scripting, and almost no test coverage. This PR addresses both of those issues and also adds the scripting friendly analyzeMocoTrajectoryRotation to compute tables from Outputs of type SimTK::Rotation.

As a bonus, but related change, MocoStudy::analyze<T>() is now templatized, so Moco users need not search for the utility functions when computing non-double type Outputs. For backwards-compatibility, the non-templatized MocoStudy::analyze() is still available as a simple wrapper to the new templatized version. Finally, wrappers in the bindings were added for specific template arguments of analyze<T>, so that they are available in scripting.

Testing I've completed

Updated testDataTable.cpp, test_DataTable.py, and TestTables.java.

Looking for feedback on...

One drawback of using TimeSeriesTable_<SimTK::Rotation> is that certain methods are not supported simply because Simbody types are not available (e.g., averageRow fails because SimTK::RowVector_<SimTK::Rotation> does not exist). Making TimeSeriesTable_<SimTK::Rotation> more accessible probably makes it more likely for users to encounter this edge case.

CHANGELOG.md (choose one)


This change is Reviewable

nickbianco commented 1 month ago

Thanks @aymanhab!