本文整理汇总了Python中ddapp.timercallback.TimerCallback.callback方法的典型用法代码示例。如果您正苦于以下问题:Python TimerCallback.callback方法的具体用法?Python TimerCallback.callback怎么用?Python TimerCallback.callback使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ddapp.timercallback.TimerCallback
的用法示例。
在下文中一共展示了TimerCallback.callback方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: startApplication
# 需要导入模块: from ddapp.timercallback import TimerCallback [as 别名]
# 或者: from ddapp.timercallback.TimerCallback import callback [as 别名]
def startApplication(enableQuitTimer=False):
appInstance = QtGui.QApplication.instance()
if enableQuitTimer:
quitTimer = TimerCallback()
quitTimer.callback = appInstance.quit
quitTimer.singleShot(0.1)
appInstance.exec_()
示例2: showHandCloud
# 需要导入模块: from ddapp.timercallback import TimerCallback [as 别名]
# 或者: from ddapp.timercallback.TimerCallback import callback [as 别名]
def showHandCloud(hand='left', view=None):
view = view or app.getCurrentRenderView()
if view is None:
return
assert hand in ('left', 'right')
maps = om.findObjectByName('Map Server')
assert maps is not None
viewId = 52 if hand == 'left' else 53
reader = maps.source.reader
def getCurrentViewId():
return reader.GetCurrentMapId(viewId)
p = vtk.vtkPolyData()
obj = showPolyData(p, '%s hand cloud' % hand, view=view, parent='sensors')
obj.currentViewId = -1
def updateCloud():
currentViewId = getCurrentViewId()
#print 'updateCloud: current view id:', currentViewId
if currentViewId != obj.currentViewId:
reader.GetDataForMapId(viewId, currentViewId, p)
#print 'updated poly data. %d points.' % p.GetNumberOfPoints()
obj._renderAllViews()
t = TimerCallback()
t.targetFps = 1
t.callback = updateCloud
t.start()
obj.updater = t
return obj
示例3: main
# 需要导入模块: from ddapp.timercallback import TimerCallback [as 别名]
# 或者: from ddapp.timercallback.TimerCallback import callback [as 别名]
def main():
app = consoleapp.ConsoleApp()
meshCollection = lcmobjectcollection.LCMObjectCollection('MESH_COLLECTION_COMMAND')
affordanceCollection = lcmobjectcollection.LCMObjectCollection('AFFORDANCE_COLLECTION_COMMAND')
meshCollection.sendEchoRequest()
affordanceCollection.sendEchoRequest()
def printCollection():
print
print '----------------------------------------------------'
print datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
print '%d affordances' % len(affordanceCollection.collection)
for desc in affordanceCollection.collection.values():
print
print 'name:', desc['Name']
print 'type:', desc['classname']
timer = TimerCallback(targetFps=0.2)
timer.callback = printCollection
timer.start()
#app.showPythonConsole()
app.start()
示例4: startSwarmVisualization
# 需要导入模块: from ddapp.timercallback import TimerCallback [as 别名]
# 或者: from ddapp.timercallback.TimerCallback import callback [as 别名]
def startSwarmVisualization():
global timerCallback, nav_data, nav_cloud
nav_cloud = vtknp.getVtkPolyDataFromNumpyPoints(nav_data)
nav_cloud_obj = vis.showPolyData(shallowCopy(nav_cloud), 'nav data')
nav_cloud_obj.initialized = False
def updateSwarm():
global nav_cloud
if not nav_cloud_obj.initialized:
nav_cloud_obj.mapper.SetColorModeToMapScalars()
nav_cloud_obj.initialized = True
#print nav_data.shape[0], nav_cloud.GetNumberOfPoints()
nav_cloud = vtknp.getVtkPolyDataFromNumpyPoints(nav_data)
nav_cloud_obj.setPolyData(shallowCopy(nav_cloud))
#print nav_cloud_obj.polyData.GetNumberOfPoints()
timerCallback = TimerCallback(targetFps=30)
timerCallback.callback = updateSwarm
timerCallback.start()
示例5: startQuitTimer
# 需要导入模块: from ddapp.timercallback import TimerCallback [as 别名]
# 或者: from ddapp.timercallback.TimerCallback import callback [as 别名]
def startQuitTimer(timeoutInSeconds):
quitTimer = TimerCallback()
quitTimer.callback = ConsoleApp.quit
quitTimer.singleShot(timeoutInSeconds)
示例6: TimerCallback
# 需要导入模块: from ddapp.timercallback import TimerCallback [as 别名]
# 或者: from ddapp.timercallback.TimerCallback import callback [as 别名]
#########################
numRays = 20
rayLength = 5
angleMin = -np.pi/2
angleMax = np.pi/2
angleGrid = np.linspace(angleMin, angleMax, numRays)
rays = np.zeros((3,numRays))
rays[0,:] = np.cos(angleGrid)
rays[1,:] = np.sin(angleGrid)
timer = TimerCallback(targetFps=30)
timer.callback = tick
playTimer = TimerCallback(targetFps=30)
playTimer.callback = tick3
app = ConsoleApp()
view = app.createView()
panel = QtGui.QWidget()
示例7: spawnBasicLabel
# 需要导入模块: from ddapp.timercallback import TimerCallback [as 别名]
# 或者: from ddapp.timercallback.TimerCallback import callback [as 别名]
ql.setMinimum(min)
ql.setOrientation(QtCore.Qt.Vertical)
return ql
statusLabel = spawnBasicLabel()
l.addWidget(wrapInVTitledItem("Behavior", [statusLabel]))
def statusUpdate():
behavior = atlasDriver.getCurrentBehaviorName()
statusLabel.setText(behavior)
if (behavior != "user"):
statusLabel.setStyleSheet(LABEL_DEFAULT_STYLE_SHEET + "background-color:red; color:white")
else:
statusLabel.setStyleSheet(LABEL_DEFAULT_STYLE_SHEET + "background-color:white; color:black")
statusTimer = TimerCallback(targetFps=FPS)
statusTimer.callback = statusUpdate
statusTimer.start()
controllerLabel = spawnBasicLabel()
l.addWidget(wrapInVTitledItem("Controller", [controllerLabel]))
def controllerUpdate():
status = atlasDriver.getControllerStatus()
if not status:
status = "Unknown"
if len(status) > 6:
status = status[0:6]
rate = atlasDriver.getControllerRate()
if not rate:
rate = 0.0
controllerLabel.setText("%s\n%06.1fhz" % (status, rate))
if (rate < 500):