Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve passive fiber curve in DeGroote muscle #3873

Open
mrrezaie opened this issue Aug 15, 2024 · 3 comments
Open

Improve passive fiber curve in DeGroote muscle #3873

mrrezaie opened this issue Aug 15, 2024 · 3 comments

Comments

@mrrezaie
Copy link
Contributor

Hi, the passive fiber-force-length curve in the DeGroote2016 (or Thelen2003) equation becomes negative when fiber length < optimal length. OpenSim Moco adjusted the curve, but it is generating force when fiber length <= optimal length. I found that CasADi supports if statements through if_else function which can simply resolve this issue by ignoring the negative values in the original equation. This could make the curve more physiological:

degroote_passive_force_length_curve

I tested this method, and it functioned well in Muscle Redundancy Solver (Python). I'm looking forward to improvements, and thank you in advance.

@nickbianco
Copy link
Member

@mrrezaie, interesting. Is the CasADi if-else function designed to be differentiable?

@mrrezaie
Copy link
Contributor Author

mrrezaie commented Aug 15, 2024

Hi, I'm not expert, according to the source code and the examples, it seems to be differentiable when using SX. To ensure differentiability in MX, there is an additional bool argument to disable short-circuiting: https://github.com/casadi/casadi/blob/main/casadi/core/mx.cpp#L1259-L1279
Hope this helps.

@nickbianco
Copy link
Member

Thanks @mrrezaie. Currently, it's difficult to access CasADi functions directly when building new components and MocoGoals, but it would great to make this possible somehow. I will definitely consider it going forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants