Ejemplo n.º 1
0
    def __init__(self):
        vizconnect.go('vizconnect_config_cave_art.py')

        _startPos = [28, 2.45, 160]

        ### Collision
        ### Desktop
        #viz.collision(viz.ON)
        viz.MainView.setPosition(_startPos)

        ### Cave
        ac = view_collision.AvatarCollision()
        ac.setCollideList([vizconnect.AVATAR_HEAD])
        ac.setTransport(vizconnect.getTransport().getNode3d())

        #viz.MainView.gravity(9.81)

        self.view = vizconnect.getGroup(
            'cave_manual_configuration').getNode3d()
        #self.setCameraPosition([120, 3.3, 87])
        self.setCameraPosition(_startPos, viz.ABS_GLOBAL)
        #self.view.setEuler([-90,0,7],viz.ABS_LOCAL)

        ### Scene Lighting
        self.setupLighting()
Ejemplo n.º 2
0
def getHostName():
	#Conditional statement making runtime automated
	compterName = socket.gethostname()
	if compterName == socket.gethostname():
		CONFIG_FILE = "vizconnect_config_CaveFloor+ART_headnode.py"
		vizconnect.go(CONFIG_FILE)
	else:
		viz.go()
Ejemplo n.º 3
0
def init(qHaveSimultaneous):
    if qHaveSimultaneous:
        vizconnect.go('vizconnectSetups/vive_ppt_intersense.py')
    else:
        vizconnect.go('vizconnectSetups/viveLighthouse.py')
    piazza = viz.add('piazza.osgb')
    piazza2 = viz.add('piazza_animations.osgb')

    vive = vizconnect.getRawTracker('head_tracker')
    if qHaveSimultaneous:
        optHead = vizconnect.getRawTracker('optical_heading')
        PPT1 = vizconnect.getRawTracker('ppt_1')
        PPT2 = vizconnect.getRawTracker('ppt_2')
        PPT3 = vizconnect.getRawTracker('ppt_3')
        PPT4 = vizconnect.getRawTracker('ppt_4')
        inertiacube = vizconnect.getRawTracker('inertiacube')

    # check controller is on
    steamvr.getControllerList()[0].isButtonDown(2)

    def getTrackInfo():
        if 1:
            if qHaveSimultaneous:
                return {
                    'vive': vive.getPosition() + vive.getEuler(),
                    'optical_heading':
                    optHead.getPosition() + optHead.getEuler(),
                    'PPT1': PPT1.getPosition(),
                    'PPT2': PPT2.getPosition(),
                    'PPT3': PPT3.getPosition(),
                    'PPT4': PPT4.getPosition(),
                    'inertiacube': inertiacube.getEuler()
                }
            else:
                return {'vive': vive.getPosition() + vive.getEuler()}
        else:
            return {
                'viveController':
                steamvr.getControllerList()[0].getPosition() +
                steamvr.getControllerList()[0].getEuler()
            }

    trialStartSound = viz.addAudio('sounds/quack.wav', play=0, volume=2.)
    trialCompletedSound = viz.addAudio('sounds/pop.wav', play=0, volume=2.)
    alarmSound = viz.addAudio('alarm.wav', play=0, volume=2.)

    # make return values
    Sounds = namedtuple('Sounds', 'trialStart trialCompleted alarm')
    InitReturn = namedtuple('initReturn', 'visuals sounds trackerDataFun')
    return InitReturn(visuals=[piazza, piazza2],
                      sounds=Sounds(trialStart=trialStartSound,
                                    trialCompleted=trialCompletedSound,
                                    alarm=alarmSound),
                      trackerDataFun=getTrackInfo)
