Пример #1
0
def createCheckpoint():
	
	
	if (globalVariables.windowOpen is False):
		globalVariables.windowOpen = True
		userPosition = viz.MainView.getPosition() #Frage User Position
		#Erschaffe VizInfo Box
		infoBox = vizinfo.add("")
		infoBox.scale(0.8,1)
		infoBox.translate(0.65,0.6)
		infoBox.title("Checkpoint anlegen")

		textBox = infoBox.add(viz.TEXTBOX, "Kommentar:")
		bestaetigeButton = infoBox.add(viz.BUTTON_LABEL, "ok")	

		

		def checkpointHinzufuegen():
			#Füge Checkpoint zur Liste auf 3 Nachkommastellen gerundet an	
			checkPointsList.append([round(userPosition[0],3), round(userPosition[1],3), round(userPosition[2],3), textBox.get()])
			infoBox.remove()
			globalVariables.windowOpen = False
		
		vizact.onbuttondown(bestaetigeButton, checkpointHinzufuegen)	
	else:
		pass
Пример #2
0
def phase_choice():
    # load start box
    choice_box = vizinfo.add('')
    choice_box.title('Phase Choice')
    choice_box.scale(2, 2)
    choice_box.translate(0.85, 0.65)
    choice_box.drag(viz.OFF)

    # add options for different mazes
    learning_phase = choice_box.add(viz.BUTTON, 'Learning')
    testing_phase = choice_box.add(viz.BUTTON, 'Testing')

    # add variables for user chocies
    learning_phase_pressed = viztask.waitButtonDown(learning_phase)
    testing_phase_pressed = viztask.waitButtonDown(testing_phase)

    # data variable to hold user choices
    data = viz.Data()

    global phase_selection
    yield viztask.waitAny([learning_phase_pressed, testing_phase_pressed],
                          data)
    if data.condition is learning_phase_pressed:
        phase_selection = 'Learning'
        choice_box.remove()
    elif data.condition is testing_phase_pressed:
        phase_selection = 'Testing'
        choice_box.remove()
Пример #3
0
def openTextBox():
	if (globalVariables.windowOpen is False):
		globalVariables.windowOpen = True
		#Erschaffe VizInfo Box
		infoBox = vizinfo.add("")
		infoBox.scale(0.8,1)
		infoBox.translate(0.65,0.6)
		infoBox.title("Setze 3D Text")

		textBox = infoBox.add(viz.TEXTBOX, "Text:")
		bestaetigeButton = infoBox.add(viz.BUTTON_LABEL, "Ok")	
		
		
		
		#Text schreiben und Box + Button löschen
		def writeText():
			text = textBox.get()
			userPosition = viz.MainView.getPosition()
			text3D = viz.addText3D(text, pos = [userPosition[0]-0.2, userPosition[1], userPosition[2] + 0.2])
			text3D.setScale(0.2, 0.2, 0.2)
			text3D.color(viz.RED)
			infoBox.remove()
			noteList.append(text3D)
			globalVariables.windowOpen = False
		vizact.onbuttondown(bestaetigeButton, writeText)	
	else:
		pass
Пример #4
0
	def GameFinish (self, delay):
		self.info = vizinfo.add(self.tooltips['congrats'])
		self.info.visible(0)
		self.info.icon(viz.add('textures/c-olive_icon.png'))
		self.info.add(viz.TEXT3D, self.tooltips['finish']+'\n'+self.tooltips['produce'] % self._oil.getMessage())
		self.info.add(viz.TEXT3D, self.tooltips['stats'])
		self.info.translate(0.1,0.95)
		self.info.alignment(vizinfo.UPPER_LEFT)
		self.info.scale(2.4,2.6)
		self.info.messagecolor(100,100,0)
		self.info.bgcolor(viz.BLACK, 0.8)
		self.info.bordercolor([100,100,0], .9)
		points = self.info.add(viz.TEXQUAD, self.tooltips['score']+': %s' % self._total.getMessage())
		points.texture(viz.add('textures/total_icon.png'))
		time = self.info.add(viz.TEXQUAD, self.tooltips['time']+': %s' % self.ConvertTime(viz.tick()))
		time.texture(viz.add('textures/time_icon.png'))
		self.info.shrink()
		#hide all other panels
		self._scorePanel.visible(0)
		self._infoPanel.visible(0)
		self._alertPanel.visible(0)
		for p in self.PLAYERS.values():
			p._infoPanel.visible(0)
			p._alertPanel.visible(0)
			p._hud.visible(0)
		time.addAction(vizact.waittime(delay))
		time.addAction(vizact.call(self.info.visible, 1))
		time.addAction(vizact.waittime(.1))
		time.addAction(vizact.call(self.PlayVictory))
		time.addAction(vizact.call(self.info.expand))
