Vuzix tracker module: No update function?

Official forum for open source FreePIE discussion and development.
Post Reply
mxxmmxxm
One Eyed Hopeful
Posts: 7
Joined: Fri Dec 23, 2011 9:55 pm

Vuzix tracker module: No update function?

Post by mxxmmxxm »

Hi! Sorry to trouble everyone, but I'm trying to set up a basic vuzix->TrackIR emulation script, and I've run into a difficulty. Using the example android->freetrack script on the site, as a template, I tried just substituting vuzix and trackir, but the Vuzix module doesn't seem to have an update signal.

How would I handle the update() function in this case?

(If it's helpful, here's the code I've got.

Code: Select all

def update():
    global yaw
    yaw = vuzix.yaw
    global pitch
    pitch = -vuzix.roll
    global roll
    roll = vuzix.pitch

if starting:
    centerYaw = 0
    centerPitch = 0
    centerRoll = 0
   
    yaw = 0
    pitch = 0
    roll = 0
    vuzix.update += update #This part doesn't work.

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
CyberVillain
Petrif-Eyed
Posts: 2166
Joined: Mon Jun 22, 2009 8:36 am
Location: Stockholm, Sweden

Re: Vuzix tracker module: No update function?

Post by CyberVillain »

not all plugins can use the update event for different reasons. Brantlew wrote the vuxiz plugin and I know he does not like the event model. He favors the polling model.


You can do it like this

Code: Select all

def update():
    global yaw
    yaw = vuzix.yaw
    global pitch
    pitch = -vuzix.roll
    global roll
    roll = vuzix.pitch

if starting:
    centerYaw = 0
    centerPitch = 0
    centerRoll = 0
   
    yaw = 0
    pitch = 0
    roll = 0

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
Post Reply

Return to “FreePIE”