本文整理匯總了Python中pybullet.addUserDebugParameter方法的典型用法代碼示例。如果您正苦於以下問題:Python pybullet.addUserDebugParameter方法的具體用法?Python pybullet.addUserDebugParameter怎麽用?Python pybullet.addUserDebugParameter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pybullet
的用法示例。
在下文中一共展示了pybullet.addUserDebugParameter方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import addUserDebugParameter [as 別名]
def __init__(self, render=False):
self._observation = []
self.action_space = spaces.Discrete(9)
self.observation_space = spaces.Box(np.array([-math.pi, -math.pi, -5]),
np.array([math.pi, math.pi, 5])) # pitch, gyro, com.sp.
if (render):
self.physicsClient = p.connect(p.GUI)
else:
self.physicsClient = p.connect(p.DIRECT) # non-graphical version
p.setAdditionalSearchPath(pybullet_data.getDataPath()) # used by loadURDF
self._seed()
# paramId = p.addUserDebugParameter("My Param", 0, 100, 50)
示例2: main
# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import addUserDebugParameter [as 別名]
def main(joint_control, arm, random_policy):
use_IK = 0 if joint_control else 1
env = iCubReachGymEnv(renders=True, control_arm=arm, use_IK=use_IK, control_orientation=1, obj_pose_rnd_std=0.05)
env.reset()
motorsIds = []
if not random_policy:
if use_IK:
dv = 1
motorsIds.append(p.addUserDebugParameter("lhPosX", -dv, dv, 0.0))
motorsIds.append(p.addUserDebugParameter("lhPosY", -dv, dv, 0.0))
motorsIds.append(p.addUserDebugParameter("lhPosZ", -dv, dv, 0.0))
motorsIds.append(p.addUserDebugParameter("lhRollx", -dv, dv, 0.0))
motorsIds.append(p.addUserDebugParameter("lhPitchy", -dv, dv, 0.0))
motorsIds.append(p.addUserDebugParameter("lhYawz", -dv, dv, 0.0))
else:
dv = 1
joints_idx = env._robot._joints_to_control
for j in joints_idx:
info = p.getJointInfo(env._robot.robot_id, j)
jointName = info[1]
motorsIds.append(p.addUserDebugParameter(jointName.decode("utf-8"), -dv, dv, 0.0))
done = False
for t in range(10000000):
# env.render()
if not random_policy:
action = []
for motorId in motorsIds:
action.append(p.readUserDebugParameter(motorId))
else:
action = env.action_space.sample()
state, reward, done, info = env.step(action)
if t % 100 == 0:
print("reward ", reward)
if done:
print("done ", done)
env.reset()
示例3: main
# 需要導入模塊: import pybullet [as 別名]
# 或者: from pybullet import addUserDebugParameter [as 別名]
def main(cart_control, random_policy):
use_IK = 1 if cart_control else 0
env = pandaPushGymGoalEnv(renders=True, use_IK=use_IK, obj_pose_rnd_std=0.0)
env.reset()
motorsIds = []
if not random_policy:
if use_IK:
dv = 1
motorsIds.append(p.addUserDebugParameter("lhPosX", -dv, dv, 0.0))
motorsIds.append(p.addUserDebugParameter("lhPosY", -dv, dv, 0.0))
motorsIds.append(p.addUserDebugParameter("lhPosZ", -dv, dv, 0.0))
motorsIds.append(p.addUserDebugParameter("lhRollx", -dv, dv, 0.0))
motorsIds.append(p.addUserDebugParameter("lhPitchy", -dv, dv, 0.0))
motorsIds.append(p.addUserDebugParameter("lhYawz", -dv, dv, 0.0))
else:
dv = 1
joint_idxs = tuple(env._robot._joint_name_to_ids.values())
for j in joint_idxs[:env._robot.joint_action_space]:
info = p.getJointInfo(env._robot.robot_id, j)
jointName = info[1]
motorsIds.append(p.addUserDebugParameter(jointName.decode("utf-8"), -dv, dv, 0.0))
done = False
for t in range(10000000):
# env.render()
if not random_policy:
action = []
for motorId in motorsIds:
action.append(p.readUserDebugParameter(motorId))
else:
action = env.action_space.sample()
state, reward, done, info = env.step(action)
if t % 100 == 0:
print("reward ", reward)
if done:
print("done ", done)
env.reset()