View Single Post
  #1  
Old 07-26-2016, 07:03 AM
bbb bbb is offline
Member
 
Join Date: Nov 2015
Posts: 46
question regarding viz.getpostion written into text file

Hey all,
I'm using vizard 5.3 for navigation test using Oculus rift Dk2(runtime 0.8) and xbox one controller. In order to calculate some measurements from the experiment we write every 100ms:

# Get the tracking data.
def getData(tracking_data, startTime):
orientation = viz.MainView.getEuler()
position = viz.MainView.getPosition()
timeStamp = viz.tick()
# Make a string out of the data.
data = 'orientation: ' + str(orientation) + '\t' + 'position: ' + str(position) + '\t' 'time: ' + str(timeStamp - startTime) + '\n'
# Write it to the tracking file.
tracking_data.write(data)

The loop runs 3 times(3 tries per day for this test), each time is a different trial(try) and it uses the getData function to write to text file(different text file for each trial).

trials = range(1, 4)

for i in trials:
# enable movement
walking_transport.setEnabled(viz.ON)
# disable orientation
ori_transport.setEnabled(viz.OFF)

# store the time at which this trial started
startTime = viz.tick()
tracking_data = open(participant_code + '_hidden_12X12 trackingDataTrial' + str(i) + '.txt', 'a')
expTimer = vizact.ontimer(0.1, getData, tracking_data, startTime)

Sometimes it writes more data to text files than should be. It seems like the time start from the begining over and over and the last time it start, that is the correct data (i have another text file that the time of each trial is written in it, that is why i know the last data is the correct one). Does anyone can tell me way is it happening?

Thanks in advence.
Reply With Quote