stanfordnmbl / opencap-core

Main OpenCap processing pipeline
Apache License 2.0
144 stars 112 forks source link

Remove model constraints (and the rest) to make IK faster #172

Closed antoinefalisse closed 2 months ago

antoinefalisse commented 2 months ago

@suhlrich @carmichaelong

The patella constraints make IK super slow; by removing them we can get some massive speed up. Since the patella should not be defining the IK solution at all (no markers attached to the patella), it should be fine to create a temporary model without the patella bodies, the patellofemoral joints, and the patella constraints and then run IK with that model. This is what this PR is implementing. Note that there are muscles attached to the patella, I therefore also removed all muscles (no involved in IK):

I did a fair bit of testing:

When I compare the resulting IK results, the angles are within 1deg. You can run the compare.py script in the attached folder to appreciate the differences for running. Interesting fact 1: the largest differences are for the pro_sup angles. Intersting fact 2: with constraints the mtp angle is set to 7.5deg, without constraints tht mtp angle is set to 0deg. There are no markers attached to the mtp, so 0deg seems more expected. The side benefit of this PR is that we no longer get this knee_angle_beta columns in the mot file, so we no longer see it in the dashboard.

test.zip

antoinefalisse commented 2 months ago

@suhlrich and @carmichaelong, thanks for the feedback. Cleaner now and tested that I get the model out. Merging!