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

[Moco] feature request: a normalize state tracking error function similiar to setNormalizeTrackingError for contact errors #3971

Open nik-steventon opened 4 days ago

nik-steventon commented 4 days ago

Hi,

I was wondering if it would be possible to create a function that would normalize the state values to their peak value in a coordinate.sto file? This would be similar to the setNormalizeTrackingError for a ContactTrackingGoal, which normalizes tracking errors to the peak contact force values. I think this would make it easier to set relative weights as muscle activations, grfs, and states errors would all be bound between 0-1. If my understanding is correct, this would avoid the optimizer preferencing tracking joint ranges of motion which have high values and hopefully negate the need to set other tracking values significantly higher to account for this.

Thanks in advance.

Regards, Nik

nickbianco commented 2 days ago

Hi @nik-steventon. Good idea! We will keep this in mind for future development plans.

nik-steventon commented 2 days ago

Thanks for the reply @nickbianco, that would be great! In the meantime, is there anyway to access the source code for the setNormalizeTrackingError() function? No worries if not, but I wouldn't mind having a go at pulling together some code to replicate this function for state errors and would be happy to share it here and on the Moco forum if I can get it to work.

nickbianco commented 2 days ago

You can find the source code for the GRF normalization here: https://github.com/opensim-org/opensim-core/blob/a5bb51736375c6ad8f6009046af5ccc1a7ac145f/OpenSim/Moco/MocoGoal/MocoContactTrackingGoal.cpp#L200

If you're able to replicate this behavior for MocoStateTrackingGoal and want to create a PR, let me know!