Ejemplo n.º 4
0
def fadeAvatar(showingAvatar):
	global avatars, currentAvatar
	for a in avatars:
		if a is showingAvatar:
			a.alpha(1)
			a.enable(viz.RENDERING)
			currentAvatar = a
			
			initAvatarMovement(avatarNames[avatars.index(currentAvatar)])
			#a.getBone('Bip01 Head').disable(viz.RENDERING) #makes it so the user can't see eyelashes, etc.
		else:
			a.alpha(0)
			a.disable(viz.RENDERING)
			if a != Male1:
				vizconnect.getAvatar(avatarNames[avatars.index(a)]).setAnimator(None, make='WorldViz', model='Inverse Kinematics')
	
	vizconnect.go('vizconnect_config_vive_proteus.py')
Ejemplo n.º 5
0
    def setupOculusMon(self, displayList):

        vizconnect.go('setupDK2Cluster.py')
        #viz.window.setFullscreenMonitor(self.sysCfg['displays'])
        #displayList = self.sysCfg['displays'];

        if len(displayList) < 2:
            print 'Display list is <1.  Need two displays.'
        else:
            print 'Using display number' + str(
                displayList[0]) + ' for oculus display.'
            print 'Using display number' + str(
                displayList[1]) + ' for mirrored display.'

        ### Set the rift and exp displays

        riftMon = []
        expMon = displayList[1]

        with viz.cluster.MaskedContext(viz.MASTER):

            # Set monitor to the oculus rift
            monList = viz.window.getMonitorList()

            for mon in monList:
                if mon.name == 'Rift DK2':
                    riftMon = mon.id

            viz.window.setFullscreen(riftMon)

        with viz.cluster.MaskedContext(viz.CLIENT1):

            count = 1
            while (riftMon == expMon):
                expMon = count

            viz.window.setFullscreenMonitor(expMon)
            viz.window.setFullscreen(1)
	def __init__(self, expCfgName = ""):
		"""
		Opens and interprets both the system config (as defined by the <platform>.cfg file) and the experiment config
		(as defined by the file in expCfgName). Both configurations MUST conform the specs given in sysCfgSpec.ini and
		expCfgSpec.ini respectively. It also initializes the system as specified in the sysCfg.
		"""		
		self.__createSysCfg()
		
		for pathName in self.sysCfg['set_path']:
			viz.res.addPath(pathName)
		
			
		self.vizconnect = vizconnect.go( 'vizConnect/' + self.sysCfg['vizconfigFileName'])
		self.__postVizConnectSetup()
Ejemplo n.º 7
0
import viz, vizconnect, vizact, vizinfo, vizjoy, vizproximity, oculus

viz.window.setName('AVERNO')
#viz.window.setBorder(viz.BORDER_FIXED)
#viz.go()
vizconnect.go('configOculus.py')

model = {
	'mundo1' : "models/AbernoD.obj",
	'mundo2' : "models/AbernoL04.obj",
	'mundo3' : "models/AbernoD.obj",
	'mundo4' : "models/AbernoL04.obj"
}

item = {
	'gem' : "ball.wrl"
}

image = {
	'portada' : "img/Portada_Averno_1024.jpg"
}

button = {
	'portada_A' : "img/button_up_Dojo.png",
	'portada_B' : "img/button_down_Dojo.png"
}

sound = {
	'chime' : "sound/chime.wav",
	'elevator' : "sound/elevator.wav"
}
Ejemplo n.º 8
0
C0 = 0,6,0   # Front  Wall: C1,C2,C5,C6 
C1 = 0,6,8   # Left   Wall: C0,C1,C4,C5 
C2 = 8,6,8   # Right  Wall: C2,C3,C6,C7 
C3 = 8,6,0   # Bottom Wall: C5,C6,C4,C7 
C4 = 0,0,0 
C5 = 0,0,8 
C6 = 8,0,8 
C7 = 8,0,0

#Create front wall 
FrontWall = vizcave.Wall(   upperLeft=C1, 
                            upperRight=C2, 
                            lowerLeft=C5, 
                            lowerRight=C6, 
                            name='Front Wall' ) 

