def setUp(): global currentCondition viz.setMultiSample(8) initGlobals() currentCondition = viz.choose('Select condition:', CONDITION_CHOICES) print "CurCondition:", currentCondition setFlags() # setUpRecording() # # if YOKE_F: # setUpYoke() # # if not FLYING_F: # setUpHelicopter() # # if(not confirmStates(currentCondition)): # viz.quit() # finish() #TODO make it so that on failure no files are created. # return # # #configData() if USE_HMD_F: setUpHMD() if not FLYING_F: setHeliInitPos() else: viz.go() viz.MainView.setPosition(START_POSITION_HELI) setUpWorld() setUpChild() setUpSound()
def InitRecording(): # Condition is ALWAYS 1 here. pptExtension.STATE = 0 pptExtension.ARMS_LIMIT_STATE = 0 pptExtension.LEGS_LIMIT_STATE = 0 global name name = vizinput.input('Participant Name: ') global gender genderChoices = ['female', 'male'] gender = vizinput.choose('Gender: ', genderChoices) global condition wcChoices = ['Third Arm', 'Cylinder', 'Floating hand', 'Floating ball'] condition = vizinput.choose('Which condition would you like to use?', wcChoices) global skin, skinChoices skinChoices = ['1','2','3','4','5','6','7','8','9','10'] skin = viz.choose('Skin Color? (1 = lightest, 10 = darkest)',skinChoices) global file file = hf_playback.openAvatarRecording(genderChoices[gender], name, 'w')
# the end line is perpendicular to walking direction K = -DIMENSION_X/DIMENSION_Z # The slope of the end line END_DIS = 2.0 # The distance between end line to home pole position of following trial # The intercept of the end line for two home poles respectively B = [-(DIAGONAL/2 - END_DIS) / math.cos(ROOM_ANGLE), (DIAGONAL/2 - END_DIS) / math.cos(ROOM_ANGLE)] ##################################################################################### # Settings IPD = viz.input('Please enter notes(IPD):') # Dialog box asking for type of control and subject number HMD = 'Odyssey' MONITOR = 'PC Monitor' controlOptions = [HMD,MONITOR] controlType = controlOptions[viz.choose('How would you like to explore? ', controlOptions)] subject = viz.input('Please enter the subject number:','') subject = str(subject).zfill(2) # Use keyboard controls # Controls: # q - Strafe L w - Forward e - Strafe R # a - Turn L s - Back d - Turn R # # y - Face Up r - Fly Up # h - Face Down f - Fly Down if controlType == MONITOR: HZ = 60
## paused = False Swapped = False SubjEyePercent = None SubjHeightJudgement = None ToRecord_YN = None HaltFlag = False DebugFlag = False CalcErrorFlag = True EH_Flag = False Estimate = None FootH_Offset = 0 ##Reorganize LAter viz.setLogFile('Diagnostic.log') print("New Log Begin") if viz.choose("Debug Mode", ["False","True"]) == 1: DebugFlag = True print("In debug mode.") #~~~~~~~~~~Environment Setup~~~~~~~~# # Add the Piazza, set scale Piazza = viz.add('Piazza.osgb') #Disables rendering of Piazza built in ground plane. Piazza.getChild('pz_ground').disable(viz.RENDERING) # Create Grass ground plane # Sets plane size to the size of Piazza and attaches it as a child (so it SHOULD rotate the grass plane with the Piazza) GrassGround = viz.addTexQuad(parent = Piazza ,size = (Piazza.getBoundingBox().width, Piazza.getBoundingBox().depth)) # Rotates quad to be parallel with ground GrassGround.setEuler([0,90,0])
name = viz.addTextbox() nameText = {'':'Player %s name:', 'GR':'Όνομα παίκτη %s:'} title = viz.addText(nameText[LANG]%str(i+1), viz.SCREEN) title.fontSize(24) title.addParent(inputPanel) title.setPosition([.4, .53+.1*p, 0]) name.setPosition([.5, .5+.1*p, 0]) name.addParent(inputPanel) names.append(name) startB = viz.addButtonLabel('START') startB.setPosition(.5,.4) startB.addParent(inputPanel) vizact.onbuttonup(startB, initialize) if studyMode: trial = viz.choose('Choose practice or main trial:',['practice', 'trial']) condition = viz.choose('Choose study condition:',['1P', '3P', 'Facilitated']) if trial: group = viz.input('Choose group number:', '') displayInputPanel() else: initialize() else: condition = CONDITION #0->'1P', 1->'3P', 2->'F' trial = TRIAL #1->full factory & logging, 0->practice initialize() #---------------------------------------------------------------- def sendEventToMachine (mach, action): (mActions, mMessage, multi) = FSM[mach].evaluate_multi_input(action, gPlayers[1]['player'], True) gPlayers[1]['player'].BroadcastActionsMessages(mActions, mMessage)