本文整理汇总了Python中director.consoleapp.ConsoleApp.start方法的典型用法代码示例。如果您正苦于以下问题:Python ConsoleApp.start方法的具体用法?Python ConsoleApp.start怎么用?Python ConsoleApp.start使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类director.consoleapp.ConsoleApp
的用法示例。
在下文中一共展示了ConsoleApp.start方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
# 需要导入模块: from director.consoleapp import ConsoleApp [as 别名]
# 或者: from director.consoleapp.ConsoleApp import start [as 别名]
def main():
app = ConsoleApp()
camVis = CameraVisualizer()
camVis.createUI()
camVis.showUI()
app.start()
示例2: main
# 需要导入模块: from director.consoleapp import ConsoleApp [as 别名]
# 或者: from director.consoleapp.ConsoleApp import start [as 别名]
def main():
app = ConsoleApp()
view = app.createView(useGrid=False)
imageManager = cameraview.ImageManager()
cameraView = cameraview.CameraView(imageManager, view)
view.show()
app.start()
示例3: robotMain
# 需要导入模块: from director.consoleapp import ConsoleApp [as 别名]
# 或者: from director.consoleapp.ConsoleApp import start [as 别名]
def robotMain(useDrivingGains=False, useController=False):
print 'waiting for robot state...'
commandStream.waitForRobotState()
print 'starting.'
commandStream.timer.targetFps = 1000
if useController==True:
commandStream.useController()
else:
commandStream.publishChannel = 'ROBOT_COMMAND'
if useDrivingGains:
commandStream.applyDrivingDefaults()
commandStream.startStreaming()
positionListener = PositionGoalListener()
planListener = CommittedRobotPlanListener()
ConsoleApp.start()
示例4: main
# 需要导入模块: from director.consoleapp import ConsoleApp [as 别名]
# 或者: from director.consoleapp.ConsoleApp import start [as 别名]
def main():
app = ConsoleApp()
view = app.createView(useGrid=False)
view.orientationMarkerWidget().Off()
view.backgroundRenderer().SetBackground([0,0,0])
view.backgroundRenderer().SetBackground2([0,0,0])
cameraChannel = parseChannelArgument()
imageManager = cameraview.ImageManager()
imageManager.queue.addCameraStream(cameraChannel)
imageManager.addImage(cameraChannel)
cameraView = cameraview.CameraImageView(imageManager, cameraChannel, view=view)
cameraView.eventFilterEnabled = False
view.renderWindow().GetInteractor().SetInteractorStyle(vtk.vtkInteractorStyleImage())
view.show()
app.start()
示例5: Simulator
# 需要导入模块: from director.consoleapp import ConsoleApp [as 别名]
# 或者: from director.consoleapp.ConsoleApp import start [as 别名]
class Simulator(object):
def __init__(
self,
percentObsDensity=20,
endTime=40,
nonRandomWorld=False,
circleRadius=0.7,
worldScale=1.0,
autoInitialize=True,
verbose=True,
):
self.verbose = verbose
self.startSimTime = time.time()
self.collisionThreshold = 0.4
self.randomSeed = 5
self.Sensor_rayLength = 8
self.percentObsDensity = percentObsDensity
self.defaultControllerTime = 1000
self.nonRandomWorld = nonRandomWorld
self.circleRadius = circleRadius
self.worldScale = worldScale
# create the visualizer object
self.app = ConsoleApp()
self.view = self.app.createView(useGrid=False)
self.initializeOptions()
self.initializeColorMap()
if autoInitialize:
self.initialize()
self.XVelocity_drawing = 0.0
self.YVelocity_drawing = 0.0
def initializeOptions(self):
self.options = dict()
self.options["World"] = dict()
self.options["World"]["obstaclesInnerFraction"] = 0.98
self.options["World"]["randomSeed"] = 40
self.options["World"]["percentObsDensity"] = 0.0
self.options["World"]["nonRandomWorld"] = True
self.options["World"]["circleRadius"] = 1.0
self.options["World"]["scale"] = 1
self.options["Sensor"] = dict()
self.options["Sensor"]["rayLength"] = 10
self.options["Sensor"]["numRays"] = 50
self.options["Car"] = dict()
self.options["Car"]["velocity"] = 4.0
self.options["dt"] = 0.05
self.options["runTime"] = dict()
self.options["runTime"]["defaultControllerTime"] = 100
def setDefaultOptions(self):
defaultOptions = dict()
defaultOptions["World"] = dict()
defaultOptions["World"]["obstaclesInnerFraction"] = 0.98
defaultOptions["World"]["randomSeed"] = 40
defaultOptions["World"]["percentObsDensity"] = 30
defaultOptions["World"]["nonRandomWorld"] = True
defaultOptions["World"]["circleRadius"] = 1.75
defaultOptions["World"]["scale"] = 2.5
defaultOptions["Sensor"] = dict()
defaultOptions["Sensor"]["rayLength"] = 10
defaultOptions["Sensor"]["numRays"] = 51
defaultOptions["Car"] = dict()
defaultOptions["Car"]["velocity"] = 20
defaultOptions["dt"] = 0.05
defaultOptions["runTime"] = dict()
defaultOptions["runTime"]["defaultControllerTime"] = 100
for k in defaultOptions:
self.options.setdefault(k, defaultOptions[k])
for k in defaultOptions:
if not isinstance(defaultOptions[k], dict):
continue
for j in defaultOptions[k]:
self.options[k].setdefault(j, defaultOptions[k][j])
def initializeColorMap(self):
self.colorMap = dict()
self.colorMap["default"] = [0, 1, 0]
def initialize(self):
self.dt = self.options["dt"]
#.........这里部分代码省略.........
示例6: testSDF
# 需要导入模块: from director.consoleapp import ConsoleApp [as 别名]
# 或者: from director.consoleapp.ConsoleApp import start [as 别名]
for aff in affs:
om.removeFromObjectModel(aff)
def testSDF():
print "Testind SDF loader"
n_pre=len(affordanceManager.getAffordances())
dataDir = app.getTestingDataDirectory()
filename=os.environ['DRC_BASE'] + '/software/models/worlds/tabledemo.sdf'
sc=sceneloader.SceneLoader()
print "Loading "+filename
sc.loadSDF(filename)
n_post=len(affordanceManager.getAffordances())
print "Number of affordances loaded: "+str(n_post-n_pre)
assert n_post>n_pre
testCollection()
testAffordanceToUrdf()
loadTableTopPointCloud()
segmentTableTopPointCloud()
testSDF()
from director import affordancepanel
panel = affordancepanel.AffordancePanel(view, affordanceManager, ikServer, robotStateJointController, raycastDriver)
panel.widget.show()
app.start()
示例7: ConsoleApp
# 需要导入模块: from director.consoleapp import ConsoleApp [as 别名]
# 或者: from director.consoleapp.ConsoleApp import start [as 别名]
view.forceRender()
print '%d samples/sec' % (sampleCount / elapsed), '%d total samples' % totalSampleCount
startTime = timeNow
sampleCount = 0
if app.getTestingEnabled():
assert badSampleCount == 0
app.quit()
app = ConsoleApp()
app.setupGlobals(globals())
view = app.createView()
view.show()
robotSystem = robotsystem.create(view, planningOnly=True)
view.resetCamera()
if robotSystem.ikPlanner.planningMode == 'pydrake':
robotSystem.ikPlanner.plannerPub._setupLocalServer()
runTest()
elif robotSystem.ikPlanner.planningMode == 'matlabdrake':
robotSystem.ikServer.connectStartupCompleted(onMatlabStartup)
robotSystem.startIkServer()
app.start(enableAutomaticQuit=False)
# after the app starts, runTest() will be called by onMatlabStartup
示例8: main
# 需要导入模块: from director.consoleapp import ConsoleApp [as 别名]
# 或者: from director.consoleapp.ConsoleApp import start [as 别名]
def main():
atlasdriver.init()
panel = atlasdriverpanel.AtlasDriverPanel(atlasdriver.driver)
panel.widget.show()
ConsoleApp.start()
示例9: debugMain
# 需要导入模块: from director.consoleapp import ConsoleApp [as 别名]
# 或者: from director.consoleapp.ConsoleApp import start [as 别名]
def debugMain():
listener = DebugAtlasCommandListener()
ConsoleApp.start()
示例10: Simulator
# 需要导入模块: from director.consoleapp import ConsoleApp [as 别名]
# 或者: from director.consoleapp.ConsoleApp import start [as 别名]
#.........这里部分代码省略.........
colorByName="RGB255")
def update_locator(self):
"""Updates cell locator."""
d = DebugData()
d.addPolyData(self._world.to_polydata())
for obstacle, frame in self._obstacles:
d.addPolyData(obstacle.to_positioned_polydata())
self.locator = vtk.vtkCellLocator()
self.locator.SetDataSet(d.getPolyData())
self.locator.BuildLocator()
def run(self, display):
"""Launches and displays the simulator.
Args:
display: Displays the simulator or not.
"""
if display:
widget = QtGui.QWidget()
layout = QtGui.QVBoxLayout(widget)
layout.addWidget(self._view)
widget.showMaximized()
# Set camera.
applogic.resetCamera(viewDirection=[0.2, 0, -1])
# Set timer.
self._tick_count = 0
self._timer = TimerCallback(targetFps=120)
self._timer.callback = self.tick
self._timer.start()
self._app.start()
def tick(self):
"""Update simulation clock."""
self._tick_count += 1
self._run_ticks += 1
if self._tick_count >= 500:
print("timeout")
for robot, frame in self._robots:
self.reset(robot, frame)
need_update = False
for obstacle, frame in self._obstacles:
if obstacle.velocity != 0.:
obstacle.move()
self._update_moving_object(obstacle, frame)
need_update = True
if need_update:
self.update_locator()
for i, (robot, frame) in enumerate(self._robots):
self._update_moving_object(robot, frame)
for sensor in robot.sensors:
sensor.set_locator(self.locator)
robot.move()
for sensor in robot.sensors:
frame_name = "rays{}".format(i)
self._update_sensor(sensor, frame_name)
if sensor.has_collided():
self._num_crashes += 1