Page 1 of 2

Vive controller emulation using an Xbox controller

Posted: Wed Jun 29, 2016 5:40 am
by zelmon64
NeoToriyama asked to be able to emulate the Vive controllers with an xbox controller. Here is an initial script that takes the input from an xbox 360 controller and sends it to the Hydra to be used in SteamVR:
xbox_vive_emulation_v0.3.2.py.7z
This works fine with sixense_simple3d.exe but after the initial button pushing in SteamVR the xbox controller only acts as an xbox controller.

Re: Vive controller emulation using an Xbox controller

Posted: Wed Jun 29, 2016 6:12 am
by NeoToriyama
Thank you for all the help, it's much appreciated. I'll give it a go. I hope this is the start of better Vive-to-Xbox controller emulation. It can only improve from here on out :)

Re: Vive controller emulation using an Xbox controller

Posted: Wed Jun 29, 2016 6:20 am
by zelmon64
NeoToriyama wrote:Thank you for all the help, it's much appreciated. I'll give it a go. I hope this is the start of better Vive-to-Xbox controller emulation. It can only improve from here on out :)
I forgot to mention a setting that may need to change. On line two is "i=1". This will probably need to be changed to "i=0" for you. If you test it in sixense_simple3d.exe don't forget to copy over the fake sixence.dll to that folder as well (it's in C:\Program Files (x86)\Steam\steamapps\common\Sixense SDK\SixenseSDK\samples\win32\sixense_simple3d).

Re: Vive controller emulation using an Xbox controller

Posted: Wed Jun 29, 2016 6:24 am
by NeoToriyama
Okay, will do.

Re: Vive controller emulation using an Xbox controller

Posted: Wed Jun 29, 2016 6:35 am
by NeoToriyama
So, I was actually able to get the controller to show up in the CyberPong and Budget Cuts! I can move the left controller, but it's pointed away from the screen, but you can rotate it by holding LB and moving the left stick, the right controller works with the trigger, but you can't move at all. You have to move the left stick around sometimes for it to move into the scene. This is a great start!

EDIT: The left controller is inverted as well for rotation, but once you get used to it, it's much easier. I was actually able to start and play a game of Cyber-pong, although I was defeated pretty easily. If we could somehow map the right hand controller to the right stick and the rotation to the of the right controller to rb and get rid of the inverted controls for rotation on both controllers, it would be a huge step forward.

Re: Vive controller emulation using an Xbox controller

Posted: Wed Jun 29, 2016 8:00 am
by zelmon64
NeoToriyama wrote:So, I was actually able to get the controller to show up in the CyberPong and Budget Cuts! I can move the left controller, but it's pointed away from the screen, but you can rotate it by holding LB and moving the left stick, the right controller works with the trigger, but you can't move at all. You have to move the left stick around sometimes for it to move into the scene. This is a great start!

EDIT: The left controller is inverted as well for rotation, but once you get used to it, it's much easier. I was actually able to start and play a game of Cyber-pong, although I was defeated pretty easily. If we could somehow map the right hand controller to the right stick and the rotation to the of the right controller to rb and get rid of the inverted controls for rotation on both controllers, it would be a huge step forward.
This one should do as you asked. For some reason I can't seem to get it to work in SteamVR (can't even launch a VR game). The right stick was previously set to act as the Vive controller touch pad but it now controls the other controller's movement.

Re: Vive controller emulation using an Xbox controller

Posted: Wed Jun 29, 2016 1:05 pm
by NeoToriyama
Okay awesome thanks, I'll test it out now. That's weird though that you can't get it working. I ran the sixense test you talked about earlier and then as it was open, I launched a game from Steam, I'm not sure if that's why it worked, but I'd say you should give it a try.

EDIT: Also, are you using Vridge/Riftcat or an actual HMD?

Re: Vive controller emulation using an Xbox controller

Posted: Wed Jun 29, 2016 2:00 pm
by NeoToriyama
I modified the script slightly, so that I could move the posz1 for both of the analog sticks while either holding LB or RB and pressing the D-pad up and down.

Re: Vive controller emulation using an Xbox controller

Posted: Wed Jun 29, 2016 8:17 pm
by NeoToriyama
I've got another question, what is the grip button mapped to?

Re: Vive controller emulation using an Xbox controller

Posted: Thu Jun 30, 2016 3:31 am
by zelmon64
It turns out that it wasn't working for me because I was being lazy and trying to use driver_null instead of VRidge (the Hydra calibration probably can't get the position of the HMD when using driver_null).

I've mapped the Hydra bumpers (Vive grips) to the triggers (fully depressed) when RB and LB are pressed. I've also mapped the Hydra sticks (Vive touchpads) to the xbox sticks when RB or LB are pressed and the corresponding triggers are partially depressed.

I added your modification so that you won't need to re-add it.

I noticed that the pitch was assigned to horizontal stick movement and the yaw to vertical movement so I swapped them to make it more intuitive (is that what you meant earlier when you said they were inverted?). Actually, just to check, what are the sizes of the fake sixense.dll files you're using? are they 27kB and 32kB? If not then we're using different versions which behave differently.

Re: Vive controller emulation using an Xbox controller

Posted: Thu Jun 30, 2016 5:01 am
by NeoToriyama
Oh okay! Well, I'm glad you got it working. I've tested a good amount of games and had some pretty funny experiences trying to play with emulated Vive controllers. The file sizes for the fake .dlls are 16kb (sixense.dll) and 18kb (sixense_x64.dll).

Okay, cool I'll test it out now and see how it performs, and yes that's what I meant by the inverted controls. I'll do some more testing to see how well the new script works.

Re: Vive controller emulation using an Xbox controller

Posted: Thu Jun 30, 2016 5:05 am
by NeoToriyama
Before testing, i got an error that says "Local variable 'posz1' referenced before assignment. Is this an error on my part?

Re: Vive controller emulation using an Xbox controller

Posted: Thu Jun 30, 2016 6:39 am
by zelmon64
NeoToriyama wrote:Before testing, i got an error that says "Local variable 'posz1' referenced before assignment. Is this an error on my part?
No, it was my bad - I added your mod without testing it. I've now moved the global definitions to the top of the function so that the problem shouldn't happen again.

Re: Vive controller emulation using an Xbox controller

Posted: Thu Jun 30, 2016 6:49 am
by NeoToriyama
No worries, I figured it was a small error if any.

Re: Vive controller emulation using an Xbox controller

Posted: Thu Jun 30, 2016 7:14 am
by NeoToriyama
Okay, I've only tested one title, but it works now and really well I might add. A lot more streamlined this time around. You're doing amazing work.

Re: Vive controller emulation using an Xbox controller

Posted: Fri Jul 01, 2016 3:40 am
by zelmon64
I've added a condition where if the A button is held down the HMD position can be moved with the left stick and d-pad up/down. Reset it with the left stick button and reset the HMD forward direction (send ctrl+shift+alt+R) with d-pad left. I "ummed-and-ahed" about adding HMD orientation control and decided to add it for completeness. It is similarly controlled by holding the B button but the roll is controlled with the d-pad left/right instead of up/down (I thought it made more sense).

Re: Vive controller emulation using an Xbox controller

Posted: Fri Jul 01, 2016 9:16 pm
by NeoToriyama
Awesome, sounds good. I'll give it a go.

Re: Vive controller emulation using an Xbox controller

Posted: Sun Jul 03, 2016 2:52 am
by NeoToriyama
It's working great man, I really appreciate all the work you put into this, it's also cool because it works with just about every game haven't had an issue yet.

Re: Vive controller emulation using an Xbox controller

Posted: Thu Jul 07, 2016 10:08 pm
by NeoToriyama
Think you can help? It's the same problem many people seem to be having with IMU emulation in SteamVR. After a few minutes, the screen goes black and creates an unfortunate disappointment. The only solution was to create an environment variable to disable the 64 bit version of SteamVR. Can you make a tutorial on how to do so? I'm able to create an environment variable, but what folder/and or file do I target? Any help would be appreciated. I've asked everywhere I could think of with no response.

Re: Vive controller emulation using an Xbox controller

Posted: Fri Jul 08, 2016 3:55 am
by zelmon64
NeoToriyama wrote:Think you can help? It's the same problem many people seem to be having with IMU emulation in SteamVR. After a few minutes, the screen goes black and creates an unfortunate disappointment. The only solution was to create an environment variable to disable the 64 bit version of SteamVR. Can you make a tutorial on how to do so? I'm able to create an environment variable, but what folder/and or file do I target? Any help would be appreciated. I've asked everywhere I could think of with no response.
How long does it take to go black? If you have it morrored on your monitor do both go black? I haven't been able to replicate this but only have the VRidge trial so am limited to 10 minutes. Does this only happen in games or can it happen if only SteamVR is running?

