The MP3car.com Store  

Welcome to the MP3Car.com forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. Registering will also remove advertisements. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.

Go Back   MP3Car.com > Mp3Car Technical > Software & Software Development

Reply
 
Thread Tools Display Modes
Old 01-20-2007, 08:15 PM   #1
inh
Maximum Bitrate
 
Join Date: Jan 2007
Location: Fort Riley KS
Vehicle: 91 CRX Si
Posts: 514
My Photos: (0)
Space Navigator PE GlovePIE script

To keep from polluting the Space nav driver developmen thread with my glovepie scripting, i decided to make my own thread..

If you want to get your Space nav working as something that sends key commands, follow the directions here http://blog.ifallacy.com/ to get PPjoy and GlovePIE installed. Then load up my attached script in glovepie below..

Since i use roadrunner, here are some snippets from my ini file's to get it working with the mp3 player..

execTBL.ini:
Code:
"SN_RT","RRNEXT" "SN_LT","RRPREV" "SN_UP","VOL+" "SN_DN","VOL-" "SN_1","PLAY"

and keyTBL:
Code:
6038,"SN_UP" 6040,"SN_DN" 6037,"SN_LT" 6039,"SN_RT" 6049,"SN_1"

For those of you not using RR, the keymappings are ctrl + alt + (numer 1, and the four directional arrow keys)

Edit your files accordingly, and then load up my script in GlovePIE and have some fun

as it is, press down on the hat to play/pause (ctrl + alt + 1)
tilt left and right to skip forewards/backwards through songs (ctrl + alt + (left/right arrow))
tilt up and down to toggle through the list, just liek you were pressing the up and down arrow keys..

