Skip to content

[Interactive Drive] Add physics via Physx - #423

Open
ArielG-NV wants to merge 10 commits into
NVIDIA:mainfrom
ArielG-NV:physics-test
Open

[Interactive Drive] Add physics via Physx#423
ArielG-NV wants to merge 10 commits into
NVIDIA:mainfrom
ArielG-NV:physics-test

Conversation

@ArielG-NV

@ArielG-NV ArielG-NV commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Changes:

  • Added physx to drive the backend of physics. This requires maintaining our own physx python bindings.
  • Removed Vulkan backend from ludus-renderer due to significant overhaul causing this backend to be a maintenance burden that requires a complete rewrite. If there is need for the backend in the future we will just rewrite the code then.
  • Physics are generally obeying physx as the main-controller, but some hacks are added to prevent out-of-distribution behavior (yaw-lock on vehicles, speed lock on non-ego vehicles, etc...)
  • Changed the BEV render to be an orthographic top-down view for reasons that it makes driving+navigation easier. Added a green car to identify the ego on the BEV.
  • Made all collision logic (and other game-like-frills) under the --game-mode flag for the interactive-drive demos
  • Added a new view when clicking 3, a physx-debug view. This view enabled viewing the colliders we setup on the backend of physx: vehicles, pedestrians, road-boundaries as walls, etc....
  • Added a visual-flare when hitting/getting-hit by objects with enough force.
  • Tried to fit all objects into a very 'hacked-up' scene graph structure for ease of future feature additions

@ArielG-NV ArielG-NV added the enhancement New feature or request label Aug 6, 2026
@copy-pr-bot

copy-pr-bot Bot commented Aug 6, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@ArielG-NV

Copy link
Copy Markdown
Collaborator Author

/ok to test

@copy-pr-bot

copy-pr-bot Bot commented Aug 6, 2026

Copy link
Copy Markdown

/ok to test

@ArielG-NV, there was an error processing your request: E1

See the following link for more information: https://docs.gha-runners.nvidia.com/cpr/e/1/

@greptile-apps

greptile-apps Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Adds a PhysX-backed mutable simulation and object graph to Interactive Drive, removes the Vulkan renderer, and introduces game-mode collision behavior, debug rendering, and collision flare presentation.

  • Builds and loads pinned PhysX bindings into a platform-local cache.
  • Synchronizes dynamic actors and map barriers between the object graph, physics world, renderer, and world-model inputs.
  • Adds game-mode controls, physics debug view, BEV changes, collision effects, and focused tests.
  • Removes the Vulkan implementation and consolidates rendering on CUDA.

Confidence Score: 2/5

This PR should not merge until the native buffer lifetime hazard and the unexpectedly enabled programmatic game-mode defaults are fixed.

Exported NumPy arrays can outlive and access freed native vector storage, while direct Python API launches enable collision physics, speed limiting, and visual effects without opting into game mode.

Files Needing Attention: integrations/omnidreams/ludus-renderer/ludus_renderer/_cpp/physx/bindings.cpp; integrations/omnidreams/omnidreams/interactive_drive/config.py

Security Review

The native buffer accessors expose NumPy arrays over class-owned vectors without retaining the owning NativeScene, so escaped arrays can access freed native memory after the physics owner is destroyed.

Important Files Changed

Filename Overview
integrations/omnidreams/ludus-renderer/ludus_renderer/_cpp/physx/bindings.cpp Adds the native PhysX scene and fixed-capacity buffers, but its exported NumPy views do not retain their native owner.
integrations/omnidreams/ludus-renderer/ludus_renderer/physx.py Wraps native PhysX synchronization and stable buffers; its public and compact-result views expose the native buffer lifetime defect.
integrations/omnidreams/ludus-renderer/ludus_renderer/object_graph.py Adds graph topology, spatial selection, and bounded PhysX copies with no accepted correctness issue.
integrations/omnidreams/omnidreams/interactive_drive/config.py Adds physics and flare controls, but defaults game-mode-only behavior to enabled for non-CLI construction.
integrations/omnidreams/omnidreams/interactive_drive/cli.py Correctly maps --game-mode to collision, speed-limit, and visual-flare settings for CLI launches.
integrations/omnidreams/omnidreams/interactive_drive/runtime/loop.py Integrates simulation, flare scheduling, pipeline submission, and presentation in a consistent frame order.
integrations/omnidreams/omnidreams/interactive_drive/simulation/game_physics.py Builds and synchronizes PhysX topology, actor controls, collisions, and debug state without an independently accepted defect.

Reviews (1): Last reviewed commit: "optimizations" | Re-trigger Greptile

Comment on lines +650 to +654
return py::array_t<float>(
{static_cast<py::ssize_t>(mCapacity), static_cast<py::ssize_t>(kStateWidth)},
{static_cast<py::ssize_t>(kStateWidth * sizeof(float)), static_cast<py::ssize_t>(sizeof(float))},
mStates.data(),
py::none());

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 security Native buffer owner is lost

When Python retains any returned buffer after releasing its NativeScene or PhysXWorld, the array still references freed std::vector storage because py::none() does not retain the native owner, causing corrupted reads, writes, or a process crash.

How this was verified: All seven public buffer accessors construct arrays over member-vector storage with py::none() as their lifetime base.

steer_return_rate_rad_per_s: float = 0.7
steer_rate_rad_per_s: float = 0.55
steer_return_rate_rad_per_s: float = 0.9
speed_limit_enabled: bool = True

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Game mode defaults stay enabled

When InteractiveDriveApp or AppConfig is constructed through the Python API instead of cli.py, these defaults enable speed limiting, actor and static collisions, and collision flares without opting into game mode, causing programmatic launches to behave differently from the documented default.

Knowledge Base Used: Integrations

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

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

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant