当前位置: 首页>>代码示例>>Python>>正文


Python viz.tick函数代码示例

本文整理汇总了Python中viz.tick函数的典型用法代码示例。如果您正苦于以下问题:Python tick函数的具体用法?Python tick怎么用?Python tick使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了tick函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: checkStats

	def checkStats():
		stats = viz.getRenderStats()
		if stats.frameTime > 0.012:
			print viz.tick()
			print stats

#	vizact.onupdate(viz.PRIORITY_DEFAULT, checkStats)
开发者ID:vhilab,项目名称:Ocean-Acidification,代码行数:7,代码来源:CG_scenes.py

示例2: timer3

def timer3():
	viz.playSound('boing!.wav')
	global reaction_timer_initial
	a=viz.tick()
	print('in timer!')
	global timer2
	reaction_timer_initial=viz.tick()
开发者ID:apiatski,项目名称:Freshman_Research,代码行数:7,代码来源:viz_quick_check.py

示例3: run

    def run(self):
        exp = self.block.experiment

        lf = exp.left_finger
        rf = exp.right_finger

        # wait for the subject to touch the target sphere.
        yield self.block.experiment.wait_for_target()

        # target touched, now figure out which hand is doing the tracing.
        left_is_closer = distance(lf, exp.target) < distance(rf, exp.target)
        finger = lf if left_is_closer else rf
        self.trace_color = (1, 0, 0) if left_is_closer else (0, 1, 0)
        self.trace_name = 'left' if left_is_closer else 'right'

        # animate the target along the path, recording mocap data as we go.
        start = viz.tick()
        for i, v in enumerate(self.vertices):
            # ramp up the speed linearly from 0.
            s = min(1, 0.1 * (i+1)) * self.speed
            yield viztask.addAction(exp.target, vizact.moveTo(v, speed=s))

            # keep track of the position of the tracing finger.
            finger_position = finger.getPosition()
            self.trace.append(finger_position)

            # record values from the simulation and from the mocap.
            fields = [i, viz.tick() - start]
            fields.extend(exp.target.getPosition())
            fields.extend(finger_position)
            fields.extend(exp.head.get_pose().pos)
            for _, marker in sorted(exp.mocap.get_markers().iteritems()):
                fields.extend(marker.pos)
                fields.append(marker.cond)
            self.records.append(fields)
开发者ID:EmbodiedCognition,项目名称:tracing-experiment,代码行数:35,代码来源:main.py

示例4: update

    def update(self):
        '''Update our knowledge of the current data from phasespace.'''
        if self._lock.acquire(False):
            return

        now = viz.tick()
        #if now - math.floor(now) < 0.1 / self.frame_rate:
        #    logging.info('%dus elapsed since last phasespace update',
        #                 1000000 * (now - self._updated))
        self._updated = now

        rigids = OWL.owlGetRigids()
        markers = OWL.owlGetMarkers()
        err = OWL.owlGetError()
        if err != OWL.OWL_NO_ERROR:
            hex = '0x%x' % err
            logging.debug(
                'OWL error %s (%s) getting marker data',
                ERROR_MAP.get(err, hex), hex)
            return
        getting_at = viz.tick() - now

        sx, sy, sz = self.scale
        ox, oy, oz = self.offset
        def transform(x, y, z):
            return sz * z + oz, sy * y + oy, sx * x + ox
        def swizzle(w, a, b, c):
            return c, b, a, -w

        for marker in markers:
            t, o = marker.id >> 12, marker.id & 0xfff
            x, y, z = marker.x, marker.y, marker.z
            self.trackers[t].update_markers(o,
                Marker(pos=transform(x, y, z), cond=marker.cond),
                Marker(pos=(x, y, z), cond=marker.cond))
        marker_at = viz.tick() - now

        for rigid in rigids:
            self.trackers[rigid.id].update_pose(Pose(
                pos=transform(*rigid.pose[0:3]),
                quat=swizzle(*rigid.pose[3:7]),
                cond=rigid.cond))
        rigid_at = viz.tick() - now

        #logging.info('phasespace update: %dus -> %dus -> %dus',
        #             1000000 * getting_at,
        #             1000000 * marker_at,
        #             1000000 * rigid_at)

        self._lock.release()
开发者ID:EmbodiedCognition,项目名称:cube-experiment,代码行数:50,代码来源:phasespace.py

示例5: testPhase

def testPhase():
	results = []
	
	if centerSensor not in manager.getActiveSensors():
		yield vizproximity.waitEnter(centerSensor)
	sensor = sphereSensors[0]
	info.setText("Walk to the sphere now.")
	startTime = viz.tick()
	yield vizproximity.waitEnter(sensor)
	info.setText('Please return to the center of the room')
	elapsedTime = viz.tick() - startTime
	results.append((sensor.name, elapsedTime))
	info.setText("You're all done now!")
	viztask.returnValue(results)
开发者ID:vhilab,项目名称:VRITS-2015,代码行数:14,代码来源:Challenge+6.py

示例6: record_data

 def record_data(self):
     self.records.append((
         viz.tick() - self.start_tick,
         self.previous_target,
         self.current_target,
         self.suit.get_markers(),
     ))
开发者ID:EmbodiedCognition,项目名称:cube-experiment,代码行数:7,代码来源:main.py

示例7: EnterProximity_end_sensor

def EnterProximity_end_sensor(end_sensor):
	start_node.translate(x_translate1,y_height1,z_depth1)
	right_node1.setPosition(0,100,0)
	right_node2.setPosition(0,100,0)
	right_node3.setPosition(0,100,0)
	sensor_data.write('\nEntered End sensor at:' + str(viz.tick()))
	print('Entered end_sensor')
开发者ID:apiatski,项目名称:Freshman_Research,代码行数:7,代码来源:viz_box_experiment3.py

示例8: getData

def getData():
	elapsed_time = viz.tick() - start_time
	position = viz.MainView.getPosition()
	#Make a string out of the data. 
	data = "Time: " + str(elapsed_time) + '\t' + "Position: " + str(position) + '\n' 
	#Write it to the tracking file.
	game_data.write(data)
开发者ID:vhilab,项目名称:VRITS-2015,代码行数:7,代码来源:D2C3.py

示例9: GameFinish

	def GameFinish (self, delay):
		self.info = vizinfo.add(self.tooltips['congrats'])
		self.info.visible(0)
		self.info.icon(viz.add('textures/c-olive_icon.png'))
		self.info.add(viz.TEXT3D, self.tooltips['finish']+'\n'+self.tooltips['produce'] % self._oil.getMessage())
		self.info.add(viz.TEXT3D, self.tooltips['stats'])
		self.info.translate(0.1,0.95)
		self.info.alignment(vizinfo.UPPER_LEFT)
		self.info.scale(2.4,2.6)
		self.info.messagecolor(100,100,0)
		self.info.bgcolor(viz.BLACK, 0.8)
		self.info.bordercolor([100,100,0], .9)
		points = self.info.add(viz.TEXQUAD, self.tooltips['score']+': %s' % self._total.getMessage())
		points.texture(viz.add('textures/total_icon.png'))
		time = self.info.add(viz.TEXQUAD, self.tooltips['time']+': %s' % self.ConvertTime(viz.tick()))
		time.texture(viz.add('textures/time_icon.png'))
		self.info.shrink()
		#hide all other panels
		self._scorePanel.visible(0)
		self._infoPanel.visible(0)
		self._alertPanel.visible(0)
		for p in self.PLAYERS.values():
			p._infoPanel.visible(0)
			p._alertPanel.visible(0)
			p._hud.visible(0)
		time.addAction(vizact.waittime(delay))
		time.addAction(vizact.call(self.info.visible, 1))
		time.addAction(vizact.waittime(.1))
		time.addAction(vizact.call(self.PlayVictory))
		time.addAction(vizact.call(self.info.expand))
开发者ID:tokola,项目名称:GitHub_OLiVE,代码行数:30,代码来源:Window.py

示例10: testPhase

def testPhase():
    results = []

    for i in range(0, 5):

        # Instruct participant where to go
        instruction = "Walk around for 5 seconds, see where you end up in this world.  You can press 1, 2, or 3".format(
            sensor.name
        )
        info.setText(instruction)

        # store the time at which this trial started
        startTime = viz.tick()

        position = viz.MainView.getPosition()
        before = str(subject) + "\t" + str(position) + "\n"

        # The yielded command returns a viz.Data object with information
        # about the proximity event such as the sensor, target involved
        yield vizproximity.wait(5)

        position = viz.MainView.getPosition()
        after = str(subject) + "\t" + str(position) + "\n"

        # save results
        results.append((before, after))

    info.setText("Thank You. You have completed the experiment")

    # return results
    viztask.returnValue(results)
