-
Notifications
You must be signed in to change notification settings - Fork 455
Tighten example test assertions with empirical bounds #2396
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
Open
adenzler-nvidia
wants to merge
10
commits into
newton-physics:main
Choose a base branch
from
adenzler-nvidia:adenzler/tighten-example-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3544782
Tighten example test assertions with empirical bounds
adenzler-nvidia d14af1b
Merge remote-tracking branch 'upstream/main' into adenzler/tighten-ex…
adenzler-nvidia 8578086
Widen cloth_style3d velocity bound for GPU
adenzler-nvidia 233bcf4
Merge remote-tracking branch 'upstream/main' into adenzler/tighten-ex…
adenzler-nvidia 7c1cc6d
Loosen cloth_franka max velocity bound to 22 cm/s
adenzler-nvidia f06bf28
Merge remote-tracking branch 'upstream/main' into adenzler/tighten-ex…
adenzler-nvidia 322f340
Merge remote-tracking branch 'upstream/main' into adenzler/tighten-ex…
adenzler-nvidia 23dce5a
Widen softbody_gift centroid and bbox bounds for GPU variance
adenzler-nvidia 345a806
Widen softbody_dropping_to_cloth centroid x bound for GPU variance
adenzler-nvidia 6adf9e1
Merge remote-tracking branch 'upstream/main' into HEAD
adenzler-nvidia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Fail fast when body state is missing instead of silently passing.
Right now, this test can pass without executing any assertions if either array is
None. That creates a false-green path for regressions in state setup.✅ Proposed fix
def test_final(self): """Test cable bundle hysteresis simulation for stability and correctness (called after simulation).""" - if self.state_0.body_q is not None and self.state_0.body_qd is not None: - body_positions = self.state_0.body_q.numpy() - body_velocities = self.state_0.body_qd.numpy() + if self.state_0.body_q is None or self.state_0.body_qd is None: + raise RuntimeError("Body state is not available.") + + body_positions = self.state_0.body_q.numpy() + body_velocities = self.state_0.body_qd.numpy() - # Numerical stability - assert np.isfinite(body_positions).all(), "Non-finite values in body positions" - assert np.isfinite(body_velocities).all(), "Non-finite values in body velocities" + # Numerical stability + assert np.isfinite(body_positions).all(), "Non-finite values in body positions" + assert np.isfinite(body_velocities).all(), "Non-finite values in body velocities" - # Exclude kinematic obstacle bodies (they teleport during release phase) - obstacle_set = set(self.obstacle_bodies) - cable_indices = [i for i in range(body_positions.shape[0]) if i not in obstacle_set] - cable_positions = body_positions[cable_indices] - cable_velocities = body_velocities[cable_indices] + # Exclude kinematic obstacle bodies (they teleport during release phase) + obstacle_set = set(self.obstacle_bodies) + cable_indices = [i for i in range(body_positions.shape[0]) if i not in obstacle_set] + cable_positions = body_positions[cable_indices] + cable_velocities = body_velocities[cable_indices]As per coding guidelines:
newton/examples/**/*.py: “Implementtest_final()— runs after the example completes to verify simulation state is valid.”📝 Committable suggestion
🤖 Prompt for AI Agents