polygraphene / FreePIEVRController

FreePIE input plugin for Daydream and GearVR controller
9 stars 3 forks source link

Crashing on FreePie #1

Open nopecio opened 5 years ago

nopecio commented 5 years ago

Hi, excellent work on ALVR, truly amazing. I'm trying to setup my keyboard as a second controller using freePie, but then the trigger in my gearVR controller stops working. So i'm trying to remap the controllers using freePIEVRController, but as soon as i try to use it in the py script it crashes. The exception is: System.MissingMemberException: 'NoneType' object has no attribute 'button'

It seems like the global vrcontrolles is null.

This is the script i'm using and it crashes in line 29 (the line after c = 0), if i remove the "or vrcontroller[c].button[1]" it works, but of course, i'm still without trigger. ` if starting:

alvr.two_controllers = True

controller = 1

alvr.buttons[controller][alvr.Id("trackpad_click")] = keyboard.getKeyDown(Key.C) alvr.buttons[controller][alvr.Id("trackpad_touch")] = keyboard.getKeyDown(Key.C)

if keyboard.getKeyDown(Key.LeftArrow): alvr.trackpad[controller][0] = -1.0 alvr.trackpad[controller][1] = 0.0 elif keyboard.getKeyDown(Key.UpArrow): alvr.trackpad[controller][0] = 0.0 alvr.trackpad[controller][1] = 1.0 elif keyboard.getKeyDown(Key.RightArrow): alvr.trackpad[controller][0] = 1.0 alvr.trackpad[controller][1] = 0.0 elif keyboard.getKeyDown(Key.DownArrow): alvr.trackpad[controller][0] = 0.0 alvr.trackpad[controller][1] = -1.0

c = 0 alvr.buttons[c][alvr.Id("trackpad_click")] = alvr.buttons[c][alvr.Id("trackpad_click")] or vrcontroller[c].button[1] alvr.buttons[c][alvr.Id("trackpad_touch")] = alvr.buttons[c][alvr.Id("trackpad_touch")] or vrcontroller[c].touch `

AltoRetrato commented 4 years ago

Hi!

IIRC, this happens when the Gear VR is not connected to the PC. This means you must have already paired the controller with the PC, and right after you run the FreePIE script, you have only a few seconds to click a button in the controller for it to wake up and connect.

When I start a FreePIE script and don't touch any controller button, I see this output in the FreePIE Console:

Trying to connect Gear VR Controller[...]
Error: Failed to enable notify.

Because the connection is done at the start of the script and there is no automatic reconnection, you must restart the script to try again. When I click a controller button as soon as I start the script, the Console output is this:

Trying to connect Gear VR Controller[...]
Connected.
CoffeeMan240 commented 4 years ago

Hello. I'm having the same problem, only that I've done that, but it doesn't work. I'm using the deprecated daydream controller emulator. Please help. This even happens when connected

AltoRetrato commented 4 years ago

I'm having the same problem, only that I've done that, but it doesn't work. I'm using the deprecated daydream controller emulator. Please help. This even happens when connected

Hi there!

It would be interesting if you could say exactly what is your problem, what you have done, and what is not working (what unexpected behavior is happening, or what expected behavior is not happening) - or else, we can only guess...

I guess you have a FreePIE script that aborts with a message like System.MissingMemberException: 'NoneType' object has no attribute 'button'. If that's the case, it means FreePIE can't see you controller for whatever reason, such as problems with FreePIEVRController.dll or Bluetooth connection.

I suggest that you add this code to the start of your script (or at least before it uses the vrcontroller variable) and check the output in the diagnostics tab of FreePIE, so you might have a better idea of what is causing the problem:

  gearvr = "vrcontroller" in globals() # gearvr = True if the vrcontroller variable exists
  if not gearvr:
    diagnostics.debug("Gear VR controller plugin not found!")
    diagnostics.debug("Be sure to move the FreePIEVRController.dll file into the FreePIE plugins folder")
    diagnostics.debug('then right-click the file, select Properties and check "Unblock".')
  else:
    diagnostics.debug("Gear VR controller plugin found.")
    if not hasattr(vrcontroller[0], 'BUTTONS'):
      diagnostics.debug("Gear VR controller not found. Is Bluetooth on your computer turned on?")
      gearvr = False