regzo2 / PicoStreamingAssistantFTUDP

Demonstration of how to fetch face tracking data via the Pico Streaming Assistant.
26 stars 10 forks source link

Module reinitialize stuck #16

Closed lonelyicer closed 5 months ago

lonelyicer commented 5 months ago

Disconnecting from steamvr midway triggers the module to reinitialise, but it willl stuck at "using XXXX" image

rogermiranda1000 commented 5 months ago

I was able to recreate it doing the following:

  1. Launch & connect to PICO Connect
  2. Launch SteamVR [the module will init]
  3. Remove the headset and wait until it enters sleep mode (screen turns off); the module will stop and [try] to start again
    [MainStandalone] Information: VRCFT Version 5.1.1.0 initializing...
    [MainStandalone] Information: Initializing OSC...
    [OSC] Debug: OSC Service Initializing
    [OSC] Debug: Binding Sender Client
    [OSC] Debug: OSC Service Initialized with result (True, True)
    [MainStandalone] Information: Initializing main service...
    [VRCFaceTracking.UnifiedTrackingMutator] Debug: Reading configuration...
    [MainStandalone] Debug: Starting OSC update loop...
    [MainStandalone] Debug: Checking for deletion requests for installed modules...
    [MainStandalone] Information: Checking for updates for installed modules...
    [MainStandalone] Information: Initializing modules...
    [UnifiedLibManager] Information: Starting initialization tracking
    [UnifiedLibManager] Information: Tearing down all modules...
    [VRCFaceTracking.UnifiedTrackingMutator] Debug: Configuration loaded.
    [UnifiedLibManager] Debug: Pico4SAFTExtTrackingModule properly implements ExtTrackingModule.
    [UnifiedLibManager] Warning: Bad IL format. The format of the file 'C:\Users\roger\AppData\Roaming\VRCFaceTracking\CustomLibs\vcruntime140.dll' is invalid. Assembly not able to be loaded. Skipping.
    [UnifiedLibManager] Debug: Initializing requested runtimes...
    [UnifiedLibManager] Information: Initializing runtimes...
    [UnifiedLibManager] Information: Initializing Pico4SAFTExtTrackingModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
    [UnifiedLibManager] Information: Loading External Module Pico4SAFTExtTrackingModule, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
    [Pico4SAFTExtTrackingModule] Information: Got PICO Connect; checking settings.json to choose what protocol to use...
    [Pico4SAFTExtTrackingModule] Information: Expecting PICO Connect settings file at 'C:\Users\roger\AppData\Roaming\PICO Connect\settings.json'
    [Pico4SAFTExtTrackingModule] Information: Using PICO Connect.
    [Pico4SAFTExtTrackingModule] Information: Initializing PICO Connect data stream.
    [Pico4SAFTExtTrackingModule] Debug: Host end-point: 127.0.0.1:29765
    [Pico4SAFTExtTrackingModule] Debug: Initialization Timeout: 0ms
    [Pico4SAFTExtTrackingModule] Debug: Client established: attempting to receive PxrFTInfo.
    [Pico4SAFTExtTrackingModule] Information: Waiting for PICO Connect data stream.
    [Pico4SAFTExtTrackingModule] Debug: PICO Connect handshake success.
    [UnifiedLibManager] Debug: Starting thread for Pico4SAFTExtTrackingModule
    [UnifiedLibManager] Information: Tracking initialized via Pico4SAFTExtTrackingModule.Pico4SAFTExtTrackingModule
    [Pico4SAFTExtTrackingModule] Information: Got PICO Connect; checking settings.json to choose what protocol to use...
    [Pico4SAFTExtTrackingModule] Information: Expecting PICO Connect settings file at 'C:\Users\roger\AppData\Roaming\PICO Connect\settings.json'
    [Pico4SAFTExtTrackingModule] Information: Using PICO Connect.
    [Pico4SAFTExtTrackingModule] Debug: Data was not sent within the timeout. Se produjo un error durante el intento de conexión ya que la parte conectada no respondió adecuadamente tras un periodo de tiempo, o bien se produjo un error en la conexión establecida ya que el host conectado no ha podido responder.

Note: stopping&launching VRCFT again will solve the issue

rogermiranda1000 commented 5 months ago

Another way to reproduce it instead of step 3, activate passthrough. Same outcome

rogermiranda1000 commented 5 months ago

Here's what I think it's happening: the second "Using PICO Connect" is due to calling StreamerValidity ( https://github.com/regzo2/PicoStreamingAssistantFTUDP/blob/d3ddbdc9335421021e71505ef1e617c3b6800243/PicoStreamingAssistantFTUDP/Pico4SAFTExtTrackingModule.cs#L216 ), which instantiates a new instance (logging those messages). The problem is that if that part of the code gets called it's because the socket has reached timeout trying to read, or (in this case) the socket has been closed. As the socket it's closed, when the Update calls ReceivePxrData it returns always false ( https://github.com/regzo2/PicoStreamingAssistantFTUDP/blob/d3ddbdc9335421021e71505ef1e617c3b6800243/PicoStreamingAssistantFTUDP/PicoConnectors/LegacyConnector.cs#L144 ). To fix this issue, the entire Initialize sequence should be called (in other words, if you don't call connector.Connect() it will be stuck forever).

rogermiranda1000 commented 5 months ago

Solved in the next version.