Python pybullet.addUserDebugParameter() Examples
The following are 3
code examples of pybullet.addUserDebugParameter().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
pybullet
, or try the search function
.
Example #1
Source File: balancebot_env.py From balance-bot with MIT License | 6 votes |
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)
Example #2
Source File: test_icub_push_gym_env.py From pybullet-robot-envs with GNU Lesser General Public License v2.1 | 4 votes |
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()
Example #3
Source File: test_panda_push_gym_env.py From pybullet-robot-envs with GNU Lesser General Public License v2.1 | 4 votes |
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()