Page 3 of 9

Re: Razer hydra emulation

Posted: Wed Oct 16, 2013 3:42 am
by geekmaster
CyberVillain wrote:hmm, thanks for input, but I do not understand if you want changes in FreePIE? :D

One way would be to expose the quaternion but there are not many API's that have these, Android Raw mode and Hydra are the only two that I can think of from top of my head

edit: Yei exposes them aswell
I solved the gimbal lock problem for Euler angles just like how it is done mechanically in aerospace. They have a fourth axis driven by a motor that keeps the three Euler axis alignments away from gimbal lock. In software we can do that for free. I have getyaw(), getpitch(), and getroll() functions that just swap coordinate systems as needed before converting to a Euler angle. They coordinate system change is hidden in each function.

I only brought this up in this thread because it was being discussed as a gimble lock problem, and my *different* gimbal lock axis (pitch instead of roll) made me realize that this was solvable with coordinate rotation just be redefining the axes, just like how it is done in mechanical systems. It works. My Euler angles no longer have gimbal lock problems.

If FreePie has a gimbal lock problem, it may be worth fixing...

Re: Razer hydra emulation

Posted: Wed Oct 16, 2013 5:39 am
by CyberVillain
But you said you still have the problem but on a different axis?

Re: Razer hydra emulation

Posted: Wed Oct 16, 2013 12:44 pm
by geekmaster
CyberVillain wrote:But you said you still have the problem but on a different axis?
I do now. But earlier I tested code (which I did not save) that clearly behaved as described earlier and at different forums (gimbal lock on roll). I thought I had recreated that code but there are still anomalies in obscure locations when rotating the hydra.

The plan was that if I can have both code sets, one with gimbal lock only on roll and the other only on pitch, I can convert the quaternion both ways, one in getroll() and the other in getpitch(). Unfortunately, I cannot now reproduce the problem others describe (gimbal lock on roll). Where can I find some code that has good pitch but gimbal lock on roll, so I can compare to see why I have a different axis with gimbal lock on my hydra?

Anyway, using just a quaternion or rotation matrix is clearly better, but harder to grasp. I like the simplicity of roll/pitch/yaw that I have used forever... Time to get comfortable with quaternions all the way, and forego Euler angles altogether, it seems...

Re: Razer hydra emulation

Posted: Wed Oct 21, 2015 8:48 am
by Jpwinks001
Croccy22 wrote:I GOT IT WORKING!!!!!!!!

I replaced the sixense.dll from minecrift with your dll and used the following script:

Code: Select all

def update():
    global yaw
    yaw = math.radians(-ahrsImu.yaw)
    global pitch
    pitch = math.radians(ahrsImu.pitch)
    global roll
    roll = math.radians(ahrsImu.roll)

if starting:
    centerYaw = 0
    centerPitch = 0
    centerRoll = 0
   
    yaw = 0
    pitch = 0
    roll = 0
    ahrsImu.update += update

hydra[0].yaw  = yaw - centerYaw
hydra[0].pitch = pitch - centerPitch
hydra[0].roll = roll - centerRoll

if keyboard.getKeyDown(Key.Z):
    centerYaw = yaw
    centerPitch = pitch
    centerRoll = roll
    
if keyboard.getKeyDown(Key.O):
   hydra[0].trigger = 1
   
if keyboard.getKeyDown(Key.P):
   hydra[1].trigger = 1
Minecraft is now working with my DIY Rift with full headtracking!!! THANKYOU SO MUCH!!

I may well have a play with using a PS Move to do the body tracking as that is now supported too.

Can you suggest any improvements to my script. Only thing I am unsure about is I think My keyboard bit leaves the hydra triggers pressed down?

Also Minecraft is one of those games that is 64bit!! It uses 64bit java and so to start with I couldn't get anything to work. In the end I uni-installed the 64bit java and re-installed minecraft to force it to use 32bit java and it now works perfectly. I guess it would be nice to have a 64bit variant just so I have access to extra memory. Not sure how much work this would be? There is a sixense_x64.dll in minecrift.

Might have to look at some other programs that utilise the Hydra now. But think I will just be happy playing Minecraft for a while :)