Пример #5
0
def get_subject_info():

    # create an input box for entering experiment information
    input_box = vizinfo.add('')
    input_box.title('Subject Info')
    input_box.scale(2, 2)
    input_box.translate(0.85, 0.65)
    input_box.drag(viz.OFF)

    # create inpux box and handles
    subject_id = input_box.add(viz.TEXTBOX, 'Subject ID')
    experimenter = input_box.add(viz.TEXTBOX, 'Experimenter')
    start_button = input_box.add(viz.BUTTON, 'Continue')

    # wait until the start button is pressed
    yield viztask.waitButtonDown(start_button)

    # get the data from the input box
    global subject_id_data
    global experimenter_data
    subject_id_data = subject_id.get()
    experimenter_data = experimenter.get()

    input_box.remove()

    # get the date
    global cur_date
    cur_date = strftime("%m/%d/%Y", localtime())

    # write out information

    # define output file globals
    global output_df
    global output_file
    global coordinates_df
    global coordinates_file
    global coord_columns
    output_file = 'sub-' + subject_id_data + '.tsv'
    coordinates_file = 'sub-' + subject_id_data + '_coordinates.tsv'
    # check if output file exists
    if os.path.isfile(output_file):
        output_df = pd.read_csv(output_file, sep='\t')
    else:
        columns = [
            'study_id', 'lab_id', 'experimenter', 'date', 'condition', 'maze',
            'phase', 'trial', 'sub_trial', 'object', 'movement_time',
            'average_velocity', 'total_distance'
        ]
        output_df = pd.DataFrame(columns=columns)

    coord_columns = ['coord_1', 'coord_2', 'coord_3', 'coord_4']
    if os.path.isfile(coordinates_file):
        coordinates_df = pd.read_csv(output_file, sep='\t')
    else:
        coordinates_df = pd.DataFrame(columns=coord_columns)
Пример #6
0
    def setupHealthStats(self):

        self.message=self.playerStatusString()
        name=self.name
        
        
        self.infobar=vizinfo.add(self.message)
        
        self.infobar._group.parent(viz.SCREEN, 3)
        self.infobar.title("Stats and Options")
        self.infobar.drag(viz.ON)
Пример #7
0
def inputRequest(key):
	messageWindow = vizinfo.add('')
	#yield viztask.waitTime(1.2) # wait for 1.2 seconds
	messageWindow.message("Do you think you could pass? \nPress \"a\" if you think you could, \"b\" if not.")
	messageWindow.translate(0.9, 0.95)   # can vary depending on desired position of box
	messageWindow.visible(viz.ON)
	
	if key == wii.BUTTON_A:
		participant_answer = True
		messageWindow.remove()
	if key == wii.BUTTON_B:
		participant_answer = False
		messageWindow.remove()
Пример #8
0
def porten(tracker):
	
	if (globalVariables.windowOpen is False):
		globalVariables.windowOpen = True
		#Erschaffe VizInfo Box
		infoBox = vizinfo.add("")
		infoBox.scale(0.8,1)
		infoBox.translate(0.65,0.6)
		infoBox.title("Zu beliebige Position porten")

		posiXBox = infoBox.add(viz.TEXTBOX, "X-Koordinate:")
		posiYBox = infoBox.add(viz.TEXTBOX, "Y-Koordinate:")
		posiZBox = infoBox.add(viz.TEXTBOX, "Z-Koordinate:")
		portButton1 = infoBox.add(viz.BUTTON_LABEL, "Porten")	
		

		
		def porten2():
			#Position abfragen und infobox
			posiX = posiXBox.get()
			posiY = posiYBox.get()
			posiZ = posiZBox.get()
			infoBox.remove()

			def removePortPanel():
				checkPointsPanel.remove()
				okButton.remove()
				globalVariables.windowOpen = False
				
			try:
				###Kolissionserkennung einbauen###
				viz.MainView.setPosition(float(posiX), float(posiY), float(posiZ))
				tracker.setPosition(float(posiX), float(posiY), float(posiZ))
				globalVariables.windowOpen = False
			except:
				#####Noch überarbeiten###
				checkPointsPanel = vizinfo.InfoPanel("Fehler",align=viz.ALIGN_CENTER,fontSize=25,icon=False,key=None)
				checkPointsPanel.visible(True)
				#Erschaffe Bestätigungsbutton
				okButton = viz.addButtonLabel("Ok")
				okButton.setPosition(0.5,0.40)
				okButton.setScale(1,1)
				vizact.onbuttondown(okButton,removePortPanel)
		vizact.onbuttondown(portButton1, porten2)
	else:
		pass
Пример #9
0
def delete3DNote():
	if (globalVariables.windowOpen is False):
		globalVariables.windowOpen = True
		#Erschaffe VizInfo Box
		infoBox = vizinfo.add("")
		infoBox.scale(0.8,1)
		infoBox.translate(0.65,0.6)
		infoBox.title("Lösche 3D Text")

		textBox = infoBox.add(viz.TEXTBOX, "3D Text Nr:")
		bestaetigeButton = infoBox.add(viz.BUTTON_LABEL, "Löschen")		
		
		
		#Checkpoint löschen und Box + Button löschen
		def delete3DNote1():

			noteNummer = textBox.get()
			infoBox.remove()
			
			def removeNotePanel():
				notePanel.remove()
				okButton.remove()
				globalVariables.windowOpen = False
				
					
			try:
				if (int(noteNummer)>0):
					noteList[int (noteNummer)-1].remove()
					del noteList[int (noteNummer)-1] #Lösche 3D Notiz
					globalVariables.windowOpen = False
				else:
					raise
			except:
				notePanel = vizinfo.InfoPanel("Bitte nur Nummern im Bereich\nder verfügbaren 3D Notizen eingeben.",align=viz.ALIGN_CENTER,fontSize=25,icon=False,key=None)
				notePanel.visible(True)
				#Erschaffe Bestätigungsbutton
				okButton = viz.addButtonLabel("Ok")
				okButton.setPosition(0.5,0.40)
				okButton.setScale(1,1)
				vizact.onbuttondown(okButton,removeNotePanel)
		vizact.onbuttondown(bestaetigeButton, delete3DNote1)	
	else:
		pass
Пример #10
0
def portCheckPoint(tracker):
	if (globalVariables.windowOpen is False):
		globalVariables.windowOpen = True
		#Erschaffe VizInfo Box
		infoBox = vizinfo.add("")
		infoBox.scale(0.8,1)
		infoBox.translate(0.65,0.6)
		infoBox.title("Zu Checkpoint porten")

		portBox = infoBox.add(viz.TEXTBOX, "Checkpoint Nr:")
		portButton1 = infoBox.add(viz.BUTTON_LABEL, "Porten")	
		

		
		def porten():
			#Position abfragen und infobox entfernen
			checkPointNummer = portBox.get()
			infoBox.remove()
			
			def removeCheckPointsPanel():
				checkPointsPanel.remove()
				okButton.remove()
				globalVariables.windowOpen = False
				
			try:
				if (int(checkPointNummer)>0): #Prüfe eingabe und porte
					position = checkPointsList[int(checkPointNummer)-1]
					viz.MainView.setPosition(position[0], position[1], position[2])
					tracker.setPosition(position[0], position[1], position[2])
				else:
					raise
			except:

				checkPointsPanel = vizinfo.InfoPanel("Bitte nur Nummern im Bereich\nder verfügbaren Checkpoints eingeben.",align=viz.ALIGN_CENTER,fontSize=25,icon=False,key=None)
				checkPointsPanel.visible(True)
				#Erschaffe Bestätigungsbutton
				okButton = viz.addButtonLabel("Ok")
				okButton.setPosition(0.5,0.40)
				okButton.setScale(1,1)
				vizact.onbuttondown(okButton,removeCheckPointsPanel)
				
		vizact.onbuttondown(portButton1, porten)
