From 16d73ef289b0dee7ed3a507ab336b02345e1371f Mon Sep 17 00:00:00 2001 From: Nemanja Date: Thu, 10 Sep 2020 21:39:06 +0100 Subject: [PATCH] changed self._p to p, as former is undefined --- .../envs/panda_envs/panda_push_gym_env.py | 12 ++++++------ .../envs/panda_envs/panda_reach_gym_env.py | 12 ++++++------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/pybullet_robot_envs/envs/panda_envs/panda_push_gym_env.py b/pybullet_robot_envs/envs/panda_envs/panda_push_gym_env.py index a962b60..725acde 100644 --- a/pybullet_robot_envs/envs/panda_envs/panda_push_gym_env.py +++ b/pybullet_robot_envs/envs/panda_envs/panda_push_gym_env.py @@ -264,7 +264,7 @@ def render(self, mode="rgb_array"): if mode != "rgb_array": return np.array([]) - base_pos, _ = self._p.getBasePositionAndOrientation(self._robot.robot_id, + base_pos, _ = p.getBasePositionAndOrientation(self._robot.robot_id, physicsClientId=self._physics_client_id) cam_dist = 1.3 @@ -273,7 +273,7 @@ def render(self, mode="rgb_array"): RENDER_HEIGHT = 640 RENDER_WIDTH = 480 - view_matrix = self._p.computeViewMatrixFromYawPitchRoll(cameraTargetPosition=base_pos, + view_matrix = p.computeViewMatrixFromYawPitchRoll(cameraTargetPosition=base_pos, distance=cam_dist, yaw=cam_yaw, pitch=cam_pitch, @@ -281,16 +281,16 @@ def render(self, mode="rgb_array"): upAxisIndex=2, physicsClientId=self._physics_client_id) - proj_matrix = self._p.computeProjectionMatrixFOV(fov=60, aspect=float(RENDER_WIDTH) / RENDER_HEIGHT, + proj_matrix = p.computeProjectionMatrixFOV(fov=60, aspect=float(RENDER_WIDTH) / RENDER_HEIGHT, nearVal=0.1, farVal=100.0, physicsClientId=self._physics_client_id) - (_, _, px, _, _) = self._p.getCameraImage(width=RENDER_WIDTH, height=RENDER_HEIGHT, + (_, _, px, _, _) = p.getCameraImage(width=RENDER_WIDTH, height=RENDER_HEIGHT, viewMatrix=view_matrix, projectionMatrix=proj_matrix, - renderer=self._p.ER_BULLET_HARDWARE_OPENGL, + renderer=p.ER_BULLET_HARDWARE_OPENGL, physicsClientId=self._physics_client_id) - # renderer=self._p.ER_TINY_RENDERER) + # renderer=p.ER_TINY_RENDERER) rgb_array = np.array(px, dtype=np.uint8) rgb_array = np.reshape(rgb_array, (RENDER_HEIGHT, RENDER_WIDTH, 4)) diff --git a/pybullet_robot_envs/envs/panda_envs/panda_reach_gym_env.py b/pybullet_robot_envs/envs/panda_envs/panda_reach_gym_env.py index a81cc9a..042dc7f 100644 --- a/pybullet_robot_envs/envs/panda_envs/panda_reach_gym_env.py +++ b/pybullet_robot_envs/envs/panda_envs/panda_reach_gym_env.py @@ -248,7 +248,7 @@ def render(self, mode="rgb_array"): if mode != "rgb_array": return np.array([]) - base_pos, _ = self._p.getBasePositionAndOrientation(self._robot.robot_id, + base_pos, _ = p.getBasePositionAndOrientation(self._robot.robot_id, physicsClientId=self._physics_client_id) cam_dist = 1.3 @@ -257,7 +257,7 @@ def render(self, mode="rgb_array"): RENDER_HEIGHT = 720 RENDER_WIDTH = 960 - view_matrix = self._p.computeViewMatrixFromYawPitchRoll(cameraTargetPosition=base_pos, + view_matrix = p.computeViewMatrixFromYawPitchRoll(cameraTargetPosition=base_pos, distance=cam_dist, yaw=cam_yaw, pitch=cam_pitch, @@ -265,16 +265,16 @@ def render(self, mode="rgb_array"): upAxisIndex=2, physicsClientId=self._physics_client_id) - proj_matrix = self._p.computeProjectionMatrixFOV(fov=60, aspect=float(RENDER_WIDTH) / RENDER_HEIGHT, + proj_matrix = p.computeProjectionMatrixFOV(fov=60, aspect=float(RENDER_WIDTH) / RENDER_HEIGHT, nearVal=0.1, farVal=100.0, physicsClientId=self._physics_client_id) - (_, _, px, _, _) = self._p.getCameraImage(width=RENDER_WIDTH, height=RENDER_HEIGHT, + (_, _, px, _, _) = p.getCameraImage(width=RENDER_WIDTH, height=RENDER_HEIGHT, viewMatrix=view_matrix, projectionMatrix=proj_matrix, - renderer=self._p.ER_BULLET_HARDWARE_OPENGL, + renderer=p.ER_BULLET_HARDWARE_OPENGL, physicsClientId=self._physics_client_id) - # renderer=self._p.ER_TINY_RENDERER) + # renderer=p.ER_TINY_RENDERER) rgb_array = np.array(px, dtype=np.uint8) rgb_array = np.reshape(rgb_array, (RENDER_HEIGHT, RENDER_WIDTH, 4))