Matt.
Hi,
Sorry to bring this post back from the grave but I am still working with this.
I am using my android diy rift for this. I have used your code and changed it to android[0]
It all works in the game but it barley moves. I messed around with the vr setting sin MC but nothing is allowing me to get full head tracking. Is there something different I am doing? I am using the lates Minecrift build 1.8.1 and the latest Freepie 1.9.6 with a SSGS5 phone.
Thanks,
JP

Re: Razer hydra emulation

Posted: Sat Feb 20, 2016 2:49 am
by Bullfrogberry
I am a noob when it comes to control emulation and to code. I am getting some errors form FreePIE.

I have tried all three scripts from the previous recommendations in the posts and same errors.

Object reference not set to an instance of an object.
Object reference not set to an instance of an object.
An item with the same key has already been added.

Code: Select all

def update():
    global yaw
    yaw = math.radians(-ahrsImu.yaw)
    global pitch
    pitch = math.radians(ahrsImu.pitch)
    global roll
    roll = math.radians(ahrsImu.roll)

if starting:
    centerYaw = 0
    centerPitch = 0
    centerRoll = 0
   
    yaw = 0
    pitch = 0
    roll = 0
    ahrsImu.update += update

hydra[0].yaw  = yaw - centerYaw
hydra[0].pitch = pitch - centerPitch
hydra[0].roll = roll - centerRoll

if keyboard.getKeyDown(Key.Z):
    centerYaw = yaw
    centerPitch = pitch
    centerRoll = roll
    
if keyboard.getKeyDown(Key.O):
   hydra[0].trigger = 1
   
if keyboard.getKeyDown(Key.P):
   hydra[1].trigger = 1
I try running the code without anything else running (minecrift, my Trinus VR with FreePIR output) I have also tried connecting and running everything first.

Do I need to change my code to match my specific device? I am using a note 2 with Android of course connected by USB running Trinus VR which has many options for sensor output.
Thanks for the feedback.

Re: Razer hydra emulation

Posted: Sat Feb 20, 2016 1:25 pm
by CyberVillain
Is ahrsImu really correct for that hardware?

Re: Razer hydra emulation

Posted: Wed Mar 23, 2016 7:33 am
by gladiusz
Hello. I made Hydra emulator for PS Move by using programs like Motioninjoy, ppJoy, JoyEmu and x360ce. I had to use last program, beacuse FreePie doesn't read ppJoy buttons. In this way, I can use Move in games like Tuscany demo and it works quite cool. I can even use Sixaxis controls as axis x and z of second Hydra. The problem is, that by using x360ce it can read only 4 axis. Is there any way to read buttons and axis from ppJoy?

Code: Select all

if starting:
   hydra[0].isDocked = True
   hydra[0].enabled = True
   hydra[1].isDocked = True
   hydra[0].enabled = True
   
if keyboard.getPressed(Key.NumberPad0):
	hydra[0].isDocked = False

if keyboard.getPressed(Key.NumberPad1):
	hydra[1].isDocked = False

hydra[1].trigger = joystick[3].getDown(6)
hydra[0].trigger = xbox360[0].leftShoulder or joystick[3].getDown(7)

hydra[1].joybutton = joystick[3].getDown(9)
hydra[0].joybutton = joystick[3].getDown(10)

hydra[1].bumper = joystick[3].getDown(4)
hydra[0].bumper = xbox360[0].rightShoulder or joystick[3].getDown(5)


hydra[0].one = xbox360[0].a or joystick[3].getDown(2)
hydra[0].two = xbox360[0].b or joystick[3].getDown(1)
hydra[0].three = xbox360[0].x or joystick[3].getDown(3)
hydra[0].four = xbox360[0].y or joystick[3].getDown(0)

hydra[1].one = joystick[3].getDown(15)
hydra[1].two = joystick[3].getDown(14)
hydra[1].three = joystick[3].getDown(16)
hydra[1].four = joystick[3].getDown(13)

hydra[1].start = xbox360[0].back or joystick[3].getDown(8)
hydra[0].start = xbox360[0].start or joystick[3].getDown(11)


hydra[0].yaw = xbox360[0].rightStickX
hydra[0].pitch = xbox360[0].rightStickY
hydra[0].roll = xbox360[0].leftStickY
hydra[0].z = xbox360[0].leftStickX * 300

