For anyone with the same problem, here's my solution I eventually used:
Code:
import viz
import vizact
import viztask
viz.go()
#CONSTANTS
TIMER_SPEED = 0.1
SEC_DELAY = 4
yaw_list = []
pitch_list = []
roll_list = []
def logTrackingData():
orientation = viz.MainView.getEuler()
yaw_list.append(orientation[0])
pitch_list.append(orientation[1])
roll_list.append(orientation[2])
def readTrackingData():
global yaw, pitch, roll
#Read information
yaw = yaw_list[0]
pitch = pitch_list[0]
roll = roll_list[0]
#Delete information already read
yaw_list.pop(0)
pitch_list.pop(0)
roll_list.pop(0)
def readWithDelay():
#Wait 4 seconds
yield viztask.waitTime(SEC_DELAY)
vizact.ontimer(TIMER_SPEED, readTrackingData)
vizact.ontimer(TIMER_SPEED, logTrackingData)
viztask.schedule(readWithDelay())