예제 #1
0
    def __init__(self, objname, markerid=5):
        self.markerid = markerid
        self.objname = objname
        self.gdb = db.GraspDB(database="wrs",
                              user="******",
                              password="******")
        self.robot = ur3dualsim.Ur3DualRobot()
        self.rgthnd = rtq85nm.newHand(hndid="rgt")
        self.lfthnd = rtq85nm.newHand(hndid="lft")
        self.robotmesh = ur3dualsimmesh.Ur3DualMesh(rgthand=self.rgthnd,
                                                    lfthand=self.lfthnd)
        self.robotball = ur3dualsimball.Ur3DualBall()
        self.robotik = ur3dualik
        self.env = bunrisettingfree.Env()
        self.env.reparentTo(base.render)
        self.objcm = self.env.loadobj(objname)
        self.obstaclecmlist = self.env.getstationaryobslist()
        for obstaclecdcm in self.obstaclecmlist:
            obstaclecdcm.showcn()

        self.robot.goinitpose()

        self.rgtwatchpos = [400.0, -200.0, 1200.0]
        self.rgtwatchrotmat = [[0.09141122, -0.76823672, 0.63360582],
                               [-0.99509199, -0.04625775, 0.08747659],
                               [-0.03789355, -0.63849242, -0.76869468]]
        self.rgtwatchjs = self.robot.numik(self.rgtwatchpos,
                                           self.rgtwatchrotmat, "rgt")

        self.robot.movearmfk(self.rgtwatchjs, armname="rgt")
        self.rbtmnp = self.robotmesh.genmnp(self.robot,
                                            self.rgthnd.jawwidthopen,
                                            self.lfthnd.jawwidthopen)
        self.rbtmnp.reparentTo(base.render)

        # uncomment the following commands to actuate the robot
        # self.ur3u = ur3urx.Ur3DualUrx()
        # self.ur3u.movejntssgl(self.robot.initjnts[3:9], 'rgt')
        # self.ur3u.movejntssgl(self.robot.initjnts[9:15], 'lft')
        # self.ur3u.movejntssgl(self.rgtwatchjs, 'rgt')

        self.hc = cameras.HndCam(rgtcamid=0, lftcamid=1)

        # goallist, a list of 4x4 h**o numpy mat
        self.goallist = []
        self.objrenderlist = []
        self.startobjcm = None

        self.rbtmnpani = [None, None]
        self.objmnpani = [None]
예제 #2
0
env.reparentTo(base.render)
obscmlist = env.getstationaryobslist()
# for obscm in obscmlist:
#     obscm.showcn()

# load obj collision model using env
objcm = env.loadobj("bunnysim.stl")

# another example -- load obj collision model independently
# this_dir, this_filename = os.path.split(__file__)
# objname = "tool_motordriver.stl"
# objpath = os.path.join(this_dir, "objects", objname)
# objcm = cm.CollisionModel(objpath)

robot = ur3dual.Ur3DualRobot()
robotball = ur3dualball.Ur3DualBall()
rgthnd = rtq85.Rtq85(jawwidth=85)
lfthnd = rtq85.Rtq85(jawwidth=85)
robotmesh = ur3dualmesh.Ur3DualMesh(rgthand=rgthnd, lfthand=lfthnd)
robotnp = robotmesh.genmnp(robot, jawwidthrgt=85.0, jawwidthlft=0.0)
# robotnp.reparentTo(base.render)
armname = 'rgt'
cdchecker = cdck.CollisionCheckerBall(robotball)
ctcallback = ctcb.CtCallback(base, robot, cdchecker, armname=armname)
smoother = sm.Smoother()

robot.goinitpose()
# robotnp = robotmesh.genmnp(robot, jawwidthrgt = 85.0, jawwidthlft=0.0)
# robotnp.reparentTo(base.render)
# base.run()