hydra[0].x = xbox360[0].rightStickX * 200
hydra[0].y = xbox360[0].rightStickY * 200

hydra[1].x = -joystick[3].yRotation * 0.25
hydra[1].z = joystick[3].xRotation * 0.35


hydra[1].joyx = joystick[3].x * 0.003
hydra[1].joyy = -joystick[3].y * 0.003
hydra[0].joyy = -joystick[3].zRotation * 0.001
hydra[0].joyx = joystick[3].z * 0.001

Re: Razer hydra emulation

Posted: Wed Mar 23, 2016 8:09 am
by CyberVillain
Why not use vjoy?

Re: Razer hydra emulation

Posted: Wed Mar 23, 2016 9:37 am
by gladiusz
JoyEmu require ppJoy. At all FreePie doesnt read any Virtual joystick. Heres link to JoyEmu https://code.google.com/archive/p/moveframework/
And heres the link for what i ve done:
https://www.youtube.com/watch?v=PGKP_GW5QfU

Re: Razer hydra emulation

Posted: Thu Mar 31, 2016 6:39 pm
by TiagoTiago
gladiusz wrote:JoyEmu require ppJoy. At all FreePie doesnt read any Virtual joystick. Heres link to JoyEmu https://code.google.com/archive/p/moveframework/
And heres the link for what i ve done:
https://www.youtube.com/watch?v=PGKP_GW5QfU
It seems that for some reason the Youtube tag isn't working; if anyone is interested, the URL is: https://www.youtube.com/watch?v=PGKP_GW5QfU (got it from quoting the post)

Re: Razer hydra emulation

Posted: Thu Mar 31, 2016 8:09 pm
by cybereality
Nice. Video seems to work for me.

Re: Razer hydra emulation

Posted: Thu Mar 31, 2016 8:58 pm
by TiagoTiago
cybereality wrote:Nice. Video seems to work for me.
I'm sorry about that; I'm so used to other forums having wonky embedding code, and on the other hand, html5 Youtube embedding working very effortlessly, that I didn't even thought of checking if any of my privacy/security related browser addons could be interfering with an embedded flash applet.

After fiddling with the settings, I'm getting the video here now.

Re: Razer hydra emulation

Posted: Fri Apr 01, 2016 5:42 am
by gladiusz
Anyone has any idea how to read ppJoy? If it worked with 6-axis it'd be awesome alternative for Sixense Stem and Hydra

Re: Razer hydra emulation

Posted: Fri Apr 01, 2016 7:44 am
by CyberVillain
with read you mean read the virtual gamepad created with ppJoy? It works with the joystick plugin

Re: Razer hydra emulation

Posted: Fri Apr 01, 2016 11:30 am
by gladiusz
Exactly. So ppjoy should be recognized as joystick[2] for example? I tried it but it didn't work. I'll try again.
EDIT: It doesn't work. FreePie see devices like joystick[1], joystick[2] and joystick[4] but it doesn't read any buttons and axis.

Re: Razer hydra emulation

Posted: Sun Apr 03, 2016 8:22 am
by CyberVillain
We read the joysticks like any game would so if your virtual stick is configured correctly you should be able to read it with the joystick plugin.

Re: Razer hydra emulation

Posted: Sun Apr 03, 2016 9:53 am
by gladiusz
I've tested it many times and it doesn't work. I've tried with the only one controller connected and I can easily assign buttons to virtual ppJoy controller, but I can't read. Virtual controller should be recognized as joystick[1] and it is, but values are 0 all time. I use PPJoy 0.8.4.6

Re: Razer hydra emulation

Posted: Sun Apr 03, 2016 8:02 pm
by geekmaster
geekmaster wrote:
CyberVillain wrote:But you said you still have the problem but on a different axis?
I do now. But earlier I tested code (which I did not save) that clearly behaved as described earlier and at different forums (gimbal lock on roll). I thought I had recreated that code but there are still anomalies in obscure locations when rotating the hydra.

The plan was that if I can have both code sets, one with gimbal lock only on roll and the other only on pitch, I can convert the quaternion both ways, one in getroll() and the other in getpitch(). ...
I just rememembered how to avoid gimbal lock in software. Instead of a fourth axis motor to drive the gyroscope away from gimble lock (as used in vintage military hardware), you do it in software simply by swapping coordinate systems when you approach gimble lock, pushing nearby gimble lock to an axis nearly 90-degrees away, which simulates motorized gimble lock avoidance. The downside is that you need to monitor your coordinates and translate axes when required.

