-
Notifications
You must be signed in to change notification settings - Fork 327
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
remove matrix computation for calc_spiral_wrap_point #3463
remove matrix computation for calc_spiral_wrap_point #3463
Conversation
Hi @nickbianco , I was wondering if you could give some insight into the failing unit test for |
Hi @pepbos, the test was failing here, where we're checking the errors between virtual IMU data between two conditions. One of those conditions computes IMU signals based on a 18-muscle model and a previous MocoInverse solution. If the changes here are changing the muscle wrapping results in that model, that could be leading to the test failures. In the case that it is barely failing and everything looks good, then we might just need to update |
Hi @nickbianco thank you for your comment! I looked into the failing test: I verified that with these changes the acceleration signals look very much the same, but the error is just a bit larger. If that is the case, it will fix the issue here as well. If I misunderstood the unit test, please let me know :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! The Windows2022 test failure is unrelated, so feel free to merge.
Awesome! |
This PR is a minor refactoring of the cylinder wrapping points computation.
The
WrapCylinder::_make_spiral_path()
function computes a rotation matrix, transposes it, multiplies is, and proceeds to use a single column. This rotation matrix can essentially be omitted.The
WrapCylinder::_make_spiral_path()
function is often called during a simulation using e.g. the Rajagopal model, and takes up quite some time. This was also mentioned in #3164 , but that PR was not merged. This PR essentially takes one element of #3164 , i.e eliminating the computation of a rotation matrix.Performance Comparison
Small change, and small perf boost of 3% for Rajagopal.
Brief summary of changes
The changes are to
WrapCylinder::_make_spiral_path()
:m = ...
on line 660 is removed, saving a matrix multiplication and transpose.CalcSpiralWrapPoint
is redefined as a lambda function within_make_spiral_path
theta
is computed using the arctan rather than the acos, to capture the sign.Testing I've completed
Running the rajagopal model, I verified that the computed wrapping points are the same up to error of
~1e-14
.Looking for feedback on...
I would be interested to hear if you think it is worth revisiting #3164 , or perhaps chopping it up into smaller PRs such as these.
CHANGELOG.md
This change is![Reviewable](https://camo.githubusercontent.com/1541c4039185914e83657d3683ec25920c672c6c5c7ab4240ee7bff601adec0b/68747470733a2f2f72657669657761626c652e696f2f7265766965775f627574746f6e2e737667)