Пример #11
0
def port3DNote(tracker):
	if (globalVariables.windowOpen is False):
		globalVariables.windowOpen = True
		#Erschaffe VizInfo Box
		infoBox = vizinfo.add("")
		infoBox.scale(0.8,1)
		infoBox.translate(0.65,0.6)
		infoBox.title("Zu 3D Text porten")

		noteBox = infoBox.add(viz.TEXTBOX, "Text Nr:")
		portButton1 = infoBox.add(viz.BUTTON_LABEL, "Porten")	
		
		def porten():
			#Position abfragen und textbox + button entfernen
			noteNummer = noteBox.get()
			infoBox.remove()
			
			def removeNotePanel():
				notePanel.remove()
				okButton.remove()
			
			try:
				if (int(noteNummer)>0): #Prüfe eingabe und porte
					position = noteList[int(noteNummer)-1].getPosition()
					viz.MainView.setPosition(position[0], position[1], position[2]-0.5)
					tracker.setPosition(position[0], position[1], position[2]-0.5)
				else:
					raise
			except:
				notePanel = vizinfo.InfoPanel("Bitte nur Nummern im Bereich\nder verfügbaren 3D Notizen eingeben.",align=viz.ALIGN_CENTER,fontSize=25,icon=False,key=None)
				notePanel.visible(True)
				#Erschaffe Bestätigungsbutton
				okButton = viz.addButtonLabel("Ok")
				okButton.setPosition(0.5,0.40)
				okButton.setScale(1,1)
				vizact.onbuttondown(okButton,removeNotePanel)
				
		vizact.onbuttondown(portButton1, porten)
	else:
		pass
Пример #12
0
def ShowMessage(mystring):
	info = vizinfo.add(mystring)
	messagePos = (.5, .5)		#change if want message in dif spot
	info.translate(messagePos)
	yield viztask.waitTime(2)
	info.visible(0)
Пример #13
0
import viz,vizinfo,viztask,vizact
from datetime import datetime
global subj
"""
Adds a panel to the screen where the subject info gets 
filled out.
"""
info_box = vizinfo.add('')
info_box.scale(2,2)
info_box.translate(0.85,0.8)
info_box.title('Participant Info')

#Add the GUI elements to the box
id_box = info_box.add(viz.TEXTBOX,'Participant ID')
day_box = info_box.add(viz.TEXTBOX, 'Day')
run_box = info_box.add(viz.TEXTBOX, 'Run Number')
scan_box = info_box.add(viz.CHECKBOX,'Scanner')
training_box = info_box.add(viz.CHECKBOX,'Training?')
run_button = info_box.add(viz.BUTTON,'Run')
info_box.visible(viz.OFF)