Re: Razer hydra emulation

Posted: Mon Apr 04, 2016 12:59 am
by CyberVillain
gladiusz wrote:I've tested it many times and it doesn't work. I've tried with the only one controller connected and I can easily assign buttons to virtual ppJoy controller, but I can't read. Virtual controller should be recognized as joystick[1] and it is, but values are 0 all time. I use PPJoy 0.8.4.6

I do not have ppJoy installed since it needs windows in test mode etc, but i have vjoy and it works fine

Code: Select all

diagnostics.watch(joystick["vJoy Device"].getDown(0))
vJoy[0].setButton(0,mouse.leftButton)

Re: Razer hydra emulation

Posted: Mon Apr 04, 2016 1:01 am
by CyberVillain
geekmaster wrote:
geekmaster wrote:
CyberVillain wrote:But you said you still have the problem but on a different axis?
I do now. But earlier I tested code (which I did not save) that clearly behaved as described earlier and at different forums (gimbal lock on roll). I thought I had recreated that code but there are still anomalies in obscure locations when rotating the hydra.

The plan was that if I can have both code sets, one with gimbal lock only on roll and the other only on pitch, I can convert the quaternion both ways, one in getroll() and the other in getpitch(). ...
I just rememembered how to avoid gimbal lock in software. Instead of a fourth axis motor to drive the gyroscope away fron gimble lock (as used in vintage military hardware), you do it in software simply by swapping coordinate systems when you approach gimble lock, pushing nearby gimble lock to an axis nearly 90-degrees away, which simulates motorized gimble lock avoidance. The downside is that you need to monitor your coordinates and translate axes when required.
Cool, might something we can support in future. until then I guess it has to be taken care of in script

Re: Razer hydra emulation

Posted: Mon Apr 04, 2016 12:03 pm
by gladiusz
CyberVillain wrote:
gladiusz wrote:I've tested it many times and it doesn't work. I've tried with the only one controller connected and I can easily assign buttons to virtual ppJoy controller, but I can't read. Virtual controller should be recognized as joystick[1] and it is, but values are 0 all time. I use PPJoy 0.8.4.6

I do not have ppJoy installed since it needs windows in test mode etc, but i have vjoy and it works fine

Code: Select all

diagnostics.watch(joystick["vJoy Device"].getDown(0))
vJoy[0].setButton(0,mouse.leftButton)

Code: Select all

diagnostics.watch(joystick["PPJoy Virtual Joystick 1"].x)
diagnostics.watch(joystick[0].x)
ppJoy[0].setAxis(AxisTypes.X, 1000)
In FreePie values are 0 all time, but in Game Controller Panel everything is fine. I've also tested VJoy and there weren't any problems, but I need ppJoy.

Re: Razer hydra emulation

Posted: Tue Apr 05, 2016 2:06 am
by CyberVillain
That is really strange, does reading real joysticks work with the joystickplugin?

Re: Razer hydra emulation

Posted: Tue Apr 05, 2016 2:19 am
by gladiusz
Yes, it does. Reading real controllers, vJoy, Xbox controller works perfect. The only problem is ppJoy. I think that I installed everything correctly, because ppJoy is seen by games, control panel and x360ce.

Re: Razer hydra emulation

Posted: Tue Apr 05, 2016 3:04 am
by CyberVillain
That is crazy, we read the hardware with DirectX Input. So not much I can do there. There has been plans to use Raw input instead, dont know if that would work better

Re: Razer hydra emulation

Posted: Mon Apr 11, 2016 1:08 pm
by konstantin_lozev
Have you seen that?
https://m.youtube.com/watch?v=PGKP_GW5QfU
Oj the forum post from the description they mention FreePIE, but I could not rrad moe than that...

Re: Razer hydra emulation

