Skip to content

Commit

Permalink
Refactor Pybullet Robots (#1169)
Browse files Browse the repository at this point in the history
* Move Single Arm Robots to their own module

* Fix the linting issue
  • Loading branch information
williamshen-nz authored Aug 5, 2022
1 parent 1bf7801 commit 7934ec5
Show file tree
Hide file tree
Showing 8 changed files with 408 additions and 383 deletions.
7 changes: 4 additions & 3 deletions src/envs/pybullet_blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@
from predicators.src.envs.blocks import BlocksEnv
from predicators.src.envs.pybullet_env import PyBulletEnv, \
create_pybullet_block
from predicators.src.envs.pybullet_robots import _SingleArmPyBulletRobot, \
create_change_fingers_option, create_move_end_effector_to_pose_option, \
from predicators.src.envs.pybullet_robots import \
create_change_fingers_option, create_move_end_effector_to_pose_option
from predicators.src.pybullet_helpers.robots import SingleArmPyBulletRobot, \
create_single_arm_pybullet_robot
from predicators.src.settings import CFG
from predicators.src.structs import Array, Object, ParameterizedOption, \
Expand Down Expand Up @@ -214,7 +215,7 @@ def _initialize_pybullet(self) -> None:
self._physics_client_id))

def _create_pybullet_robot(
self, physics_client_id: int) -> _SingleArmPyBulletRobot:
self, physics_client_id: int) -> SingleArmPyBulletRobot:
ee_home = (self.robot_init_x, self.robot_init_y, self.robot_init_z)
return create_single_arm_pybullet_robot(CFG.pybullet_robot, ee_home,
self._ee_orn,
Expand Down
7 changes: 4 additions & 3 deletions src/envs/pybullet_cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
from predicators.src.envs.cover import CoverEnv
from predicators.src.envs.pybullet_env import PyBulletEnv, \
create_pybullet_block
from predicators.src.envs.pybullet_robots import _SingleArmPyBulletRobot, \
create_change_fingers_option, create_move_end_effector_to_pose_option, \
from predicators.src.envs.pybullet_robots import \
create_change_fingers_option, create_move_end_effector_to_pose_option
from predicators.src.pybullet_helpers.robots import SingleArmPyBulletRobot, \
create_single_arm_pybullet_robot
from predicators.src.settings import CFG
from predicators.src.structs import Action, Array, Object, \
Expand Down Expand Up @@ -134,7 +135,7 @@ def _initialize_pybullet(self) -> None:
self._physics_client_id))

def _create_pybullet_robot(
self, physics_client_id: int) -> _SingleArmPyBulletRobot:
self, physics_client_id: int) -> SingleArmPyBulletRobot:
ee_home = (self._workspace_x, self._robot_init_y, self._workspace_z)
return create_single_arm_pybullet_robot(CFG.pybullet_robot, ee_home,
self._ee_orn,
Expand Down
4 changes: 2 additions & 2 deletions src/envs/pybullet_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

from predicators.src import utils
from predicators.src.envs import BaseEnv
from predicators.src.envs.pybullet_robots import _SingleArmPyBulletRobot
from predicators.src.pybullet_helpers.robots import SingleArmPyBulletRobot
from predicators.src.settings import CFG
from predicators.src.structs import Action, Array, Pose3D, State, Task, Video

Expand Down Expand Up @@ -116,7 +116,7 @@ def _initialize_pybullet(self) -> None:

@abc.abstractmethod
def _create_pybullet_robot(
self, physics_client_id: int) -> _SingleArmPyBulletRobot:
self, physics_client_id: int) -> SingleArmPyBulletRobot:
"""Make and return a PyBullet robot object in the given
physics_client_id.
Expand Down
Loading

0 comments on commit 7934ec5

Please sign in to comment.