Skip to content
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

Fix issues in OpenSim::ExpressionBasedBushingForce::generateDecorations #3999

Merged

Conversation

adamkewley
Copy link
Contributor

@adamkewley adamkewley commented Jan 27, 2025

Issue found when working on a student's model, which contained an ExpressionBasedBushingForce. The student had set the visual properties (visual_aspect_ratio, moment_visual_scale, and force_visual_scale) to zero in order to hide the frame/moment/force decorations that the component emits, but that resulted in NaNed geometry being emitted by the component, which then caused weird issues in opensim-creator's renderer.

When diagnosing that issue I also noticed that the function emits both of the frame decorations twice: once when fixed is true and once when fixed is false, and the NaN problem returns if the underlying implementation produces a NaN or zero-length vector (here, F_GM). The check against normSqr serves the double-purpose of checking for NaNs and zero-length results.

Brief summary of changes

Adds if checks etc. to the existing implementation to ensure that it filters out the edge cases.

Testing I've completed

Running it via OpenSim Creator

Looking for feedback on...

CHANGELOG.md (choose one)

  • updated.

This change is Reviewable

Copy link
Member

@nickbianco nickbianco left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

@nickbianco nickbianco merged commit 5a71c60 into main Jan 27, 2025
12 checks passed
@nickbianco nickbianco deleted the fix_ExpressionBasedBushingForce-double-emission-and-nan-geom branch January 27, 2025 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants