本文整理汇总了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()
示例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()
示例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()
示例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
示例5: __del__
# 需要导入模块: import pybullet [as 别名]
# 或者: from pybullet import disconnect [as 别名]
def __del__(self):
p.disconnect()
示例6: close
# 需要导入模块: import pybullet [as 别名]
# 或者: from pybullet import disconnect [as 别名]
def close(self):
"""Terminate the simulation"""
p.disconnect()
示例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
示例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)
示例9: __del__
# 需要导入模块: import pybullet [as 别名]
# 或者: from pybullet import disconnect [as 别名]
def __del__(self):
if CONNECTED_TO_SIMULATOR:
p.disconnect()
示例10: close
# 需要导入模块: import pybullet [as 别名]
# 或者: from pybullet import disconnect [as 别名]
def close(self):
'''
Close connection to bullet sim and save collected data.
'''
pb.disconnect()
示例11: _close
# 需要导入模块: import pybullet [as 别名]
# 或者: from pybullet import disconnect [as 别名]
def _close(self):
p.disconnect()
示例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")
示例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()