當前位置: 首頁>>代碼示例>>Python>>正文


Python pybullet.disconnect方法代碼示例

本文整理匯總了Python中pybullet.disconnect方法的典型用法代碼示例。如果您正苦於以下問題:Python pybullet.disconnect方法的具體用法?Python pybullet.disconnect怎麽用?Python pybullet.disconnect使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在pybullet的用法示例。


在下文中一共展示了pybullet.disconnect方法的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_rolling_friction

# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import disconnect [as 別名]
def test_rolling_friction(self):
        import pybullet as p
        p.connect(p.DIRECT)
        p.loadURDF("plane.urdf")
        sphere = p.loadURDF("sphere2.urdf",[0,0,1])
        p.resetBaseVelocity(sphere,linearVelocity=[1,0,0])
        p.changeDynamics(sphere,-1,linearDamping=0,angularDamping=0)
        #p.changeDynamics(sphere,-1,rollingFriction=0)
        p.setGravity(0,0,-10)
        for i in range (1000):
          p.stepSimulation()
        vel = p.getBaseVelocity(sphere)
        self.assertLess(vel[0][0],1e-10)
        self.assertLess(vel[0][1],1e-10)
        self.assertLess(vel[0][2],1e-10)
        self.assertLess(vel[1][0],1e-10)
        self.assertLess(vel[1][1],1e-10)
        self.assertLess(vel[1][2],1e-10)
        p.disconnect() 
開發者ID:utra-robosoccer,項目名稱:soccer-matlab,代碼行數:21,代碼來源:unittests.py

示例2: test_connect_direct

# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import disconnect [as 別名]
def test_connect_direct(self):
        import pybullet as p
        cid = p.connect(p.DIRECT)
        self.assertEqual(cid,0)
        p.disconnect() 
開發者ID:utra-robosoccer,項目名稱:soccer-matlab,代碼行數:7,代碼來源:unittests.py

示例3: test_loadurdf

# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import disconnect [as 別名]
def test_loadurdf(self):
        import pybullet as p
        p.connect(p.DIRECT)
        ob = p.loadURDF("r2d2.urdf")
        self.assertEqual(ob,0)
        p.disconnect() 
開發者ID:utra-robosoccer,項目名稱:soccer-matlab,代碼行數:8,代碼來源:unittests.py

示例4: __del__

# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import disconnect [as 別名]
def __del__(self):
    """Clean up connection if not already done."""
    try:
      pybullet.disconnect(physicsClientId=self._client)
    except pybullet.error:
      pass 
開發者ID:utra-robosoccer,項目名稱:soccer-matlab,代碼行數:8,代碼來源:bullet_client.py

示例5: __del__

# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import disconnect [as 別名]
def __del__(self):
    p.disconnect() 
開發者ID:utra-robosoccer,項目名稱:soccer-matlab,代碼行數:4,代碼來源:kukaCamGymEnv.py

示例6: close

# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import disconnect [as 別名]
def close(self):
        """Terminate the simulation"""
        p.disconnect() 
開發者ID:StanfordVL,項目名稱:NTP-vat-release,代碼行數:5,代碼來源:bullet_world.py

示例7: __del__

# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import disconnect [as 別名]
def __del__(self):
        """Clean up connection if not already done."""
        try:
            pybullet.disconnect(physicsClientId=self._client)
        except pybullet.error:
            pass 
開發者ID:facebookresearch,項目名稱:pyrobot,代碼行數:8,代碼來源:bullet_client.py

示例8: render

# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import disconnect [as 別名]
def render(self, mode='human'):
        if not self.gui:
            self.gui = True
            p.disconnect(self.id)
            self.id = p.connect(p.GUI, options='--background_color_red=0.8 --background_color_green=0.9 --background_color_blue=1.0 --width=%d --height=%d' % (self.width, self.height))

            self.world_creation = WorldCreation(self.id, robot_type=self.robot_type, task=self.task, time_step=self.time_step, np_random=self.np_random, config=self.config)
            self.util = Util(self.id, self.np_random)
            # print('Physics server ID:', self.id) 
