Exemplo n.º 1
0
def main():
    
    global wingl
    global wingr
    viz.cam.setHandler(vizcam.KeyboardCamera())
    myo.init()
    gyrolist = [[0,0,0]]
    viz.setMultiSample(4)
    viz.fov(150)
    wingl = viz.addChild('basketball.osgb')
    wingl.setScale([10,0.3,1])
    wingl.setCenter([100,100,100])
    wingl.setEuler([0,90,0])
    wingl.collideSphere(0.5)
    lStartPOS = [ 0, 2.5, 2 ]
    wingl.setPosition( lStartPOS )
    wingr = viz.addChild('basketball.osgb')
    wingr.setScale([10,0.3,1])
    wingr.setCenter([100,100,100])
    wingr.setEuler([0,90,0])
    wingr.collideSphere(0.5)
    rStartPOS = [ 0, 2.5, 2 ]
    wingr.setPosition( rStartPOS )

    #viz.MainView.setPosition([0,2,-15])
    hub = myo.Hub()
    hub.set_locking_policy(myo.locking_policy.none)
    hub.run(1000, Listener())
    vizact.ontimer(0.01 ,updateMyo, [gy, gy2, gy3, wingl, orx, ory, orz, orw, or1x, or1y, or1z, or1w, wingr])
def set_graphics_quality():
    """Vsync ON; Multisample 8, glFinish ON."""
    # Just to make sure vertical sync is ON, against tearing.
    viz.vsync(1)
    # Helps reduce latency.
    viz.setOption('viz.glFinish', 1)
    viz.setMultiSample(8)
Exemplo n.º 3
0
    def _setup_vizard_configuration(self):
        """
		Setup some stuff for Vizard
		"""
        viz.setMultiSample(cfg.multi_sample_level)

        # Disable the head light for better lighting
        viz.MainView.getHeadLight().disable()

        # Disable the mouse with controller controls.
        # Without deactivation, the controller would move the mouse.
        if cfg.control_scheme == "controller":
            # Trap the mouse in the graphics window.
            viz.mouse.setTrap(viz.ON)
            # Make the mouse invisible.
            viz.mouse.setVisible(viz.OFF)

        # Display models for the trackers
        tracker_names = ['r_hand_tracker', 'l_hand_tracker']
        for tracker_name in tracker_names:
            controller = vizconnect.getRawTracker(tracker_name)

            if cfg.control_scheme == "steamvr":
                if not isinstance(controller, viz.VizGroup):
                    # Display HTC Vive controller model if the controller is connected
                    model = controller.addModel()
                    viz.link(controller, model)

            elif cfg.control_scheme == "controller":
                # Display a sphere, when controlled with a gamepad
                model = vizshape.addSphere(.05, color=viz.GRAY)
                viz.link(controller, model)
Exemplo n.º 4
0
def recordViewAnimation():
    ### replace with your own application setup
    import viz
    import vizcam
    import vizact

    viz.setMultiSample(4)

    viz.go()

    vizcam.WalkNavigate()

    piazza = viz.addChild("piazza.osgb")
    ###

    ### Add this at the bottom
    '''
	 Create an AnimationPathRecorder and link it to any node, which needs to have it's transformation documented.
	 If 'start' is set to True the recording will start automatically, otherwise you need to start manually.
	 you can specify the file name under which the animation will be saved. '.txt' is automatically added.
	'''
    rec = AnimationPathRecorder(start=False)
    viz.link(viz.MainView, rec)

    # toggle path recording and saving finished recording to a file named 'test_animation.txt'
    def toggleRecord(rec):
        if rec.isRunning():
            rec.stop()
            rec.writeToFile("test_animation")
            print "Animation path saved to test_animation.txt"
        else:
            rec.start()
            print "Animation path recording started."

    vizact.onkeydown('r', toggleRecord, rec)
Exemplo n.º 5
0
    def __init__(self):
        viz.EventClass.__init__(self)

        self.EH = 1.2
        Proj_Dist = 1.0  #front projection distance to Eye

        Proj_V_F = 1.115  #vertical extent of projection (m)
        Proj_H_F = 1.985  #1.96#horizontal extent of projection (m)

        Proj_HfG = .665  #Front projection height from ground.

        FB = Proj_HfG  #FrontBottom
        FT = Proj_HfG + Proj_V_F  #FrontTop

        FL = -Proj_H_F / 2  #Front Left
        FR = Proj_H_F / 2  #Front Right

        FC0 = FL, FB, Proj_Dist  # Front  Wall: FC0,FC1,FC2,FC3
        FC1 = FR, FB, Proj_Dist
        FC2 = FL, FT, Proj_Dist
        FC3 = FR, FT, Proj_Dist

        self.FrontWall = vizcave.Wall(upperLeft=FC2,
                                      upperRight=FC3,
                                      lowerLeft=FC0,
                                      lowerRight=FC1,
                                      name='Front Wall')  #Create front wall

        viz.setMultiSample(8)  #set anti-aliasing

        #Initialize graphics window
        viz.go()
        #	viz.eyeheight(1.2)
        #for monitor in viz.window.getMonitorList():
        #    print monitor.name
        #    print '   ',monitor

        viz.window.setFullscreenMonitor(2)
        viz.window.setFullscreen(viz.ON)

        self.cave = vizcave.Cave(stereo=0)
        self.cave.addWall(self.FrontWall)  #,window=self.frontWindow)

        # print ("1_N: ", self.cave.getNearPlane()) #default is [.1, -1.]
        # print ("1_F: ", self.cave.getFarPlane())

        #set near and far plane.
        self.cave.setNearPlane(1.0)
        self.cave.setFarPlane(100.0)

        view = viz.MainView

        self.track = viztracker.Keyboard6DOF()  #tracker object
        self.track.setPosition(0, self.EH, 0)
        viz.link(self.track, view)  #linked to mainview
        self.cave.setTracker(pos=self.track)
        ##Create CaveView object for manipulating the entire cave environment
        ##The caveorigin is a node that can be adjusted to move the entire cave around the virtual environment, it needs a tracker object to initialise it.
        self.caveview = vizcave.CaveView(self.track)
