Repository navigation
Fix invalid PathWrapPoint locations leading to incorrect moment arm calculations - #4485
Conversation
4d09ed6 to
a01ec3d
Compare
tkuchida
left a comment
There was a problem hiding this comment.
Nice catch 👍. Minor comment below.
| markCacheVariableValid(s, _location); | ||
| // The location in the parent frame has changed, so we must invalidate the | ||
| // Point's cached ground-frame quantities. | ||
| invalidateCache(s); |
There was a problem hiding this comment.
Seems like Point::invalidateCache() would only ever be called from here, so perhaps just put the three markCacheVariableInvalid() lines here. Alternatively, for readability, the method could be called something more descriptive like invalidateLocalCacheVariables() or similar.
There was a problem hiding this comment.
Calling markCacheVariableInvalid() directly would be nice, but the Point cache variables (e.g., _locationCV) are private so something like markCacheVariableValid(s, _locationCV) will not compile. I don't think we should promote those cache variables those cache variables to protected, so I've opted for this method.
I've renamed to invalidateGroundKinematicsCache(), let me know what you think.
…alculations Fixes a bug where changes to the parent-frame location of a PathWrapPoint did not invaldiate the point's ground-frame location stored in the Point cache. This fixes an issue where a GeometryPath with two or more wrapping obstacles could produce moment arms about unexpected coordinates (e.g., pelvis rotational coordinates) due to outdated path point information.
ac611ad to
ad5d303
Compare
|
Thanks @tkuchida! |
Fixes an issue raised by Ross Miller on the forum. Possibly related: #3805.
Brief summary of changes
This change fixes a bug where changes to the parent-frame location of a
PathWrapPointdid not invaldiate the point's ground-frame location stored in thePointcache. This fixes an issue where aGeometryPathwith two or more wrapping obstacles could produce moment arms about unexpected coordinates (e.g., pelvis rotational coordinates) due to outdated path point information.Note that this change also fixes issues with path length calculations, so muscle paths with two or more wrapping obstacles may see slight changes in lengths going forward.
Testing I've completed
Added test case "GeometryPath with multiple wrap objects" to
testGeometryPathWrapping.cpp.The reference files
std_testGeometryPathWrapping_subject_walk_armless_muscles_lengths.stoandstd_testMocoInverse_subject_18musc_solution.sto(used bytestMocoInverse.cpp) needed to be updated since path length calculations have been updated (re: fixed) when two or more wrap surfaces are present. Additionally, a few TODOs intestMocoInverse.cppthat existed because of this bug were resolved.Looking for feedback on...
AI/LLM use
Used Claude Code to identify the bug and implement an initial solution.
CHANGELOG.md (choose one)
Please review the CONTRIBUTING.md file for detailed contributing guidelines.
This change is