예제 #1
0
    def __init__(self):

        # create simple GUI window with buttons for: pause, continue and a window to print strings
        self.pause_button = viz.addButtonLabel('pause Experiment')
        self.pause_button.setPosition(.5, .7)
        self.pause_button.setScale(2, 2)

        self.continue_button = viz.addButtonLabel('continue Experiment')
        self.continue_button.setPosition(.5, .5)
        self.continue_button.setScale(2, 2)

        self.text_screen = viz.addText('current marker:', viz.SCREEN)
        self.text_screen.setPosition(.25, .3)

        self.marker_field = viz.addButtonLabel('markers')
        self.marker_field.setPosition(.5, .2)
        self.marker_field.setScale(2, 2)

        # register callbacks for GUI to either pause or continue function
        viz.callback(viz.BUTTON_EVENT, self.on_button_press)

        # create network outlet
        self.connection_to_vr_machine = viz.addNetwork('BPN-C043')

        # register callback for network event handling
        viz.callback(viz.NETWORK_EVENT, self.write)

        # send behavioral to LSL stream (saved extra for faster testing of behavioral data)
        # create and start LSL marker stream
        self.behavior_stream_info = StreamInfo('BehavioralMarkerStream',
                                               'Markers', 1, 0, 'string',
                                               socket.gethostname())
        self.behavior_stream = StreamOutlet(self.behavior_stream_info)
counter = numberCount()

import vizact

wii1 = wiiObj()
vizact.onsensordown(wii1.wiimote,wii.BUTTON_B,counter.targetDetected)		

###############################################################################################################################################################################
###############################################################################################################################################################################
###############################################################################################################################################################################

networkingOn = True;

if networkingOn :
	netClient = viz.addNetwork('performLabVR2')
else:
	counter.startPresentingNumbers()

def onNetwork(packet):
	
	print 'Received network message: ' + packet.message
	
	if( packet.message == 'start'  ):
		
		counter.startPresentingNumbers()
	
	elif( packet.message == 'stop'  ): 

		counter.stopPresentingNumbers()
		
예제 #3
0
from PyDAQmx import *
import viz, vizact, viztask, vizshape, viznet, numpy, time, os, copy, csv, vizproximity

viz.go()
# constants
global t, Response, x, colors, off, real_tg_dist
x = 10 * numpy.hstack((numpy.zeros(95), numpy.ones(5)))
real_tg_dist = (0, 6.5, 0.5)

# Local network
monitor_record_Network = viz.addNetwork('SimonR-PC')
VRPNhost = 'SimonR-PC'

# Setup VRPN
vrpn = viz.add('vrpn7.dle')
head = vrpn.addTracker('Tracker0@' + VRPNhost, 9)
body = vrpn.addTracker('Tracker0@' + VRPNhost, 10)
tracker = vrpn.addTracker('Tracker0@' + VRPNhost, 4)
head.swapPos([1, 2, -3])
head.swapQuat([-1, -2, 3, 4])
body.swapPos([1, 2, -3])
body.swapQuat([-1, -2, 3, 4])

# Set up proximity sensor
manager = vizproximity.Manager()
target = vizproximity.Target(head)
manager.addTarget(target)


# LED flashing for single trial
class LEDs(object):
예제 #4
0
import viz, viztask, vizact, vizproximity, winsound, vizshape, vizinput, time

real_tg_dist = (0, 6.5, 0.5)

viz.go()

view = viz.MainView
view.setPosition([0, 10, 3.5])
view.setEuler(45, 90, 0)
subject_no = vizinput.input('Subject_no: ')

serverName = 'srushton-PC'
labNetwork = viz.addNetwork(serverName)

# Setup VRPN
vrpn = viz.add('vrpn7.dle')
head = vrpn.addTracker('Tracker0@localhost', 9)
body = vrpn.addTracker('Tracker0@localhost', 10)
tracker = vrpn.addTracker('Tracker0@localhost', 4)
head.swapPos([1, 2, -3])
head.swapQuat([-1, -2, 3, 4])
body.swapPos([1, 2, -3])
body.swapQuat([-1, -2, 3, 4])

ground = viz.add('ground.osgb')
target_1 = vizshape.addCylinder(height=3, radius=0.02)
target_1.color(viz.RED)
target_1.setPosition([0, 0, 0])
target_2 = vizshape.addCylinder(height=3, radius=0.02)
target_2.color(viz.RED)
target_2.setPosition([0, 0, 7])
예제 #5
0
import viz
import viztask
import vizshape
import viznet
import vizinfo
import time

#viz.window.setFullscreenMonitor(2)
viz.go()
view = viz.MainView
view.setPosition([0, 10, 3.5])
view.setEuler(45, 90, 0)

myNetwork = viz.addNetwork('Simon-Dell')
VRPNhost = 'SimonR-PC'

info = vizinfo.InfoPanel('monitoring', align=viz.ALIGN_CENTER, icon=False)

# Setup VRPN
vrpn = viz.add('vrpn7.dle')
head = vrpn.addTracker('Tracker0@' + VRPNhost, 9)
body = vrpn.addTracker('Tracker0@' + VRPNhost, 10)
tracker = vrpn.addTracker('Tracker0@' + VRPNhost, 4)
head.swapPos([1, 2, -3])
head.swapQuat([-1, -2, 3, 4])
body.swapPos([1, 2, -3])
body.swapQuat([-1, -2, 3, 4])

ground = viz.add('ground.osgb')
target_1 = vizshape.addCylinder(height=3, radius=0.02)
target_1.color(viz.RED)
예제 #6
0
import viztask
import vizshape
import viznet
import vizinfo
import time

#viz.window.setFullscreenMonitor(2)
viz.go()
view = viz.MainView

# Set up the position of the camera for a better view of the monitoring (see below)
view.setPosition([0, 10, 3.5])
view.setEuler(45, 90, 0)

# Add other computers to the local network
myNetwork = viz.addNetwork('Simon-Dell')  # the backpack laptop
VRPNhost = 'SimonR-PC'  # the PC that sends out the VRPN signal

info = vizinfo.InfoPanel('monitoring', align=viz.ALIGN_CENTER, icon=False)

# Setup VRPN
vrpn = viz.add('vrpn7.dle')
head = vrpn.addTracker('Tracker0@' + VRPNhost, 9)
body = vrpn.addTracker('Tracker0@' + VRPNhost, 10)
tracker = vrpn.addTracker('Tracker0@' + VRPNhost, 4)
head.swapPos([1, 2, -3])
head.swapQuat([-1, -2, 3, 4])
body.swapPos([1, 2, -3])
body.swapQuat([-1, -2, 3, 4])
# tracker.swapPos([1,2,-3])
예제 #7
0
import vizinfo


viz.setMultiSample(4)
viz.go()
viz.phys.enable()
viz.phys.setGravity(0,0,0)
dojo = viz.add('dojo.osgb')
#dojo.setScale([20,0,20])
#frame = viz.add("frame.dae")
sky = viz.add('sky_day.osgb')


player_matrix = viz.Matrix()
targetMachine = 'PC-SANDERS1'
targetMailbox = viz.addNetwork(targetMachine)

def sendPosition():
	#Retrieve current transform of viewpoint	
	mat = viz.MainView.getMatrix()

	#Send position/rotation to target network object
	targetMailbox.send(action=updatePlayer, quat=mat.getQuat(), pos=mat.getPosition())

# Start a timer that sends out data over the network every frame
vizact.ontimer(0,sendPosition)


def updatePlayer(e):
	player_matrix.setPosition(e.pos)
	player_matrix.setQuat(e.quat)