Processing Error for custom Osim model

Upload mocap files and get an optimally scaled OpenSim model and IK back in minutes. Share your data with the community. Browse and download biomechanics data. Hosted by Stanford University.

Available at https://addbiomechanics.org
User avatar
Duncan Lee
Posts: 24
Joined: Thu Sep 14, 2023 10:15 am

Re: Processing Error for custom Osim model

Post by Duncan Lee » Thu Feb 08, 2024 1:58 pm

Hi Nick,

Here is the link to the trial: https://app.addbiomechanics.org/data/3a ... /subject1/
I'm not sure if that gives you access but please let me know.

Using the same model I ran IK in OpenSim and nothing errored out, so I'm not sure what is wrong. Thank you for your help.

Best,
Duncan

User avatar
Nicholas Bianco
Posts: 968
Joined: Thu Oct 04, 2012 8:09 pm

Re: Processing Error for custom Osim model

Post by Nicholas Bianco » Tue Feb 13, 2024 4:44 pm

Hi Duncan,

After a bit of debugging, I've narrowed down the issue to when the results are saved to a B3D file (our version of a C3D file with some additional data). Essentially, the whole pipeline runs, but fails right at the end when writing out the results (you can actually see this in the logs too). I'm still trying to narrow in to the actual error, but I've discovered a few things for you to look into.

1. I noticed that all the markers in the generic model that you've uploaded have the property "fixed" set to "false". (In the model XML file it looks like "<fixed>false</fixed>"). You should set this property to "true" for anatomical markers in your model; otherwise AddBiomechanics will assume that all markers are anatomical which might not lead to the best possible fit.

2. The kinematics fitter runs twice since, after the first run, the pipeline detects that some experimental markers have swapped labels. We try to fix marker labeling errors like this as best we can with automated heuristics, but it can sometimes fail. I'm not sure that this is related to the B3D file writing error, but it is worth investigating.

Best,
Nick

User avatar
Nicholas Bianco
Posts: 968
Joined: Thu Oct 04, 2012 8:09 pm

Re: Processing Error for custom Osim model

Post by Nicholas Bianco » Wed Feb 14, 2024 10:40 am

Hi Duncan,

I've found the bug! It turns out that even when only fitting kinematics, we use the foot bodies to calculate some quantities during a post-processing step. When not specified by the user, we assume that the foot body names are 'calcn_r' and 'calcn_l' (which is the case if you skip the dynamics fit).

As a temporary fix, you can rename the foot bodies in your model to those above, and it should avoid the error. The dev team will start looking into a permanent fix.

Best,
Nick

User avatar
Duncan Lee
Posts: 24
Joined: Thu Sep 14, 2023 10:15 am

Re: Processing Error for custom Osim model

Post by Duncan Lee » Wed Feb 14, 2024 3:14 pm

Hi Nick,

Thank you so much for looking into this. I can try renaming the foot bodies and running it again. Is this only the case with the skip dynamics fit? As in if I do run the dynamics fit it should work?

As for your other two points, I can look into that on my end. When you say anatomical markers, do you mean markers on bony landmarks?

Thank you,
Duncan

User avatar
Nicholas Bianco
Posts: 968
Joined: Thu Oct 04, 2012 8:09 pm

Re: Processing Error for custom Osim model

Post by Nicholas Bianco » Wed Feb 14, 2024 3:46 pm

Hi Duncan,

If you run dynamics and provide the correct foot body names, it should work.
When you say anatomical markers, do you mean markers on bony landmarks?
Yes, that is correct.

Best,
Nick

User avatar
Duncan Lee
Posts: 24
Joined: Thu Sep 14, 2023 10:15 am

Re: Processing Error for custom Osim model

Post by Duncan Lee » Wed Feb 21, 2024 1:32 pm

Hi Nick,

Thank you for that. I tried running it with GRF data an Fit Physics enabled, and it did work. However, my 2-min trial got broken up into 6 20-second segments. Is this normal, and is there any way to prevent it?

Also, I noticed that the listed Marker RMSE for the trials is different than the average Marker RMSE in the log file though the force and torque residuals are similar:
GUI:
addbiomechanics_rmse.png
addbiomechanics_rmse.png (43.84 KiB) Viewed 916 times
Log file:
Avg Marker RMSE: 0.7550610840065322cm
Avg Residual Force: 1.2472154308254915 N (0.15713347836220776% of original 793.7299191904478 N)
Avg Residual Torque: 16.831105060588495 Nm (100.0% of original 0.0 Nm)
Avg CoP movement in 'perfect' GRFs: 0.023664190521720314 m
Avg force change in 'perfect' GRFs: 0.7034834272998527 N
Writing OpenSim results
Writing the OpenSim result files...

Do you know why that is and which one to trust?

Thanks,
Duncan

User avatar
Nicholas Bianco
Posts: 968
Joined: Thu Oct 04, 2012 8:09 pm

Re: Processing Error for custom Osim model

Post by Nicholas Bianco » Thu Feb 22, 2024 1:26 pm

Hi Duncan,

When enabling "Fit Physics", AddBiomechanics will break up the processing into segments based on where you do and do not have ground reaction forces available. There is not a way to prevent this in the current interface. The dynamics fitting algorithm requires GRF data to perform well, so this segmentation is done to achieve the best results.

The marker RMSE in the log might be the overall RMSE from the kinematics fitting step before dynamics fitting. The marker RMSE in dynamics fitting will be different (usually a bit higher), since that step is trying to achieve dynamic consistency will also fitting the marker data as close as possible.

If you are just looking for a good kinematic fit, I recommend renaming the foot bodies for now until we push a fix for the default foot names issue.

Best,
Nick

User avatar
Duncan Lee
Posts: 24
Joined: Thu Sep 14, 2023 10:15 am

Re: Processing Error for custom Osim model

Post by Duncan Lee » Mon Feb 26, 2024 2:27 pm

Hi Nicholas,

Thank you for that information. I'm a little confused as to what "do and do not have ground reaction forces" means, as my trial has ground reaction forces throughout and the trial was broken up into even 20s segments.

Also, I renamed the foot bodies in my osim model by replacing R_Foot and L_Foot with calcn_r and calcn_l in the model XML file, however I just tried running with "Do Not Fit Physics" and it appears to generate the same error as before.

Thank you,
Duncan

POST REPLY