script:
Code:
//ver 1.0 by inh //Routine to determine which axis is being acted upong the most due to it being //inevitable that more than one axis will change at a time //this checks all values after a specified time and determines which one changed the most //get a position reading from all axises var.roll.1 = MapRange(Joystick1.roll, -1,1, 0,1) var.yaw.1 = MapRange(Joystick1.yaw, -1,1, 0,1) var.pitch.1 = MapRange(Joystick1.pitch, -1,1, 0,1) var.x.1 = MapRange(Joystick1.x, -1,1, 0,1) var.y.1 = MapRange(Joystick1.y, -1,1, 0,1) var.z.1 = MapRange(Joystick1.z, -1,1, 0,1) //wait a bit, then get positions again wait 200ms var.roll.2 = MapRange(Joystick1.roll, -1,1, 0,1) var.yaw.2 = MapRange(Joystick1.yaw, -1,1, 0,1) var.pitch.2 = MapRange(Joystick1.pitch, -1,1, 0,1) var.x.2 = MapRange(Joystick1.x, -1,1, 0,1) var.y.2 = MapRange(Joystick1.y, -1,1, 0,1) var.z.2 = MapRange(Joystick1.z, -1,1, 0,1) //compare second reading to first usign subtraction, then use th absolute function so that even negative values //return whole numbers. the greated var.whatever.diff value will be the axis that has changed the most var.roll.diff = abs(var.roll.2 - var.roll.1) var.yaw.diff = abs(var.yaw.2 - var.yaw.1) var.pitch.diff = abs(var.pitch.2 - var.pitch.1) var.x.diff = abs(var.x.2 - var.x.1) var.y.diff = abs(var.y.2 - var.y.1) var.z.diff = abs(var.z.2 - var.z.1) //Filter to filter out very slight movements of the hat (it must cause an increas (or decrease) of more than 0.04 to continue...) if ((var.roll.diff >= 0.04) or (var.yaw.diff >= 0.04) or (var.pitch.diff >= 0.04) or (var.x.diff >= 0.04) or (var.y.diff >= 0.04) or (var.z.diff >= 0.04)) //super-sloppy if tree to figure out which var.*.diff is the greatest, and then act accordingly.. //as of now it just spits out which axis is being acted upon up in the debug bar at the top //of the scripting window.. if ((var.roll.diff > var.yaw.diff) and (var.roll.diff > var.pitch.diff) and (var.roll.diff > var.x.diff) and (var.roll.diff > var.y.diff) and (var.roll.diff > var.z.diff)) var.roll.dir = sign(var.roll.2 - var.roll.1) if (var.roll.dir = -1) debug = "Roll (Twist Left)" key.ctrl = 1 key.alt = 1 key.down = 1 wait 100ms key.ctrl = 0 key.alt = 0 key.down = 0 elseif (var.roll.dir = 1) debug = "Roll (Twist Right)" key.ctrl = 1 key.alt = 1 key.up = 1 wait 100ms key.ctrl = 0 key.alt = 0 key.up = 0 endif else if ((var.yaw.diff > var.roll.diff) and (var.yaw.diff > var.pitch.diff) and (var.yaw.diff > var.x.diff) and (var.yaw.diff > var.y.diff) and (var.yaw.diff > var.z.diff)) var.yaw.dir = sign(var.yaw.2 - var.yaw.1) if (var.yaw.dir = -1) debug = "Yaw (Tilt Right)" key.ctrl = 1 key.alt = 1 key.right = 1 wait 600ms key.ctrl = 0 key.alt = 0 key.right = 0 elseif (var.yaw.dir = 1) debug = "Yaw (Tilt Left)" key.ctrl = 1 key.alt = 1 key.left = 1 wait 600ms key.ctrl = 0 key.alt = 0 key.left = 0 endif else if ((var.pitch.diff > var.roll.diff) and (var.pitch.diff > var.yaw.diff) and (var.pitch.diff > var.x.diff) and (var.pitch.diff > var.y.diff) and (var.pitch.diff > var.z.diff)) var.pitch.dir = sign(var.pitch.2 - var.pitch.1) if (var.pitch.dir = -1) debug = "Pitch (Tilt Forewards)" key.up = 1 wait 100ms key.up = 0 elseif (var.pitch.dir = 1) debug = "Pitch (Tilt Backwards)" key.down = 1 wait 100ms key.down = 0 endif elseif ((var.x.diff > var.yaw.diff) and (var.x.diff > var.pitch.diff) and (var.x.diff > var.roll.diff) and (var.x.diff > var.y.diff) and (var.x.diff > var.z.diff)) var.x.dir = sign(var.x.2 - var.x.1) if (var.x.dir = -1) debug = "X (Slide Left)" elseif (var.x.dir = 1) debug = "X (Slide Right)" endif else if ((var.y.diff > var.roll.diff) and (var.y.diff > var.pitch.diff) and (var.y.diff > var.x.diff) and (var.y.diff > var.yaw.diff) and (var.y.diff > var.z.diff)) var.y.dir = sign(var.y.2 - var.y.1) if (var.y.dir = -1) debug = "Y (Slide Forewards)" elseif (var.y.dir = 1) debug = "Y (Slide Backwards)" endif else if ((var.z.diff > var.roll.diff) and (var.z.diff > var.yaw.diff) and (var.z.diff > var.x.diff) and (var.z.diff > var.y.diff) and (var.z.diff > var.pitch.diff)) var.z.dir = sign(var.z.2 - var.z.1) if (var.z.dir = -1) debug = "Z (Pull Up)" elseif (var.z.dir = 1) debug = "Z (Push Down)" key.1 = 1 key.ctrl = 1 key.alt = 1 wait 500ms key.1 = 0 key.ctrl = 1 key.alt = 1 endif else debug = " " endif else debug = "Press harder/longer girly-man" endif var.roll.1 = 0 var.yaw.1 = 0 var.pitch.1 = 0 var.x.1 = 0 var.y.1 = 0 var.z.1 = 0 var.roll.2 = 0 var.yaw.2 = 0 var.pitch.2 = 0 var.x.2 = 0 var.y.2 = 0 var.z.2 = 0

inh is offline   Reply With Quote
Sponsored Links
Old 01-21-2007, 01:39 PM   #2
Newbie
 
Join Date: Jul 2006
Location: Plano, TX
Vehicle: 2006/Nissan/Altima
Posts: 48
My Photos: (0)
Excellent Work !!!
azhar97 is offline   Reply With Quote
Old 01-21-2007, 05:44 PM   #3
inh
Maximum Bitrate
 
Join Date: Jan 2007
Location: Fort Riley KS
Vehicle: 91 CRX Si
Posts: 514
My Photos: (0)
Thanks I hope some other people took the time to get glovepie setup for use with the space nav.. i cant wait till we have a dedicated drive released, this thing is AWESOME for working with roadrunner
inh is offline   Reply With Quote
Old 01-24-2007, 06:58 PM   #4
Maximum Bitrate
 
