def initTrackers(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
	#VC: place any general initialization code here
	rawTracker = vizconnect.getRawTrackerDict()

	#VC: initialize a new tracker
	_name = 'head_tracker'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			index = 0
			
			#VC: create the raw object
			import steamvr
			try:
				tracker = steamvr.getExtension().getHMDList()[index]
			except IndexError:
				viz.logWarn("** WARNING: Not able to connect to tracker at index {0}. It's likely that not enough trackers are connected.".format(index))
				tracker = viz.addGroup()
				tracker.invalidTracker = True
			rawTracker[_name] = tracker
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='Valve', model='SteamVR HMD Tracker')

	#VC: set the name of the default
	vizconnect.setDefault('tracker', 'head_tracker')

	#VC: return values can be modified here
	return None
def initTrackers(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
    #VC: place any general initialization code here
    rawTracker = vizconnect.getRawTrackerDict()

    #VC: initialize a new tracker
    _name = 'r_hand_tracker'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            trackerIndex = -1
            speed = 0.5
            debug = False

            #VC: create the raw object
            from vizconnect.util.virtual_trackers import Keyboard
            rawTracker[_name] = Keyboard(trackerIndex=trackerIndex,
                                         speed=speed,
                                         debug=debug)

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='Virtual',
                                  model='Keyboard')

        #VC: set the parent of the node
        if initFlag & vizconnect.INIT_PARENTS:
            vizconnect.getTracker(_name).setParent(vizconnect.getRoot())

    #VC: initialize a new tracker
    _name = 'l_hand_tracker'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            group = None

            #VC: create the raw object
            if group is None:
                group = viz.addGroup()
            rawTracker[_name] = group

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='Virtual',
                                  model='Group')

        #VC: set the parent of the node
        if initFlag & vizconnect.INIT_PARENTS:
            vizconnect.getTracker(_name).setParent(vizconnect.getRoot())

    #VC: set the name of the default
    vizconnect.setDefault('tracker', 'r_hand_tracker')

    #VC: return values can be modified here
    return None
示例#3
0
def initTrackers(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
	#VC: place any general initialization code here
	rawTracker = vizconnect.getRawTrackerDict()

	#VC: initialize a new tracker
	_name = 'head_tracker'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			index = 0
			
			#VC: create the raw object
			import oculus
			sensorList = oculus.getSensors()
			if index < len(sensorList):
				orientationTracker = sensorList[index]
			else:
				viz.logWarn("** WARNING: Oculus VR Rift Orientation Tracker not present.")
				orientationTracker = viz.addGroup()
				orientationTracker.invalidTracker = True
			rawTracker[_name] = orientationTracker
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='Oculus VR', model='DK2')

	#VC: return values can be modified here
	return None
def initTrackers(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
	#VC: place any general initialization code here
	rawTracker = vizconnect.getRawTrackerDict()

	#VC: initialize a new tracker
	_name = 'head_tracker'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			rotationSensitivity = 0.15
			debug = False

			#VC: create the raw object
			from vizconnect.util.virtual_trackers import MouseOrientation
			rawTracker[_name] = MouseOrientation(rotationSensitivity=rotationSensitivity, debug=debug)

		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='Virtual', model='Mouse Orientation')

		#VC: init the offsets
		if initFlag&vizconnect.INIT_OFFSETS:
			_link = vizconnect.getTracker(_name).getLink()
			#VC: clear link offsets
			_link.reset(viz.RESET_OPERATORS)

			#VC: reset orientation
			_link.preEuler([0, 0, 0], target=viz.LINK_ORI_OP, priority=-20)

			#VC: apply offsets
			_link.postTrans([0, 1.7, 0])

	#VC: return values can be modified here
	return None
示例#5
0
def initTrackers(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
	#VC: place any general initialization code here
	rawTracker = vizconnect.getRawTrackerDict()

	#VC: initialize a new tracker
	_name = 'head_tracker'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			group = None
			
			#VC: create the raw object
			if group is None:
				group = viz.addGroup()
			rawTracker[_name] = group
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='Virtual', model='Group')

	#VC: initialize a new tracker
	_name = 'rift_tracker'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			index = 0
			
			#VC: create the raw object
			import oculus
			sensorList = oculus.getSensors()
			if index < len(sensorList):
				orientationTracker = sensorList[index]
			else:
				viz.logWarn("** WARNING: Oculus VR Rift Orientation Tracker not present.")
				orientationTracker = viz.addGroup()
				orientationTracker.invalidTracker = True
			rawTracker[_name] = orientationTracker
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='Oculus VR', model='DK2')
	
		#VC: init the offsets
		if initFlag&vizconnect.INIT_OFFSETS:
			_link = vizconnect.getTracker(_name).getLink()
			#VC: clear link offsets
			_link.reset(viz.RESET_OPERATORS)
			
			#VC: reset orientation
			_link.preEuler([0, 0, 0], target=viz.LINK_ORI_OP, priority=-20)

	#VC: return values can be modified here
	return None
示例#6
0
def initTrackers(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
    #VC: place any general initialization code here
    rawTracker = vizconnect.getRawTrackerDict()

    #VC: initialize a new tracker
    _name = 'dk2'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            index = 0

            #VC: create the raw object
            import oculus
            sensorList = oculus.getSensors()
            if index < len(sensorList):
                orientationTracker = sensorList[index]
            else:
                viz.logWarn(
                    "** WARNING: Oculus VR Rift Orientation Tracker not present."
                )
                orientationTracker = viz.addGroup()
                orientationTracker.invalidTracker = True
            rawTracker[_name] = orientationTracker

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='Oculus VR',
                                  model='DK2')

        #VC: init the offsets
        if initFlag & vizconnect.INIT_OFFSETS:
            _link = vizconnect.getTracker(_name).getLink()
            #VC: clear link offsets
            _link.reset(viz.RESET_OPERATORS)

            #VC: apply offsets
            _link.postTrans([0, 1.405, 0])

        #VC: init the mappings for the wrapper
        if initFlag & vizconnect.INIT_WRAPPER_MAPPINGS:
            #VC: on-state mappings
            if initFlag & vizconnect.INIT_MAPPINGS_ON_STATE:
                vizconnect.getTracker(_name).setOnStateEventList([
                    vizconnect.onstate(
                        lambda rawInput: rawInput['keyboard'].isButtonDown(19),
                        vizconnect.getTracker(_name).resetHeading
                    ),  # make=Generic, model=Keyboard, name=keyboard, signal=Key R
                ])

    #VC: return values can be modified here
    return None
def initTrackers(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
	#VC: place any general initialization code here
	rawTracker = vizconnect.getRawTrackerDict()

	#VC: initialize a new tracker
	_name = 'head_tracker'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			addMouseOrientation = True
			positionSensitivity = 2.5
			heightOffset = 1.82
			sensorIndex = 0
			
			#VC: create the raw object
			import oculus
			sensorList = oculus.getSensors()
			if sensorIndex < len(sensorList):
				dk2Tracker = sensorList[sensorIndex]
				from vizconnect.util import virtual_trackers
				tracker = virtual_trackers.TrackerAndKeyboardWalking(dk2Tracker, addMouseOrientation=addMouseOrientation, positionSensitivity=positionSensitivity, heightOffset=heightOffset)
			else:
				viz.logWarn("** WARNING: Oculus Tracker not present.")
				tracker = viz.addGroup()
				tracker.invalidTracker = True
			rawTracker[_name] = tracker
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='Oculus VR', model='Rift With Mouse And Keyboard')
	
		#VC: init the offsets
		if initFlag&vizconnect.INIT_OFFSETS:
			_link = vizconnect.getTracker(_name).getLink()
			#VC: clear link offsets
			_link.reset(viz.RESET_OPERATORS)
			
			#VC: reset orientation
			_link.preEuler([0, 0, 0], target=viz.LINK_ORI_OP, priority=-20)
	
		#VC: init the mappings for the wrapper
		if initFlag&vizconnect.INIT_WRAPPER_MAPPINGS:
			#VC: on-state mappings
			if initFlag&vizconnect.INIT_MAPPINGS_ON_STATE:
				vizconnect.getTracker(_name).setOnStateEventList([
						vizconnect.onstate(lambda rawInput: rawInput['keyboard'].isButtonDown(19), vizconnect.getTracker(_name).resetHeading),# make=Generic, model=Keyboard, name=keyboard, signal=Key R
				])

	#VC: return values can be modified here
	return None
示例#8
0
def initTrackers(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
	#VC: place any general initialization code here
	rawTracker = vizconnect.getRawTrackerDict()

	#VC: initialize a new tracker
	_name = 'head_tracker'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			positionSensitivity = 1.0
			rotationSensitivity = 0.09
			debug = False
			
			#VC: create the raw object
			from vizconnect.util.virtual_trackers import MouseAndKeyboardWalking
			rawTracker[_name] = MouseAndKeyboardWalking(positionSensitivity=positionSensitivity, rotationSensitivity=rotationSensitivity, debug=debug)
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='Virtual', model='Mouse and Keyboard Walking')

	#VC: initialize a new tracker
	_name = 'r_hand_tracker'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			scaleVelocityWithDistance = True
			extensionAccel = 80
			debug = False
			
			#VC: create the raw object
			from vizconnect.util.virtual_trackers import ScrollWheel
			rawTracker[_name] = ScrollWheel(scaleVelocityWithDistance=scaleVelocityWithDistance, extensionAccel=extensionAccel, debug=debug)
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='Virtual', model='Mouse Scroll Wheel')
	
		#VC: init the offsets
		if initFlag&vizconnect.INIT_OFFSETS:
			_link = vizconnect.getTracker(_name).getLink()
			#VC: clear link offsets
			_link.reset(viz.RESET_OPERATORS)
			
			#VC: apply offsets
			_link.postTrans([0.1, -0.1, 0.4])

	#VC: return values can be modified here
	return None
示例#9
0
def initTrackers(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
	#VC: place any general initialization code here
	rawTracker = vizconnect.getRawTrackerDict()

	#VC: initialize a new tracker
	_name = 'rift_orientation_tracker'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: create the raw object
			import oculus
			index=0
			sensorList = oculus.getSensors()
			if index < len(sensorList):
				orientationTracker = sensorList[index]
			else:
				viz.logWarn("** WARNING: Oculus VR Rift Orientation Tracker not present.")
				orientationTracker = viz.addGroup()
				orientationTracker.invalidTracker = True
			rawTracker[_name] = orientationTracker
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='Oculus VR', model='Rift Orientation Tracker')
	
		#VC: init the offsets
		if initFlag&vizconnect.INIT_OFFSETS:
			_link = vizconnect.getTracker(_name).getLink()
			#VC: clear link offsets
			_link.reset(viz.RESET_OPERATORS)
			
			#VC: reset orientation
			_link.preEuler([0, 0, 0], target=viz.LINK_ORI_OP, priority=-20)
			
			#VC: apply offsets
			_link.postTrans([0, 1.68, 0])			
	
		#VC: init the mappings for the wrapper
		if initFlag&vizconnect.INIT_WRAPPER_MAPPINGS:
			#VC: on-state mappings
			if initFlag&vizconnect.INIT_MAPPINGS_ON_STATE:
				vizconnect.getTracker(_name).setOnStateEventList([
						vizconnect.onstate(lambda rawInput: rawInput['joystick'].isButtonDown(2), vizconnect.getTracker(_name).resetHeading),# make=Generic, model=Joystick, name=joystick, signal=Button 2
				])

	#VC: return values can be modified here
	return None
示例#10
0
def initTrackers(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
    #VC: place any general initialization code here
    rawTracker = vizconnect.getRawTrackerDict()

    #VC: initialize a new tracker
    _name = 'head_tracker'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            rotationSensitivity = 0.15
            debug = False

            #VC: create the raw object
            from vizconnect.util.virtual_trackers import MouseOrientation
            rawTracker[_name] = MouseOrientation(
                rotationSensitivity=rotationSensitivity, debug=debug)

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='Virtual',
                                  model='Mouse Orientation')

        #VC: init the offsets
        if initFlag & vizconnect.INIT_OFFSETS:
            _link = vizconnect.getTracker(_name).getLink()
            #VC: clear link offsets
            _link.reset(viz.RESET_OPERATORS)

            #VC: reset orientation
            _link.preEuler([0, 0, 0], target=viz.LINK_ORI_OP, priority=-20)

            #VC: apply offsets
            _link.postTrans([0, 1.7, 0])

    #VC: return values can be modified here
    return None
def initWrappers():

	# get all of the raw items from vizconnect
	rawGroup = vizconnect.getRawGroupDict()
	rawInput = vizconnect.getRawInputDict()
	rawDisplay = vizconnect.getRawDisplayDict()
	rawTracker = vizconnect.getRawTrackerDict()
	rawTransport = vizconnect.getRawTransportDict()
	rawEvent = vizconnect.getRawEventDict()
	rawTool = vizconnect.getRawToolDict()
	rawAvatar = vizconnect.getRawAvatarDict()
	rawAnimator = vizconnect.getRawAnimatorDict()

	# below are listed the wrapped group objects

	# below are listed the wrapped display objects
	vizconnect.addDisplay(rawDisplay['zsight_60'], 'zsight_60', '', 'Sensics', 'zSight 60')

	# below are listed the wrapped tracker objects
	vizconnect.addTracker(rawTracker['ppt_Rhead'], 'ppt_Rhead', 'ppt', 'WorldViz', 'PPT')
	vizconnect.addTracker(rawTracker['optical_heading'], 'optical_heading', '', 'Virtual', 'Optical Heading')
	vizconnect.addTracker(rawTracker['ppt_hand'], 'ppt_hand', 'ppt', 'WorldViz', 'PPT')
	vizconnect.addTracker(rawTracker['osv3_sensor_bus'], 'osv3_sensor_bus', '', 'Inertial Labs', 'OSv3 (Sensor Bus)')
	vizconnect.addTracker(rawTracker['ppt_Lhead'], 'ppt_Lhead', 'ppt', 'WorldViz', 'PPT')

	# below are listed the wrapped input objects

	# below are listed the wrapped event objects

	# below are listed the wrapped transport objects

	# below are listed the wrapped tool objects

	# below are listed the wrapped avatar objects


	return True
def initTrackers(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
	#VC: place any general initialization code here
	rawTracker = vizconnect.getRawTrackerDict()

	#VC: initialize a new tracker
	_name = 'mouse_and_keyboard_walking'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			positionSensitivity = 2.5
			rotationSensitivity = 0.15
			debug = False
			
			#VC: create the raw object
			from vizconnect.util.virtual_trackers import MouseAndKeyboardWalking
			rawTracker[_name] = MouseAndKeyboardWalking(positionSensitivity=positionSensitivity, rotationSensitivity=rotationSensitivity, debug=debug)
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='Virtual', model='Mouse and Keyboard Walking')

	#VC: return values can be modified here
	return None