Posted: Mon Apr 11, 2016 1:28 pm
by jim_davis
konstantin_lozev wrote:Have you seen that?
https://m.youtube.com/watch?v=PGKP_GW5QfU
Oj the forum post from the description they mention FreePIE, but I could not rrad moe than that...
Hahahahaha, I'm the fellow who made the original post on r/Oculus. The polish developer is actually in this thread a few posts above us (the same video has been linked here a few weeks ago). I feel like a dummy for not seeing it here in the first place.

Re: Razer hydra emulation

Posted: Mon Apr 11, 2016 11:18 pm
by konstantin_lozev
It's good to have a reason to come back to MTBS3D to comment. So, briefly, what is the state of PS Move support?

Re: Razer hydra emulation

Posted: Tue Apr 12, 2016 1:03 am
by gladiusz
Until FreePie doesn't read values from ppJoy, only my way works and give us hydra emulation with 4-axis. I remember that NoxWings was working on plugin for PS Move and PS Move Api library, but I'm afraid he lost his project

Re: Razer hydra emulation

Posted: Tue Apr 12, 2016 1:41 am
by CyberVillain
His work seems pushed to his repository at Github, maybe someone with a PS Move can pickup were he left off?

https://github.com/NoxWings/FreePIE

Re: Razer hydra emulation

Posted: Tue Apr 12, 2016 2:03 am
by CyberVillain
I merged his work with our master and created a branch


https://github.com/AndersMalmgren/FreePIE/tree/psmove

Re: Razer hydra emulation

Posted: Tue Apr 12, 2016 2:10 am
by gladiusz
Now it's good occasion to do it, because we have SCP drivers for PS Move Navigator. So it's no need to use Motioninjoy and motion controllers can be paired by default Windows Bluetooth drivers. Beyond that PS Move Api contains driver for Eye camera, so we don't have to pay for CL Eye drivers. The other way would be support for motion controller by SCP, but Nefarious, creator of SCP, is only interested in dualshock controllers. The last way is replacing ppJoy with vJoy, so someone smart can do it here https://github.com/darress/moveframework

Re: Razer hydra emulation

Posted: Tue Apr 12, 2016 2:50 am
by CyberVillain
No need for vjoy/ppjoy, you can interact directly with the library (MF_CWrapper.dll). Csharp code here can easily be ported to a FreePIE plugin

https://github.com/darress/moveframewor ... amework_CS

Re: Razer hydra emulation

Posted: Tue Apr 12, 2016 3:05 am
by CyberVillain
I compiled the program, please test if it works, you need some dlls from here

https://github.com/darress/moveframewor ... master/bin


Please check which ones we will need to include so do not copy them all

Re: Razer hydra emulation

Posted: Wed Apr 13, 2016 7:21 am
by CyberVillain
If above code works I can whip together a plugin in minutes.

Re: Razer hydra emulation

Posted: Wed Apr 13, 2016 9:18 am
by jim_davis
Hey this is probably going to be really dumb newbie question, but I don't think that I'm placing the DLL's in the correct folder. It asked for MF_CWrapper.dll first, which I placed in the folder with the exe you attached, but it was unable to find it.

Re: Razer hydra emulation

Posted: Wed Apr 13, 2016 10:53 am
by gladiusz
The same error. If it turned out to be helpful, some other polish guy, wrote next to MF_CWrapper.dll: "I modified CWrapperMain.cpp to get data with angular acceleration with function getAngularAcceleration, which works the same as getPosition. Function should be added to CSWrapper.cs".

Re: Razer hydra emulation

Posted: Thu Apr 14, 2016 12:45 am
by CyberVillain
It alaso need some or all of the other dlls

Re: Razer hydra emulation

Posted: Thu Apr 14, 2016 3:55 am
by gladiusz
Even with all dlls from github, it still asking for MF_CWrapper.dll. All I know is, we shouldn't copy CLEyeMulticam.dll, because it's out of date and it doesn't work under Windows 8 and 10. Instead of that we should install CL Eye SDK in developer mode.

Re: Razer hydra emulation

Posted: Thu Apr 14, 2016 5:09 am
by CyberVillain
Maybe someone needs to recompile the wrapper dll, i couldnt compile out of the box atlest.

Re: Razer hydra emulation

Posted: Thu Apr 14, 2016 12:31 pm
by CyberVillain
I recompiled the cpp solution in Release mode and ended up with two dlls, still get the same error you guys get. My limited cpp knowledge is not enough im afraid