Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 11, 2024
1 parent b26ff1d commit 3ccfee9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 14 deletions.
18 changes: 7 additions & 11 deletions omnigibson/action_primitives/starter_semantic_action_primitives.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,7 @@ def __exit__(self, *args):
def _assemble_robot_copy(self):
if m.TORSO_FIXED:
assert isinstance(self.robot, (Tiago, R1)), "Fixed torso mode only works with Tiago and R1!"
fk_descriptor = (
"left_fixed" if "left_fixed" in self.robot.robot_arm_descriptor_yamls else "left"
)
fk_descriptor = "left_fixed" if "left_fixed" in self.robot.robot_arm_descriptor_yamls else "left"
else:
fk_descriptor = (
"combined" if "combined" in self.robot.robot_arm_descriptor_yamls else self.robot.default_arm
Expand Down Expand Up @@ -293,9 +291,7 @@ def __init__(
task_relevant_objects_only (bool): Whether to only consider objects relevant to the task
when computing the action space. Defaults to False.
"""
log.warning(
"The StarterSemanticActionPrimitive is a work-in-progress and is only provided as an example. "
)
log.warning("The StarterSemanticActionPrimitive is a work-in-progress and is only provided as an example. ")
super().__init__(env)
self.controller_functions = {
StarterSemanticActionPrimitiveSet.GRASP: self._grasp,
Expand Down Expand Up @@ -931,18 +927,18 @@ def _target_in_reach_of_robot_relative(self, relative_target_pose):
def _manipulation_control_idx(self):
"""The appropriate manipulation control idx for the current settings."""
if m.TORSO_FIXED:
assert isinstance(self.robot, (Tiago, R1)) and self.arm == "left", "Fixed torso mode only supports left arm for Tiago and R1!"
assert (
isinstance(self.robot, (Tiago, R1)) and self.arm == "left"
), "Fixed torso mode only supports left arm for Tiago and R1!"
return self.robot.arm_control_idx["left"]

# if the robot has trunk control idx, append that to the manipulation control idx
if hasattr(self.robot, 'trunk_control_idx'):
if hasattr(self.robot, "trunk_control_idx"):
return th.cat([self.robot.trunk_control_idx, self.robot.arm_control_idx[self.arm]])
else:
# Otherwise just return the default arm control idx
return self.robot.arm_control_idx[self.arm]



@property
def _manipulation_descriptor_path(self):
"""The appropriate manipulation descriptor for the current settings."""
Expand Down
4 changes: 2 additions & 2 deletions omnigibson/robots/r1.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def assisted_grasp_end_points(self):
@property
def trunk_joint_names(self):
return [f"torso_joint{i}" for i in range(1, 5)]

@property
def manipulation_link_names(self):
return [
Expand All @@ -224,7 +224,7 @@ def manipulation_link_names(self):
"right_arm_link6",
"right_gripper_link1",
"right_gripper_link2",
"right_hand"
"right_hand",
]

@classproperty
Expand Down
6 changes: 5 additions & 1 deletion omnigibson/tasks/grasp_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ def _reset_agent(self, env):
control_idx_in_joint_pos = th.arange(dim)

with PlanningContext(
env, self._primitive_controller.robot, self._primitive_controller.robot_copy, self._primitive_controller.arm, "original"
env,
self._primitive_controller.robot,
self._primitive_controller.robot_copy,
self._primitive_controller.arm,
"original",
) as context:
for _ in range(MAX_JOINT_RANDOMIZATION_ATTEMPTS):
joint_pos, joint_control_idx = self._get_random_joint_position(robot)
Expand Down

0 comments on commit 3ccfee9

Please sign in to comment.