def initTrackers(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
	#VC: place any general initialization code here
	rawTracker = vizconnect.getRawTrackerDict()

	#VC: initialize a new tracker
	_name = 'mouse_and_keyboard_walking'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			positionSensitivity = 2.5
			rotationSensitivity = 0.15
			debug = False
			
			#VC: create the raw object
			from vizconnect.util.virtual_trackers import MouseAndKeyboardWalking
			rawTracker[_name] = MouseAndKeyboardWalking(positionSensitivity=positionSensitivity, rotationSensitivity=rotationSensitivity, debug=debug)
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='Virtual', model='Mouse and Keyboard Walking')

		#VC: set the parent of the node
		if initFlag&vizconnect.INIT_PARENTS:
			vizconnect.getTracker(_name).setParent(vizconnect.getRoot())
			
	#VC: initialize a new tracker
	_name = 'righthand'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			trackerIndex = -1
			speed = 0.5
			debug = False
			
			#VC: create the raw object
			from vizconnect.util.virtual_trackers import Keyboard
			rawTracker[_name] = Keyboard(trackerIndex=trackerIndex, speed=speed, debug=debug)
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='Virtual', model='Keyboard')

	#VC: initialize a new tracker
	_name = 'lefthand'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			trackerIndex = -1
			speed = 0.5
			debug = False
			
			#VC: create the raw object
			from vizconnect.util.virtual_trackers import Keyboard
			rawTracker[_name] = Keyboard(trackerIndex=trackerIndex, speed=speed, debug=debug)
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='Virtual', model='Keyboard')

	#VC: initialize a new tracker
	_name = 'rightfoot'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			trackerIndex = -1
			speed = 0.5
			debug = False
			
			#VC: create the raw object
			from vizconnect.util.virtual_trackers import Keyboard
			rawTracker[_name] = Keyboard(trackerIndex=trackerIndex, speed=speed, debug=debug)
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='Virtual', model='Keyboard')

	#VC: initialize a new tracker
	_name = 'leftfoot'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			trackerIndex = -1
			speed = 0.5
			debug = False
			
			#VC: create the raw object
			from vizconnect.util.virtual_trackers import Keyboard
			rawTracker[_name] = Keyboard(trackerIndex=trackerIndex, speed=speed, debug=debug)
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='Virtual', model='Keyboard')

	#VC: return values can be modified here
	return None
def initTrackers(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
	#VC: place any general initialization code here
	rawTracker = vizconnect.getRawTrackerDict()

	#VC: initialize a new tracker
	_name = 'mouse_scrollwheel'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			trap = False
			visible = True
			scaleVelocityWithDistance = True
			extensionAccel = 100
			debug = False
			toggleTrapKey = ''
			
			#VC: create the raw object
			if toggleTrapKey:
				import vizact
				vizact.onkeydown(toggleTrapKey, viz.mouse.setTrap, viz.TOGGLE)
			from vizconnect.util.virtual_trackers import ScrollWheel
			rawTracker[_name] = ScrollWheel(trap=trap, visible=visible, scaleVelocityWithDistance=scaleVelocityWithDistance, extensionAccel=extensionAccel, debug=debug)
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='Virtual', model='Mouse Scrollwheel')
	
		#VC: init the offsets
		if initFlag&vizconnect.INIT_OFFSETS:
			_link = vizconnect.getTracker(_name).getLink()
			#VC: clear link offsets
			_link.reset(viz.RESET_OPERATORS)
			
			#VC: apply offsets
			_link.postTrans([0.1, -0.1, 0.7])

	#VC: initialize a new tracker
	_name = 'mouse_and_keyboard_walking'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			positionSensitivity = 1.5
			rotationSensitivity = 0.15
			trap = False
			visible = True
			debug = False
			toggleTrapKey = ''
			
			#VC: create the raw object
			if toggleTrapKey:
				import vizact
				vizact.onkeydown(toggleTrapKey, viz.mouse.setTrap, viz.TOGGLE)
			from vizconnect.util.virtual_trackers import MouseAndKeyboardWalking
			rawTracker[_name] = MouseAndKeyboardWalking(positionSensitivity=positionSensitivity, rotationSensitivity=rotationSensitivity, trap=trap, visible=visible, debug=debug)
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='Virtual', model='Mouse and Keyboard Walking')

	#VC: set the name of the default
	vizconnect.setDefault('tracker', 'mouse_and_keyboard_walking')

	#VC: return values can be modified here
	return None
def initTrackers(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
	#VC: place any general initialization code here
	rawTracker = vizconnect.getRawTrackerDict()

	#VC: initialize a new tracker
	_name = 'steamvr_controller_tracker'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			index = 1
			
			#VC: create the raw object
			import steamvr
			try:
				tracker = steamvr.getControllerList()[index]
			except IndexError:
				viz.logWarn("** WARNING: Not able to connect to tracker at index {0}. It's likely that not enough trackers are connected.".format(index))
				tracker = viz.addGroup()
				tracker.invalidTracker = True
			rawTracker[_name] = tracker
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='Valve', model='SteamVR Controller Tracker')

	#VC: initialize a new tracker
	_name = 'steamvr_controller_tracker2'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			index = 0
			
			#VC: create the raw object
			import steamvr
			try:
				tracker = steamvr.getControllerList()[index]
			except IndexError:
				viz.logWarn("** WARNING: Not able to connect to tracker at index {0}. It's likely that not enough trackers are connected.".format(index))
				tracker = viz.addGroup()
				tracker.invalidTracker = True
			rawTracker[_name] = tracker
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='Valve', model='SteamVR Controller Tracker')

	#VC: initialize a new tracker
	_name = 'steamvr_hmd_tracker'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			index = 0
			
			#VC: create the raw object
			import steamvr
			try:
				tracker = steamvr.getExtension().getHMDList()[index]
			except IndexError:
				viz.logWarn("** WARNING: Not able to connect to tracker at index {0}. It's likely that not enough trackers are connected.".format(index))
				tracker = viz.addGroup()
				tracker.invalidTracker = True
			rawTracker[_name] = tracker
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='Valve', model='SteamVR HMD Tracker')
	
		#VC: init the offsets
		if initFlag&vizconnect.INIT_OFFSETS:
			_link = vizconnect.getTracker(_name).getLink()
			#VC: clear link offsets
			_link.reset(viz.RESET_OPERATORS)

	#VC: return values can be modified here
	return None
def initTrackers(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
	#VC: place any general initialization code here
	rawTracker = vizconnect.getRawTrackerDict()

	#VC: initialize a new tracker
	_name = 'headtracker'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			vrpnName = 'DTrack'
			ip = '192.168.0.10'
			index = 0
			
			#VC: create the raw object
			vrpn7 = viz.add('vrpn7.dle')
			rawTracker[_name] = vrpn7.addTracker(vrpnName+'@'+ip, index)
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='A.R.T.', model='DTrack')
	
		#VC: init the offsets
		if initFlag&vizconnect.INIT_OFFSETS:
			_link = vizconnect.getTracker(_name).getLink()
			#VC: clear link offsets
			_link.reset(viz.RESET_OPERATORS)
			
			#VC: apply swap
			_link.swapPos([1, 2, -3])
			_link.swapQuat([-1, -2, 3, 4])

	#VC: initialize a new tracker
	_name = 'wandtracker'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			vrpnName = 'DTrack'
			ip = '192.168.0.10'
			index = 1
			
			#VC: create the raw object
			vrpn7 = viz.add('vrpn7.dle')
			rawTracker[_name] = vrpn7.addTracker(vrpnName+'@'+ip, index)
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='A.R.T.', model='DTrack')
	
		#VC: init the offsets
		if initFlag&vizconnect.INIT_OFFSETS:
			_link = vizconnect.getTracker(_name).getLink()
			#VC: clear link offsets
			_link.reset(viz.RESET_OPERATORS)
			
			#VC: apply swap
			_link.swapPos([1, 2, -3])
			_link.swapQuat([-1, -2, 3, 4])

	#VC: return values can be modified here
	return None
