Current Version Download Link: https://dl.dropboxusercontent.com/u/413 ... in-001.zip
It currently needs quite a bit of work, but the basic hand tracking is in. I got some poor, but promising results emulating the Hydra in the Tuscany Hydra demo. A big part of my problem is that I don't have a Hydra, so I don't know the actual ranges used/expected. For example, normalizing the x,y,z position in the leap motion results in a 0 to 1 range relative to the left and top of the field of view around the Leap. They refer to it as the interaction box: https://developer.leapmotion.com/docume ... onBox.html
The script below is what I am using by trial and error that gave me the best results emulating the Hydra so far. I included the diagnostic.watch for each of the existing values captured by the plugin for your reference. The orientations are on -/+ pi on each axis. The positions are normalized from 0 to 1 and I converted them to -1000 to 1000 range, in the script below, because some of my initial searches turned up Hydra positional values in this range, but that's only a guess at this point.
If you want to use this very early version of the plugin,
1) Acquire a leap motion or take it out of that drawer
2) Install the Latest Skeletal Tracking Beta https://developer.leapmotion.com/
3) Install .net 4.0 or higher framework if you don't already have it installed
4) Unzip the archive into your Freepie folder so the LeapMotionFreepiePlugin.dll file is in the plugins folder (e.g., C:\Program Files\FreePie\plugins) and the other dlls (Leap.dll, LeapCSharp.dll, LeapCSharp.NET4.0.dll, msvcp120.dll, mscvcr120.dll) are in the root of the Freepie folder (e.g., C:\Program Files\FreePie)
5) If you want to emulate the hydra copy the sixense_fake.dll (located in the root folder of your FreePIE installation) over the sixense.dll in the folder of the application you want use this plugin with.
6) Run a script like the one below, but hopefully better and more compatible with the Razer or any device you want to emulate with the Leap supported by FreePIE.
7) You will need to bind a key to the triggers of the hydra 0 and 1 for the calibration stages (e.g., mouse click). I used my gesture, which is a bit wonky right now, but it's serviceable.
Some caveats, right versus left hand detection only works when two hands are detected. It detects the right most and left most hand. So one hand is detected as both right and left, since it is technically the right most and left most hand when its alone. At a later stage you could restrict left and right hands to either side of the Leap to avoid glitchy behavior. But that introduces a few other issues, like restricted movement (left hand couldn't cross over to the right side of leap physically).
I hope someone with experience with the Leap can help test and sort out the translation to other devices like the Hydra, either by suggesting improvements to the script or my Leap API/plugin development, which I just started learning. The big issues right now are the positional/orientation translation to Hydra, and figuring out how best to emulate calibration with the Leap (i.e., where should your hands be when it says touch your shoulders or point at the base).
Update 6/27 - I had better results using the Sixense test app from the SDK. It also has very nice logging capabilities to see the hydra reported position and orientation for comparison against the leap values. The position mapping worked surprising well, as well as the pitch, yaw, and roll (once reversed). I experimented some with different ranges, and increase the range of the x position increases the currently restricted range of motion left to right (e.g., 1000 to 2000). I don't think the calibration will be much of a problem; the sdk documentation says its mainly for determining the hemisphere of the unit relative to the base. Make index finger typing motions with your right hand to emulate hydra button presses to move past the calibration, if you are using my example script.
Link to Sixense app (it's in the samples/win32 folder) : http://sixense.com/windowssdkdownload
Don't forget to replace the sixense.dll with sixense_fake.dll (discussed above).
Code: Select all
diagnostics.watch(leap.rightpitch) diagnostics.watch(leap.rightyaw) diagnostics.watch(leap.rightroll) diagnostics.watch(leap.rightxpos) diagnostics.watch(leap.rightypos) diagnostics.watch(leap.rightzpos) diagnostics.watch(leap.leftpitch) diagnostics.watch(leap.leftyaw) diagnostics.watch(leap.leftroll) diagnostics.watch(leap.leftxpos) diagnostics.watch(leap.leftypos) diagnostics.watch(leap.leftzpos) diagnostics.watch(leap.typekeytapgesture) hydra.yaw = leap.rightyaw hydra.pitch = leap.rightpitch hydra.roll = -leap.rightroll hydra.x = filters.mapRange(leap.rightxpos, 0, 1, -1000,1000) hydra.y = filters.mapRange(leap.rightypos, 0, 1, -1000,1000) hydra.z = filters.mapRange(leap.rightzpos, 0, 1, -1000,1000) hydra.yaw = leap.leftyaw hydra.pitch = leap.leftpitch hydra.roll = -leap.leftroll hydra.x = filters.mapRange(leap.leftxpos, 0, 1, -1000,1000) hydra.y = filters.mapRange(leap.leftypos, 0, 1, -1000,1000) hydra.z = filters.mapRange(leap.leftzpos, 0, 1, -1000,1000) hydra.trigger = leap.typekeytapgesture hydra.trigger = leap.typekeytapgesture
6/27 - Updated example script to use mapRange function to increase legibility.