Join Date: Oct 2003
Location: Copenhagen, Denmark
Vehicle: Citroen Xsara 2,0 16V VTS
Posts: 727
My Photos: (0)
Does GlovePIE let you use Activex/Com objects in your code ?
__________________
Transflective Lilliput 8", LV-677DC Core Duo 1,83Ghz, , Mpegbox uSDC20D, Shuttle Express, HQCT, PG XS6600 http://carpc.boyakasha.dk
_dopehead_ is offline   Reply With Quote
Old 01-24-2007, 09:35 PM   #5
inh
Maximum Bitrate
 
Join Date: Jan 2007
Location: Fort Riley KS
Vehicle: 91 CRX Si
Posts: 514
My Photos: (0)
not sure, why would you need to?
__________________
Space Navigator - 6 Axis input device: Take it apart - Driver App
RRCam - Video/webcam capture, text overlay, and recording: 2.0 Stable
inh is offline   Reply With Quote
Old 01-24-2007, 10:34 PM   #6
Maximum Bitrate
 
Join Date: Oct 2003
Location: Copenhagen, Denmark
Vehicle: Citroen Xsara 2,0 16V VTS
Posts: 727
My Photos: (0)
I was thinking of doing maybe some different functions other than keypress when a certain skin in RR is started like my GPS which has no keyboard shortcuts or API yet. If we can call the RR SDK we could get information from RR about what screen is active, maybe there is another way of doing this, i don't know.
__________________
Transflective Lilliput 8", LV-677DC Core Duo 1,83Ghz, , Mpegbox uSDC20D, Shuttle Express, HQCT, PG XS6600 http://carpc.boyakasha.dk
_dopehead_ is offline   Reply With Quote
Old 01-24-2007, 10:40 PM   #7
inh
Maximum Bitrate
 
Join Date: Jan 2007
Location: Fort Riley KS
Vehicle: 91 CRX Si
Posts: 514
My Photos: (0)
ah ok gotcha.. take a look around the glovepie scripting, though i dont think it is able to do what ya want =[ why not implement keycombos in your gps? or is it not your gps app.. =[
__________________
Space Navigator - 6 Axis input device: Take it apart - Driver App
RRCam - Video/webcam capture, text overlay, and recording: 2.0 Stable
inh is offline   Reply With Quote
Old 01-28-2007, 08:32 PM   #8
Maximum Bitrate
 
Join Date: Oct 2003
Location: Copenhagen, Denmark
Vehicle: Citroen Xsara 2,0 16V VTS
Posts: 727
My Photos: (0)
Will look through GlovePie site
I can't implement keyboard shortcuts in my gps appl. it's simply not supported, so i am thinking of doing a mouse emulation when RR starts my GPS, for this i would want to have RR send me window messages about current screen.
__________________
Transflective Lilliput 8", LV-677DC Core Duo 1,83Ghz, , Mpegbox uSDC20D, Shuttle Express, HQCT, PG XS6600 http://carpc.boyakasha.dk
_dopehead_ is offline   Reply With Quote
Old 02-27-2007, 06:29 PM   #9
Newbie
 
Join Date: Feb 2007
Posts: 1
My Photos: (0)
I'm not sure I am in the good forum to expose my problem, but someone with glovepie/spacenavigator knowledge might have a solution. My situation is as follow; I got the space navigator device from 3d connexion. Having installed PPjoy and 3dxppjoy, I m sending midi messages to music programs through Midi yoke.
Here is an example of the very basic "script"

midi.BankSelectLevel = MapRange(Joystick2.x, -1,1, 0,127)/127
midi.ModWheel = MapRange(Joystick2.y, -1,1, 0,127)/127
midi.Breath = MapRange(Joystick2.z, -1,1, 0,127)/127
midi.Control3 = MapRange(Joystick2.pitch, -1,1, 0,127)/127
midi.FootPedal = MapRange(Joystick2.yaw, -1,1, 0,127)/127
midi.PortamentoTime = MapRange(Joystick2.roll, -1,1, 0,127)/127

Well, the data is sent and read with no problem from external music app, except for a very annoying detail: normally midi data consist of integrated numbers between 0 - 127. Well, in my case the data received by all tested applications shows that it is going beyond these limits. The result being that when for example a knob gets to its maximum, it "virtually" continues to increase above 127. It is very annoying as afterwards, the knob's value won t decrease before it gets back to 127 (which, depending on how long u held it, could take some time).
Is there anyway of preventing this by, let's say, limiting the output data threshold?

Thanks in advance for any suggestions

P.S. I have also tried to use EnsureMap, and EnsureRangeMap with no success.
Bugs is offline   Reply With Quote
Old 03-23-2007, 06:20 PM   #10
Constant Bitrate
 
Join Date: Aug 2006
Location: Central PA
Vehicle: 2001 Chevy Camaro SS
Posts: 183
My Photos: (0)
Works great! Thanks a bunch. Only thing I'm curious about is if there is there any way to add context switching?
__________________
2001 SS Camaro carputer
scotty562 is offline   Reply With Quote
Sponsored Links
Old 07-22-2007, 08:39 AM   #11
Variable Bitrate
 
nemo1's Avatar
 
Join Date: Jun 2006
Posts: 258
My Photos: (0)
The link in the first post is not working. Anyone got another tutorial on how to install PPjoy and GlovePie?
nemo1 is offline   Reply With Quote
Old 08-11-2007, 10:46 AM   #12
Variable Bitrate
 
nemo1's Avatar
 
Join Date: Jun 2006
Posts: 258
My Photos: (0)
Hi...I have got it working. I noticed one thing. When I tilt up and down to toggle through the list, it works. After I toggle to a song I want and press the hat to play it, everything is fine up to this point. When I toggle again it becomes volume increase and decrease.

Any plans to make it control volume or its already there and I did something wrong. Wonder if it would be a good idea to make use the side buttons, think that should be more straight forward.

BTW good job
nemo1 is offline   Reply With Quote
Old 08-11-2007, 02:00 PM   #13
inh
Maximum Bitrate
 
Join Date: Jan 2007
Location: Fort Riley KS
Vehicle: 91 CRX Si
Posts: 514
My Photos: (0)
Thanks =] That script is really just a quick hack i threw together in like two hours the day i got my space navigator.. All current efforot is with another application, written by people on this forum. Check out the driver dev link in my sig. You need to uninstall all the ppjoy crap and get the factory drivers back on the spacenav, but then this lil tiny app that you configure with an xml file takes over and sends commands. I have it controlling volume, play/pause, next/prev, as well as acting as a mouse. It is also able to do different things based on what screen is being displayed (im still workin on getting this setup)

go check it out, most importantly on the last few pages where i've posted my code.
__________________
Space Navigator - 6 Axis input device: Take it apart - Driver App
RRCam - Video/webcam capture, text overlay, and recording: 2.0 Stable
inh is offline   Reply With Quote
Old 08-11-2007, 10:18 PM   #14
Variable Bitrate
 
nemo1's Avatar
 
Join Date: Jun 2006
Posts: 258
My Photos: (0)
Great...i'll take a look. ....I saw the code on the last page of the Driver Dev link but where do I place them?

Last edited by nemo1 : 08-11-2007 at 10:28 PM.
nemo1 is offline   Reply With Quote
Old 08-12-2007, 01:51 AM   #15
inh
Maximum Bitrate
 
Join Date: Jan 2007
Location: Fort Riley KS
Vehicle: 91 CRX Si
Posts: 514
My Photos: (0)
download the app from the sourceforge link in cherrybombs sig, then do a search on google and download xerces-c_2_7.dll and put it in the same folder
__________________
Space Navigator - 6 Axis input device: Take it apart - Driver App
RRCam - Video/webcam capture, text overlay, and recording: 2.0 Stable
inh is offline   Reply With Quote
Sponsored Links
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Script to Automatically press F3 when off course - Streets and Trips 2006 breaker021 GPS 6 06-02-2006 09:20 AM
space cadets lez Off Topic 2 12-11-2005 11:45 AM


All times are GMT -5. The time now is 11:42 AM.


Sponsored Links
The MP3car.com Store

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.1.0
Copyright © 1999 - 2008 Mp3Car.com Inc.
Ad Management by RedTyger
Message Board Statistics