Exemplo n.º 6
0
def init_settings(mainSceneWindow, cameraWindow, cameraWindowView, cam, pause_screen, nunchuck_disconnect_screen, message_screen, wiimote, nunchuck_wiimote, should_it_run):
	viz.MainWindow.visible(viz.OFF) #Hago invisible la main window
	viz.setMultiSample(8) # FSAA de 8
	viz.fogcolor = viz.BLACK # Color de sombra = negro
	viz.fog(0.15) # Agrega sombra de tipo exponencial
	viz.collision(viz.ON) # Habilita colisiones en el mundo
	viz.phys.enable() # Habilita la fisica

	#Desabilita mouse
	viz.mouse.setOverride(viz.ON)

	#Mouse invisible
	viz.mouse.setVisible(viz.OFF)

	#Subventana que renderea viz.MainWindow
	mainSceneWindow = viz.addWindow()
	mainSceneWindow.setSize(0.7,1)
	mainSceneWindow.setPosition(0,1)
	mainSceneWindow.fov(40, 1.3) # Coloca el FOV de la ventana principal en la actual con los valores de default (40 grados verticales, 1.3 aspect ratio)

	#Creando una ventana y un punto de vista para la camara
	cameraWindow = viz.addWindow(pos =[.7,1],size=(0.4,1)) #Creando la ventana
	cameraWindowView = viz.addView() #Creando un viewpoint
	cameraWindowView.setScene(2) #Poniendo la nueva ventana en la escena 2
	cameraWindow.setView(cameraWindowView) #Ligando el viewpoint con la nueva ventana

	#Vincular camara web a plugin de AR
	cam = ar.addWebCamera(window=cameraWindow) #Agregando una camara en la ventada nueva

	# Configuracion de mensajes de la pantalla
	message_screen = viz.addTexQuad(parent=viz.SCREEN, pos=[0.5,0.5,1], scale=[12.80,10.24,1]) 
	pause_screen = viz.add("PAUSA.png")
	nunchuck_disconnect_screen = viz.add("NUNCHUCK_DISCONNECTED.png")
	message_screen.texture(pause_screen)
	message_screen.visible(viz.OFF) #Cuando should_it_run sea False, viz.ON es el valor a usar.

	# Conecta al primer wiimote disponible
	wiimote = wii.addWiimote()
	# Prende el LED 1 del wiimote
	wiimote.led = wii.LED_1
	# Obten el nunchuck del wiimote
	nunchuck_wiimote = wiimote.nunchuk 

	#Determines wheter the program should run or not.
	#It will run if the Nunchuck is connected; otherwise, it won't.
	should_it_run = True

	#Ensures that the program won't run without the NUNCHUCK plug'd in.
	if(wiimote.getExtension() == wii.EXT_NUNCHUK):
		should_it_run = True
	else:
		print "Please plug-in the Wii NUNCHUCK."
		message_screen.texture(nunchuck_disconnect_screen)
		message_screen.visible(viz.ON)
		should_it_run = False
	
	return mainSceneWindow, cameraWindow, cameraWindowView, cam, pause_screen, nunchuck_disconnect_screen, message_screen, wiimote, nunchuck_wiimote, should_it_run
def main():

    viz.vsync(viz.ON)
    viz.window.setFullscreenMonitor([2])
    viz.setMultiSample(4)
    viz.MainWindow.clip(0.01, 200)

    viz.go(viz.FULLSCREEN)

    environment = viz.addChild("piazza.osgb")
    environment.setPosition(2.75, 0, -0.75)

    mocap = phasespace.Phasespace()

    head = mocap.get_rigidTracker("hmd")

    # DOES NOT ACCOUNT FOR RIGID BODY OFFSET DURING RESET

    # mocap.track_rigid('Resources/hmd-nvisMount.rb', center_markers=(1,2))
    head.link_pose(viz.MainView)

    # glove = mocap.track_points([8, 9, 10])

    paddle = mocap.track_rigid({17: (0, 0, 1), 19: (0, 0, 0), 20: (1, 0, 0), 22: (0, 1, 0)})

    mocap.start_thread()
    # mocap.start_timer()

    def log_mocap(timer_id):
        # print 'glove#9 pos {0[1]:.2f} {0[1]:.2f} {0[2]:.2f}'.format(*glove.get_marker(9))
        print "head    pos {0[0]:.2f} {0[1]:.2f} {0[2]:.2f}, quat {1[0]:.3f} {1[1]:.3f} {1[2]:.3f} {1[3]:.3f}".format(
            *head.get_pose()
        )
        print "main    " + str(viz.MainView.getPosition())
        # print 'paddle  pos {0[0]:.2f} {0[1]:.2f} {0[2]:.2f}, quat {1[0]:.3f} {1[1]:.3f} {1[2]:.3f} {1[3]:.3f}'.format(*paddle.get_pose())

    viz.callback(viz.TIMER_EVENT, log_mocap)
    viz.starttimer(0, 1, viz.FOREVER)

    def keydown(key):

        if key == "h":
            head.reset()
        if key == "H":
            head.save()
        elif key == "1":

            print "Marker Pos: " + str(mocap.get_MarkerPos(1))

    viz.callback(viz.KEYDOWN_EVENT, keydown)
	def __setupVizParams__(self):
		
		#Just playing here#
		#viz.setMultiSample(8)
		#viz.fov(120)
		
		#Check monitor refresh rate and set stereo mode accordingly#
		monitor_RefreshRate = viz.getOption('viz.monitor.refresh_rate', type=int)
		#if(119 <= monitor_RefreshRate):
			#Turn on the physics engine
		viz.phys.enable() 
		viz.window.setFullscreenMonitor(2)
		viz.setMultiSample(8)
		viz.go(viz.FULLSCREEN | viz.QUAD_BUFFER)
		print "here"