def initTrackers(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
	#VC: place any general initialization code here
	rawTracker = vizconnect.getRawTrackerDict()

	#VC: initialize a new tracker
	_name = 'r_hand_tracker'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			scaleVelocityWithDistance = True
			extensionAccel = 100
			debug = False
			
			#VC: create the raw object
			from vizconnect.util.virtual_trackers import ScrollWheel
			rawTracker[_name] = ScrollWheel(scaleVelocityWithDistance=scaleVelocityWithDistance, extensionAccel=extensionAccel, debug=debug)
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='Virtual', model='Mouse Scroll Wheel')
	
		#VC: init the offsets
		if initFlag&vizconnect.INIT_OFFSETS:
			_link = vizconnect.getTracker(_name).getLink()
			#VC: clear link offsets
			_link.reset(viz.RESET_OPERATORS)
			
			#VC: apply offsets
			_link.postTrans([0.1, -0.1, 0.4])

	#VC: initialize a new tracker
	_name = 'rift_with_mouse_and_keyboard'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			addMouseOrientation = False
			positionSensitivity = 2.5
			heightOffset = 1.82
			sensorIndex = 0
			
			#VC: create the raw object
			import oculus
			sensorList = oculus.getSensors()
			if sensorIndex < len(sensorList):
				dk2Tracker = sensorList[sensorIndex]
				from vizconnect.util import virtual_trackers
				tracker = virtual_trackers.TrackerAndKeyboardWalking(dk2Tracker, addMouseOrientation=addMouseOrientation, positionSensitivity=positionSensitivity, heightOffset=heightOffset)
			else:
				viz.logWarn("** WARNING: Oculus Tracker not present.")
				tracker = viz.addGroup()
				tracker.invalidTracker = True
			rawTracker[_name] = tracker
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='Oculus VR', model='Rift With Mouse And Keyboard')
	
		#VC: set the parent of the node
		if initFlag&vizconnect.INIT_PARENTS:
			vizconnect.getTracker(_name).setParent(vizconnect.getRoot())

	#VC: return values can be modified here
	return None
示例#18
0
def initTrackers(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
    #VC: place any general initialization code here
    rawTracker = vizconnect.getRawTrackerDict()

    #VC: initialize a new tracker
    _name = 'head_tracker'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: request that any dependencies be created
        if initFlag & vizconnect.INIT_INDEPENDENT:
            initTrackers(vizconnect.INIT_INDEPENDENT, ['ppt_1'])
            initTrackers(vizconnect.INIT_INDEPENDENT, ['ppt_2'])
            initTrackers(vizconnect.INIT_INDEPENDENT, ['ppt_3'])
            initTrackers(vizconnect.INIT_INDEPENDENT, ['ppt_4'])
            initTrackers(vizconnect.INIT_INDEPENDENT, ['inertiacube'])

        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            index = 0

            #VC: create the raw object
            import steamvr
            try:
                tracker = steamvr.getExtension().getHMDList()[index]
            except IndexError:
                viz.logWarn(
                    "** WARNING: Not able to connect to tracker at index {0}. It's likely that not enough trackers are connected."
                    .format(index))
                tracker = viz.addGroup()
                tracker.invalidTracker = True
            rawTracker[_name] = tracker

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='Valve',
                                  model='SteamVR HMD Tracker')

    #VC: initialize a new tracker
    _name = 'ppt_1'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            pptHostname = '169.254.254.71'
            markerId = 1

            #VC: create the raw object
            vrpn7 = viz.add('vrpn7.dle')
            rawTracker[_name] = vrpn7.addTracker('PPT0@' + pptHostname,
                                                 markerId - 1)

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='WorldViz',
                                  model='PPT')

    #VC: initialize a new tracker
    _name = 'ppt_2'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            pptHostname = '169.254.254.71'
            markerId = 2

            #VC: create the raw object
            vrpn7 = viz.add('vrpn7.dle')
            rawTracker[_name] = vrpn7.addTracker('PPT0@' + pptHostname,
                                                 markerId - 1)

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='WorldViz',
                                  model='PPT')

    #VC: initialize a new tracker
    _name = 'ppt_3'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            pptHostname = '169.254.254.71'
            markerId = 3

            #VC: create the raw object
            vrpn7 = viz.add('vrpn7.dle')
            rawTracker[_name] = vrpn7.addTracker('PPT0@' + pptHostname,
                                                 markerId - 1)

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='WorldViz',
                                  model='PPT')

    #VC: initialize a new tracker
    _name = 'ppt_4'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            pptHostname = '169.254.254.71'
            markerId = 4

            #VC: create the raw object
            vrpn7 = viz.add('vrpn7.dle')
            rawTracker[_name] = vrpn7.addTracker('PPT0@' + pptHostname,
                                                 markerId - 1)

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='WorldViz',
                                  model='PPT')

    #VC: initialize a new tracker
    _name = 'inertiacube'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            port = 6

            #VC: create the raw object
            isense = viz.add('intersense.dle')
            isenseTracker = isense.addTracker(port=port)
            if not isenseTracker.valid():
                viz.logWarn(
                    "** WARNING: can't connect to InterSense InertiaCube at {0}."
                    .format(port))
            rawTracker[_name] = isenseTracker

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='InterSense',
                                  model='InertiaCube')

    #VC: initialize a new tracker
    _name = 'optical_heading'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: request that any dependencies be created
        if initFlag & vizconnect.INIT_INDEPENDENT:
            initTrackers(vizconnect.INIT_INDEPENDENT, ['ppt_3'])
            initTrackers(vizconnect.INIT_INDEPENDENT, ['ppt_4'])
            initTrackers(vizconnect.INIT_INDEPENDENT, ['inertiacube'])

        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            leftPosTracker = vizconnect.getTracker('ppt_3').getNode3d()
            rightPosTracker = vizconnect.getTracker('ppt_4').getNode3d()
            oriTracker = vizconnect.getTracker('inertiacube').getNode3d()
            distance = 0.195

            #VC: create the raw object
            from vizconnect.util.virtual_trackers import OpticalHeading
            rawTracker[_name] = OpticalHeading(leftPosTracker,
                                               rightPosTracker,
                                               oriTracker,
                                               distance=distance)

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='Virtual',
                                  model='Optical Heading')

    #VC: set the name of the default
    vizconnect.setDefault('tracker', 'head_tracker')

    #VC: return values can be modified here
    return None
