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

Custom spatial transform within model definition appears to block Radians --> Degrees conversion within GUI/IK #3936

Open JoshCarter97 opened 1 month ago

JoshCarter97 commented 1 month ago

Hi,

I believe we have found a bug whereby within a model file at the location: jointset --> --> SpatialTransform --> --> LinearFunction

if the coefficients are not set to "1 0", but instead scaled in some way (i.e "0.2 0") then the range and coordinate values within the GUI (and also those output from inverse kinematics) remain in radians rather than being converted to degrees. This can become quite confusing as all other coordinate values are shown/output in degrees as expected, so it may not be immediately noticeable in your results if you are unaware of this behaviour.

This was discovered when using an adapted version of the below model, which has a custom coefficient within the "L5_S1_IVDjnt" joint and the "flex_extension" coordinate. https://simtk.org/frs/?group_id=1021

We found that changing the custom coefficient value back to 1 resolved the conversion issue within the Coordinates tab of the GUI.

This was tested on version 4.5 and can be recreated by changing the first coefficient value within a coordinates Spatial Transform Linear Function in a text editor, save the model file, load the model file back into the GUI, go to the coordinates tab and check if the range current position of those values remain in radians.

nickbianco commented 1 month ago

Hi @JoshCarter97, is this issue limited to GUI output? If so, this issue might be more appropriate at https://github.com/opensim-org/opensim-gui. If not, could you provide a minimum working example?

JoshCarter97 commented 1 month ago

Hi @nickbianco, I just checked this and the missing conversion step does seem to happen regardless of whether you are calling the Inverse Kinematics Tool within the GUI or via the API (Python in my case).

I have added a working example below, where I think regardless of the effect that the SpatialTransform has on the joint angles the output is in Radians rather than Degrees.

SpatialTransformOutputUnits.zip