cave = vizcave.Cave()
cave.addWall(FrontWall, mask=viz.MASTER)


viz.window.setFullscreenMonitor(1)
viz.window.setFullscreen(viz.ON)
vizconnect.go('test_projection_config.py')


viz.vsync(viz.ON)

#viz.MainWindow.setStereoSwap(viz.TOGGLE)

piazza = viz.addChild('piazza.osgb')
Ejemplo n.º 9
0
offsetNode.alpha(0)
car = viz.addChild("mini.osg", parent=offsetNode)  #load car model here
car.setPosition(0.3, -1.1, 0.2)
viz.setMultiSample(4)
NUM_CARS = 0
carlist = []
pivot = [0, 0, 0]
carchoice = 1
currentcar = 'Mini'
speed = 0.0
steer = 0.0
motion = 0
rotateY = 0.0
rotateX = 0.0
viz.clip(0.1, 30000)
vizconnect.go('camera.py')
viz.splashScreen('assets/tracksplash.jpg')
viz.phys.enable()
#carchoiceinit = vizinput.choose('Choose a car:', ['Mini','BMW','Ford Thunderbird','Ford Focus','Lamborghini Murcielago','TVR Speed 12','Dodge Challenger', 'Caterham Seven'])
#carchoice = carchoiceinit + 1
environmentchoice = vizinput.choose('Select time of day:', ['Day', 'Night'])
viz.message(
    'Arrow Keys to steer. Z to go down a gear, X to go up a gear. G to swap between automatic/manual. Up to accelerate, Down to reverse (Automatic only). Spacebar to brake.'
)
#import Drivingfunctions
track = viz.addChild('assets/environment/track.osgb')
station = viz.addChild('assets/environment/gasStation.fbx')
#buildings = viz.addChild('assets/environment/City.osgb')
tower = viz.addChild('assets/environment/Building.fbx')
if environmentchoice == 0:
    environment = viz.addChild('sky_day.osgb')
Ejemplo n.º 10
0
x_translate_shifted1=x_translate1+max(control_array)+.25
#NEW SHIFT!
#z_depth_translate= z_depth1-max(control_array)
#x_translate_shifted2=x_translate1+1.5
#x_translate_shifted3=x_translate1+1.5


height1= 1
#height2= .025
#height3=.025

#tracking data
import hand

    
vizconnect.go('./vizconnect_config.py')
headTracker = vizconnect.getRawTracker('optical_heading')
handTracker = vizconnect.getRawTracker('ppt_hand')
viewpoint = vizconnect.getDisplay().getNode3d()
movable = vizconnect.getMovableNode()
main_sphere=vizshape.addSphere(radius=.005,slices=20,stacks=20)
viz.link(handTracker, main_sphere)
#viztracker.go()
#
#
#composite = viztracker.getManager().getCompositeList()[0]
#headTracker = composite.getRawTracker(composite.HEAD)
#handTracker = composite.getRawTracker(composite.RHAND)
#handTracker = viztracker.main_sphere
#stupidhand = viztracker.get('righthand') 
#stupidhand.setScale(.01,.01,.01)
Ejemplo n.º 11
0
    # 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
        headTrack = viztracker.Keyboard6DOF()
        link = viz.link(headTrack, viz.MainView)
        headTrack.eyeheight(1.6)
        link.setEnabled(True)
        viz.go()
    elif controlType == HMD:
        HZ = 90
        vizconnect.go('vizconnect_config.py')
        # Overwrite headset ipd
        IPD = viz.MainWindow.getIPD()
        vizact.onupdate(viz.UPDATE_LINKS + 1, overwriteIPD)
        # add Odyssey tracker
        ODTracker = vizconnect.getTracker('head_tracker')

    # Use a large size of the viewing frustum
    viz.clip(.001, 1000)

    # loads experimental conditions
    inputFile = os.path.abspath(
        os.path.join(INPUT_DIR, 'exp_a_subj' + subject + '.csv'))

    with open(inputFile, 'r') as file:
        lines = file.read().split('\n')[1:-1]