def main():
    viz.setOption('viz.fullscreen.monitor', 1)
    viz.setOption('viz.window.width', 2 * 640)
    viz.setOption('viz.window.height', 480)
    viz.setMultiSample(4)
    viz.MainWindow.clip(0.01, 500)

    vizconfig.register(nvis.nvisorSX111())

    viz.go(viz.FULLSCREEN)

    piazza = viz.addChild('piazza.osgb')

    mocap = phasespace.Mocap('192.168.1.230')

    head = mocap.track_rigid('Resources/hmd-nvis.rb', center_markers=(0, 5))
    head.link_pose(viz.MainView)

    glove = mocap.track_points([8, 9, 10])

    paddle = mocap.track_rigid({
        17: (0, 0, 1),
        19: (0, 0, 0),
        20: (1, 0, 0),
        22: (0, 1, 0),
    })

    mocap.start_thread()

    #mocap.start_timer()

    def log_mocap(timer_id):
        print 'glove#9 pos {0[1]:.2f} {0[1]:.2f} {0[2]:.2f}'.format(
            *glove.get_marker(9))
        print 'head    pos {0[0]:.2f} {0[1]:.2f} {0[2]:.2f}, quat {1[0]:.3f} {1[1]:.3f} {1[2]:.3f} {1[3]:.3f}'.format(
            *head.get_pose())
        print 'paddle  pos {0[0]:.2f} {0[1]:.2f} {0[2]:.2f}, quat {1[0]:.3f} {1[1]:.3f} {1[2]:.3f} {1[3]:.3f}'.format(
            *paddle.get_pose())

    viz.callback(viz.TIMER_EVENT, log_mocap)
    viz.starttimer(0, 1, viz.FOREVER)

    def keydown(*args):
        head.reset()
        paddle.reset()

    viz.callback(viz.KEYDOWN_EVENT, keydown)
Exemplo n.º 10
0
def InitVive():
    viz.setMultiSample(8)
    # Setup SteamVR HMD
    hmd = steamvr.HMD()
    if not hmd.getSensor():
        sys.exit('SteamVR HMD not detected')

    navigationNode = viz.addGroup()
    viewLink = viz.link(navigationNode, viz.MainView)
    viewLink.preMultLinkable(hmd.getSensor())

    # setting starting camera position and rotation of the view
    navigationNode.setEuler(180, 0, 0)
    navigationNode.setPosition(-0, 0.3, 3.0)

    # setting starting camera position and rotation
    viz.MainView.setEuler([180, 0, 0])
    viz.MainView.setPosition([0, 1.3, 4])
def main():
    viz.setOption('viz.fullscreen.monitor', 1)
    viz.setOption('viz.window.width', 2 * 640)
    viz.setOption('viz.window.height', 480)
    viz.setMultiSample(4)
    viz.MainWindow.clip(0.01, 500)

    vizconfig.register(nvis.nvisorSX111())

    viz.go(viz.FULLSCREEN)

    piazza = viz.addChild('piazza.osgb')

    mocap = phasespace.Mocap('192.168.1.230')

    head = mocap.track_rigid('Resources/hmd-nvis.rb', center_markers=(0, 5))
    head.link_pose(viz.MainView)

    glove = mocap.track_points([8, 9, 10])

    paddle = mocap.track_rigid({
      17:(0, 0, 1),
      19:(0, 0, 0),
      20:(1, 0, 0),
      22:(0, 1, 0),
    })

    mocap.start_thread()
    #mocap.start_timer()

    def log_mocap(timer_id):
        print 'glove#9 pos {0[1]:.2f} {0[1]:.2f} {0[2]:.2f}'.format(*glove.get_marker(9))
        print 'head    pos {0[0]:.2f} {0[1]:.2f} {0[2]:.2f}, quat {1[0]:.3f} {1[1]:.3f} {1[2]:.3f} {1[3]:.3f}'.format(*head.get_pose())
        print 'paddle  pos {0[0]:.2f} {0[1]:.2f} {0[2]:.2f}, quat {1[0]:.3f} {1[1]:.3f} {1[2]:.3f} {1[3]:.3f}'.format(*paddle.get_pose())

    viz.callback(viz.TIMER_EVENT, log_mocap)
    viz.starttimer(0, 1, viz.FOREVER)

    def keydown(*args):
        head.reset()
        paddle.reset()

    viz.callback(viz.KEYDOWN_EVENT, keydown)
Exemplo n.º 12
0
def main():
    global wingl
#    global wingr
    viz.cam.setHandler(vizcam.KeyboardCamera())
    myo.init()
    gyrolist = [[0,0,0]]
    viz.setMultiSample(4)
#    
    wingl = viz.addChild('basketball.osgb')
    wingl.setScale([10,0.3,1])
    wingl.setCenter([100,100,100])
    wingl.setEuler([0,90,0])
    wingl.collideSphere(0.5)
    lStartPOS = [ 0, 2.5, 2 ]
    wingl.setPosition( lStartPOS )
#    wingr = viz.addChild('basketball.osgb')
#    wingr.setScale([10,0.3,1])
#    wingr.setCenter([100,100,100])
#    wingr.setEuler([0,90,0])
#    wingr.collideSphere(0.5)
#    rStartPOS = [ 0, 2.5, 2 ]
#    wingr.setPosition( rStartPOS )

    #viz.MainView.setPosition([0,2,-15])
    hub = myo.Hub()
    hub.set_locking_policy(myo.locking_policy.none)
    hub.run(1000, Listener())
    vizact.ontimer(0.01 ,updateMyo, [gy, gy2, gy3, wingl, orx, ory, orz, orw, or1x, or1y, or1z, or1w])
    vizact.onkeydown('p', hub.shutdown)
    FileReader()
    initializeObjectFiles()
    initializeLocations()
    vizact.ontimer(0.1, update)
    vizact.onkeydown(' ', statusUpdate)
    vizact.onkeydown('s', hub.shutdown)
    
#    viz.AVIRecorder.maxWidth = 1920;
#    viz.AVIRecorder.maxHight = 1080;
    vizact.onkeydown('b', viz.window.startRecording, 'myo_capture.avi' ) 
    vizact.onkeydown('e', viz.window.stopRecording )
