Пример #1
0
    def __init__(self):

        self.app = ConsoleApp()
        self.view = self.app.createView()
        self.robotSystem = robotsystem.create(self.view)

        self.config = drcargs.getDirectorConfig()
        jointGroups = self.config['teleopJointGroups']
        self.jointTeleopPanel = JointTeleopPanel(self.robotSystem, jointGroups)
        self.jointCommandPanel = JointCommandPanel(self.robotSystem)

        self.jointCommandPanel.ui.speedSpinBox.setEnabled(False)

        self.jointCommandPanel.ui.mirrorArmsCheck.setChecked(self.jointTeleopPanel.mirrorArms)
        self.jointCommandPanel.ui.mirrorLegsCheck.setChecked(self.jointTeleopPanel.mirrorLegs)
        self.jointCommandPanel.ui.resetButton.connect('clicked()', self.resetJointTeleopSliders)
        self.jointCommandPanel.ui.mirrorArmsCheck.connect('clicked()', self.mirrorJointsChanged)
        self.jointCommandPanel.ui.mirrorLegsCheck.connect('clicked()', self.mirrorJointsChanged)

        self.widget = QtGui.QWidget()

        gl = QtGui.QGridLayout(self.widget)
        gl.addWidget(self.app.showObjectModel(), 0, 0, 4, 1) # row, col, rowspan, colspan
        gl.addWidget(self.view, 0, 1, 1, 1)
        gl.addWidget(self.jointCommandPanel.widget, 1, 1, 1, 1)
        gl.addWidget(self.jointTeleopPanel.widget, 0, 2, -1, 1)
        gl.setRowStretch(0,1)
        gl.setColumnStretch(1,1)

        #self.sub = lcmUtils.addSubscriber('COMMITTED_ROBOT_PLAN', lcmdrc.robot_plan_t, self.onRobotPlan)
        lcmUtils.addSubscriber('STEERING_COMMAND_POSITION_GOAL', lcmdrc.joint_position_goal_t, self.onSingleJointPositionGoal)
        lcmUtils.addSubscriber('THROTTLE_COMMAND_POSITION_GOAL', lcmdrc.joint_position_goal_t, self.onSingleJointPositionGoal)
Пример #2
0
    def __init__(self):

        self.app = ConsoleApp()
        self.view = self.app.createView()
        self.robotSystem = robotsystem.create(self.view)

        self.config = drcargs.getDirectorConfig()
        jointGroups = self.config['teleopJointGroups']
        self.jointTeleopPanel = JointTeleopPanel(self.robotSystem, jointGroups)
        self.jointCommandPanel = JointCommandPanel(self.robotSystem)

        self.jointCommandPanel.ui.speedSpinBox.setEnabled(False)

        self.jointCommandPanel.ui.mirrorArmsCheck.setChecked(self.jointTeleopPanel.mirrorArms)
        self.jointCommandPanel.ui.mirrorLegsCheck.setChecked(self.jointTeleopPanel.mirrorLegs)
        self.jointCommandPanel.ui.resetButton.connect('clicked()', self.resetJointTeleopSliders)
        self.jointCommandPanel.ui.mirrorArmsCheck.connect('clicked()', self.mirrorJointsChanged)
        self.jointCommandPanel.ui.mirrorLegsCheck.connect('clicked()', self.mirrorJointsChanged)

        self.widget = QtGui.QWidget()

        gl = QtGui.QGridLayout(self.widget)
        gl.addWidget(self.app.showObjectModel(), 0, 0, 4, 1) # row, col, rowspan, colspan
        gl.addWidget(self.view, 0, 1, 1, 1)
        gl.addWidget(self.jointCommandPanel.widget, 1, 1, 1, 1)
        gl.addWidget(self.jointTeleopPanel.widget, 0, 2, -1, 1)
        gl.setRowStretch(0,1)
        gl.setColumnStretch(1,1)

        #self.sub = lcmUtils.addSubscriber('COMMITTED_ROBOT_PLAN', lcmdrc.robot_plan_t, self.onRobotPlan)
        lcmUtils.addSubscriber('STEERING_COMMAND_POSITION_GOAL', lcmdrc.joint_position_goal_t, self.onSingleJointPositionGoal)
        lcmUtils.addSubscriber('THROTTLE_COMMAND_POSITION_GOAL', lcmdrc.joint_position_goal_t, self.onSingleJointPositionGoal)
Пример #3
0

def testPlanConstraints():

    # this is required for now, makes it avoid communication with matlab
    # inside the call to ikPlanner.addPose
    ikPlanner.pushToMatlab = False

    constraints = buildConstraints()
    poses = ce.getPlanPoses(constraints, ikPlanner)

    poseJsonStr = json.dumps(poses, indent=4)
    constraintsJsonStr = ce.encodeConstraints(constraints, indent=4)

    print poseJsonStr
    print constraintsJsonStr

    constraints = ce.decodeConstraints(constraintsJsonStr)
    pprint.pprint(constraints)


app = ConsoleApp()
app.setupGlobals(globals())

view = app.createView()
robotsystem.create(view, globals())

