Пример #1
0
def addUser():
	global mainUser
	# ---- Trackers ----
	# Initialize an empty composite object to store all the trackers
	# The composite.storeTracker() method is used to combine the individual trackers for the user's body within the composite
	composite = VU.VUCompositeTrackers()
	vrpn = viz.add('vrpn7.dle')

	headPos = vrpn.addTracker( 'PPT0@'+PPT_MACHINE,PPT_HEAD_ID) 
	
	if not OPTICAL_HEADING:
		iLabs = viz.addExtension( 'inertiallabs.dle' )
		headOri = iLabs.addSensorBus(port=INERTIALLABS_HEAD_PORT)[0]
		VU.onkeydownspecial('r', resetHead, headOri, 90 )
		

	# ---- Display ----
	import sensics
	sensics.zSight_60()
	
	if not OPTICAL_HEADING:
		headTracker = viz.mergeLinkable( headPos, headOri )
	else:
		headTracker = headPos
	composite.storeTracker (composite.HEAD, headTracker )
	viz.setOption('viz.fullscreen', 1 ) # Go fullscreen on monitor 1 
	viz.setOption('viz.fov', [37.5, 1.25]) # Set fov to match sensics specs
	viz.setOption('viz.setDisplayMode', [1280,1024]) # Change resolution of displays
	
	# ---- Input ----
	wandpos = vrpn.addTracker('PPT0@' + PPT_MACHINE, PPT_WAND_ID)

	wandori = iLabs.addSensorBus(port=INERTIALLABS_HAND_PORT)[0]
	wandtracker = viz.mergeLinkable( wandpos, wandori )
#	wandjoy = VU.VUJoystickPPTWandVRPN(hostname=PPT_MACHINE, markerid=PPT_WAND_ID+1)
#	wandflyer = VU.VUTrackerWandFlyerSmooth(wandjoy, wandtracker,accelerationSteps=Config.WAND_ACCELERATION_STEPS, decelerationSteps=Config.WAND_DECELERATION_STEPS, speed=Config.WAND_SPEED_SCALE, keystrokes=[Config.WAND_BUTTON1,Config.WAND_BUTTON2,Config.WAND_BUTTON3,Config.WAND_BUTTON4,Config.WAND_BUTTON5,Config.WAND_BUTTON6],buttonReset=None, buttonForward=None, buttonFist=None, oriSteer=False )
#	wandflyer.getHandSensor().joystick = wandjoy
#	composite.addDriverNode(wandflyer)
#	composite.storeTracker( composite.RHAND, wandtracker )
#the following is beta:
	global main_sphere
	composite.storeTracker(composite.RHAND,wandtracker)
	viz.link(wandtracker, main_sphere)
#end beta.
#not sure if u need this in beta:	composite.createRightHand(wandori)
	VU.onkeydownspecial('r', resetHand, wandori, 90 )
#	composite.storeTracker( composite.RHAND, wandtracker )
	#composite.createRightHand(wandori)
#	viz.link(wandtracker,ball)

	# ---- Avatar ----
	composite.createAvatarNone()
	
	# ---- Finalize Composite ----
	composite.finishTrackers() # Build up internal links for all the tracking devices
	composite.defineViewpoint() # Attach viewpoint to default location on the user
	mainUser = composite
	manager.addComposite(mainUser, 'Main-User')
Пример #2
0
LEFTHIP = 16
LEFTKNEE = 17
LEFTANKLE = 18
LEFTFOOT = 19
RIGHTHIP = 20
RIGHTKNEE = 21
RIGHTANKLE = 22
RIGHTFOOT = 23

# Store trackers, links, and vizshape objects
trackers = []
links = []
shapes = []

