XR Raycasting callback is triggered only after the VR session ends

Isaac Sim Version

4.2.0

Operating System

Windows 11
Windows 10
Windows Server 2022

GPU Information

  • Model: Nvidia RTX 4070 Laptop
  • Driver Version: 566.36
  • Model: Nvidia A10G
  • Driver Version: 553.24 grid

Description

I would appreciate your ideas and help. I’m making a small tool for measuring distance in VR. I made a prototype based on kit 106.5, now I’ve ported it to IsaacSim 4.2 and faced a weird problem. I send a raycast via xrcore and subscribe to callback, but the callback is only triggered when I turn off VR mode. Here is a sample code:

        origin = controller_0_translate  # Raycast start point
        direction = db.inputs.direction_vector  # Raycast direction
        min_t = 0.1  # Min distance(mm)
        max_t = 100000.0  # Max distance(mm)
    
        ray = XRRay(origin=origin, direction=direction, min_t=min_t, max_t=max_t)
        xr_core = XRCore.get_singleton()
        xr_profile = xr_core.get_current_xr_profile()
        xr_profile.submit_raycast_query(ray, raycast_callback)

def raycast_callback(ray: XRRay, result: XRRayQueryResult):
    if result.valid:
        print("Raycast Hit Detected!")
        print(f"Hit Position: {result.hit_position}")
    else:
        print("Raycast did not hit any object.")

Steps to Reproduce

  1. submit_raycast_query via xr core
  2. Stop vr
  3. Recieve raycast result

Screenshots or Videos

image
15:29:10 - Send raycast
15:29:49 - Stop VR, and recieve bunch of results.

Additional Information

This is also observed if you send many raycasts, the callback for all of them will come only after the VR mode stops.

What I’ve Tried

Now I have replaced XR Core raycasting with PhysX raycasting and it works as expected, i.e. the callback is triggered immediately.
When working in Composer compiled from the Kit 106.5 template, the callback from the XR raycast system comes immediately. The problem is observed only in IsaacSim.
Perhaps the PhysX raycast system or something else is intercepting the main thread/suspending the raycasting of other systems?