Ejemplo n.º 12
0
    def stop(self):
        """
		Stop the grab.
		"""
        # Restore original parant of the zoomed object
        HelpFunctions.set_parent_without_changing_transform(
            self.grabbed_object, self._grabbed_object_old_parent)


# Code to test the behaviour. (No functionality for the project)
if __name__ == "__main__":
    import vizconnect
    import Controls

    vizconnect.go("vizconnect_config_steamvr.py")

    r_input = vizconnect.getRawInput('r_hand_input')
    l_input = vizconnect.getRawInput('l_hand_input')
    inputs = [r_input, l_input]

    r_tracker = vizconnect.getRawTracker('r_hand_tracker')
    l_tracker = vizconnect.getRawTracker('l_hand_tracker')
    trackers = [r_tracker, l_tracker]

    r_model = r_tracker.addModel()
    viz.link(r_tracker, r_model)
    l_model = l_tracker.addModel()
    viz.link(l_tracker, l_model)

    environment = viz.addChild('sky_day.osgb')
Ejemplo n.º 13
0
# Time Variables
timeA = 0.0  # Start time
timeB = 0.0  # Stores the time frame when you enter a sensor
timeEnd = 0.0  # Stores the entire time frame of the trial
trialTimeList = [
]  # Used to make the text to file printing easier and also stores all of trial times.
leftEarly = "No"  # If the user left early, this will change to "Yes"

viz.mouse.setVisible(viz.OFF)  # remove mouse cursor when program starts

# General screen setup.
viz.setMultiSample(4)
viz.fov(60)

#Tracking data from vizconnect_config__________________________________________
'''
#### HEADSET
vizconnect.go('./Vizconnect_config_4limbs.py')
headTracker = vizconnect.getRawTracker('optical_heading')
handTracker = vizconnect.getRawTracker('ppt_hand')
viewpoint = vizconnect.getDisplay().getNode3d()
main_sphere=vizshape.addSphere(radius=.005,slices=20,stacks=20) #Adding a sphere to represent user's fingertip
viz.link(handTracker, main_sphere) #Linking sphere to vizconnect tracking of the hand


### For mouse and keyboard walking to test outside lab
'''

vizconnect.go('./Vizconnect_config_4limbs_avatar_copy.py')
### Substitute mouse and keyboard tracking
leftHand = vizconnect.getRawTracker('lefthand')
Ejemplo n.º 14
0
#Vizworld Imports
import viz
import vizconnect
import vizjoy
import vizact
import viz
import vizact

#Custom modules
import joystickSetup
from emotion.emotion import *

vizconnect.go('vizconnect_config2.py')

#Init Game
room = viz.add('room.osgb')
scientist = viz.add('./avatars/male/avatar 003.cfg')
scientist.setPosition([-7.64, 0, 7.91])
scientist.setEuler(120,0,0)
scientist.state(1)

#Emotions for Scientist
affectManager=AffectManager(24)
scientist_expression=affectManager.createBasicEkmanWithExpression(scientist)

head = vizconnect.getTracker('rift_orientation_tracker').getNode3d()

joystick = vizconnect.getInput('joystick')
transport = vizconnect.getTransport('wandmagiccarpet')

avatarNova = viz.add('./avatars/female/avatar 001.cfg')
Ejemplo n.º 15
0
import random

import viz
import vizfx
import vizact
import vizconnect

import tools

# We're going to add a grabber with highlighting, so we have to update stencil
# settings before calling viz.go
if __name__ == "__main__":
    viz.setOption('viz.display.stencil', 8)

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

# get the quality setting of the demo if specified
DEMO_QUALITY_SETTING = max(
    0, viz.getOption('DEMO_QUALITY_SETTING', default=4, type=int))