testPlanConstraints()

#app.start()
Пример #4
0
from director import robotsystem
from director import robotposegui
from director.consoleapp import ConsoleApp
from director import ikplanner
from director import playbackpanel

app = ConsoleApp()

app.setupGlobals(globals())

view = app.createView()

robotSystem = robotsystem.create(view)

testPlanning = True
if testPlanning:

    robotSystem.startIkServer()  # launches matlab server

    playbackPanel = playbackpanel.PlaybackPanel(
        robotSystem.planPlayback, robotSystem.playbackRobotModel,
        robotSystem.playbackJointController, robotSystem.robotStateModel,
        robotSystem.robotStateJointController, robotSystem.manipPlanner)

    robotSystem.ikPlanner.addPostureGoalListener(
        robotSystem.robotStateJointController)
    robotSystem.manipPlanner.connectPlanReceived(playbackPanel.setPlan)
    playbackPanel.widget.show()

jc = robotSystem.robotStateJointController
pose = robotSystem.ikPlanner.getMergedPostureFromDatabase(
Пример #5
0
from director.uuidutil import newUUID
from director import geometryencoder
from director import sceneloader
import drc as lcmdrc
import os
import json
from director.utime import getUtime
app = ConsoleApp()

app.setupGlobals(globals())
app.showPythonConsole()

view = app.createView()
view.show()

robotsystem.create(view, globals())


def affordanceFromDescription(desc):
    affordanceManager.collection.updateDescription(desc)
    return affordanceManager.getAffordanceById(desc['uuid'])

def newBox():
    desc = dict(classname='BoxAffordanceItem', Name='test box', Dimensions=[0.5, 0.2, 0.1], uuid=newUUID(), pose=((0.5,0.0,1.0), (1,0,0,0)))
    return affordanceFromDescription(desc)

def newSphere():
    desc = dict(classname='SphereAffordanceItem', Name='test sphere', Radius=0.2, uuid=newUUID(), pose=((0.5,0.0,1.0), (1,0,0,0)))
    return affordanceFromDescription(desc)

def newCylinder():
Пример #6
0
    toolBar = applogic.findToolBar('Main Toolbar')
    app.app.addToolBarAction(toolBar,
                             'Gripper Open',
                             icon='',
                             callback=gripperOpen)
    app.app.addToolBarAction(toolBar,
                             'Gripper Close',
                             icon='',
                             callback=gripperClose)


# create a default mainwindow app
app = mainwindowapp.construct(globalsDict=globals())

# load a minimal robot system with ik planning
robotSystem = robotsystem.create(app.view, planningOnly=True)

# add the teleop and playback panels to the mainwindow
app.app.addWidgetToDock(robotSystem.teleopPanel.widget,
                        QtCore.Qt.RightDockWidgetArea)
app.app.addWidgetToDock(robotSystem.playbackPanel.widget,
                        QtCore.Qt.BottomDockWidgetArea)

setupToolbar()

# show sim time in the status bar
infoLabel = KukaSimInfoLabel(app.mainWindow.statusBar())

# use pydrake ik backend
ikPlanner = robotSystem.ikPlanner
if ikPlanner.planningMode == 'pydrake':
Пример #7
0
actionhandlers.init()

quit = app.quit
exit = quit
view = app.getDRCView()
camera = view.camera()
tree = app.getMainWindow().objectTree()
orbit = cameracontrol.OrbitController(view)
showPolyData = segmentation.showPolyData
updatePolyData = segmentation.updatePolyData


###############################################################################


robotSystem = robotsystem.create(view)
globals().update(dict(robotSystem))


useIk = True
useRobotState = True
usePerception = True
useGrid = True
useSpreadsheet = True
useFootsteps = True
useHands = True
usePlanning = True
useHumanoidDRCDemos = True
useAtlasDriver = True
useLCMGL = True
useOctomap = True
Пример #8
0
            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

Пример #9
0
selector = RobotSelector()
# To hide the selector if there is only one robot we actually need to hide the action that is created by the
# toolbar's addwidget
selectorAction = app.getMainWindow().toolBar().addWidget(selector)

# If this is a single robot configuration, we expect modelName as a top level key. Otherwise it will be a second
# level one.
robotSystems = []
for (
        _,
        robotConfig,
) in drcargs.DirectorConfig.getDefaultInstance().robotConfigs.iteritems():
    print("Loading config for robot with name {}".format(
        robotConfig["robotName"]))
    robotSystems.append(
        robotsystem.create(view, robotName=robotConfig["robotName"]))

# If there is only one robot, the selector should not be shown
if len(robotSystems) == 1:
    selectorAction.setVisible(False)
    # When there is only one robot we do not want to prefix topics
    robotSystems[0]._add_fields(rosPrefix="", single=True)
else:
    for robotSystem in robotSystems:
        # With multiple robots, prefix the topics with the robot names
        robotSystem._add_fields(rosPrefix=robotSystem.robotName, single=False)

# Before going through all the robot systems, we do some setup which is universal and not linked to any specific robot
useLightColorScheme = True

sceneRoot = om.getOrCreateContainer("scene")