It is currently Tue Sep 17, 2019 7:13 pm



Reply to topic  [ 2 posts ] 
 Vuzix tracker module: No update function? 
Author Message
One Eyed Hopeful

Joined: Fri Dec 23, 2011 9:55 pm
Posts: 7
Reply with quote
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:
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


Sun Sep 15, 2013 3:51 pm
Profile
Petrif-Eyed

Joined: Mon Jun 22, 2009 8:36 am
Posts: 2160
Location: Stockholm, Sweden
Reply with quote
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:
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

_________________
FreePIE
My blog


Mon Sep 16, 2013 12:52 am
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB® Forum Software © phpBB Group
Designed by STSoftware.