Skip to content

Conversation

@ooctipus
Copy link
Collaborator

Description

This PR adds a comprehensive collision behavior test suite for Isaac Lab, inspired by the Newton physics engine collision tests. The test suite ensures that objects created with different colliders exhibit expected and understandable behavior.

Key features:

  • Tests for primitive colliders: sphere, box, capsule, cylinder, cone
  • Tests for mesh colliders: MeshSphereCfg, MeshCuboidCfg, MeshCapsuleCfg, MeshCylinderCfg, MeshConeCfg
  • Tests for SDF colliders: signed distance field collision approximation
  • Articulated body collision tests using the Allegro hand with per-finger collision isolation

Test coverage includes:

  • Horizontal collision between object pairs (momentum transfer verification)
  • Falling collision with ground plane
  • Box stacking stability (primitive, mesh, and mixed combinations)
  • Sphere bounce restitution behavior
  • Momentum conservation for equal-mass sphere collisions
  • Per-finger collision isolation on an articulated hand (drops object on specific finger, verifies only that finger deflects)

The tests are designed to avoid initial interpenetration of collision objects, which can cause undefined behavior in physics engines.

Type of change

  • New feature (non-breaking change which adds functionality)

Screenshots

Please attach before and after screenshots of the change if applicable.

Checklist

  • I have read and understood the contribution guidelines
  • I have run the pre-commit checks with ./isaaclab.sh --format
  • [] I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the changelog and the corresponding version in the extension's config/extension.toml file
  • I have added my name to the CONTRIBUTORS.md or my name already exists there

@github-actions github-actions bot added enhancement New feature or request isaac-lab Related to Isaac Lab team labels Jan 25, 2026
@ooctipus ooctipus changed the title Add physics collision tests Adds physics collision tests Jan 25, 2026
@ooctipus ooctipus moved this to In progress in Isaac Lab Jan 25, 2026
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 25, 2026

Greptile Overview

Greptile Summary

Added comprehensive collision behavior test suite with 977 lines of code covering primitive colliders (sphere, box, capsule, cylinder, cone), mesh colliders, and SDF colliders. The test suite includes horizontal collision tests between object pairs verifying momentum transfer, ground collision tests for all shape types, box stacking stability tests for primitive and mesh combinations, sphere bounce restitution tests, momentum conservation tests for equal-mass collisions, and articulated hand per-finger collision isolation tests using the Allegro hand.

Key changes:

  • Created test/physics/test_collision_behavior.py with 6 test functions and extensive parameterization
  • Bumped version from 0.54.0 to 0.54.1 in extension.toml
  • Added changelog entry documenting the new test suite

Test coverage:

  • 24 collision pair combinations for horizontal collision tests
  • 11 shape types for falling collision tests
  • 4 stacking combinations (primitive/mesh box pairs)
  • 3 restitution values for bounce tests
  • 6 sphere pair combinations for momentum conservation
  • 12 articulated hand tests (4 fingers × 3 sphere types)

The tests are well-structured with helper functions, proper fixtures, and clear assertions. The code follows the existing IsaacLab testing patterns and includes comprehensive documentation.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The PR adds a comprehensive test suite without modifying any production code. All changes are additive (new test file, version bump, changelog update). The test code is well-structured, follows established patterns, includes proper documentation, and provides extensive coverage of collision behavior scenarios. No breaking changes or risks to existing functionality.
  • No files require special attention

Important Files Changed

Filename Overview
source/isaaclab/test/physics/test_collision_behavior.py Added comprehensive collision test suite with 977 lines covering primitive, mesh, and SDF colliders with horizontal collisions, ground collisions, stacking, restitution, momentum conservation, and articulated hand tests
source/isaaclab/config/extension.toml Bumped version from 0.54.0 to 0.54.1
source/isaaclab/docs/CHANGELOG.rst Added changelog entry for version 0.54.1 documenting the new collision behavior test suite

Sequence Diagram

sequenceDiagram
    participant Test as Test Suite
    participant Sim as Simulation Context
    participant Scene as Interactive Scene
    participant ObjA as Object A
    participant ObjB as Object B
    participant Physics as Physics Engine

    Note over Test: test_horizontal_collision
    Test->>Sim: build_simulation_context(device, dt, gravity_enabled=False)
    Test->>Scene: InteractiveScene(scene_cfg)
    Test->>Scene: Add object_a, object_b configurations
    Test->>Sim: Apply SDF collision (if needed)
    Test->>Sim: sim.reset()
    Test->>Scene: scene.reset()
    Test->>ObjA: Set initial velocity (2.0 m/s in X)
    Test->>ObjB: Set velocity to zero
    
    loop collision_steps (240 iterations)
        Test->>Scene: write_data_to_sim()
        Test->>Sim: sim.step(render=False)
        Test->>Scene: scene.update(dt)
        Test->>Physics: Check collision detection
        Test->>Test: Verify no interpenetration
    end
    
    Test->>Test: Verify collision occurred
    Test->>Test: Verify momentum transfer
    Test->>Test: Verify no spurious velocities
    
    Note over Test: test_falling_collision_with_ground
    Test->>Sim: build_simulation_context(gravity_enabled=True, add_ground_plane=True)
    Test->>Scene: Create object at height 2.0m
    
    loop fall_steps (480 iterations)
        Test->>Scene: write_data_to_sim()
        Test->>Sim: sim.step()
        Test->>Scene: scene.update(dt)
    end
    
    Test->>Test: Verify object didn't fall through ground
    Test->>Test: Verify object came to rest
    
    Note over Test: test_finger_collision_isolation
    Test->>Sim: build_simulation_context(gravity_enabled=True)
    Test->>Scene: Create Allegro hand (gravity disabled)
    Test->>Scene: Create sphere above target finger
    Test->>Sim: Apply SDF collision (if needed)
    
    loop settle_steps (30 iterations)
        Test->>Scene: Let hand settle
    end
    
    Test->>Test: Record initial joint positions
    
    loop drop_steps (480 iterations)
        Test->>Scene: Simulate sphere drop
        Test->>Test: Track peak deflection per finger
    end
    
    Test->>Test: Verify target finger deflected significantly
    Test->>Test: Verify target finger had highest deflection
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

No files reviewed, no comments

Edit Code Review Agent Settings | Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request isaac-lab Related to Isaac Lab team

Projects

Status: In progress

Development

Successfully merging this pull request may close these issues.

1 participant