opensim-org / opensim-core

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

[Moco] Support joints where `qdot != u` #3529

Open nickbianco opened 10 months ago

nickbianco commented 10 months ago

This will allow us to support all OpenSim joint types in Moco (e.g., BallJoint, ScapulothoracicJoint, etc).

We can implement this by incorporating the linear transform matrix, N, for kinematic differential equations provided by Simbody. The kinematic defect constraints would then take the following form qdot - N(q)*u = 0.

The current implementation for kinematic defect constraints (qdot = u) is implemented algebraically in CasADi, so adding a new set of kinematic defects could negatively affect the sparsity of the problem. Therefore, we should only add them as necessary.

If it's possible to obtain an analytic expression for N(q) for individual joint types, then we might be able to prevent lost sparsity.

For joints that use quaternions, we will also need to enforce the quaternion normalization constraint as a path constraint.

Landstand commented 1 month ago

@nickbianco Has there been any update with this issue? I am trying to use the Ajay Seth Scapulothoracic model (https://simtk.org/projects/scapulothoracic) for a project of mine for investigating shoulder mechanisms, but am unable to run Moco with the model due to the ScapulathoracicJoint exception.

nickbianco commented 1 month ago

Hi @Landstand, it's not currently high on our priorities, but I would like to get to this eventually! Sorry I don't have a better answer for you right now.