Are all your drivers for the Hydra and SteamVR up to date?

edit: I found your reddit post. Does this only happen with Leap Motion or does it also happen with the Hydra emulation? PSMoveService is now using a x64 bit version so maybe that's what's needed of the Leap Motion implementation. I don't have a Leap Motion so I can't try it out.

Re: Vive controller emulation using an Xbox controller

Posted: Fri Jul 08, 2016 7:03 am
by NeoToriyama
It happens in random intervals and yes it happens with both Hydra emulation and Leap Motion after some time. Different games tend to go black at different times. It only happens with SteamVR games when I'm using IMU emulation. Even if I'm emulating Hydra or Leap Motion during Oculus Rift titles, the screen never goes black. Also, yes they're up to date, but the Leap Motion driver hasn't been updated for almost a month, so I'm assuming you're correct that it isn't using x64 bit version and that's causing the black screen. If I uninstall all the drivers, the SteamVR games never go black. You must be right about the 64bit implementation. As far as disabling the 64bit server, do you know how to do it?

Re: Vive controller emulation using an Xbox controller

Posted: Fri Jul 08, 2016 7:21 am
by zelmon64
NeoToriyama wrote:It happens in random intervals and yes it happens with both Hydra emulation and Leap Motion after some time. Different games tend to go black at different times. It only happens with SteamVR games when I'm using IMU emulation. Even if I'm emulating Hydra or Leap Motion during Oculus Rift titles, the screen never goes black. Also, yes they're up to date, but the Leap Motion driver hasn't been updated for almost a month, so I'm assuming you're correct that it isn't using x64 bit version and that's causing the black screen. If I uninstall all the drivers, the SteamVR games never go black. You must be right about the 64bit implementation. As far as disabling the 64bit server, do you know how to do it?
I'm not certain how to do it but HipsterSloth posted the following before he pushed the x64 version of PSMoveservice (I never tried it myself).
HipsterSloth wrote:IMPORTANT STEAM VR NOTE
SteamVR just updated today (7/5/2016) making the 64-bit vrserver the default. The problem with this is that I'm not currently building 64-bit version of the plugin yet, though I'm going to fix that soon.

In the mean time do the following gross work around:

1) Go to: C:\Program Files (x86)\Steam\steamapps\common\SteamVR\bin (Or where ever your SteamVR folder lives)
2) Rename the "win64" folder to "win64_original"
3) Duplicate the "win32" folder to "win64"

This tricks SteamVR into thinking it's running the 64-bit server

Re: Vive controller emulation using an Xbox controller

Posted: Fri Jul 08, 2016 8:33 am
by NeoToriyama
Thank you! I'll give it a go.

Re: Vive controller emulation using an Xbox controller

Posted: Fri Jul 08, 2016 8:47 am
by NeoToriyama
Damn, no dice. It seems as though the issue isn't SteamVR. It may be the actual Leap Motion drivers. It's weird that no one is actively working on them. Unless it's actually that difficult that it isn't worth it. I'm unsure. It seemed to fix the issue with the Hydra emulation so, it must be the Leap Motion drivers that are conflicting with SteamVR.

EDIT: It's definitely the Leap Motion drivers now, tested a few games with Hydra emulation and no black screen after multiple playthroughs.

Re: Vive controller emulation using an Xbox controller

Posted: Thu Jul 14, 2016 2:37 am
by zelmon64
NeoToriyama wrote:Damn, no dice. It seems as though the issue isn't SteamVR. It may be the actual Leap Motion drivers. It's weird that no one is actively working on them. Unless it's actually that difficult that it isn't worth it. I'm unsure. It seemed to fix the issue with the Hydra emulation so, it must be the Leap Motion drivers that are conflicting with SteamVR.

EDIT: It's definitely the Leap Motion drivers now, tested a few games with Hydra emulation and no black screen after multiple playthroughs.
Just to let you know, I've been trying to build the x64 version but I keep getting errors. I ordered one of those HP keyboards with the LM built in because I found a cheap one so hopefully I'll be able to make some progress.

Are you still having problems or managed to find a way to fix it?

Re: Vive controller emulation using an Xbox controller