class Subject(object):
	def __init__(self):
		self.init_time = datetime.now().strftime("%Y.%m.%d.%H.%M")
		self.time_offset = -1
		
	def set_time_offset(self, timestamp):
		"""
		If the experiment relies on an external trigger
		to begin, set the timing offset, so that when we
		dump this subject's behavioral data, 
Пример #14
0
def task_choice():

    # ensure that the mouse is turned on
    viz.mouse(viz.ON)
    viz.mouse.setVisible(viz.ON)

    # load condition_box
    condition_box = vizinfo.add('')
    condition_box.title('SNAP')
    condition_box.scale(2, 2)
    condition_box.translate(0.85, 0.65)
    condition_box.drag(viz.OFF)

    # add different options
    condition_one = condition_box.add(viz.BUTTON, 'Condition 1')
    condition_two = condition_box.add(viz.BUTTON, 'Condition 2')
    practice = condition_box.add(viz.BUTTON, 'Practice Program')
    expertise = condition_box.add(viz.BUTTON, 'Visuomotor Expertise Program')
    maze_quit = condition_box.add(viz.BUTTON, 'Quit Maze Program')

    # add variables for user chocies
    condition_one_pressed = viztask.waitButtonDown(condition_one)
    condition_two_pressed = viztask.waitButtonDown(condition_two)
    practice_pressed = viztask.waitButtonDown(practice)
    expertise_pressed = viztask.waitButtonDown(expertise)
    maze_quit_pressed = viztask.waitButtonDown(maze_quit)

    # data variable to hold user choices
    data = viz.Data()

    # setup globals
    global condition
    global maze_root
    global start_coords
    global start_ori
    global end_coords

    # While statment that will run a different maze based on user choice.
    # Will keep looping until the user selects quit and ends the program
    while True:
        yield viztask.waitAny([
            condition_one_pressed, condition_two_pressed, practice_pressed,
            expertise_pressed, maze_quit_pressed
        ], data)
        condition_box.remove()
        if data.condition is condition_one_pressed:
            condition = 1
            yield maze_choice()
            yield run_condition_one()
            yield task_choice()
        elif data.condition is condition_two_pressed:
            condition = 2
            yield maze_choice()
            yield run_condition_two()
            yield task_choice()
        elif data.condition is practice_pressed:
            viz.mouse(viz.OFF)
            viz.mouse.setVisible(viz.OFF)
            maze_root = 'C:\Experiments\Bike_Extend_Pilot\SNAP\PMS'
            start_coords = (0, 40, 0)
            start_ori = (3.5, 0, 0)
            yield practice_maze()
            yield task_choice()
        elif data.condition is expertise_pressed:
            viz.mouse(viz.OFF)
            viz.mouse.setVisible(viz.OFF)
            maze_root = 'C:\Experiments\Bike_Extend_Pilot\SNAP\VMS'
            start_coords = (0, 40, 0)
            start_ori = (0, 0, 0)
            end_coords = [1150, 1275, -190, -100]
            yield expertise_maze()
            yield task_choice()
        elif data.condition is maze_quit_pressed:
            viz.quit()

    viz.quit()
Пример #15
0
    print 'Hand Tracker euler',handTracker.getEuler() #and this
    print 'Viewpoint position',viewpoint.getPosition()
    print 'Movable position',movable.getPosition(),'\n'
vizact.ontimer(5, printData)
# Setup tracking if this is the main script
if __name__ == "__main__":
	import viztracker
	viztracker.DEFAULT_HANDS = True
	viztracker.go()


info = vizinfo.add("""
1: Toggle Hat
2: Toggle Snare