Exemplo n.º 13
0
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()
Exemplo n.º 14
0
    def __init__(self, filename=''):
        '''Opens and interprets configuration files for running experiments.

        This constructor opens both the system config (as defined by the
        <platform>.cfg file) and the experiment config (as defined by the given
        filename).

        Both configurations must conform the specs given in SYSTEM.ini and
        experiment.ini respectively. It also initializes the system as specified
        in the system config.
        '''
        self.exp = self.create_exp_config(filename)
        self.sys = self.create_sys_config()
        for path in self.sys['set_path']:
            viz.res.addPath(path)

        viz.window.setFullscreenMonitor(self.sys['displays'])
        viz.setMultiSample(self.sys['antiAliasPasses'])
        viz.MainWindow.clip(0.01, 200)

        self.writables = []
        self.writer = None
        self.mocap = None
        self.body_camera = None

        self._setup_hmd()
        self._setup_recorder()
        self._setup_eyetracking()
        self._setup_phasespace()
        self._setup_hiball()

        self.writables.append(self.mocap)
        self.writables.append(self.body_camera)

        if self.sys['use_fullscreen']:
            viz.go(viz.FULLSCREEN)
        else:
            viz.go()
def main():
    # Initialize window
    viz.setMultiSample(8)
    viz.go()

    # Setup SteamVR HMD
    hmd = steamvr.HMD()
    if not hmd.getSensor():
        sys.exit('SteamVR HMD not detected')

    # Setup navigation node and link to main view
    navigationNode = viz.addGroup()
    viewLink = viz.link(navigationNode, viz.MainView)
    viewLink.preMultLinkable(hmd.getSensor())

    # Load environment
    gallery = vizfx.addChild('gallery.osgb')
    gallery.hint(viz.OPTIMIZE_INTERSECT_HINT)
    gallery.disable(viz.SHADOW_CASTING)

    #Create skylight
    viz.MainView.getHeadLight().disable()
    sky_light = viz.addDirectionalLight(euler=(0,90,0), color=viz.WHITE)
    sky_light.setShadowMode(viz.SHADOW_DEPTH_MAP)
    
    #Start the Leap Motion!
    handGenerator = LeapListener()
    handGenerator.startLeap(hmd.getSensor())
    
    # Add controllers
    for controller in steamvr.getControllerList():

        # Create model for controller
        controller.model = controller.addModel(parent=navigationNode)
        controller.model.disable(viz.INTERSECTION)
        viz.link(controller, controller.model)
Exemplo n.º 16
0
	def display(self):
		"""
		Initialize the display
		
		Mode selection:
			0 - Regular computer
			1 - 3D TV
			2 - Oculus rift
		"""
		if self.displayMode == 0:
			viz.setMultiSample(4)
			viz.fov(60)
			viz.window.setSize([1280,720])
			viz.go()
			viz.window.setFullscreenMonitor(1)
#			viz.go(viz.FULLSCREEN) #viz.FULLSCREEN

		elif self.displayMode == 1:
			viz.setMultiSample(4)
			viz.go(viz.STEREO_HORZ | viz.FULLSCREEN)
			
		elif self.displayMode == 2:
			viz.go(viz.STEREO_HORZ)
			viz.setMultiSample(16)
			viz.window.setSize([1280,720])
			
			KEYS = {
				'reset'		: 'r',
				'camera'	: 'c'}
			
			# Helps reduce latency
			#do not use ? makes things worse.
			#viz.setOption('viz.glFinish',1)
		
		elif self.displayMode == 3:
			viz.setMultiSample(4)
			viz.fov(60)
			viz.go(viz.FULLSCREEN) #viz.FULLSCREEN
			viz.window.setFullscreenMonitor(2)

		# Initial direction of main view
		viz.MainView.setEuler([0,0,0])
		viz.MainView.setPosition([0,0,-3], viz.ABS_GLOBAL)
Exemplo n.º 17
0
	def display(self):
		"""
		Initialize the display
		
		Mode selection:
			0 - Regular computer
			1 - 3D TV
			2 - Oculus rift
		"""
		if self.displayMode == 0:
			viz.setMultiSample(4)
			viz.fov(60)
			viz.window.setSize([1280,720])
			viz.go()
			viz.window.setFullscreenMonitor(1)
#			viz.go(viz.FULLSCREEN) #viz.FULLSCREEN

		elif self.displayMode == 1:
			viz.setMultiSample(4)
			viz.go(viz.STEREO_HORZ | viz.FULLSCREEN)
			
		elif self.displayMode == 2:
			viz.go(viz.STEREO_HORZ)
			viz.setMultiSample(16)
			viz.window.setSize([1280,720])
			
			KEYS = {
				'reset'		: 'r',
				'camera'	: 'c'}
			
			# Helps reduce latency
			#do not use ? makes things worse.
			#viz.setOption('viz.glFinish',1)
		
		elif self.displayMode == 3:
			viz.setMultiSample(4)
			viz.fov(60)
			viz.go(viz.FULLSCREEN) #viz.FULLSCREEN
			viz.window.setFullscreenMonitor(2)

		# Initial direction of main view
		viz.MainView.setEuler([0,0,0])
		viz.MainView.setPosition([0,0,-3], viz.ABS_GLOBAL)