Posted: Sat Jul 16, 2016 12:25 am
by konstantin_lozev
That's an awesome idea for emulation. I was thinking of making a similar script with a similar approach, but with a standard gamepad. How did you finally tackle the problem of 2x6dof which is 12 axes vs the 4 axes available on the Xbox (and standard) controllers? I was thinking of assuming you always move the Vive/Hydra wands somewhere from your elbows, then you have only 4 dof in total to cover in most cases.

Re: Vive controller emulation using an Xbox controller

Posted: Sat Jul 16, 2016 3:53 am
by zelmon64
konstantin_lozev wrote:That's an awesome idea for emulation. I was thinking of making a similar script with a similar approach, but with a standard gamepad. How did you finally tackle the problem of 2x6dof which is 12 axes vs the 4 axes available on the Xbox (and standard) controllers? I was thinking of assuming you always move the Vive/Hydra wands somewhere from your elbows, then you have only 4 dof in total to cover in most cases.
In my script the two analogue sticks default to x and y position of the Hydra controllers. When a bumper is held down the corresponding stick controls the yaw and pitch of the corresponding controller. The d-pad is set to change the roll and z position of a controller also when the corresponding bumper is held down.

It seems to work reasonably well and can easily be modified to use the generic `joystick` instead of `xbox360`. One interesting thing to note is that when in the SteamVR menu the real xbox controller input is detected as well as the emulated Vive controllers which can lead to unintentional things happening. I was going to use a DS4 controller instead to try to circumvent this behaviour but then found that the DS4 is also recognised by Steam. I can't find a way to turn off controller support in Steam (which I thought was rather ironic).

Re: Vive controller emulation using an Xbox controller

Posted: Sat Jul 16, 2016 12:59 pm
by NeoToriyama
Sorry about the late response, I actually haven't been able to fix it, although I'm assuming after research the issue is Riftcat/Vridge. Many people I know that have the actual Rift or Vive don't experience black screens. I even have a friend that has OSVR and he gets no black screens using Leap Motion. I reached out to the devs at Riftcat and they'e aware of the issue and say they will work on the issue in August as they're currently working on the GearVR version.

Re: Vive controller emulation using an Xbox controller

Posted: Sat Aug 06, 2016 2:25 am
by zelmon64
I've figured why the initialisation of the emulated Hydra controllers does not always work. I had the initial and reset positions set for both controllers as (0,0,0). This meant that they were in exactly the same place which would be impossible if they are supposed to be either side of your head. Ihave now set them to have an offset of +/- 65 in the x direction (eg side by side).

To further help initialisation I have modified the behaviour of the start and back buttons. Now when the either of the bumpers are held, if either the start or back buttons are pressed the start button on both Hydra controllers will be pressed.

I have also swapped the forwards / back positional movement of the controllers because it was anoying me (sorry if anyone liked that configuration).

The default real xbox controller is also now set to use the first instead of the second (i = 0) so hopefully that will be better for most people.

Re: Vive controller emulation using an Xbox controller

Posted: Fri Aug 19, 2016 2:10 pm
by egglego
Hi, After a lot of trial and error I have kind of got my xbox controller thinking its a Hydra thinking its a vive wand. When Steam VR starts it tells me to point my controller at the base station, i press the left trigger and then the right trigger. Steam then tells me to put the controllers to my head and press both system buttons. the green controller icons then blink and vrserver crashes.

what buttons on the 360 controller do i need to press for the hydra system buttons?

any help would be gratefully received.

thanks

Neil.

Re: Vive controller emulation using an Xbox controller

Posted: Sat Aug 20, 2016 2:33 am
by zelmon64
egglego wrote:Hi, After a lot of trial and error I have kind of got my xbox controller thinking its a Hydra thinking its a vive wand. When Steam VR starts it tells me to point my controller at the base station, i press the left trigger and then the right trigger. Steam then tells me to put the controllers to my head and press both system buttons. the green controller icons then blink and vrserver crashes.

what buttons on the 360 controller do i need to press for the hydra system buttons?

any help would be gratefully received.

thanks

Neil.
Like I said in the previous post, to simultaneously press both system buttons hold one bumper and press either start or back. I don't know why it's crashing though because it shouldn't have a time limit for performing this action. Check your log files to see if there's a clue to why it crashes.

Re: Vive controller emulation using an Xbox controller

