当前位置: 首页>>代码示例>>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;未经允许,请勿转载。