本文整理汇总了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()