Exemplo n.º 18
0
    def __setupSystem(self):

        # Set up the wiimote
        ################################################################
        ################################################################
        ##  Misc. Design specific items here.
        if (self.sysCfg['use_wiimote']):
            # Create wiimote holder
            self.wiimote = 0
            self._connectWiiMote()

        #Set up the HMD
        if self.sysCfg['use_hmd']:
            self.hmd = HMD(self.sysCfg['hmd'], True)
            self.use_HMD = True
        else:
            self.hmd = HMD(self.sysCfg['hmd'], False)
            self.use_HMD = False

        viz.window.setFullscreenMonitor(self.sysCfg['displays'])

        viz.setMultiSample(self.sysCfg['antiAliasPasses'])
        viz.MainWindow.clip(0.01, 200)
        viz.vsync(1)

        viz.setOption("viz.glfinish", 1)
        viz.setOption("viz.dwm_composition", 0)

        #Set up recording
        if self.sysCfg['use_DVR'] == 1:
            self.use_DVR = True
        else:
            self.use_DVR = False
        self.writer = None  #Will get initialized later when the system starts

        #Set up the eye tracking callibration/configuration (eyeTrackingCal)

        if self.sysCfg['use_eyetracking']:
            self.use_eyeTracking = True
            if self.sysCfg['hmd']['type'] == 'nvis':

                import EyeTrackerCalibrationNVIS_MT
                self.eyeTrackingCal = EyeTrackerCalibrationNVIS_MT.EyeTrackerCalibrationNVIS(
                    self.sysCfg['eyetracker']['settingsDir'])
                self.eyeTrackingCal.changeDisplayNum(
                    self.sysCfg['displays'][0])

                print "Eye tracking enabled using NVIS visor"
            else:
                print "Error in VRLabConfig: Eye-tracking not setup for this HMD."
                sys.exit(1)
        else:
            self.use_eyeTracking = False
            self.eyeTrackingCal = None

        self.mocap = None
        self.bodyCam = None

        if self.sysCfg['use_phasespace']:

            from mocapInterface import phasespaceInterface
            self.mocap = phasespaceInterface(self.sysCfg)

            self.use_phasespace = True
        else:
            self.use_phasespace = False

        if self.sysCfg['use_virtualPlane']:

            isAFloor = self.sysCfg['virtualPlane']['isAFloor']
            planeName = self.sysCfg['virtualPlane']['planeName']
            planeCornerFile = self.sysCfg['virtualPlane']['planeCornerFile']
            self.virtualPlane = virtualPlane.virtualPlane(
                self, planeName, isAFloor, planeCornerFile)

        if self.sysCfg['use_virtualPlane']:
            viz.go(viz.FULLSCREEN | viz.QUAD_BUFFER)
        elif self.sysCfg['use_fullscreen']:
            viz.go(viz.FULLSCREEN)
        else:
            viz.go()
Exemplo n.º 19
0
	def __setupSystem(self):
		
		# Set up the wiimote
		################################################################
		################################################################
		##  Misc. Design specific items here.
		if( self.sysCfg['use_wiimote']):
			# Create wiimote holder
			self.wiimote = 0
			self._connectWiiMote()
		
		#Set up the HMD
		if self.sysCfg['use_hmd']:
			self.hmd = HMD(self.sysCfg['hmd'], True)
			self.use_HMD = True
		else:
			self.hmd = HMD(self.sysCfg['hmd'], False)
			self.use_HMD = False
		
		
		viz.window.setFullscreenMonitor(self.sysCfg['displays'])
		
		viz.setMultiSample(self.sysCfg['antiAliasPasses'])
		viz.MainWindow.clip(0.01 ,200)
		viz.vsync(1)
		
		viz.setOption("viz.glfinish", 1)
		viz.setOption("viz.dwm_composition", 0)
		
		#Set up recording
		if self.sysCfg['use_DVR'] == 1:
			self.use_DVR = True
		else:
			self.use_DVR = False
		self.writer = None #Will get initialized later when the system starts
		
		#Set up the eye tracking callibration/configuration (eyeTrackingCal)
		
		if self.sysCfg['use_eyetracking']:
			self.use_eyeTracking = True
			if self.sysCfg['hmd']['type'] == 'nvis':
			
				import EyeTrackerCalibrationNVIS_MT
				self.eyeTrackingCal = EyeTrackerCalibrationNVIS_MT.EyeTrackerCalibrationNVIS(self.sysCfg['eyetracker']['settingsDir'])
				self.eyeTrackingCal.changeDisplayNum(self.sysCfg['displays'][0])
				
				
				print "Eye tracking enabled using NVIS visor"
			else:
				print "Error in VRLabConfig: Eye-tracking not setup for this HMD."
				sys.exit(1)
		else:
			self.use_eyeTracking = False
			self.eyeTrackingCal = None
			
		#self.writables.append(self.eyeTrackingCal)
			
		self.mocap = None
		self.bodyCam = None
		
		if self.sysCfg['use_phasespace']:
			
			from mocapInterface import phasespaceInterface			
			self.mocap = phasespaceInterface(self.sysCfg);
				
			self.use_phasespace = True
		else:
			self.use_phasespace = False
		
		if self.sysCfg['use_hiball']:
			from HiBallCameraMT import HiBallCamera
			#self.mocap = HiBallCamera(self.sysCfg['hiball']['origin'], self.sysCfg['hiball']['scale'], None, None, self.sysCfg, None);
			self.mocap = HiBallCamera(self.sysCfg['hiball']['origin'], particle=None, sensorNum=self.sysCfg['hiball']['headCam'], attachTo=viz.MainView, preTrans = self.sysCfg['hiball']['preTransHead'])
			if self.sysCfg['hiball']['bodyCam'] != -1:
				self.bodyCam = HiBallCamera(self.sysCfg['hiball']['origin'], particle=None, sensorNum=self.sysCfg['hiball']['bodyCam'], attachTo=None, preTrans = self.sysCfg['hiball']['preTransBody'])
			else:
				self.bodyCam = None
			self.use_hiball = True
		else:
			self.use_hiball = False
		

		self.writables.append(self.mocap)
		self.writables.append(self.bodyCam)
		
		if self.sysCfg['use_fullscreen']:
			viz.go(viz.FULLSCREEN)
		else:
			viz.go()
		
		self._setWinPriority(priority=5)
Exemplo n.º 20
0
#world_axes = vizshape.addAxes()
#X = viz.addText3D('X',pos=[1.1,0,0],color=viz.RED,scale=[0.3,0.3,0.3],parent=world_axes)
#Y = viz.addText3D('Y',pos=[0,1.1,0],color=viz.GREEN,scale=[0.3,0.3,0.3],align=viz.ALIGN_CENTER_BASE,parent=world_axes)
#Z = viz.addText3D('Z',pos=[0,0,1.1],color=viz.BLUE,scale=[0.3,0.3,0.3],align=viz.ALIGN_CENTER_BASE,parent=world_axes)

# add a stencil buffer for the outline highlight
if __name__ == "__main__":
    viz.setOption('viz.display.stencil', 8)
    #vizconnect.go('./vizconnect_config.py')
    vizconnect.go('./xylo_vizconnect_config2017.py')
    for tracker in vizconnect.ConfigurationManager.get().getDict('tracker'):
        print(tracker)
    # get the quality setting of the demo if specified
    DEMO_QUALITY_SETTING = max(
        0, viz.getOption('DEMO_QUALITY_SETTING', default=4, type=int))
    viz.setMultiSample(DEMO_QUALITY_SETTING * 2)
    # disable the head lamps since we're doing lighting ourselves
    for window in viz.getWindowList():
        window.getView().getHeadLight().disable()
