SceneReconstructionProvider stops providing updates

I have found that my Vision Pro device can get into a state where my app is no longer receiving fresh SceneReconstructionProvider updates. It reports that the SceneReconstructionProvider goes into the DataProviderState.running state, and .anchorUpdates will report a set of stale mesh anchors when first fired up, but does not produce any further updates. Once the device gets into this state, I can force quit the app, and even uninstall and re-install it, and I get the same few mesh updates, but no fresh updates until I restart the device.

Sample async function below. I can confirm that print("WE FELL OFF THE END OF sceneReconstruction.anchorUpdates") never gets executed, so it stays inside the sceneReconstruction.anchorUpdates loop.

let session = ARKitSession()
var handTracking = HandTrackingProvider()
let sceneReconstruction = SceneReconstructionProvider()
let planeDetection = PlaneDetectionProvider(alignments: [.horizontal, .vertical])
let worldTracking = WorldTrackingProvider()

...

func start() async {
    do {
        await requestAuth()
        if dataProvidersAreSupported && isReadyToRun && !isRunning {
            //                print("ARKitSession starting.")
            try await session.run([sceneReconstruction, handTracking, planeDetection, worldTracking])
            startCount += 1
            // TODO: Fail gracefully if we have to attempt start too many (# TBD) times
        } else {
            print("dataProvidersAreSupported: \(dataProvidersAreSupported). isReadyToRun: \(isRunning)")
            print("handTracking.state: \(handTracking.state), sceneReconstruction.state: \(sceneReconstruction.state) worldTracking.state: \(worldTracking.state), planeDetection.state; \(planeDetection.state)")
        }
    }catch {
        print("ARKitSession error:", error)
    }
}

...

func processReconstructionUpdates() async {
    while (true) {
        for await update in sceneReconstruction.anchorUpdates {
            let meshAnchor = update.anchor
            
            guard let shape = try? await ShapeResource.generateStaticMesh(from: meshAnchor) else { continue }
            switch update.event {
            case .added:
                let entity = try! await generateModelEntity(geometry: meshAnchor.geometry)
                entity.transform = Transform(matrix: meshAnchor.originFromAnchorTransform)
                entity.collision = CollisionComponent(shapes: [shape], isStatic: true)
                entity.components.set(InputTargetComponent())
                entity.name = "mesh"
                
                entity.physicsBody = PhysicsBodyComponent(mode: .static)
                
                let sortComponent = ModelSortGroupComponent(group: modelSortGroup, order: 1)
                entity.components.set(sortComponent)
                entity.components.set(OpacityComponent(opacity: 0.5))
                meshEntities[meshAnchor.id] = entity
                
                meshesParent.addChild(entity, preservingWorldTransform: true)
            case .updated:
                guard let entity = meshEntities[meshAnchor.id],
                      let updatedEntity = try? await generateModelEntity(geometry: meshAnchor.geometry) else { continue }
                
                entity.transform = Transform(matrix: meshAnchor.originFromAnchorTransform)
                entity.collision?.shapes = [shape]
                if let newMesh = updatedEntity.model?.mesh {
                    entity.model?.mesh = newMesh
                }
            case .removed:
                meshEntities[meshAnchor.id]?.removeFromParent()
                meshEntities.removeValue(forKey: meshAnchor.id)
            }
            
            print("We now have '\(meshEntities.count)' mesh entities")
        }
        print("WE FELL OFF THE END OF sceneReconstruction.anchorUpdates")
        try? await Task.sleep(nanoseconds: 1_000_000)
     }

Please file a feedback radar containing a sysdiagnose.

In the meantime, you can also take a look at this Scene reconstruction sample code and see if it behaves differently:

My code was set up following that sample code, and doesn't deviate from it very much at all, other than the type of mesh it creates.

Can you point me to how to trigger the sysdiagnose? I tried accessing this resource from another forum post, but it says I don't have access even though I am logged into my developer account:

https://download.developer.apple.com/visionOS/visionOS_Logs/Sysdiagnose_Logging_Instructions.pdf

Hello @patchedreality,

You should be able to access the visionOS sysdiagnose instructions from here: https://developer.apple.com/bug-reporting/profiles-and-logs/?name=sysdiagnose

Also, if you have a focused sample project that reproduces this issue, I am very interested to see it :)

Ok, it happened again today. I really have no idea what causes it to start happening. It appears random. Sometimes everything is working perfectly well, but then it gets into a state where it stops reporting mesh updates. I attempted to capture my syslog around the time I noticed it start happening. It is feedback FB13808797.

SceneReconstructionProvider stops providing updates
 
 
Q