# Start vrpn
vrpn = viz.addExtension('vrpn7.dle')
trackerLocationA = '[email protected]'
trackerLocationB = '[email protected]'
# Now add all trackers and link a shape to it
for i in range(0,24):
	t = vrpn.addTracker(trackerLocationA, i)
	s = vizshape.addSphere(radius = 0.1)
	l = viz.link(t,s)
	trackers.append(t)
	links.append(l)
	shapes.append(s)

	if i == HEAD:
		s.color(viz.GREEN)
	elif i == TORSO:
		s.color(viz.RED)
Пример #3
0
def getExtension():
	"""Get Oculus extension object"""
	global _extension
	if _extension is None:
		_extension = viz.addExtension('oculus.dle')
	return _extension
LEFTHIP = 16
LEFTKNEE = 17
LEFTANKLE = 18
LEFTFOOT = 19
RIGHTHIP = 20
RIGHTKNEE = 21
RIGHTANKLE = 22
RIGHTFOOT = 23

# Store trackers, links, and vizshape objects
trackers = []
links = []
shapes = []

# Start vrpn
vrpn = viz.addExtension("vrpn7.dle")
trackerLocationA = "[email protected]"
trackerLocationB = "[email protected]"
# Now add all trackers and link a shape to it
for i in range(0, 24):
    t = vrpn.addTracker(trackerLocationA, i)
    s = vizshape.addSphere(radius=0.1)
    l = viz.link(t, s)
    trackers.append(t)
    links.append(l)
    shapes.append(s)

    if i == HEAD:
        s.color(viz.GREEN)
    elif i == TORSO:
        s.color(viz.RED)
Пример #5
0
def getExtension():
	"""Get Joystick extension object"""
	global _extension
	if _extension is None:
		_extension = viz.addExtension('DirectInput.dle')
	return _extension
Пример #6
0
#Create Gradient 3D textures
gradientTex3D = None

#Do we have a gradient folder
if Gradient.CheckGradientFolder( data.imageDirectory):
	gradientList = T3DLoading.loadImages( data.imageDirectory + '\\' + Gradient.GRADIENTS_DIRECTORY_NAME )
	gradient_descriptor = T3DLoading.VizTextureDescriptor()
	gradient_descriptor.populateFromVizTexture( gradientList[0] )
	gradient_descriptor.imageType = viz.TEX_3D
	gradient_descriptor.dimensions[2] = len( gradientList )
	
	gradientTex3D = T3DLoading.createBlank3DTexture( gradient_descriptor )
	T3DLoading.loadBlank3DTexture( gradientTex3D, gradientList )

#Create Planes#
volume_region_extension = viz.addExtension('Extensions\\VizardExtension_VolumeRender.dle')
render_volume = volume_region_extension.addNode()

volume_region_extension.command( command = 0, x = data.bounding_box_size[0], y = data.bounding_box_size[1], z = data.bounding_box_size[2], w = 0.008 )
volume_region_extension.command( command = 1, x = 1, y = 0, z = 0)

print 'bounding box size', data.bounding_box_size

render_volume.texture( blankTex3D, unit = 0 )

render_volume.texture( gradientTex3D, unit = 1 )

#Apply texture
shader_transfer.ApplyShader( render_volume )

#Create clipping tool
Пример #7
0
"""
This script shows moving cirecles made of dots and measures the
participants' sway
"""
import viz, viztask, vizact, vizinput, vizshape
import math
import random
import oculus
import time
import datetime
from datetime import date
from string import maketrans
import itertools, csv, time

#start vrpn
vrpn = viz.addExtension('vrpn7.dle')

#Ask for mode
presentations = ['oculus', 'normal']
presentationMode = vizinput.choose('Presentation Mode', presentations)

#Prompt for the participant's demographic

subject = vizinput.input('What is the participant number?')
age = vizinput.input('age?')
sex = ['male', 'female']
sex_choice = vizinput.choose('Sex', sex)
handedness = ['right', 'left', 'both']
handedness_choice = vizinput.choose('Handedness', handedness)
run = vizinput.input('Which run?')
ts = time.time()