else:
    vizconnect.go('./multiscript_vizconnect_config.py')

# Add the local events (events specific to this demo)
#vizconnect.go('vizconnect_config_local_events.py')

# Load the vizconnect configuration. File: base_vizconnect_config2016.py
vizfx.addDirectionalLight(euler=(0, 90, 0))

# Add a viewpoint so the user starts at [0,0,0].
vp = vizconnect.addViewpoint(pos=[0, 0, 0],
                             posMode=vizconnect.VIEWPOINT_MATCH_BASE)
Exemplo n.º 21
0
		self._avatar.setBodyColor(bodyColor)
		self._avatar.setShadeColor(shadeColor)
#		self._avatar.setTracker(self._player_matrix)
		self._avatar.setTracker(viz.link(self._view, viz.NullLinkable,offset=[0,-0.25,0]))
		self._view.collision(viz.ON)
		self._view.eyeheight(eyeH)
		# add the representation on the map
		self._mapAva = viz.addTexQuad(size=.75)
		#self._mapAva = vizshape.addSphere(.5,10,10)
		self._mapAva.texture(viz.addTexture('textures/mapAva_icon.png'),'',0)
		self._mapAva.color(bodyColor)
		self._updateFunc = vizact.onupdate(0, self.UpdatePlayer)
		
	def UpdatePlayer(self):
#		self._view.setPosition([self._view.getPosition()[0], 1.82, self._view.getPosition()[2]])
		pos = self._view.getPosition(viz.VIEW_ORI)
		eul = self._view.getEuler(viz.VIEW_ORI)
#		quat= self._view.getQuat(viz.VIEW_ORI)
#		self._player_matrix.setPosition(pos)
#		self._player_matrix.setQuat(quat)
		self._mapAva.setPosition(pos[0], 0, pos[2])
		self._mapAva.setEuler(eul[0], 90, eul[2])
		#self._player_matrix = self._view.getMatrix(viz.VIEW_ORI)
		
		
if __name__ == '__main__':

    viz.setMultiSample(2)
    viz.go()

    ground = viz.addChild('ground.osgb')
Exemplo n.º 22
0
'''
Project  
Jourdan Kerl & Bisoye Olaleye
Performer plays music as the crowd dances
'''
import viz
import vizshape
import vizact
from random import randint

viz.setMultiSample(4)#Enable full screen anti-aliasing (FSAA) to smooth edges
viz.go() #starts an empty world 
viz.MainWindow.fov(60)#Increase the Field of View
#viz.MainView.move([0,0,7]) #X,Z,Y
viz.MainView.setPosition([-0,0,-15])
#viz.MainView.setEuler([0,30,0])
piazza = viz.addChild('piazza.osgb') #adds the plazza

sound = viz.addAudio('Panda.mp3') 
sound.loop(viz.ON)
sound.play() 

platform = viz.addChild('platform.osg')
platform.setPosition([0, .2, -11])
micStand = viz.addChild('pole.wrl',parent=platform)
micStand.setPosition([0, 0, .5])
micStand.setScale([0.5,0.36,0.5])
micStand.color(1,1,1)

mic = viz.addChild('pole.wrl')
mic.setPosition([0, 1.6, -10.5])
Exemplo n.º 23
0
    def __setupSystem(self):

        # Set up the wiimote
        ################################################################
        ################################################################
        ##  Misc. Design specific items here.

        if (self.sysCfg['use_wiimote']):
            # Create wiimote holder
            self.wiimote = 0
            self._connectWiiMote()

        ################################################################
        ##  HMD

        #Set up the HMD
        if self.sysCfg['use_hmd']:
            self.hmd = HMD(self.sysCfg['hmd'],
                           True,
                           displayList=self.sysCfg['displays'])
            self.use_HMD = True
        else:
            self.hmd = HMD(self.sysCfg['hmd'], False)
            self.use_HMD = False

        viz.setMultiSample(self.sysCfg['antiAliasPasses'])
        viz.MainWindow.clip(0.01, 200)
        #viz.vsync(1)

        viz.setOption("viz.glfinish", 1)
        viz.setOption("viz.dwm_composition", 0)

        ################################################################
        ##  Recording

        if self.sysCfg['use_DVR'] == 1:
            self.use_DVR = True
        else:
            self.use_DVR = False
        self.writer = None  #Will get initialized later when the system starts

        #Set up the eye tracking callibration/configuration (eyeTrackingCal)

        ################################################################
        ##  Eyetracking

        if self.sysCfg['use_eyetracking']:
            self.use_eyeTracking = True
            if self.sysCfg['hmd']['type'] == 'nvis':

                import EyeTrackerCalibrationNVIS_MT
                self.eyeTrackingCal = EyeTrackerCalibrationNVIS_MT.EyeTrackerCalibrationNVIS(
                    self.sysCfg['eyetracker']['settingsDir'])
                self.eyeTrackingCal.changeDisplayNum(
                    self.sysCfg['displays'][0])

                print "Eye tracking enabled using NVIS visor"
            else:
                print "Error in VRLabConfig: Eye-tracking not setup for this HMD."
                sys.exit(1)
        else:
            self.use_eyeTracking = False
            self.eyeTrackingCal = None

        ################################################################
        ##  Mocap

        #self.writables.append(self.eyeTrackingCal)

        self.mocap = None
        self.bodyCam = None

        if self.sysCfg['use_phasespace']:

            #from mocapInterface import phasespaceInterface
            #self.mocap = phasespaceInterface(self.sysCfg);

            from mocapInterface import phasespaceInterface
            self.mocap = phasespaceInterface(self.sysCfg)

            self.use_phasespace = True
        else:
            self.use_phasespace = False

        if self.sysCfg['use_hiball']:
            from HiBallCameraMT import HiBallCamera
            #self.mocap = HiBallCamera(self.sysCfg['hiball']['origin'], self.sysCfg['hiball']['scale'], None, None, self.sysCfg, None);
            self.mocap = HiBallCamera(
                self.sysCfg['hiball']['origin'],
                particle=None,
                sensorNum=self.sysCfg['hiball']['headCam'],
                attachTo=viz.MainView,
                preTrans=self.sysCfg['hiball']['preTransHead'])
            if self.sysCfg['hiball']['bodyCam'] != -1:
                self.bodyCam = HiBallCamera(
                    self.sysCfg['hiball']['origin'],
                    particle=None,
                    sensorNum=self.sysCfg['hiball']['bodyCam'],
                    attachTo=None,
                    preTrans=self.sysCfg['hiball']['preTransBody'])
            else:
                self.bodyCam = None
            self.use_hiball = True
        else:
            self.use_hiball = False

        self.writables.append(self.mocap)
        self.writables.append(self.bodyCam)

        if self.sysCfg['use_fullscreen']:
            viz.go(viz.FULLSCREEN)
        else:
            viz.go()
