WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Collision recording and external data saves (https://forum.worldviz.com/showthread.php?t=2481)

just alex 01-28-2010 11:58 AM

Collision recording and external data saves
 
I have two semi-related questions. I know I can get vizard to output when an object collides with my participant, and it can output what collided, and I'm pretty sure I can get it to say the location of the collision, but I'm also trying to find a way to get it to output the orientation of the participant and get that all saved into another file (probably just a txt).
The other question I have is if it's possible to get vizard to automatically generate a txt or whatever file to save the data in and be able to change what the saved file is on it's own. For example, I run the program once to completion, then vizard saves the data in participant1.txt later that day, I run the program again, and vizard saves the data as participant2.txt
Is that possible to do, or will I just have to go in and manually rename the files after running the study?

GiudiceLab 01-29-2010 06:18 AM

We monitor our participant's orientation with an Intersense cube, and record orientation periodically to a datafile. Our code looks something like this:
Code:

response_orientation = marker.getEuler()
response_yaw = response_orientation[0]
datafile.write(str(response_yaw))
datafile.flush()

where 'marker' is the reference for the head marker (we combine PPT and Intersense data) and 'datafile' is the handle for the datafile. We have also used viz.MainView instead of 'marker' when the viewpoint is linked to the head orientation and referencing the marker would be difficult. Also, it may be apparent, but we are only interested in yaw. You could easily capture pitch and roll, though.

As for updating the filename, we prompt at the beginning of the script for a participant number, and use that to create the filename, like this:
Code:

# open a datafile for recording
subject = viz.input('Subject number:')
filename = 'datafiles/subject' + str(subject) + '.txt'
datafile = open(filename,'a')

I'm sure you could find a way to have the subject number auto-increment, but I think it would probably take more code that you really want.

Hope that is helpful!

just alex 01-29-2010 09:46 AM

Hmm, I'll take easy coding instead of trying to do something too fancy.
So, I think the collision code should look something like this
Code:

subject_orientation = tracker.getEuler()
subject_view = subject_orientation[0,0]
def mycollision(info)
  datafile.write 'collision'
  datafile.write(str(subject_view))
  datafile.flush()

right?


All times are GMT -7. The time now is 01:39 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC