From 763d8466139220a9ae76a9a40634b31b46678270 Mon Sep 17 00:00:00 2001 From: Frank Yang Date: Mon, 16 Sep 2024 17:06:02 -0700 Subject: [PATCH 1/5] install setup file minor update --- scripts/setup.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/setup.sh b/scripts/setup.sh index 6ef119efa..534c62725 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -2,9 +2,9 @@ set -eo &> /dev/null # Make sure that the ISAAC_SIM_PATH variable is set correctly -if [[ -d ~/.local/share/ov/pkg ]] && [[ $(ls ~/.local/share/ov/pkg | grep isaac_sim) ]]; +if [[ -d ~/.local/share/ov/pkg ]] && [[ $(ls ~/.local/share/ov/pkg | grep isaac-sim) ]]; then - FOUND_ISAAC_SIM_PATH=$(ls -d ~/.local/share/ov/pkg/* | grep isaac_sim | tail -n 1) + FOUND_ISAAC_SIM_PATH=$(ls -d ~/.local/share/ov/pkg/* | grep isaac-sim | tail -n 1) echo "We found Isaac Sim installed at $FOUND_ISAAC_SIM_PATH. OmniGibson will use it by default." read -p "If you want to use a different one, please type in the path containing isaac-sim.sh here (press enter to skip) >>> " ISAAC_SIM_PATH ISAAC_SIM_PATH=${ISAAC_SIM_PATH:-$FOUND_ISAAC_SIM_PATH} @@ -14,10 +14,10 @@ else read -p "If you have already installed it in a custom location, please type in the path containing isaac-sim.sh here >>> " ISAAC_SIM_PATH fi -while [[ ! -f "${ISAAC_SIM_PATH}/isaac*.sh" ]]; do - read -p "isaac*.sh not found in $ISAAC_SIM_PATH! Make sure you have entered the correct path >>> " ISAAC_SIM_PATH +while [[ ! -n $(find "${ISAAC_SIM_PATH}" -maxdepth 1 -name "isaac*.sh" 2>/dev/null) ]]; do + echo "isaac*.sh not found in $ISAAC_SIM_PATH." + read -p "Make sure you have entered the correct path >>> " ISAAC_SIM_PATH done -echo -e "\nUsing Isaac Sim at $ISAAC_SIM_PATH\n" # Choose venv name From d65d12015ec8fa7169b61c7315c01b39bf2a502c Mon Sep 17 00:00:00 2001 From: Frank Yang Date: Thu, 3 Oct 2024 16:15:34 -0700 Subject: [PATCH 2/5] action primitives roboarm bugfix --- .../starter_semantic_action_primitives.py | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/omnigibson/action_primitives/starter_semantic_action_primitives.py b/omnigibson/action_primitives/starter_semantic_action_primitives.py index 290a5de18..b81e862ea 100644 --- a/omnigibson/action_primitives/starter_semantic_action_primitives.py +++ b/omnigibson/action_primitives/starter_semantic_action_primitives.py @@ -1462,13 +1462,20 @@ class StarterSemanticActionPrimitives(BaseActionPrimitiveSet): # if desired arm targets are available, generate an action that moves the arms to the saved pose targets if name in self._arm_targets: if isinstance(controller, InverseKinematicsController): - target_pose = self._arm_targets[name] - target_orn_axisangle = target_pose[1] - current_pose = self._get_pose_in_robot_frame( - (self.robot.get_eef_position(self.arm), self.robot.get_eef_orientation(self.arm)) + arm = name.split("_")[-1] + target_pos, target_orn_axisangle = self._arm_targets[name] + current_pos, current_orn = self._get_pose_in_robot_frame( + (self.robot.get_eef_position(arm), self.robot.get_eef_orientation(arm)) ) - delta_pos = target_pose[0] - current_pose[0] - partial_action = th.cat((delta_pos, target_orn_axisangle)) + current_orn_axisangle = T.quat2axisangle(current_orn) + delta_pos = target_pos - current_pos + delta_orn = target_orn_axisangle - current_orn_axisangle + if controller.mode == "pose_delta_ori": + partial_action = th.cat((delta_pos, delta_orn)) + elif controller.mode == "pose_absolute_ori": + partial_action = th.cat((delta_pos, target_orn_axisangle)) + else: + partial_action = th.cat((target_pos, target_orn_axisangle)) else: target_joint_pos = self._arm_targets[name] current_joint_pos = self.robot.get_joint_positions()[self._manipulation_control_idx] From 6c6fb7d8f69bda98dac7e3ee0412221265f9e96f Mon Sep 17 00:00:00 2001 From: Frank Yang Date: Thu, 3 Oct 2024 21:00:48 -0700 Subject: [PATCH 3/5] temp fix --- .../starter_semantic_action_primitives.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/omnigibson/action_primitives/starter_semantic_action_primitives.py b/omnigibson/action_primitives/starter_semantic_action_primitives.py index b81e862ea..7b63b974c 100644 --- a/omnigibson/action_primitives/starter_semantic_action_primitives.py +++ b/omnigibson/action_primitives/starter_semantic_action_primitives.py @@ -36,7 +36,7 @@ from omnigibson.robots import * from omnigibson.robots.locomotion_robot import LocomotionRobot from omnigibson.robots.manipulation_robot import ManipulationRobot from omnigibson.tasks.behavior_task import BehaviorTask -from omnigibson.utils.control_utils import FKSolver, IKSolver +from omnigibson.utils.control_utils import FKSolver, IKSolver, orientation_error from omnigibson.utils.grasping_planning_utils import get_grasp_poses_for_object_sticky, get_grasp_position_for_open from omnigibson.utils.motion_planning_utils import ( detect_robot_collision_in_sim, @@ -1462,20 +1462,21 @@ class StarterSemanticActionPrimitives(BaseActionPrimitiveSet): # if desired arm targets are available, generate an action that moves the arms to the saved pose targets if name in self._arm_targets: if isinstance(controller, InverseKinematicsController): - arm = name.split("_")[-1] + arm = name.replace("arm_", "") target_pos, target_orn_axisangle = self._arm_targets[name] current_pos, current_orn = self._get_pose_in_robot_frame( (self.robot.get_eef_position(arm), self.robot.get_eef_orientation(arm)) ) - current_orn_axisangle = T.quat2axisangle(current_orn) delta_pos = target_pos - current_pos - delta_orn = target_orn_axisangle - current_orn_axisangle + delta_orn = orientation_error(T.quat2mat(T.axisangle2quat(target_orn_axisangle)), T.quat2mat(current_orn)) if controller.mode == "pose_delta_ori": partial_action = th.cat((delta_pos, delta_orn)) - elif controller.mode == "pose_absolute_ori": + elif controller.mode in "pose_absolute_ori": partial_action = th.cat((delta_pos, target_orn_axisangle)) + elif controller.mode == "absolute_pose": + partial_action = th.cat((target_pos, target_orn_axisangle)) else: - partial_action = th.cat((target_pos, target_orn_axisangle)) + raise ValueError("Unexpected IK control mode") else: target_joint_pos = self._arm_targets[name] current_joint_pos = self.robot.get_joint_positions()[self._manipulation_control_idx] From af4f4a5a542489bceb24fa913355901b99190f3b Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 4 Oct 2024 04:01:44 +0000 Subject: [PATCH 4/5] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- .../action_primitives/starter_semantic_action_primitives.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/omnigibson/action_primitives/starter_semantic_action_primitives.py b/omnigibson/action_primitives/starter_semantic_action_primitives.py index 7b63b974c..ceec3e50c 100644 --- a/omnigibson/action_primitives/starter_semantic_action_primitives.py +++ b/omnigibson/action_primitives/starter_semantic_action_primitives.py @@ -1468,13 +1468,15 @@ class StarterSemanticActionPrimitives(BaseActionPrimitiveSet): (self.robot.get_eef_position(arm), self.robot.get_eef_orientation(arm)) ) delta_pos = target_pos - current_pos - delta_orn = orientation_error(T.quat2mat(T.axisangle2quat(target_orn_axisangle)), T.quat2mat(current_orn)) + delta_orn = orientation_error( + T.quat2mat(T.axisangle2quat(target_orn_axisangle)), T.quat2mat(current_orn) + ) if controller.mode == "pose_delta_ori": partial_action = th.cat((delta_pos, delta_orn)) elif controller.mode in "pose_absolute_ori": partial_action = th.cat((delta_pos, target_orn_axisangle)) elif controller.mode == "absolute_pose": - partial_action = th.cat((target_pos, target_orn_axisangle)) + partial_action = th.cat((target_pos, target_orn_axisangle)) else: raise ValueError("Unexpected IK control mode") else: From eeb9258907cb58b50cccc59d8b8c524b9c4c1582 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= <1408354+cgokmen@users.noreply.github.com> Date: Thu, 3 Oct 2024 22:17:47 -0700 Subject: [PATCH 5/5] Dont compute expensive delta orn if not necessary --- .../action_primitives/starter_semantic_action_primitives.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/omnigibson/action_primitives/starter_semantic_action_primitives.py b/omnigibson/action_primitives/starter_semantic_action_primitives.py index ceec3e50c..7bd5e6878 100644 --- a/omnigibson/action_primitives/starter_semantic_action_primitives.py +++ b/omnigibson/action_primitives/starter_semantic_action_primitives.py @@ -1468,10 +1468,10 @@ class StarterSemanticActionPrimitives(BaseActionPrimitiveSet): (self.robot.get_eef_position(arm), self.robot.get_eef_orientation(arm)) ) delta_pos = target_pos - current_pos - delta_orn = orientation_error( - T.quat2mat(T.axisangle2quat(target_orn_axisangle)), T.quat2mat(current_orn) - ) if controller.mode == "pose_delta_ori": + delta_orn = orientation_error( + T.quat2mat(T.axisangle2quat(target_orn_axisangle)), T.quat2mat(current_orn) + ) partial_action = th.cat((delta_pos, delta_orn)) elif controller.mode in "pose_absolute_ori": partial_action = th.cat((delta_pos, target_orn_axisangle))