#    print 'Tracker position',headTracker.getPosition()
#    print 'Tracker euler',headTracker.getEuler()
#    print 'Hand Tracker position',handTracker.getPosition() #just added this
#    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()

#so far so good

viz.setMultiSample(4)
viz.fov(60)
viz.go()
#Add a world axis with X,Y,Z labels
world_axes = vizshape.addAxes()
X = viz.addText3D('X',pos=[1.1,0,0],color=viz.RED,scale=[0.3,0.3,0.3],parent=world_axes)
Y = viz.addText3D('Y',pos=[0,1.1,0],color=viz.GREEN,scale=[0.3,0.3,0.3],align=viz.ALIGN_CENTER_BASE,parent=world_axes)
Z = viz.addText3D('Z',pos=[0,0,1.1],color=viz.BLUE,scale=[0.3,0.3,0.3],align=viz.ALIGN_CENTER_BASE,parent=world_axes)
#grids are good
grid = vizshape.addGrid(color=[0.2]*3)
viz.clearcolor(viz.GRAY)

#Create proximity manager
manager = vizproximity.Manager()
manager.setDebug(viz.ON)
This script will query a single marker, the Marker 'E', for it's position.

Keys and their corresponding marker positions:
1 - Top left
2 - Top right
3 - Bottom left
4 - Bottom right
5 - Print in WEnvironment.py1 format
6 - Refresh (Delete) recorded positions
"""

import viz
import vizshape
from mocapInterface import mocapInterface

viz.setMultiSample(8)
viz.fov(60)
viz.go()

import vizact
from mocapInterface import mocapInterface

phaseSpaceIP = '192.168.1.230'
owlParamMarkerCount = 25

# Dir where textures and rb files are located
phaseSpaceFilePath = 'MocapResources/'

# Rb files in phaseSpaceFilePath
rigidFileNames_ridx = []
	
Exemplo n.º 26
0
def displayHeatmap(project=True):
    '''
	 - Load accumulated view textures
	 - Add cube projector with given textures and shader converting intensities to heat map colors
	 - Let projector affect scene
	 - auto_update = True will set the shader uniforms automatically each frame
	'''
    import viz
    import vizact
    import vizcam

    viz.setMultiSample(4)

    viz.go()

    #vizcam.WalkNavigate()

    if project:
        piazza = viz.addChild('piazza.osgb')

        cube_textures = {
            viz.POSITIVE_X: viz.addTexture('accumulated_p_x.bmp'),
            viz.NEGATIVE_X: viz.addTexture('accumulated_n_x.bmp'),
            viz.POSITIVE_Y: viz.addTexture('accumulated_p_y.bmp'),
            viz.NEGATIVE_Y: viz.addTexture('accumulated_n_y.bmp'),
            viz.POSITIVE_Z: viz.addTexture('accumulated_p_z.bmp'),
            viz.NEGATIVE_Z: viz.addTexture('accumulated_n_z.bmp')
        }

        heat_projector = HeatmapVisualizer(cube_textures, auto_update=True)
        heat_projector.setPosition(viz.MainView.getPosition())
        heat_projector.affect(piazza)

        ## GUI for manipulation of the output heatmap

        i_slider = viz.addSlider()
        i_x = 1.0 - i_slider.getBoundingBox().width / 2.0
        i_y = 0.0 + i_slider.getBoundingBox().height / 2.0
        i_slider.setPosition([i_x, i_y, 0])
        i_slider.set(0.5)

        i_text = viz.addText('intensity scale', parent=viz.SCREEN)
        i_text.setPosition([
            i_x - i_text.getBoundingBox().width / 2 -
            i_slider.getBoundingBox().width / 2, 0.01, 0.0
        ])
        i_text.setScale([0.4, 0.4, 1.0])

        def onSlider(obj, pos):
            if obj == i_slider:
                heat_projector.setIntensityScale(pos + 0.5)

        viz.callback(viz.SLIDER_EVENT, onSlider)
    else:
        import vizshape

        env = viz.addEnvironmentMap(
            'accumulated.bmp',
            faces=['_p_x', '_n_x', '_p_y', '_n_y', '_p_z', '_n_z'])

        sb = vizshape.addSkyBox()
        sb.texture(env)
Exemplo n.º 27
0


MSAAVal = 0
MSAA = viz.choose("Multisample Anti-Aliasing", ['16','8','4','2','None'])
if MSAA == 0:
	MSAAVal = 16
elif MSAA == 1:
	MSAAVal = 8
elif MSAA == 2:
	MSAAVal = 4
elif MSAA == 3:
	MSAAVal = 2
elif MSAA == 4:
	MSAAVal = 0
viz.setMultiSample(MSAAVal)
print ("MSAA: " + str(MSAAVal))
del MSAAVal

VSync = viz.choose("Vertical Sync", ['False', 'True'])
if VSync == 0:
	viz.vsync(0)
else:
	viz.vsync(1)
print ("VSync: " + str(VSync))

# Input questions/variables: Asked at program launch
subjectno = viz.input('subject number?' , value='99')
age = viz.input('Age number?' , value='-1')
gender = viz.choose("Gender?", ["Male","Female","Not Given"])
footSize = 0
Exemplo n.º 28
0
import viz
import viztracker
import vizinput
import vizshape
import vizproximity
import vizinfo
# Enable full screen anti-aliasing (FSAA) to smooth edges
viz.setMultiSample(1)


#Kommentar entfernen fuer 3D-Labor
"""
# connect to tracker
vrpn7 = viz.add('vrpn7.dle')
hostname = '141.82.50.174'