Posted: Sat Aug 20, 2016 12:47 pm
by egglego
Thank you for your quick response, and sorry to have you repeat yourself. in case it helps anyone else, the crashing was caused by a ps move driver that i had in the steam vr drivers folder.

Re: Vive controller emulation using an Xbox controller

Posted: Thu Sep 01, 2016 9:57 pm
by crookedDeebz
maybe I am missing something, does anyone mind helping?

- Freepie installed, script loaded and started
- hydra installed via steam
- six... installed via steam

xbox one controller, is being read by freepie and seems to follow same commands as 360 controller.

vive wands not showing as active in steam VR

- i dont have hydra or vive.

simply trying to emulate vive wands with xbone controller.

am I missing a step??

also OP, you mention system buttons and start/select buttons in referencing initialization.
what are the system buttons??

thank you and apologies for ignorance.

Re: Vive controller emulation using an Xbox controller

Posted: Fri Sep 02, 2016 12:10 am
by zelmon64
crookedDeebz wrote:maybe I am missing something, does anyone mind helping?

- Freepie installed, script loaded and started
- hydra installed via steam
- six... installed via steam

xbox one controller, is being read by freepie and seems to follow same commands as 360 controller.

vive wands not showing as active in steam VR

- i dont have hydra or vive.

simply trying to emulate vive wands with xbone controller.

am I missing a step??

also OP, you mention system buttons and start/select buttons in referencing initialization.
what are the system buttons??

thank you and apologies for ignorance.
You are forgetting to replace the sixense DLL files.

The "system" buttons are the Hydra start buttons which are mapped to the xbox back and start buttons for the left and right Hydra controllers.

Re: Vive controller emulation using an Xbox controller

Posted: Fri Sep 02, 2016 4:58 am
by crookedDeebz
thank you for the clarification.

it also seems the hydra wont start, program error with steam. i suppose that is normal until everything is setup, or at least normal for those without actual hydras.

hopefully not some other conflict.

will test this shortly.

thank you again


EDIT---
Did the sixsens swap, still nothing show up in steam vr as a usable controller.

Is that normal or should I see "working" controllers in the steam VR window?

Re: Vive controller emulation using an Xbox controller

Posted: Fri Sep 02, 2016 11:06 am
by zelmon64
crookedDeebz wrote:thank you for the clarification.

it also seems the hydra wont start, program error with steam. i suppose that is normal until everything is setup, or at least normal for those without actual hydras.

hopefully not some other conflict.

will test this shortly.

thank you again


EDIT---
Did the sixsens swap, still nothing show up in steam vr as a usable controller.

Is that normal or should I see "working" controllers in the steam VR window?
SteamVR should believe the Hydra controllers are connected even if the FreePIE script isn't running. To check, did you replaced the DLLs in the folder Steam/steamapps/common/SteamVR Driver for Razer Hydra/hydra/bin?

Re: Vive controller emulation using an Xbox controller

Posted: Fri Sep 02, 2016 11:14 am
by crookedDeebz
I have not done that yet, strange I missed 2 steps here.

thank you, i will try that now.

No hydras showing up.

Ya definitely no go on the hydras showing up.

i have replaced the ddls in x64, x32 and sixsens folders accordingly.

im surprised the hydras are nto showing up at all.

any suggestions?

Re: Vive controller emulation using an Xbox controller

Posted: Sat Sep 03, 2016 2:56 pm
by crookedDeebz
wholey shite, they were working all along.

i just never bothered to test them in a game...

however the horizontal plane is reversed, IE left = right, etc.

the left wand is missing, only see a laser beam

any suggestions?

is this mean for xbone controller? or is that the same identical as the 360?

i dont think I have a 360 controller to test.

Re: Vive controller emulation using an Xbox controller

Posted: Sat Sep 03, 2016 3:06 pm
by crookedDeebz
wholey shite, they were working all along.

i just never bothered to test them in a game...

however the horizontal plane is reversed, IE left = right, etc.

the left wand is missing, only see a laser beam

any suggestions?

is this mean for xbone controller? or is that the same identical as the 360?

i dont think I have a 360 controller to test.

Re: Vive controller emulation using an Xbox controller

Posted: Wed Oct 19, 2016 2:58 pm
by jesserichton
Hey guys. I fixed the Issue with the left goes right and right goes left probblem.