def initTrackers(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
	#VC: place any general initialization code here
	rawTracker = vizconnect.getRawTrackerDict()

	#VC: initialize a new tracker
	_name = 'ppt_left_eye'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			pptHostname = '171.64.33.43'
			markerId = 1
			
			#VC: create the raw object
			vrpn7 = viz.add('vrpn7.dle')
			rawTracker[_name] = vrpn7.addTracker('PPT0@'+pptHostname, markerId-1)
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='WorldViz', model='PPT')

	#VC: initialize a new tracker
	_name = 'rift_orientation_tracker'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			index = 0
			
			#VC: create the raw object
			import oculus
			sensorList = oculus.getSensors()
			if index < len(sensorList):
				orientationTracker = sensorList[index]
			else:
				viz.logWarn("** WARNING: Oculus VR Rift Orientation Tracker not present.")
				orientationTracker = viz.addGroup()
				orientationTracker.invalidTracker = True
			rawTracker[_name] = orientationTracker
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='Oculus VR', model='Rift Orientation Tracker')
	
		#VC: init the mappings for the wrapper
		if initFlag&vizconnect.INIT_WRAPPER_MAPPINGS:
			#VC: on-state mappings
			if initFlag&vizconnect.INIT_MAPPINGS_ON_STATE:
				vizconnect.getTracker(_name).setOnStateEventList([
						vizconnect.onstate(lambda rawInput: rawInput['keyboard'].isButtonDown(19), vizconnect.getTracker(_name).resetHeading),# make=Generic, model=Keyboard, name=keyboard, signal=Key R
				])

	#VC: initialize a new tracker
	_name = 'merged'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: request that any dependencies be created
		if initFlag&vizconnect.INIT_INDEPENDENT:
			initTrackers(vizconnect.INIT_INDEPENDENT, ['ppt_left_eye'])
			initTrackers(vizconnect.INIT_INDEPENDENT, ['rift_orientation_tracker'])
	
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			posTracker = vizconnect.getTracker('ppt_left_eye').getNode3d()
			oriTracker = vizconnect.getTracker('rift_orientation_tracker').getNode3d()
			
			#VC: create the raw object
			try:
				raw = viz.mergeLinkable(posTracker, oriTracker)
			except:
				viz.logError('Error **: unable to create merged tracker, providing empty tracker object.')
				raw = viz.addGroup()
				raw.invalidTracker = True
			rawTracker[_name] = raw
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='Virtual', model='Merged')
	
		#VC: init the offsets
		if initFlag&vizconnect.INIT_OFFSETS:
			_link = vizconnect.getTracker(_name).getLink()
			#VC: clear link offsets
			_link.reset(viz.RESET_OPERATORS)
			
			#VC: reset orientation
			_link.preEuler([0, 0, 0], target=viz.LINK_ORI_OP, priority=-20)

				#VC: apply offsets
			_link.preTrans([0.0975, -0.08, -0.07])

		#VC: set the parent of the node
		if initFlag&vizconnect.INIT_PARENTS:
			vizconnect.getTracker(_name).setParent(vizconnect.getTransport('wandmagiccarpet'))

	#VC: initialize a new tracker
	_name = 'rift_with_mouse_and_keyboard'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			addMouseOrientation = True
			positionSensitivity = 2.5
			heightOffset = 1.82
			sensorIndex = 0
			
			#VC: create the raw object
			import oculus
			sensorList = oculus.getSensors()
			if sensorIndex < len(sensorList):
				dk2Tracker = sensorList[sensorIndex]
				from vizconnect.util import virtual_trackers
				tracker = virtual_trackers.TrackerAndKeyboardWalking(dk2Tracker, addMouseOrientation=addMouseOrientation, positionSensitivity=positionSensitivity, heightOffset=heightOffset)
			else:
				viz.logWarn("** WARNING: Oculus Tracker not present.")
				tracker = viz.addGroup()
				tracker.invalidTracker = True
			rawTracker[_name] = tracker
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='Oculus VR', model='Rift With Mouse And Keyboard')

	#VC: return values can be modified here
	return None