# connect eye tracker
pptEyes = vrpn7.addTracker('PPT0@'+hostname,0)
link = viz.link(pptEyes, viz.Mainview)
"""


# Display
viz.setOption('viz.fullscreen',1)
viz.fov(40.0,1.333)
#viz.setOption('viz.stereo',viz.QUAD_BUFFER)

viz.mouse.setVisible(True)

# increase the Field of View
viz.MainWindow.fov(60)
Exemplo n.º 29
0
def captureViewIntensity():
    ### replace with your own application setup
    import viz
    import vizact
    import vizcam

    viz.setMultiSample(4)

    viz.go()

    piazza = viz.addChild("piazza.osgb")

    ### Add this at the bottom
    '''
	 - Load an animation file, which encapsulates the view rotation for a given time span.
	 - Samples per second determines how many samples are taken along the animation path over the duration of loaded animation.
	 - While the loaded animation path is playing the accumulator will accumulate view intensity values.
	 - After the animation player finished playing these intensities will be saved to a cubemap
	 - The intensity images is then used for final heatmap computation
	'''

    # load animation path
    loader = AnimationPathLoader("test_animation.txt")
    player = AnimationPathPlayer(path=loader.getAnimationPath())
    path_link = viz.link(loader.getAnimationPath(), viz.MainView)

    global accumulator
    accumulator = ViewAccumulatorCube(frame_weight=0.5, aperture_scale=0.5)
    accumulator.setPosition(viz.MainView.getPosition())

    global _capture_done
    _capture_done = False

    cube_textures = {
        viz.POSITIVE_X: accumulator.getOutputTexture(viz.POSITIVE_X),
        viz.NEGATIVE_X: accumulator.getOutputTexture(viz.NEGATIVE_X),
        viz.POSITIVE_Y: accumulator.getOutputTexture(viz.POSITIVE_Y),
        viz.NEGATIVE_Y: accumulator.getOutputTexture(viz.NEGATIVE_Y),
        viz.POSITIVE_Z: accumulator.getOutputTexture(viz.POSITIVE_Z),
        viz.NEGATIVE_Z: accumulator.getOutputTexture(viz.NEGATIVE_Z)
    }

    heat_projector = HeatmapVisualizer(cube_textures, auto_update=True)
    heat_projector.setPosition(viz.MainView.getPosition())
    heat_projector.affect(piazza)

    # update function capturing accumulating view intensity
    def updateFct(player, accumulator):
        global _capture_done

        if not player.isPlaying():
            if not _capture_done:
                accumulator.saveAll()
                _capture_done = True
                print "Intensity capture done."
            elif accumulator != None:
                accumulator.remove()
                accumulator = None
                path_link.remove()

    update = vizact.onupdate(1, updateFct, player, accumulator)
Exemplo n.º 30
0
def preVizGo():
	viz.setMultiSample(4)
	return True
Exemplo n.º 31
0
[.70, .30],#RB
[.30, .50],#LC
[.50, .30],#CB
[.70, .50],#RC
[.50, .70]]#CT

sphere_size = .015
depth = 2 # m
confidence_level = .2





# initialize window
viz.setMultiSample(8)
viz.fov(60)
viz.go()

# setup SteamVR HMD
hmd = steamvr.HMD()
if not hmd.getSensor():
	sys.exit('SteamVR HMD not detected')
	
# setup navigation node and link to main view
navigationNode = viz.addGroup()
viewLink = viz.link(navigationNode, viz.MainView)
viewLink.preMultLinkable(hmd.getSensor())


Exemplo n.º 32
0
import GodRay
import WaterParticles

import scavengerhunt

import transport_vhil
import vizshape
import globals_oa
from globals_oa import *
import schooling
import worldvizcode
import algae_blend
import vizinput
import datacollection

viz.setMultiSample(4)	# Use NVIDIA Control Panel instead.

# viz.setMultiSample(4)	# Use NVIDIA Control Panel instead.
headLight = viz.MainView.getHeadLight() 
headLight.disable() 

#setting up my own transport and event triggers
transport_vhil.setUp()
#the statement below should be called after the user's initial consent page response is received, but before the zones are loaded, for the selection will be based off of globals_oa.sfLevel
datacollection.tribeca2016Init()
#transport_vhil.user.setEuler( [180,0,0])
if globals_oa.RENDER_ENV == globals_oa.RENDER_ENV_CHOICES['VHIL']:
	viz.window.setSize(1900,1000)
#######################################################

# Add environments.
Exemplo n.º 33
0
import viz
import vizinfo
import vizact
import math
import vizshape

from config import *

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

viz.MainView.move([5, 0, -25])

#sphere = vizshape.addSphere(radius=1);
#sphere.setPosition([0, 0, 0]);

ar = viz.add('./ar/artoolkit.dle')
camera = ar.addWebCamera()

marker = camera.addMatrixMarker(47, width=1000)
#id works for 0-63
endMarker = camera.addMatrixMarker(40, width=1000)
#id works for 0-63

current = 1


def main():
    triangle = viz.addChild('thesis/triangle_1.dae')
    triangle2 = viz.addChild('thesis/triangle_1.dae')
Exemplo n.º 34
0
import viz
import vizact
import vizfx
import vizcam
import vizinfo
import time
import vizdlg
import viztask

viz.setMultiSample(16)
viz.fov(60)
viz.go()
viz.clearcolor(viz.SKYBLUE)


view = viz.MainView

viz.MainView.move([-30,4,-40])
viz.MainView.setEuler([0,0,0])
viz.MainView.gravity(0.0) 

#road between two fire 
fire1=viz.addChild('fire2.dae')
fire1.setPosition(40,15,05)
fire1.setScale(.5,.5,.5)

fire2=viz.addChild('fire2.dae')
fire2.setPosition(45,25,60)
fire2.setScale(.5,.5,.5)

#black building