开发者ID:vhilab,项目名称:VRITS-2015,代码行数:31,代码来源:PitDemo.py

示例11: update_thread

 def update_thread(self):
     while self._running:
         self.update()
         elapsed = viz.tick() - self._updated
         wait = 1. / self.frame_rate - elapsed
         while wait < 0:
             wait += 1. / self.frame_rate
开发者ID:EmbodiedCognition,项目名称:cube-experiment,代码行数:7,代码来源:phasespace.py

示例12: __init__

    def __init__(self,
                 server_name,
                 freq=OWL.OWL_MAX_FREQUENCY,
                 scale=(0.001, 0.001, 0.001),
                 offset=(0, 0, 0),
                 postprocess=False,
                 slave=False):
        super(Phasespace, self).__init__()

        flags = 0
        if postprocess:
            flags |= OWL.OWL_POSTPROCESS
        if slave:
            flags |= OWL.OWL_SLAVE

        if OWL.owlInit(server_name, flags) < 0:
            raise OwlError('phasespace')

        OWL.owlSetFloat(OWL.OWL_FREQUENCY, freq)
        OWL.owlSetInteger(OWL.OWL_STREAMING, OWL.OWL_ENABLE)

        logging.info('running phasespace at %.1f Hz', freq)

        self.scale = scale
        self.offset = offset
        self.trackers = []

        self.frame_rate = freq
        self._updated = viz.tick()
        self._lock = threading.Lock()
        self._thread = None
        self._running = False
开发者ID:EmbodiedCognition,项目名称:cube-experiment,代码行数:32,代码来源:phasespace.py

示例13: runExperimentPathSet

 def runExperimentPathSet(self, pathNum, myTimeline=None):
     global speedMultiplier
     # speedMultipler = 1
     # for ps in self.pathSets:
     print pathNum
     print len(self.pathSets)
     ps = self.pathSets[pathNum]
     if myTimeline != None:
         timeline = myTimeline
     else:
         timeline = self.timelines[pathNum]
     self.peopleset = []
     newPs = PathSet()
     for personPath in ps.peoplePaths:
         p = people.a_person(speedMultiplier)
         p.custom_walk(personPath.getFullPath())
         self.peopleset.append(p)
     tophat = people.a_person(speedMultiplier, 1)
     self.abe = tophat
     tophat.custom_walk(ps.abePath.getFullPath())
     self.peopleset.append(tophat)
     self.starttime = viz.tick()
     self.errlist = []
     self.timelist = []
     # error_timer = vizact.ontimer(0.1/speedMultiplier,self.checkError,tophat,self.errlist)
     error_timer = vizact.onupdate(-10, self.checkError, tophat)
     yield self.runPathSet(self.peopleset, newPs, tophat, 1, timeline)
     vizact.removeEvent(error_timer)
开发者ID:rajeshnarasimha,项目名称:arimmersion,代码行数:28,代码来源:path.py

示例14: update_thread

 def update_thread(self):
     while self._running:
         
         self.update()
         
         #time.sleep(1./1000)
         
         try:
             elapsed = viz.tick() - self._updated
         except:
             tick = viz.tick()
             upd = self._updated
             
         wait = 1. / 1000 - elapsed
         
         if( wait > 0 ):
             time.sleep(wait)
开发者ID:performlabrit,项目名称:IMSG-789,代码行数:17,代码来源:mocapInterface.py

示例15: ExitProximity_end_sensor

def ExitProximity_end_sensor(end_sensor):
	sensor_data.write('\nexited start plane at: ' + str(viz.tick())+'seconds')
	global times_entered_end_plane
	global scale_x1
	global n
	times_entered_end_plane=+1
	array_manipulator(control_array)
	n=n+1
开发者ID:apiatski,项目名称:Freshman_Research,代码行数:8,代码来源:viz_box_experiment3.py


注:本文中的viz.tick函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。