示例#20
0
def initTrackers(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
    #VC: place any general initialization code here
    rawTracker = vizconnect.getRawTrackerDict()

    #VC: initialize a new tracker
    _name = 'marker2'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            hostname = '127.0.0.1:2'
            sensorIndex = 14

            #VC: create the raw object
            try:
                phasespace = viz.add('phasespace.dle', 0, hostname)
            except:
                viz.logWarn(
                    "** WARNING: can't connect to PhaseSpace at {0}.".format(
                        hostname))

            validTracker = False
            if phasespace.id != -1:
                try:
                    sensor = phasespace.addMarker(sensorIndex)
                    validTracker = True
                except:
                    validTracker = False

            if not validTracker:
                viz.logWarn(
                    "** WARNING: can't connect to Northern Digital Optotrack with index {0}. It's likely that not enough sensors are connected."
                    .format(sensorIndex))
                sensor = viz.addGroup()
                sensor.invalidTracker = True
            rawTracker[_name] = sensor

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='PhaseSpace',
                                  model='Marker')

    #VC: initialize a new tracker
    _name = 'look_at'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: request that any dependencies be created
        if initFlag & vizconnect.INIT_INDEPENDENT:
            initTrackers(vizconnect.INIT_INDEPENDENT, ['marker2'])
            initTrackers(vizconnect.INIT_INDEPENDENT, ['marker3'])

        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            eye = vizconnect.getTracker('marker2').getNode3d()
            target = vizconnect.getTracker('marker3').getNode3d()

            #VC: create the raw object
            from vizconnect.util import virtual_trackers
            if eye and target:
                raw = virtual_trackers.LookAt(eye=eye, target=target)
            else:
                viz.logError(
                    'Error **: unable to create merged tracker, providing empty tracker object.'
                )
                raw = viz.addGroup()
                raw.invalidTracker = True
            rawTracker[_name] = raw

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='Virtual',
                                  model='Look At')

        #VC: init the offsets
        if initFlag & vizconnect.INIT_OFFSETS:
            _link = vizconnect.getTracker(_name).getLink()
            #VC: clear link offsets
            _link.reset(viz.RESET_OPERATORS)

            #VC: apply offsets
            _link.postEuler([0, 0, 2])

    #VC: initialize a new tracker
    _name = 'marker3'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            hostname = '127.0.0.1:2'
            sensorIndex = 15

            #VC: create the raw object
            try:
                phasespace = viz.add('phasespace.dle', 0, hostname)
            except:
                viz.logWarn(
                    "** WARNING: can't connect to PhaseSpace at {0}.".format(
                        hostname))

            validTracker = False
            if phasespace.id != -1:
                try:
                    sensor = phasespace.addMarker(sensorIndex)
                    validTracker = True
                except:
                    validTracker = False

            if not validTracker:
                viz.logWarn(
                    "** WARNING: can't connect to Northern Digital Optotrack with index {0}. It's likely that not enough sensors are connected."
                    .format(sensorIndex))
                sensor = viz.addGroup()
                sensor.invalidTracker = True
            rawTracker[_name] = sensor

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='PhaseSpace',
                                  model='Marker')

    #VC: initialize a new tracker
    _name = 'head_0'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            hostname = '127.0.0.1:2'
            sensorIndex = 3

            #VC: create the raw object
            try:
                phasespace = viz.add('phasespace.dle', 0, hostname)
            except:
                viz.logWarn(
                    "** WARNING: can't connect to PhaseSpace at {0}.".format(
                        hostname))

            validTracker = False
            if phasespace.id != -1:
                try:
                    sensor = phasespace.addMarker(sensorIndex)
                    validTracker = True
                except:
                    validTracker = False

            if not validTracker:
                viz.logWarn(
                    "** WARNING: can't connect to Northern Digital Optotrack with index {0}. It's likely that not enough sensors are connected."
                    .format(sensorIndex))
                sensor = viz.addGroup()
                sensor.invalidTracker = True
            rawTracker[_name] = sensor

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='PhaseSpace',
                                  model='Marker')

    #VC: initialize a new tracker
    _name = 'marker'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            hostname = '127.0.0.1:2'
            sensorIndex = 0

            #VC: create the raw object
            try:
                phasespace = viz.add('phasespace.dle', 0, hostname)
            except:
                viz.logWarn(
                    "** WARNING: can't connect to PhaseSpace at {0}.".format(
                        hostname))

            validTracker = False
            if phasespace.id != -1:
                try:
                    sensor = phasespace.addMarker(sensorIndex)
                    validTracker = True
                except:
                    validTracker = False

            if not validTracker:
                viz.logWarn(
                    "** WARNING: can't connect to Northern Digital Optotrack with index {0}. It's likely that not enough sensors are connected."
                    .format(sensorIndex))
                sensor = viz.addGroup()
                sensor.invalidTracker = True
            rawTracker[_name] = sensor

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='PhaseSpace',
                                  model='Marker')

    #VC: initialize a new tracker
    _name = 'look_at2'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: request that any dependencies be created
        if initFlag & vizconnect.INIT_INDEPENDENT:
            initTrackers(vizconnect.INIT_INDEPENDENT, ['head_0'])
            initTrackers(vizconnect.INIT_INDEPENDENT, ['marker'])

        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            eye = vizconnect.getTracker('head_0').getNode3d()
            target = vizconnect.getTracker('marker').getNode3d()

            #VC: create the raw object
            from vizconnect.util import virtual_trackers
            if eye and target:
                raw = virtual_trackers.LookAt(eye=eye, target=target)
            else:
                viz.logError(
                    'Error **: unable to create merged tracker, providing empty tracker object.'
                )
                raw = viz.addGroup()
                raw.invalidTracker = True
            rawTracker[_name] = raw

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='Virtual',
                                  model='Look At')

    #VC: initialize a new tracker
    _name = 'marker4'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            hostname = '127.0.0.1:2'
            sensorIndex = 21

            #VC: create the raw object
            try:
                phasespace = viz.add('phasespace.dle', 0, hostname)
            except:
                viz.logWarn(
                    "** WARNING: can't connect to PhaseSpace at {0}.".format(
                        hostname))

            validTracker = False
            if phasespace.id != -1:
                try:
                    sensor = phasespace.addMarker(sensorIndex)
                    validTracker = True
                except:
                    validTracker = False

            if not validTracker:
                viz.logWarn(
                    "** WARNING: can't connect to Northern Digital Optotrack with index {0}. It's likely that not enough sensors are connected."
                    .format(sensorIndex))
                sensor = viz.addGroup()
                sensor.invalidTracker = True
            rawTracker[_name] = sensor

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='PhaseSpace',
                                  model='Marker')

    #VC: initialize a new tracker
    _name = 'marker5'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            hostname = '127.0.0.1:2'
            sensorIndex = 22

            #VC: create the raw object
            try:
                phasespace = viz.add('phasespace.dle', 0, hostname)
            except:
                viz.logWarn(
                    "** WARNING: can't connect to PhaseSpace at {0}.".format(
                        hostname))

            validTracker = False
            if phasespace.id != -1:
                try:
                    sensor = phasespace.addMarker(sensorIndex)
                    validTracker = True
                except:
                    validTracker = False

            if not validTracker:
                viz.logWarn(
                    "** WARNING: can't connect to Northern Digital Optotrack with index {0}. It's likely that not enough sensors are connected."
                    .format(sensorIndex))
                sensor = viz.addGroup()
                sensor.invalidTracker = True
            rawTracker[_name] = sensor

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='PhaseSpace',
                                  model='Marker')

    #VC: initialize a new tracker
    _name = 'look_at3'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: request that any dependencies be created
        if initFlag & vizconnect.INIT_INDEPENDENT:
            initTrackers(vizconnect.INIT_INDEPENDENT, ['marker4'])
            initTrackers(vizconnect.INIT_INDEPENDENT, ['marker5'])

        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            eye = vizconnect.getTracker('marker4').getNode3d()
            target = vizconnect.getTracker('marker5').getNode3d()

            #VC: create the raw object
            from vizconnect.util import virtual_trackers
            if eye and target:
                raw = virtual_trackers.LookAt(eye=eye, target=target)
            else:
                viz.logError(
                    'Error **: unable to create merged tracker, providing empty tracker object.'
                )
                raw = viz.addGroup()
                raw.invalidTracker = True
            rawTracker[_name] = raw

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='Virtual',
                                  model='Look At')

    #VC: initialize a new tracker
    _name = 'marker6'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            hostname = '127.0.0.1:2'
            sensorIndex = 12

            #VC: create the raw object
            try:
                phasespace = viz.add('phasespace.dle', 0, hostname)
            except:
                viz.logWarn(
                    "** WARNING: can't connect to PhaseSpace at {0}.".format(
                        hostname))

            validTracker = False
            if phasespace.id != -1:
                try:
                    sensor = phasespace.addMarker(sensorIndex)
                    validTracker = True
                except:
                    validTracker = False

            if not validTracker:
                viz.logWarn(
                    "** WARNING: can't connect to Northern Digital Optotrack with index {0}. It's likely that not enough sensors are connected."
                    .format(sensorIndex))
                sensor = viz.addGroup()
                sensor.invalidTracker = True
            rawTracker[_name] = sensor

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='PhaseSpace',
                                  model='Marker')

    #VC: return values can be modified here
    return None
def initTrackers(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
    #VC: place any general initialization code here
    rawTracker = vizconnect.getRawTrackerDict()

    #VC: initialize a new tracker
    _name = 'dtrack_head'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            vrpnName = 'DTrack'
            ip = 'localhost'
            index = 0

            #VC: create the raw object
            vrpn7 = viz.add('vrpn7.dle')
            rawTracker[_name] = vrpn7.addTracker(vrpnName + '@' + ip, index)

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='A.R.T.',
                                  model='DTrack')

        #VC: set the parent of the node
        if initFlag & vizconnect.INIT_PARENTS:
            vizconnect.getTracker(_name).setParent(
                vizconnect.getGroup('cave_data_file'))

    #VC: initialize a new tracker
    _name = 'dtrack_flystick'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            vrpnName = 'DTrack'
            #ip = '192.168.1.51'
            ip = 'localhost'
            index = 2

            #VC: create the raw object
            vrpn7 = viz.add('vrpn7.dle')
            rawTracker[_name] = vrpn7.addTracker(vrpnName + '@' + ip, index)

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='A.R.T.',
                                  model='DTrack')

    #VC: initialize a new tracker
    _name = 'senso'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            vrpnName = 'DTrack'
            ip = '127.0.0.1'
            index = 1

            #VC: create the raw object
            vrpn7 = viz.add('vrpn7.dle')
            rawTracker[_name] = vrpn7.addTracker(vrpnName + '@' + ip, index)

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='A.R.T.',
                                  model='DTrack')

    #VC: return values can be modified here
    return None
def initTrackers(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
    #VC: place any general initialization code here
    rawTracker = vizconnect.getRawTrackerDict()

    #VC: initialize a new tracker
    _name = 'head_tracker'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            pptHostname = '141.82.50.174'
            markerId = 1

            #VC: create the raw object
            vrpn7 = viz.add('vrpn7.dle')
            rawTracker[_name] = vrpn7.addTracker('PPT0@' + pptHostname,
                                                 markerId - 1)

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='WorldViz',
                                  model='PPT')

        #VC: init the offsets
        if initFlag & vizconnect.INIT_OFFSETS:
            _link = vizconnect.getTracker(_name).getLink()
            #VC: clear link offsets
            _link.reset(viz.RESET_OPERATORS)

            #VC: apply offsets
            _link.preTrans([0, -0.04, -0.04])

    #VC: initialize a new tracker
    _name = 'r_hand_tracker'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            pptHostname = '141.82.50.174'
            markerId = 3

            #VC: create the raw object
            vrpn7 = viz.add('vrpn7.dle')
            rawTracker[_name] = vrpn7.addTracker('PPT0@' + pptHostname,
                                                 markerId - 1)

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='WorldViz',
                                  model='PPT')

        #VC: set the parent of the node
        if initFlag & vizconnect.INIT_PARENTS:
            vizconnect.getTracker(_name).setParent(vizconnect.getRoot())

    #VC: return values can be modified here
    return None
def initTrackers(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
    #VC: place any general initialization code here
    rawTracker = vizconnect.getRawTrackerDict()

    #VC: initialize a new tracker
    _name = 'dtrack_head'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            vrpnName = 'DTrack'
            ip = '192.168.5.160'
            index = 1

            #VC: create the raw object
            vrpn7 = viz.add('vrpn7.dle')
            rawTracker[_name] = vrpn7.addTracker(vrpnName + '@' + ip, index)

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='A.R.T.',
                                  model='DTrack')

        #VC: init the offsets
        if initFlag & vizconnect.INIT_OFFSETS:
            _link = vizconnect.getTracker(_name).getLink()
            #VC: clear link offsets
            _link.reset(viz.RESET_OPERATORS)

            #VC: reset orientation
            _link.preEuler([0, 0, 0], target=viz.LINK_ORI_OP, priority=-20)

            #VC: apply offsets
            _link.postTrans([0, 0, -0.02])

    #VC: initialize a new tracker
    _name = 'dtrack_flystick'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            vrpnName = 'DTrack'
            ip = '192.168.5.160'
            index = 3

            #VC: create the raw object
            vrpn7 = viz.add('vrpn7.dle')
            rawTracker[_name] = vrpn7.addTracker(vrpnName + '@' + ip, index)

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='A.R.T.',
                                  model='DTrack')

        #VC: init the mappings for the wrapper
        if initFlag & vizconnect.INIT_WRAPPER_MAPPINGS:
            #VC: on-state mappings
            if initFlag & vizconnect.INIT_MAPPINGS_ON_STATE:
                vizconnect.getTracker(_name).setOnStateEventList([
                    vizconnect.onstate(
                        lambda rawInput: rawInput['flystick'].isButtonDown(2),
                        vizconnect.getTracker(_name).resetHeading
                    ),  # make=ART, model=Flystick, name=flystick, signal=Button 2
                ])

    #VC: set the name of the default
    vizconnect.setDefault('tracker', 'dtrack_head')

    #VC: return values can be modified here
    return None
示例#24
0
def initTrackers(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
    #VC: place any general initialization code here
    rawTracker = vizconnect.getRawTrackerDict()

    #VC: initialize a new tracker
    _name = 'vrpn'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            trackerId = 'Tracker0'
            ip = 'localhost'
            sensorIndex = 38

            #VC: create the raw object
            vrpn7 = viz.add('vrpn7.dle')
            rawTracker[_name] = vrpn7.addTracker(trackerId + "@" + ip,
                                                 sensorIndex)

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='Generic',
                                  model='VRPN')

        #VC: init the offsets
        if initFlag & vizconnect.INIT_OFFSETS:
            _link = vizconnect.getTracker(_name).getLink()
            #VC: clear link offsets
            _link.reset(viz.RESET_OPERATORS)

            #VC: apply swap
            _link.swapPos([-1, 2, 3])

        #VC: set the parent of the node
        if initFlag & vizconnect.INIT_PARENTS:
            vizconnect.getTracker(_name).setParent(
                vizconnect.getAvatar('male').getAttachmentPoint('head'))

    #VC: initialize a new tracker
    _name = 'inertiacube'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            port = 0

            #VC: create the raw object
            isense = viz.add('intersense.dle')
            isenseTracker = isense.addTracker(port=port)
            if not isenseTracker.valid():
                viz.logWarn(
                    "** WARNING: can't connect to InterSense InertiaCube at {0}."
                    .format(port))
            rawTracker[_name] = isenseTracker

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='InterSense',
                                  model='InertiaCube')

    #VC: initialize a new tracker
    _name = 'merged'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: request that any dependencies be created
        if initFlag & vizconnect.INIT_INDEPENDENT:
            initTrackers(vizconnect.INIT_INDEPENDENT, ['vrpn'])
            initTrackers(vizconnect.INIT_INDEPENDENT, ['inertiacube'])

        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            posTracker = vizconnect.getTracker('vrpn').getNode3d()
            oriTracker = vizconnect.getTracker('inertiacube').getNode3d()

            #VC: create the raw object
            try:
                raw = viz.mergeLinkable(posTracker, oriTracker)
            except:
                viz.logError(
                    'Error **: unable to create merged tracker, providing empty tracker object.'
                )
                raw = viz.addGroup()
                raw.invalidTracker = True
            rawTracker[_name] = raw

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='Virtual',
                                  model='Merged')

    #VC: initialize a new tracker
    _name = 'vrpn3'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            trackerId = 'Tracker0'
            ip = 'localhost'
            sensorIndex = 40

            #VC: create the raw object
            vrpn7 = viz.add('vrpn7.dle')
            rawTracker[_name] = vrpn7.addTracker(trackerId + "@" + ip,
                                                 sensorIndex)

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='Generic',
                                  model='VRPN')

        #VC: init the offsets
        if initFlag & vizconnect.INIT_OFFSETS:
            _link = vizconnect.getTracker(_name).getLink()
            #VC: clear link offsets
            _link.reset(viz.RESET_OPERATORS)

            #VC: apply swap
            _link.swapPos([-1, 2, 3])
            _link.swapQuat([-1, 2, 3, -4])

        #VC: set the parent of the node
        if initFlag & vizconnect.INIT_PARENTS:
            vizconnect.getTracker(_name).setParent(vizconnect.getRoot())

    #VC: initialize a new tracker
    _name = 'vrpn2'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            trackerId = 'Tracker0'
            ip = 'localhost'
            sensorIndex = 39

            #VC: create the raw object
            vrpn7 = viz.add('vrpn7.dle')
            rawTracker[_name] = vrpn7.addTracker(trackerId + "@" + ip,
                                                 sensorIndex)

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='Generic',
                                  model='VRPN')

        #VC: init the offsets
        if initFlag & vizconnect.INIT_OFFSETS:
            _link = vizconnect.getTracker(_name).getLink()
            #VC: clear link offsets
            _link.reset(viz.RESET_OPERATORS)

            #VC: apply swap
            _link.swapPos([-1, 2, 3])
            _link.swapQuat([-1, 2, 3, -4])

    #VC: return values can be modified here
    return None