vizfx.addPointLight(pos=(0, 5, 1, 0), euler=(0, 90, 0))

# Load the vizconnect configuration.
if __name__ == "__main__":
    vizconnect.go('./vizconnect_config.py')
    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:
    def start_dk2_head_tracker(self, control_style):
        """
        Initializes Ole Traupe's new Oculus Rift DK2 ("DK2") head tracker class with both heading reset and drift
        correction based on Phasespace ("PS") data.

        Args:
            control_style: interaction possibilities between subject and VR world. Currently supports:
            'mouse and keyboard', 'joystick', 'wiimote with dk2 head', 'dk2 head only', 'dk2 head hands'

        Returns: a Tracker object with automatic drift correction

        """

        # import OWLTK as otk
        # import OWL as _OWL

        ## get trackers ready by declaring some general settings
        # define tracker names
        hmdOri_trackerName = 'rift_ori'  # DK2 ori tracker
        rawHmdOri_trackerName = 'rawhmd_ori'  # group/dummy tracker for feeding the DK2 ori data to (and on which the drift correction is done)
        hmdGroundTruth6dof_trackerName = 'ps_groundtruth_6dof'  # group/dummy tracker for feeding the PS data to (let's the nose-tip pos offset be applied correctly)
        hmdMerged_trackerName = 'hmd_merged'  # merged tracker controlling the HMD (from rawHmdOri and hmdGroundTruth6dof)

        # hand trackers
        #left_hand_tracker_name = 'left_hand'
        right_hand_tracker_name = 'right_hand'

        # set some tracking properties
        smoothPositionData = 2  # 0: raw/single data positional tracking
        # 1: linear regression on the samples flushed per HMD frame
        # 2: mean of such flushed samples (the only effective PS jitter removal method)
        driftCorrectionDemoMode = False  # gives some input/output options (lets you create an offset via 'o')
        streamRenderStats = True  # stream render stats to LSL, such as updateTime, drawTime, cullTime etc.
        streamDriftStats = True  # stream drift stats to LSL: current offset, current correction increment, cumulative increment
        streamCompletePhasespaceData = True  # stream all Phasespace markers and rigids for logging purposes to LSL

        # set Phasespace properties
        psServer_ip = "130.149.173.155"  # PS server address
        #psServer_ip = "130.149.34.81"
        psServer_freq = 960  # slave can't set frequency, attempt to set only returns the actual freqency;
        # important for good head tracking: run PS profile with group=3 and interpolate=3
        psServer_slave = 1  # 'slave' is the first bit in the 'flags' parameter; 'master' is currently not supported here
        psServer_headingLeds = [4097,
                                4098]  # [4097,4098] are the IDs of the 2nd and 3rd marker of the 1st rigid body (the laterals used for heading reset)
        psServer_rigidBody = 0  # '0' is the 1st rigid body (the one used as comparator for the drift correction)

        if control_style == 'dk2 head wiimote':

            # Add wiimote extension and connect to first available wiimote
            wii = viz.add('wiimote.dle')
            self.wiimote = wii.addWiimote()

            # Register callback function to the wiimotes buttons
            vizact.onsensordown(self.wiimote, wii.BUTTON_A, self.on_button_press, 'A')
            vizact.onsensordown(self.wiimote, wii.BUTTON_B, self.on_button_press, 'B')

            # todos correct vizconnect file with steamVR controller
            vizconnect.go('resources/trackers/DK2_tracker_head_only_vizconnect.py')

            # instantiate the HMD tracker object (with ground truth reset and drift correction)
            self.tracker = HMD_Tracker(hmdOri_trackerName, rawHmdOri_trackerName, hmdGroundTruth6dof_trackerName, None,
                                       None, hmdMerged_trackerName, smoothPositionData, driftCorrectionDemoMode,
                                       streamRenderStats, streamDriftStats, streamCompletePhasespaceData,
                                       psServer_ip, psServer_freq, psServer_slave, psServer_headingLeds,
                                       psServer_rigidBody)

        elif control_style == 'dk2 head & right hand':

            vizconnect.go('resources/trackers/DK2_tracker_hands_vizconnect.py')

            # instantiate the HMD tracker object (with ground truth reset and drift correction)
            # None flag in case of left hand tracker
            self.tracker = HMD_Tracker(hmdOri_trackerName, rawHmdOri_trackerName, hmdGroundTruth6dof_trackerName,
                                       hmdMerged_trackerName, None, right_hand_tracker_name,
                                       smoothPositionData, driftCorrectionDemoMode, streamRenderStats, streamDriftStats,
                                       streamCompletePhasespaceData, psServer_ip, psServer_freq, psServer_slave,
                                       psServer_headingLeds, psServer_rigidBody)
                                       
            self.sphere_radius = 0.01
            self.right_hand_tracker = vizconnect.getTracker('right_hand').getNode3d()
            self.right_hand_sphere = vizshape.addSphere(radius=self.sphere_radius)
            self.right_hand_sphere.alpha(0)
            self.right_hand_target = self.right_hand_sphere.collideSphere()
            self.right_hand_sphere.disable(viz.DYNAMICS)
            right_hand_link = viz.link(self.right_hand_tracker, self.right_hand_sphere)
            # todos say somewhere that the collide sphere is defined here

            # self.left_hand_tracker = vizconnect.getTracker('left_hand').getNode3d()
            # self.left_hand_sphere = vizshape.addSphere(radius=0.02)
            # self.left_hand_sphere.alpha(0)
            # self.left_hand_target = self.left_hand_sphere.collideSphere()
            # self.left_hand_sphere.disable(viz.DYNAMICS)
            # left_hand_link = viz.link(self.left_hand_tracker, self.left_hand_sphere)
            
            self.head_tracker = vizconnect.getTracker('hmd_merged').getNode3d()
            self.head_sphere = vizshape.addSphere(radius=self.sphere_radius)
            self.head_sphere.alpha(0)
            self.head_target = self.head_sphere.collideSphere()
            self.head_sphere.disable(viz.DYNAMICS)
            head_link = viz.link(self.head_tracker, self.head_sphere)
            
