You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the tool! This optimizer has been great for my simulations. I've bumped into a rare bug that I thought I'd share: if you are using this tool on a model that has muscles whose origin and insertion points are on different branches of the model topology tree, the tool crashes.
I ran into this when scaling the Arnold2010 model which has an (inactive) "dummy muscle" representing the patellar tendon, but another common instance where this error would crop up is in models where the psoas inserts on the femur and originates on the torso.
The error occurs because of the way getJointsSpannedByMuscle() seeks out the joints that a muscle spans. To do this, it starts at the body of the most distal PathPoint, then "climbs" the model topology tree going body-to-joint-to-body until it reaches the body with the most proximal PathPoint. This works fine for almost all cases, but if the origin point of a muscle is on a different branch of the topology tree, the function will never reach that body: it will just keep going, from femur to pelvis to ground and then crashing, since no joint exists above the ground. I can't think of any easy fixes, other than an exhaustive search of every branch of the model tree to find the right path from insertion to origin.
I've attached a zip file with a reproducible example showing a case with a simple model that works (psoas_r muscle goes from the femur to the pelvis) and a model that causes the crash (the same model but the psoas_r attaches on the torso). The figure below illustrates the difference between these models.
This is not a pressing issue for me—since I'm only using a dummy muscle to get the patellar tendon's line of action, I can just tweak the code to skip this muscle entirely. However other users might run into this same issue for full-body models incorporating a psoas muscle and possibly some other rare cases.
Hi John,
thank you for posting this, I wish all Issues were so well detailed and documented!
You are right, getJointsSpannedByMuscle does not handles the case you have pointed out.
Probably this can be fixed using getJointsSpannedByMuscle twice from both end of the chains: the second use of the function could be triggered if not for all points a spanned joint has been found.
Since this doesn't seem urgent I will leave the issue open and work on it when I come back to this tool (I do periodically).
Thank you again for reporting the bug!
Thanks for the tool! This optimizer has been great for my simulations. I've bumped into a rare bug that I thought I'd share: if you are using this tool on a model that has muscles whose origin and insertion points are on different branches of the model topology tree, the tool crashes.
I ran into this when scaling the Arnold2010 model which has an (inactive) "dummy muscle" representing the patellar tendon, but another common instance where this error would crop up is in models where the psoas inserts on the femur and originates on the torso.
The error occurs because of the way
getJointsSpannedByMuscle()
seeks out the joints that a muscle spans. To do this, it starts at the body of the most distal PathPoint, then "climbs" the model topology tree going body-to-joint-to-body until it reaches the body with the most proximal PathPoint. This works fine for almost all cases, but if the origin point of a muscle is on a different branch of the topology tree, the function will never reach that body: it will just keep going, from femur to pelvis to ground and then crashing, since no joint exists above the ground. I can't think of any easy fixes, other than an exhaustive search of every branch of the model tree to find the right path from insertion to origin.I've attached a zip file with a reproducible example showing a case with a simple model that works (psoas_r muscle goes from the femur to the pelvis) and a model that causes the crash (the same model but the psoas_r attaches on the torso). The figure below illustrates the difference between these models.
This is not a pressing issue for me—since I'm only using a dummy muscle to get the patellar tendon's line of action, I can just tweak the code to skip this muscle entirely. However other users might run into this same issue for full-body models incorporating a psoas muscle and possibly some other rare cases.
Hopefully this info proves useful!
MuscleParOpt_crash_reprex.zip
The text was updated successfully, but these errors were encountered: