예제 #1
0
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()
예제 #2
0
def startApplication(enableQuitTimer=False):
    appInstance = QtGui.QApplication.instance()
    if enableQuitTimer:
        quitTimer = TimerCallback()
        quitTimer.callback = appInstance.quit
        quitTimer.singleShot(0.1)
    appInstance.exec_()
예제 #3
0
def startApplication(enableQuitTimer=False):
    appInstance = QtGui.QApplication.instance()
    if enableQuitTimer:
        quitTimer = TimerCallback()
        quitTimer.callback = appInstance.quit
        quitTimer.singleShot(0.1)
    appInstance.exec_()
예제 #4
0
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()
예제 #5
0
파일: consoleapp.py 프로젝트: rxdu/director
 def startQuitTimer(timeoutInSeconds):
     quitTimer = TimerCallback()
     quitTimer.callback = ConsoleApp.quit
     quitTimer.singleShot(timeoutInSeconds)
예제 #6
0
print reader

import time

app = ConsoleApp()
view = app.createView()


def spin():
    polyData = vtk.vtkPolyData()
    reader.GetMesh(polyData)
    vis.updatePolyData(polyData, 'mesh')
    print "Number of points (a)", polyData.GetNumberOfPoints()
    if (polyData.GetNumberOfPoints() == 0):
        return

    polyDataPC = vtk.vtkPolyData()
    reader.GetPointCloud(polyDataPC)
    vis.updatePolyData(polyDataPC, 'output')
    print "Number of points (b)", polyDataPC.GetNumberOfPoints()


quitTimer = TimerCallback(targetFps=5.0)
quitTimer.callback = spin
quitTimer.start()

if app.getTestingInteractiveEnabled():
    view.show()
    app.showObjectModel()
    app.start()
예제 #7
0
 def startQuitTimer(timeoutInSeconds):
     quitTimer = TimerCallback()
     quitTimer.callback = ConsoleApp.quit
     quitTimer.singleShot(timeoutInSeconds)
예제 #8
0
  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):
예제 #9
0
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
예제 #10
0


#########################
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()
    global playTime
    playTime = time.time()


#########################
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()
l = QtGui.QHBoxLayout(panel)

playButton = QtGui.QPushButton('Play')
playButton.connect('clicked()', onPlayButton)

slider = QtGui.QSlider(QtCore.Qt.Horizontal)
slider.connect('valueChanged(int)', onSliderChanged)