#            if show_avatar_hands:
#
#                # link subjects hand trackers to proximity targets
#                right_hand = viz.add('resources/hand.cfg')
#                left_hand = viz.add('resources/hand_left.cfg')
#
#                right_hand_link = viz.link(subject.right_hand_tracker, right_hand)
#                left_hand_link = viz.link(subject.left_hand_tracker, left_hand)

#
#            elif subject.control_style == 'mouse and keyboard':
#
#                # add proximity target for test purposes using mouse and keyboard
#                self.head_target = viz.MainView            
#                
#                self.left_hand_tracker = vizconnect.getTracker('left_hand').getNode3d()
#                self.head_tracker = vizconnect.getTracker('hmd_merged').getNode3d()

        elif control_style == 'dk2 head only':

            vizconnect.go('resources/trackers/DK2_tracker_head_only_vizconnect.py')

            # instantiate the HMD tracker object (with ground truth reset and drift correction)
            self.tracker = HMD_Tracker(hmdOri_trackerName, rawHmdOri_trackerName, hmdGroundTruth6dof_trackerName,
                                       hmdMerged_trackerName, None, None, smoothPositionData, driftCorrectionDemoMode,
                                       streamRenderStats, streamDriftStats, streamCompletePhasespaceData, psServer_ip,
                                       psServer_freq, psServer_slave, psServer_headingLeds, psServer_rigidBody)

        else:
            print('Could not initialize HMD_Tracker')
Ejemplo n.º 17
0
#Drop Jump Simulator
#make sure run steamvr.py before run this script
#some data: walk time: 1s, dropping time: 0.9s 
import viz
import vizact
import vizfx
import timeit
import time
import vizconnect
import steamvr
from vizconnect.util import view_collision


viz.setMultiSample(4)
viz.fov(60)
vizconnect.go('vizconnect_config_htcvive.py')  #run htc vive config script
viz.go()
viz.phys.enable()


#set lab environment and light
viz.clearcolor(0.7,0.7,0.8)
viz.MainView.setPosition([9,3,15])
viz.MainView.setEuler(180, 0, 0)
lab = viz.addChild('lab.osgb')
lab.setPosition([0,0,0])
vizfx.addDirectionalLight(euler=(0,45,0))

env = viz.add(viz.ENVIRONMENT_MAP,'sky.jpg')
dome = viz.add('skydome.dlc')
dome.texture(env)
Ejemplo n.º 18
0
will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
"""

# import vizard stuff
import viz
import vizinput
import vizshape
import vizconnect
import steamvr

# Start control config file to initialize HMDs, trackers, controller and more.
# Later imports depend on initialized controls
import config as cfg
import os.path
if os.path.isfile('vizconnect_config_' + cfg.control_scheme + '.py'):
    vizconnect.go('vizconnect_config_' + cfg.control_scheme + '.py')

# import project modules
import Simulation_Data
from GrabAndZoom import GrabAndZoom
import Controls
import HelpFunctions


class ToothVR(viz.EventClass):
    """
	Class to start and manage the ToothVR application.
	"""
    def __init__(self):
        """
		Initialize everything independent of the viewed data, so ToothVR can be started just by calling run()
Ejemplo n.º 19
0
            vizact.ontimer(1. / float(viz.getOption('viz.max_frame_rate')),
                           robot_follows_marker, robot, ball)


# Einstellungen
CYCLES_PER_SEC = 0.05
viz.setMultiSample(4)
# Flimmern vermeiden
viz.setOption('viz.max_frame_rate', 60)
viz.vsync(viz.ON)
viz.go()

# VIZCONNECT
# Hier muss die passende Zeile auskommentiert werden.
# Tastatur
vizconnect.go(r'vizconnect_keyboard.py')
# HTC Vive
## vizconnect.go(r'vizconnect_hand_vive2.py')
#vizconnect.go(r'vizconnect_hand_vive.py')
# M2.01
#vizconnect.go(r'vizconnect_powerwall_with_wand')

# Globale Variablen initialisieren
part_index = 1
# Distanz, bei der das Bauteil "einrastet"
max_dist = 0.4

print 'XXXXX'

viz.collision(viz.ON)
viz.phys.enable()
Ejemplo n.º 20
0
# replace all viztracker code in your script
############################################

import vizconnect

import vizproximity #you already have this

viz.go() #you already have this, but wondering why it's at bottom of script?

piazza = viz.addChild('piazza.osgb') #don't need, just for reference to test tracking

#######################################
#Vizconnect Init code
#######################################
CONFIGURATION = 'vizconnect_config.py'
vizconnect.go(CONFIGURATION)


handTracker = vizconnect.getTracker('ppt_hand')
#handTracker = vizconnect.getRawTracker('ppt_hand')
target = vizproximity.Target(handTracker)
print handTracker
handTrackerpos = handTracker.getPosition()
print handTrackerpos

#or 
#handTracker = vizconnect.getTracker('ppt_hand')
##target = vizproximity.Target(vizproximity.Sphere(0.1,center=[0,0,0]),handTracker) #this only works for sensors, not targets
#sensor = vizproximity.Sensor(vizproximity.Sphere(0.1,center=[0,0,0]),handTracker)

Ejemplo n.º 21
0
from math import *

maxPossPerSec = 0.1
viz.setOption('viz.stereo', viz.QUAD_BUFFER)
viz.setOption('viz.fullscreen', 1)

#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')
Ejemplo n.º 22
0
#toggle billboarding of the mustache man toward the user (if you don't turn this on, he is facing away from the user)	
def billboardToggle():
	global BILLBOARD
	if BILLBOARD:
		mustacheMan.billboard(viz.OFF)
		BILLBOARD = False
	else:
		mustacheMan.billboard(viz.BILLBOARD_YAXIS)
		BILLBOARD = True

		
placeMirror()

AVATAR_BODY = ['Female1','Female2','Female3','Female4', 'Female5', 'Male1', 'Male2', 'Male3', 'Male4', 'Male5'][vizinput.choose('Which avatar would you like to begin with?',['Female1','Female2','Female3','Female4', 'Female5', 'Male1', 'Male2', 'Male3', 'Male4', 'Male5'])]

vizconnect.go('vizconnect_config_vive_proteus.py')

viz.window.setSize(1900,1000)
if AVATAR_BODY == 'Male1':
	currentAvatar = vizconnect.getRawAvatar('white_male')
if AVATAR_BODY == 'Female1':
	currentAvatar = vizconnect.getRawAvatar('black_female')
if AVATAR_BODY == 'Male2':
	currentAvatar = vizconnect.getRawAvatar('old_white_male')
if AVATAR_BODY == 'Male3':
	currentAvatar = vizconnect.getRawAvatar('black_male')
if AVATAR_BODY == 'Female2':
	currentAvatar = vizconnect.getRawAvatar('blonde_female')
if AVATAR_BODY == 'Female3':
	currentAvatar = vizconnect.getRawAvatar('female1')
if AVATAR_BODY == 'Male4':
for i in range(1,NUM_CO2):
 co2models.append(co2molecule.copy())
for i in range(1,NUM_H2O):
 h2omodels.append(h2omolecule.copy())

print "created co2models", co2models

'''#Main Setup Functions
headLight = viz.MainView.getHeadLight() 
headLight.disable() 
viz.clip(.01,1000)'''

#Setup tracking module
transport_vhil.setUp()

'''path = viz.res.getPublishedPath( 'vizconnect_config_vive_hand.py' )

viz.res.addPublishDirectory( os.path.join( viz.res.getVizardPath(), 'resources', 'fx') )
vizconnect.go( path )'''

def setUpMolecAnimation():
	global co2models, h2omodels
	for i in range(NUM_CO2):
		co2models[i].setPosition( .25 * i * (i * -1), 1.7, 0)
	for i in range(NUM_H2O):
		h2omodels[i].setPosition(2.5, .5, .4 * i * (i * -1))


def randomSortActions(moleculeSequence):
	num = len(moleculeSequence)
	finalSequence = []
Ejemplo n.º 24
0
import viz
import vizact
import viztask
import vizconnect
import vizproximity
import scene1
import scene2
import scene3

viz.setMultiSample(8)
vizconnect.go('vizconnect_config_desktop.py')
#vizconnect.go('vizconnect_config_vive.py')

grabTool = vizconnect.getRawTool('grabber')
grabTool.setItems(scene1.getGrabObjects())

vizact.onkeydown(' ', viz.setDebugSound3D, viz.TOGGLE)

CHANGE_SCENES_EVENT = viz.getEventID('CHANGE_SCENES')

oriMode = vizconnect.VIEWPOINT_MATCH_DISPLAY
posMode = vizconnect.VIEWPOINT_MATCH_FEET

scene1_pos = [[0, 0, -21.87243], [0, 0, -46.27398], [0.4, 0, -73],
              [-0.2, 2.6, -90]]
scene2_pos = [[0, 0.1, 0], [3, -3.2, 2.4], [10, -3, -4.73], [15, 0.1, -1.73]]
scene2_ori = [[90, 0, 0], [110, 0, 0], [70, 0, 0], [90, 0, 0]]
scene3_pos = [[0, 0, 0], [0, 0, 30], [0, 0, 70], [0, 0, 180]]

vp1 = []
for pos in scene1_pos: