How do i set up FreePie to track my EyeX sentry

Official forum for open source FreePIE discussion and development.
Post Reply
RedRiot
One Eyed Hopeful
Posts: 4
Joined: Mon Nov 16, 2015 1:08 pm

How do i set up FreePie to track my EyeX sentry

Post by RedRiot »

So ive bin trying to get my FreePie code to work and im getting this one error: Can't assign to read-only property yaw of type `TobiiEyeXGlobal`
what do i need to fix to get this to work? having a hard time finding toturials for setting this up atm :P
using the code that eyebo7 linked in this thread: http://www.mtbs3d.com/phpBB/viewtopic.php?f=139&t=21347
and altered it from freetrack to TobiiEyeX

any help is super welcome!
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: How do i set up FreePie to track my EyeX sentry

Post by CyberVillain »

SHow us the altered code
RedRiot
One Eyed Hopeful
Posts: 4
Joined: Mon Nov 16, 2015 1:08 pm

Re: How do i set up FreePie to track my EyeX sentry

Post by RedRiot »

CyberVillain wrote:SHow us the altered code
here you have it. sorry for slow response. was losing hopes on getting an aswer so forgot about the post for a bit.

import time
import math

class Util(object):
HalfPi = math.pi / 2.0

@staticmethod
def IsEven(x):
return x % 2 == 0

@staticmethod
def Clamp(value, minValue, maxValue):
return min(max(value, minValue), maxValue)

@staticmethod
def SensitivityTransform(x):
a = 2
b = 1.2

t = min(math.floor(b * x), 1)
return ((1 - t) * (((b * x) ** a) / b)) + (t * (1 - ((((b / (b - 1)) * (1 - x)) ** a) / (b / (b - 1)))))

@staticmethod
def SensitivityTransformPowerOf(x, power):
# y = 1 - cos((x ** 3) * HalfPi)

if Util.IsEven(power) and x < 0:
y = -(x ** power)
else:
y = (x ** power)
return y

class Vector2(object):
def __init__(self, x, y):
self.X = x
self.Y = y

@property
def Magnitude(self):
return math.sqrt((self.X ** 2 + self.Y ** 2))

def Scale(self, scaleFactor):
self.X = self.X * scaleFactor
self.Y = self.Y * scaleFactor

def Normalize(self):
self.X = self.X / self.Magnitude()
self.Y = self.Y / self.Magnitude()

#######################################################################################################################

if starting:
yaw = 0
pitch = 0
tobiiEyeXDeltaRange = math.pi
tobiiEyeXDeltaVector = Vector2(0, 0)
updateTimeStamp = time.time()

# Game specific settings
# DiRT Rally
sensitivity = 0.5
minYaw = -0.6 * tobiiEyeXDeltaRange
maxYaw = 0.6 * tobiiEyeXDeltaRange
minPitch = -0.2 * tobiiEyeXDeltaRange
maxPitch = 0.3 * tobiiEyeXDeltaRange

deltaTime = time.time() - updateTimeStamp
rotationalSpeed = (tobiiEyeXDeltaRange * deltaTime) * sensitivity
tobiiEyeXDeltaVector = Vector2(tobiiEyeX.normalizedCenterDeltaX, tobiiEyeX.normalizedCenterDeltaY)
tobiiEyeXDeltaVector.Scale(Util.SensitivityTransformPowerOf(min(tobiiEyeXDeltaVector.Magnitude, 1), 1) * rotationalSpeed)

yaw -= tobiiEyeX.normalizedCenterDeltaX
yaw = Util.Clamp(yaw, minYaw, maxYaw)
pitch -= tobiiEyeXDeltaVector.Y
pitch = Util.Clamp(pitch, minPitch, maxPitch)

tobiiEyeX.yaw = yaw
tobiiEyeX.pitch = pitch

updateTimeStamp = time.time()


#diagnostics.watch(tobiiEyeXDeltaVector.X)
#diagnostics.watch(tobiiEyeXDeltaVector.Y)
#diagnostics.watch(tobiiEyeX.yaw)
#diagnostics.watch(tobiiEyeX.pitch)


thing is. im new to this. and ive just used a code someone linked via another vid where he uses the Steelseries sentry with FreePie to controll the freecam in Elite Dangerous.
RedRiot
One Eyed Hopeful
Posts: 4
Joined: Mon Nov 16, 2015 1:08 pm

Re: How do i set up FreePie to track my EyeX sentry

Post by RedRiot »

one thing i did find out is that if i write tobiiEyeX. " . " there comes up a list of commands different from the script ive copied and altered. and i guess that has to be altered aswell. i just dont know the equivelent code for say: tobiiEyeXDeltaRange. as DeltaRange does not exist in the tobiiEyeX. command dropdown list :s
Post Reply

Return to “FreePIE”