Warthunder do not see TrackIR with FreePIE start

Official forum for open source FreePIE discussion and development.
Post Reply
Me4huk
One Eyed Hopeful
Posts: 2
Joined: Thu Mar 04, 2021 11:15 am

Warthunder do not see TrackIR with FreePIE start

Post by Me4huk »

Hello everyone. I am trying to make a simple script to modify input on Y-axis on TrackIR 5 by keypress, so that ingame camera will rise above the current position without the need to stretch my neck out. But the problem is that after running the script in FreePIE and starting the game, ingame tracking doesn't work. I'm not sure that my current script is correct for what I'm trying to achieve and I don't understand why ingame tracking doesn't work with FreePIE, so I look for your help.

Code: Select all

def update():
	y = trackIR.y
	
	if keyboard.getKeyDown(Key.C):
		y = 200
		trackIR.y = y
	else:	y = trackIR.y

	diagnostics.watch(y)

if starting:
	global y
	y = 0
	trackIR.update += update
Jabberwock
Cross Eyed!
Posts: 197
Joined: Mon Mar 02, 2015 3:58 pm

Re: Warthunder do not see TrackIR with FreePIE start

Post by Jabberwock »

Most likely TrackIR can be accessed by only one program at a time. And even if it was possible to access it, it would not work the way you want it to, because there is no way to tell the game it should only look at the modified value and not the original one.

If you run FreePIE first and it blocks TrackIR from the game, maybe it could be possible to route it somehow (e.g. via OpenTrack) in a way that could still be seen in the game. But that is rather theoretical...
Me4huk
One Eyed Hopeful
Posts: 2
Joined: Thu Mar 04, 2021 11:15 am

Re: Warthunder do not see TrackIR with FreePIE start

Post by Me4huk »

Jabberwock wrote: Fri Mar 05, 2021 6:09 am Most likely TrackIR can be accessed by only one program at a time.
Thank you, it seems exactly the case. I've done some digging here and found a working way that assumes a chain TrackIR → GlovePIE → Python → Opentrack → Warthunder. But how can I do it with FreePIE, to send data from it directly to Opentrack?

https://www.youtube.com/watch?v=Mg7rMMvQ36s

EDIT: aborting this question, have found a way. Will try to work from this:

Code: Select all

import socket
import struct

def update():
	yaw = trackIR.yaw
	pitch = trackIR.pitch
	roll = trackIR.roll	
	x = trackIR.x
	y = trackIR.y
	z = trackIR.z
		
	if keyboard.getKeyDown(Key.C):	y = 200
	else:							y = trackIR.y

	opentrack_UDPsender.sendto(struct.pack("dddddd", x, y, z, yaw, pitch, roll), ("localhost", 4242))
	#SendOsc('localhost', 6666, "/glovepie/pithon", yaw, pitch, roll, x, y, z)

	diagnostics.watch(yaw)
	diagnostics.watch(pitch)
	diagnostics.watch(roll)
	diagnostics.watch(x)
	diagnostics.watch(y)
	diagnostics.watch(z)	

if starting:
	global yaw, pitch, roll, x, y, z
	x , y , z , yaw , pitch , roll = 0,0,0,0,0,0
	opentrack_UDPsender = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
	trackIR.update += update
Jabberwock
Cross Eyed!
Posts: 197
Joined: Mon Mar 02, 2015 3:58 pm

Re: Warthunder do not see TrackIR with FreePIE start

Post by Jabberwock »

It is certainly possible, but, unfortunately, requires some work...

The list of outputs produced by FreePIE which can be read as input is rather limited. The most simple is a generic controller/joystick - FreePIE can simulate one and OpenTrack can read one. However, it is not that easy to get it right, as OT for some reason converts the received values, so it is not a straightforward process.

If you are good with Python, you might try sending the values over UDP. However, it is not supported in any way by FreePIE, so you need to do all the work in its Python implementation. Note that there are two different protocols - the FreePIE one and the internal OT one. You can find the info on them by googling. I have tried that and failed, unfortunately.

I think that FreePIE can produce Razer Hydra output and OT can accept it, but I have never tried it. It might be similar to the joystick emulation.
Post Reply

Return to “FreePIE”