#1
|
|||
|
|||
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. |
#2
|
|||
|
|||
I'm not entirely sure what you mean, and it's hard to read the code without indentations (please use the CODE tags next time), but could it be that you are not stopping the timer and closing the datafile after each trial? If that's the case, the timer for the first trial just keeps on writing data during the second and third trial; the timer for the second trial will keep on writing during the third, and only the last one will write just the data of the last trial.
|
#3
|
|||
|
|||
Hi Erik,
Sorry for the using indentation and thanks for your answer. My problem apperent to be pretty simple: I used 'a' for append instead of 'w' for writing so whenever the file name was existing my latest data was added to the same file creating long ones. |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
input from a text file | dig | Vizard | 5 | 10-20-2013 01:20 AM |
Use saved text file data as replay sources problem | mizutani_jun | Vizard | 4 | 10-14-2010 04:49 PM |
problems with output to a text file within executable | Saz | Vizard | 1 | 07-01-2009 11:01 AM |
Read file....many issues | Uttama_vizard | Vizard | 9 | 07-08-2008 02:16 PM |
I cannot show wrl file with text node | sled | Vizard | 3 | 06-25-2003 07:52 AM |