Q: Hat
W: Snare
E: Tom
R: Cymbal
T: Kick drum
""",.8)
info.alignment (vizinfo.LOWER_RIGHT)
info.translate (0.95, 0.05)


#Create environment map from drum models
DrumShinyTex = viz.add(viz.ENVIRONMENT_MAP,'nvlobby.png')

#Add drum model
DrumTomModel = viz.add('drum.wrl')
DrumTomModel.translate(0,.1,0)
DrumTomModel.setEuler([20,-15,0])
Пример #16
0
def ShowMessage(mystring):
    info = vizinfo.add(mystring)
    yield viztask.waitTime(2)
    info.visible(0)
Пример #17
0
pflanze = viz.addChild('')


pflanze.setPosition(0.3,0.3,0.3)
sensor = vizproximity.Sensor(vizproximity.Sphere(4.0),source=viz.Matrix.translate(source))

desc = pflanze.getNodeNames()

#desc = cad.getNodeNames()

#Proximity Manager
manager = vizproximity.Manager()
manager.addTarget(target)
manager.addSensor(sensor)

info = vizinfo.add(r'C:\VIZARD\Buero_test.osgt')
info.visible(False)
# Register callbacks for proximity sensors
def EnterProximity(e):
	info.message(str(desc))
	print(str(desc))
	info.visible(True)
	info.translate([.8, .8])
	print(cad.getNodeNames()[5].split("."))


def ExitProximity(e):
	info.visible(False)

manager.onEnter(None, EnterProximity)
manager.onExit(None, ExitProximity)
import viz
import vizact
import vizshape
import math
import random
import time

viz.go(viz.FULLSCREEN)

import vizinfo
info = vizinfo.add( 'You can control water using your hand!\nHelp put out as many flames as you can in the next 30 seconds!\nPress SPACE to begin the activity.\nPress S to exit the activity.' )
info.translate( [.98, .3] )

# dojo, gallery, lab, maze, piazza, pit, sky_day, sky_night
ground = viz.add('lab.osgb')

#Kinect Tracker object ID's
HEAD = 0
NECK = 1
TORSO = 2
WAIST = 3
LEFTCOLLAR = 4
LEFTSHOULDER = 5
LEFTELBOW = 6
LEFTWRIST = 7
LEFTHAND = 8
LEFTFINGERTIP = 9
RIGHTCOLLAR = 10
RIGHTSHOULDER = 11
RIGHTELBOW = 12
RIGHTWRIST = 13
Пример #19
0
__author__ = 'MrLapTop'

import viz

viz.go()

import vizinfo
vizinfo.add('This script demonstrates how to use keyboard callbacks.\nWhen a key is pressed, its value will be printed out.\nAlso the screen will toggle between black and white.')

color = 0
# This function is triggered whenever a keyboard button
# is pressed and gets passed the key that was pressed
# into the argument whichKey.
def mykeyboard(whichKey):
    print 'The following key was pressed: ', whichKey
    global color
    color = color ^ 1

    if whichKey == viz.KEY_F1:
        print 'Fkey 1 pressed'
    elif whichKey == viz.KEY_F2:
        print 'Fkey 2 pressed'
    elif whichKey == viz.KEY_F3:
        print 'Fkey 2 pressed'
    elif whichKey == viz.KEY_F4:
        print 'Fkey 2 pressed'
    elif whichKey == viz.KEY_UP:
        print 'Up arrow pressed'
    elif whichKey == viz.KEY_DOWN:
        print 'Down arrow pressed'
    elif whichKey == viz.KEY_LEFT:
Пример #20
0
def maze_choice():

    # load start box
    choice_box = vizinfo.add('')
    choice_box.title('Maze Choice')
    choice_box.scale(2, 2)
    choice_box.translate(0.85, 0.65)
    choice_box.drag(viz.OFF)

    # add options for different mazes
    maze_a = choice_box.add(viz.BUTTON, 'Maze Layout A')
    maze_b = choice_box.add(viz.BUTTON, 'Maze Layout B')
    maze_c = choice_box.add(viz.BUTTON, 'Maze Layout C')
    maze_d = choice_box.add(viz.BUTTON, 'Maze Layout D')

    # add variables for user chocies
    maze_a_pressed = viztask.waitButtonDown(maze_a)
    maze_b_pressed = viztask.waitButtonDown(maze_b)
    maze_c_pressed = viztask.waitButtonDown(maze_c)
    maze_d_pressed = viztask.waitButtonDown(maze_d)

    # data variable to hold user choices
    data = viz.Data()

    # get the maze name root, and start/end coordinates from user choice
    global maze_root
    global start_coords
    global start_ori
    global end_coords
    yield viztask.waitAny(
        [maze_a_pressed, maze_b_pressed, maze_c_pressed, maze_d_pressed], data)
    if data.condition is maze_a_pressed:
        choice_box.remove()
        yield phase_choice()
        maze_root = 'C:\Experiments\Bike_Extend_Pilot\SNAP\SNAPMazeA'
        start_coords = (0, 40, 0)
        start_ori = (0, 0, 0)
        end_coords = (-745, -700, 2125, 2180)
    elif data.condition is maze_b_pressed:
        choice_box.remove()
        yield phase_choice()
        maze_root = 'C:\Experiments\Bike_Extend_Pilot\SNAP\SNAPMazeB'
        start_coords = (-1114, 40, 2151)
        start_ori = (-180, 0, 0)
        end_coords = (-1876, -1795, 115, 156)
    elif data.condition is maze_c_pressed:
        choice_box.remove()
        yield phase_choice()
        maze_root = 'C:\Experiments\Bike_Extend_Pilot\SNAP\SNAPMazeC'
        start_coords = (100, 0, -47)
        start_ori = (90, 0, 0)
        end_coords = (640, 750, 2080, 2120)
    elif data.condition is maze_d_pressed:
        choice_box.remove()
        yield phase_choice()
        maze_root = 'C:\Experiments\Bike_Extend_Pilot\SNAP\SNAPMazeD'
        start_coords = (414, 0, 285)
        start_ori = (0, 0, 0)
        end_coords = (550, 575, 1100, 1200)
    choice_box.remove()

    # turn the mouse off so it doesn't interfere with the environment
    viz.mouse(viz.OFF)
    viz.mouse.setVisible(viz.OFF)
Пример #21
0
viz.add( 'tut_ground.wrl' )

#import viztracker
#PORT_INTERSENSE = 0
#track = viz.add('intersense.dls')
#print dir(track)
#track = viz.addOri()
#viz.link(track,viz.MainView)

import viz

viz.go()
#viz.add( 'tut_ground.wrl' )

import vizinfo
vizinfo.add('This script demonstrates how to perform manual head tracking.\nIt will retrieve data from the tracker and only rotate the yaw.\nBy default this script will connect to an intersense.\nPress the \'r\' key to reset the tracker')

#Add environment
#viz.add('gallery.ive')
viz.add('../models/crappy_smallroom1.wrl')

#Add the intersense plugin
PORT_INTERSENSE = 0
tracker = viz.add('intersense.dls')

ringbuffer_len = 20
yaw_ringbuffer = range(ringbuffer_len)
pitch_ringbuffer = range(ringbuffer_len)
roll_ringbuffer = range(ringbuffer_len)
for i in range(ringbuffer_len):
	yaw_ringbuffer[i] = 0
Пример #22
0
import viz, vizinfo, viztask, vizact
from datetime import datetime
global subj
"""
Adds a panel to the screen where the subject info gets 
filled out.
"""
info_box = vizinfo.add('')
info_box.scale(2, 2)
info_box.translate(0.85, 0.8)
info_box.title('Participant Info')

#Add the GUI elements to the box
id_box = info_box.add(viz.TEXTBOX, 'Participant ID')
day_box = info_box.add(viz.TEXTBOX, 'Day')
run_box = info_box.add(viz.TEXTBOX, 'Run Number')
scan_box = info_box.add(viz.CHECKBOX, 'Scanner')
training_box = info_box.add(viz.CHECKBOX, 'Training?')
run_button = info_box.add(viz.BUTTON, 'Run')
info_box.visible(viz.OFF)


class Subject(object):
    def __init__(self):
        self.init_time = datetime.now().strftime("%Y.%m.%d.%H.%M")
        self.time_offset = -1

    def set_time_offset(self, timestamp):
        """
		If the experiment relies on an external trigger
		to begin, set the timing offset, so that when we
Пример #23
0
import viz
import vizact
import vizinput

viz.setMultiSample(4)
viz.fov(60)

# Start Vizard with a prompt dialog box
viz.go(viz.PROMPT)

import vizinfo
vizinfo.add('This script demonstrates how to gather input from the user at startup.')

#Retrieve text from the prompt
speed = viz.get(viz.INITMESG)

#Ask user for name
name = vizinput.input('What is your name?')

choices = ['Blue','Green','Orange']
colors = [[0,0,1],[0,1,0],[1,0.5,0]]
#Ask user for favorite color
favColor = vizinput.choose('Which of the following colors is your most favorite?',choices)

#Create text object of user name
text = viz.addText(name)
text.setPosition([0,3,7])
text.color(colors[favColor])

# Try to convert the text into a number.
# If the text is invalid, then set the rotation speed to 90.