def initTrackers(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
	#VC: place any general initialization code here
	rawTracker = vizconnect.getRawTrackerDict()

	#VC: initialize a new tracker
	_name = 'merged'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: request that any dependencies be created
		if initFlag&vizconnect.INIT_INDEPENDENT:
			initTrackers(vizconnect.INIT_INDEPENDENT, ['mouse_and_keyboard_flying'])
			initTrackers(vizconnect.INIT_INDEPENDENT, ['dk2'])
	
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			posTracker = vizconnect.getTracker('mouse_and_keyboard_flying').getNode3d()
			oriTracker = vizconnect.getTracker('dk2').getNode3d()
			
			#VC: create the raw object
			try:
				raw = viz.mergeLinkable(posTracker, oriTracker)
			except:
				viz.logError('Error **: unable to create merged tracker, providing empty tracker object.')
				raw = viz.addGroup()
				raw.invalidTracker = True
			rawTracker[_name] = raw
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='Virtual', model='Merged')

	#VC: initialize a new tracker
	_name = 'dk2'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			index = 0
			
			#VC: create the raw object
			import oculus
			sensorList = oculus.getSensors()
			if index < len(sensorList):
				orientationTracker = sensorList[index]
			else:
				viz.logWarn("** WARNING: Oculus VR Rift Orientation Tracker not present.")
				orientationTracker = viz.addGroup()
				orientationTracker.invalidTracker = True
			rawTracker[_name] = orientationTracker
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='Oculus VR', model='DK2')
	
		#VC: set the parent of the node
		if initFlag&vizconnect.INIT_PARENTS:
			vizconnect.getTracker(_name).setParent(vizconnect.getRoot())

	#VC: initialize a new tracker
	_name = 'mouse_and_keyboard_flying'
	if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
		#VC: init the raw object
		if initFlag&vizconnect.INIT_RAW:
			#VC: set some parameters
			positionSensitivity = 2.5
			rotationSensitivity = 0.15
			debug = False
			
			#VC: create the raw object
			from vizconnect.util.virtual_trackers import MouseAndKeyboardFlying
			rawTracker[_name] = MouseAndKeyboardFlying(positionSensitivity=positionSensitivity, rotationSensitivity=rotationSensitivity, debug=debug)
	
		#VC: init the wrapper (DO NOT EDIT)
		if initFlag&vizconnect.INIT_WRAPPERS:
			vizconnect.addTracker(rawTracker[_name], _name, make='Virtual', model='Mouse and Keyboard Flying')
	
		#VC: set the parent of the node
		if initFlag&vizconnect.INIT_PARENTS:
			vizconnect.getTracker(_name).setParent(vizconnect.getRoot())

	#VC: return values can be modified here
	return None
示例#26
0
def initTrackers(initFlag=vizconnect.INIT_INDEPENDENT, initList=None):
    #VC: place any general initialization code here
    rawTracker = vizconnect.getRawTrackerDict()

    #VC: initialize a new tracker
    _name = 'ppt_rhead'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            pptHostname = 'localhost'
            markerId = 1

            #VC: create the raw object
            vrpn7 = viz.add('vrpn7.dle')
            rawTracker[_name] = vrpn7.addTracker('PPT0@' + pptHostname,
                                                 markerId - 1)

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='WorldViz',
                                  model='PPT')

    #VC: initialize a new tracker
    _name = 'ppt_lhead'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            pptHostname = 'localhost'
            markerId = 2

            #VC: create the raw object
            vrpn7 = viz.add('vrpn7.dle')
            rawTracker[_name] = vrpn7.addTracker('PPT0@' + pptHostname,
                                                 markerId - 1)

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='WorldViz',
                                  model='PPT')

    #VC: initialize a new tracker
    _name = 'ppt_rhand'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            pptHostname = 'localhost'
            markerId = 4

            #VC: create the raw object
            vrpn7 = viz.add('vrpn7.dle')
            rawTracker[_name] = vrpn7.addTracker('PPT0@' + pptHostname,
                                                 markerId - 1)

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='WorldViz',
                                  model='PPT')

    #VC: initialize a new tracker
    _name = 'ppt_lhand'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            pptHostname = 'localhost'
            markerId = 5

            #VC: create the raw object
            vrpn7 = viz.add('vrpn7.dle')
            rawTracker[_name] = vrpn7.addTracker('PPT0@' + pptHostname,
                                                 markerId - 1)

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='WorldViz',
                                  model='PPT')

    #VC: initialize a new tracker
    _name = 'osv3_sensor_bus'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            port = 11
            sensorIndex = 0

            #VC: create the raw object
            InertialLabs = viz.add('InertialLabs.dle')
            sensors = InertialLabs.addSensorBus(port=port)
            try:
                sensor = sensors[sensorIndex]
            except:
                viz.logWarn(
                    "** WARNING: can't connect to InertialLabs OSv3 (Sensor Bus) on port {0} with index {1}. It's likely that not enough sensors are connected."
                    .format(port, sensorIndex))
                sensor = viz.addGroup()
                sensor.invalidTracker = True
            rawTracker[_name] = sensor

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='Inertial Labs',
                                  model='OSv3 Sensor Bus')

        #VC: init the offsets
        if initFlag & vizconnect.INIT_OFFSETS:
            _link = vizconnect.getTracker(_name).getLink()
            #VC: clear link offsets
            _link.reset(viz.RESET_OPERATORS)

            #VC: reset orientation
            _link.preEuler([0, 0, 0], target=viz.LINK_ORI_OP, priority=-20)

            #VC: apply offsets
            _link.preEuler([90, 0, 180])

    #VC: initialize a new tracker
    _name = 'optical_heading'
    if vizconnect.isPendingInit('tracker', _name, initFlag, initList):
        #VC: request that any dependencies be created
        if initFlag & vizconnect.INIT_INDEPENDENT:
            initTrackers(vizconnect.INIT_INDEPENDENT, ['ppt_lhead'])
            initTrackers(vizconnect.INIT_INDEPENDENT, ['ppt_rhead'])
            initTrackers(vizconnect.INIT_INDEPENDENT, ['osv3_sensor_bus'])

        #VC: init the raw object
        if initFlag & vizconnect.INIT_RAW:
            #VC: set some parameters
            leftPosTracker = vizconnect.getTracker('ppt_lhead').getNode3d()
            rightPosTracker = vizconnect.getTracker('ppt_rhead').getNode3d()
            oriTracker = vizconnect.getTracker('osv3_sensor_bus').getNode3d()
            distance = 0.39

            #VC: create the raw object
            from vizconnect.util.virtual_trackers import OpticalHeading
            rawTracker[_name] = OpticalHeading(leftPosTracker,
                                               rightPosTracker,
                                               oriTracker,
                                               distance=distance)

        #VC: init the wrapper (DO NOT EDIT)
        if initFlag & vizconnect.INIT_WRAPPERS:
            vizconnect.addTracker(rawTracker[_name],
                                  _name,
                                  make='Virtual',
                                  model='Optical Heading')

        #VC: init the offsets
        if initFlag & vizconnect.INIT_OFFSETS:
            _link = vizconnect.getTracker(_name).getLink()
            #VC: clear link offsets
            _link.reset(viz.RESET_OPERATORS)

            #VC: reset orientation
            _link.preEuler([0, 0, 0], target=viz.LINK_ORI_OP, priority=-20)

            #VC: apply offsets
            _link.preTrans([0, -0.14, 0.05])

    #VC: return values can be modified here
    return None