Help with Android to TrackIR script
- RescueGamer
- Cross Eyed!
- Posts: 108
- Joined: Thu May 16, 2013 1:02 am
Help with Android to TrackIR script
Hi everyone, i'm trying to get headtracking on Dirt 3 with my DIY Rift which uses an android phone as tracker. Normally I use mouse emulation or the shared memory tracker plugin (only in vireio perception) with freepie. Since I don't know how to use the mouse on Dirt 3 I'm trying to use a script Android-TrackIR to get headtracking on the game knowing that Dirt 3 support head tracking with trackIR; but I can get anything functional, all Ii get on the trackIR variables is 0. So there's anyone who knows how to do a script for this?
Thanks!
Thanks!
-
- Petrif-Eyed
- Posts: 2166
- Joined: Mon Jun 22, 2009 8:36 am
- Location: Stockholm, Sweden
Re: Help with Android to TrackIR script
Dirt 2 worked with FreePIE with TrackIR fixer
http://naturalpointofview.blogspot.se/p ... fixer.html
Have you tried that?
You can base your script on the android > freetrack sample
http://andersmalmgren.github.io/FreePIE ... -freetrack
edit: Also we have gotten a few tips from the Opentrack team members that we are going to implement soon, we are a bit busy with work etc so it might take some time
http://naturalpointofview.blogspot.se/p ... fixer.html
Have you tried that?
You can base your script on the android > freetrack sample
http://andersmalmgren.github.io/FreePIE ... -freetrack
edit: Also we have gotten a few tips from the Opentrack team members that we are going to implement soon, we are a bit busy with work etc so it might take some time
- RescueGamer
- Cross Eyed!
- Posts: 108
- Joined: Thu May 16, 2013 1:02 am
Re: Help with Android to TrackIR script
Thanks for the info, I will try trackIR Fixer or basing on the freetrack script. Hope I can get this working
- RescueGamer
- Cross Eyed!
- Posts: 108
- Joined: Thu May 16, 2013 1:02 am
Re: Help with Android to TrackIR script
Nothing, i tried with trackirFixer, it catched the games, but don't move anything on cockpit view. Then I tried whit this script:
Another thing, with the freetrack script I don't see anything on the freetrack application too, I have to do something to activate freetrack or something?
But I don't see changes on the trackit program, and I can get anything on the gaming, I'm trying now with f1 2011 but nothing. This script is right? and another thing, if the script is right, I have to do something more in the trackir application or the games?def update():
global yaw
yaw = android[0].yaw
global pitch
pitch = -android[0].roll
global roll
roll = android[0].pitch
if starting:
centerYaw = 0
centerPitch = 0
centerRoll = 0
yaw = 0
pitch = 0
roll = 0
android[0].update += update
trackIR.yaw = yaw - centerYaw
trackIR.pitch = pitch - centerPitch
trackIR.roll = roll - centerRoll
if keyboard.getKeyDown(Key.LeftControl) and keyboard.getPressed(Key.C):
centerYaw = yaw
centerPitch = pitch
centerRoll = roll
Another thing, with the freetrack script I don't see anything on the freetrack application too, I have to do something to activate freetrack or something?
-
- Petrif-Eyed
- Posts: 2166
- Joined: Mon Jun 22, 2009 8:36 am
- Location: Stockholm, Sweden
Re: Help with Android to TrackIR script
Android uses radians and TackIR Degrees so you need to convert to degrees (Radians might be to small to show any output in trackir)RescueGamer wrote: ...
Wrap the output from anroid with math.degrees, i.e
yaw = math.degrees(android[0].yaw)
- RescueGamer
- Cross Eyed!
- Posts: 108
- Joined: Thu May 16, 2013 1:02 am
Re: Help with Android to TrackIR script
OK, so now I used this:
And in the wacth I see TrackIR.yaw 0, and doesn't change
Code: Select all
def update():
diagnostics.watch(trackIR.yaw)
global yaw
yaw = math.degrees(android[0].yaw)
global pitch
pitch = math.degrees(-android[0].roll)
global roll
roll = math.degrees(android[0].pitch)
if starting:
centerYaw = 0
centerPitch = 0
centerRoll = 0
yaw = 0
pitch = 0
roll = 0
android[0].update += update
trackIR.yaw = yaw - centerYaw
trackIR.pitch = pitch - centerPitch
trackIR.roll = roll - centerRoll
if keyboard.getKeyDown(Key.LeftControl) and keyboard.getPressed(Key.C):
centerYaw = yaw
centerPitch = pitch
centerRoll = roll
-
- Petrif-Eyed
- Posts: 2166
- Joined: Mon Jun 22, 2009 8:36 am
- Location: Stockholm, Sweden
Re: Help with Android to TrackIR script
It does not work like that, for x = trackIR.yaw you need a real trackIR to read fromRescueGamer wrote:OK, so now I used this:
And in the wacth I see TrackIR.yaw 0, and doesn't changeCode: Select all
def update(): diagnostics.watch(trackIR.yaw) global yaw yaw = math.degrees(android[0].yaw) global pitch pitch = math.degrees(-android[0].roll) global roll roll = math.degrees(android[0].pitch) if starting: centerYaw = 0 centerPitch = 0 centerRoll = 0 yaw = 0 pitch = 0 roll = 0 android[0].update += update trackIR.yaw = yaw - centerYaw trackIR.pitch = pitch - centerPitch trackIR.roll = roll - centerRoll if keyboard.getKeyDown(Key.LeftControl) and keyboard.getPressed(Key.C): centerYaw = yaw centerPitch = pitch centerRoll = roll
trackIR.yaw = x is fine since that will emulate trackIR
- RescueGamer
- Cross Eyed!
- Posts: 108
- Joined: Thu May 16, 2013 1:02 am
Re: Help with Android to TrackIR script
You were right, it worked! The final script I'm using is this:
Thanks for all, it works great!def update():
global yaw
yaw = filters.deadband(math.degrees(filters.continousRotation(android[0].googleYaw)), deadband)
global pitch
pitch = filters.deadband(math.degrees(-android[0].googleRoll), deadband)
global roll
roll = filters.deadband(math.degrees(-android[0].googlePitch), deadband)
if starting:
deadband = 0.01
centerYaw = 0
centerPitch = 0
centerRoll = 0
yaw = 0
pitch = 0
roll = 0
android[0].update += update
trackIR.yaw = yaw - centerYaw
trackIR.pitch = pitch - centerPitch
trackIR.roll = roll - centerRoll
if keyboard.getKeyDown(Key.LeftControl) and keyboard.getPressed(Key.C):
centerYaw = yaw
centerPitch = pitch
centerRoll = roll
-
- One Eyed Hopeful
- Posts: 21
- Joined: Fri Oct 17, 2014 1:50 am
Re: Help with Android to TrackIR script
With or Without TrackIR fixer ?RescueGamer wrote:Thanks for all, it works great!
I tryed yesterday with F1 2012 and it didn't work for me, today I'll try Dirt 2/3.
Edit:
It's working now, with F1 2012, Dirt 3 and GTR2. AMAZING !!!!
Yesterday the problem was that I wasn't in the cockpit view, silly me