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


Python ConsoleApp.start方法代码示例

本文整理汇总了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()
开发者ID:RobotLocomotion,项目名称:director,代码行数:9,代码来源:cameraViewer.py

示例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()
开发者ID:RobotLocomotion,项目名称:director,代码行数:12,代码来源:testCameraView.py

示例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()
开发者ID:david-german-tri,项目名称:director,代码行数:21,代码来源:testAtlasCommand.py

示例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()
开发者ID:caomw,项目名称:director,代码行数:25,代码来源:testImageView.py

示例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"]
#.........这里部分代码省略.........
开发者ID:peteflorence,项目名称:DirectSim,代码行数:103,代码来源:CarSimulator.py

示例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()
开发者ID:caomw,项目名称:director,代码行数:32,代码来源:testAffordanceItems.py

示例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

开发者ID:RobotLocomotion,项目名称:director,代码行数:31,代码来源:testEndEffectorIk.py

示例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()
开发者ID:RobotLocomotion,项目名称:director,代码行数:8,代码来源:testAtlasDriver.py

示例9: debugMain

# 需要导入模块: from director.consoleapp import ConsoleApp [as 别名]
# 或者: from director.consoleapp.ConsoleApp import start [as 别名]
def debugMain():

    listener = DebugAtlasCommandListener()
    ConsoleApp.start()
开发者ID:david-german-tri,项目名称:director,代码行数:6,代码来源:testAtlasCommand.py

示例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
开发者ID:raptor419,项目名称:active-obstacle-avoidance,代码行数:70,代码来源:simulator.py


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