Skip to content

Commit

Permalink
Merge branch 'master' into master_new_binding
Browse files Browse the repository at this point in the history
  • Loading branch information
yukezhu committed Nov 1, 2022
2 parents 5970135 + 940591f commit dc196c4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 21.12b0 # Replace by any tag/version: https://github.com/psf/black/tags
rev: 22.6.0 # Replace by any tag/version: https://github.com/psf/black/tags
hooks:
- id: black
language_version: python3 # Should be a command that runs python3.6+
Expand Down
9 changes: 5 additions & 4 deletions robosuite/environments/manipulation/single_arm_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,12 @@ def _eef_xmat(self):
Returns:
np.array: (3,3) End Effector orientation matrix
"""
pf = self.robots[0].robot_model.naming_prefix
pf = self.robots[0].gripper.naming_prefix

if self.env_configuration == "bimanual":
return np.array(self.sim.data.site_xmat[self.sim.model.site_name2id(pf + "right_ee")]).reshape(3, 3)
return np.array(self.sim.data.site_xmat[self.sim.model.site_name2id(pf + "right_grip_site")]).reshape(3, 3)
else:
return np.array(self.sim.data.site_xmat[self.sim.model.site_name2id(pf + "ee")]).reshape(3, 3)
return np.array(self.sim.data.site_xmat[self.sim.model.site_name2id(pf + "grip_site")]).reshape(3, 3)

@property
def _eef_xquat(self):
Expand All @@ -68,4 +69,4 @@ def _eef_xquat(self):
Returns:
np.array: (x,y,z,w) End Effector quaternion
"""
return mat2quat(self._eef_xmat)
return mat2quat(self._eef_xmat)
18 changes: 10 additions & 8 deletions robosuite/environments/manipulation/two_arm_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,13 @@ def _eef0_xmat(self):
Returns:
np.array: (3,3) orientation matrix for EEF0
"""
pf = self.robots[0].robot_model.naming_prefix
pf = self.robots[0].gripper.naming_prefix

if self.env_configuration == "bimanual":
return np.array(self.sim.data.site_xmat[self.sim.model.site_name2id(pf + "right_ee")]).reshape(3, 3)
return np.array(self.sim.data.site_xmat[self.sim.model.site_name2id(pf + "right_grip_site")]).reshape(3, 3)

else:
return np.array(self.sim.data.site_xmat[self.sim.model.site_name2id(pf + "ee")]).reshape(3, 3)
return np.array(self.sim.data.site_xmat[self.sim.model.site_name2id(pf + "grip_site")]).reshape(3, 3)

@property
def _eef1_xmat(self):
Expand All @@ -103,11 +105,11 @@ def _eef1_xmat(self):
np.array: (3,3) orientation matrix for EEF1
"""
if self.env_configuration == "bimanual":
pf = self.robots[0].robot_model.naming_prefix
return np.array(self.sim.data.site_xmat[self.sim.model.site_name2id(pf + "left_ee")]).reshape(3, 3)
pf = self.robots[0].gripper.naming_prefix
return np.array(self.sim.data.site_xmat[self.sim.model.site_name2id(pf + "left_grip_site")]).reshape(3, 3)
else:
pf = self.robots[1].robot_model.naming_prefix
return np.array(self.sim.data.site_xmat[self.sim.model.site_name2id(pf + "ee")]).reshape(3, 3)
pf = self.robots[1].gripper.naming_prefix
return np.array(self.sim.data.site_xmat[self.sim.model.site_name2id(pf + "grip_site")]).reshape(3, 3)

@property
def _eef0_xquat(self):
Expand All @@ -131,4 +133,4 @@ def _eef1_xquat(self):
Returns:
np.array: (x,y,z,w) quaternion for EEF1
"""
return mat2quat(self._eef1_xmat)
return mat2quat(self._eef1_xmat)

0 comments on commit dc196c4

Please sign in to comment.