開發者ID:Healthcare-Robotics,項目名稱:assistive-gym,代碼行數:11,代碼來源:env.py

示例9: __del__

# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import disconnect [as 別名]
def __del__(self):
        if CONNECTED_TO_SIMULATOR:
            p.disconnect() 
開發者ID:araffin,項目名稱:robotics-rl-srl,代碼行數:5,代碼來源:kuka_button_gym_env.py

示例10: close

# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import disconnect [as 別名]
def close(self):
        '''
        Close connection to bullet sim and save collected data.
        '''
        pb.disconnect() 
開發者ID:jhu-lcsr,項目名稱:costar_plan,代碼行數:7,代碼來源:client.py

示例11: _close

# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import disconnect [as 別名]
def _close(self):
        p.disconnect() 
開發者ID:gkahn13,項目名稱:GtS,代碼行數:4,代碼來源:env_bases.py

示例12: stopSimulation

# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import disconnect [as 別名]
def stopSimulation(self, physics_client):
        """
        Stops the simulated instance corresponding to the physics_client id

        Parameters:
            physics_client - The id of the simulated instance to be stopped
        """
        self._clearInstance(physics_client)

        try:
            pybullet.disconnect(physicsClientId=physics_client)

        except pybullet.error:
            print("Instance " + str(physics_client) + " already stopped") 
開發者ID:softbankrobotics-research,項目名稱:qibullet,代碼行數:16,代碼來源:simulation_manager.py

示例13: testJacobian

# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import disconnect [as 別名]
def testJacobian(self):
        import pybullet as p

        clid = p.connect(p.SHARED_MEMORY)
        if (clid<0):
            p.connect(p.DIRECT)

        time_step = 0.001
        gravity_constant = -9.81

        urdfs = ["TwoJointRobot_w_fixedJoints.urdf",
                 "TwoJointRobot_w_fixedJoints.urdf",
                 "kuka_iiwa/model.urdf",
                 "kuka_lwr/kuka.urdf"]
        for urdf in urdfs:
            p.resetSimulation()
            p.setTimeStep(time_step)
            p.setGravity(0.0, 0.0, gravity_constant)

            robotId = p.loadURDF(urdf, useFixedBase=True)
            p.resetBasePositionAndOrientation(robotId,[0,0,0],[0,0,0,1])
            numJoints = p.getNumJoints(robotId)
            endEffectorIndex = numJoints - 1

            # Set a joint target for the position control and step the sim.
            self.setJointPosition(robotId, [0.1 * (i % 3)
                                            for i in range(numJoints)])
            p.stepSimulation()

            # Get the joint and link state directly from Bullet.
            mpos, mvel, mtorq = self.getMotorJointStates(robotId)

            result = p.getLinkState(robotId, endEffectorIndex,
                    computeLinkVelocity=1, computeForwardKinematics=1)
            link_trn, link_rot, com_trn, com_rot, frame_pos, frame_rot, link_vt, link_vr = result
            # Get the Jacobians for the CoM of the end-effector link.
            # Note that in this example com_rot = identity, and we would need to use com_rot.T * com_trn.
            # The localPosition is always defined in terms of the link frame coordinates.

            zero_vec = [0.0] * len(mpos)
            jac_t, jac_r = p.calculateJacobian(robotId, endEffectorIndex,
                    com_trn, mpos, zero_vec, zero_vec)

            assert(allclose(dot(jac_t, mvel), link_vt))
            assert(allclose(dot(jac_r, mvel), link_vr))
        p.disconnect() 
開發者ID:utra-robosoccer,項目名稱:soccer-matlab,代碼行數:48,代碼來源:unittests.py


注:本文中的pybullet.disconnect方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。