From 97e1711750e047a4a7a7cdc5d440a1a14575b8a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= Date: Tue, 3 Oct 2023 02:25:06 -0700 Subject: [PATCH 01/37] No more docs build on the OG repo. --- .github/workflows/docs.yml | 77 -------------------------------------- 1 file changed, 77 deletions(-) delete mode 100644 .github/workflows/docs.yml diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml deleted file mode 100644 index ad99e03df..000000000 --- a/.github/workflows/docs.yml +++ /dev/null @@ -1,77 +0,0 @@ -name: Build & deploy docs - -on: - workflow_dispatch: - pull_request: - branches: - - og-develop - -concurrency: - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.sha }} - cancel-in-progress: true - -jobs: - docs: - runs-on: [linux] - container: - image: stanfordvl/omnigibson-dev:latest - options: --gpus=all --privileged --user=root - env: - DISPLAY: "" - OMNIGIBSON_HEADLESS: 1 - volumes: - - /scr/omni-data/datasets:/data - - /usr/share/vulkan/icd.d/nvidia_icd.json:/etc/vulkan/icd.d/nvidia_icd.json - - /usr/share/vulkan/icd.d/nvidia_layers.json:/etc/vulkan/implicit_layer.d/nvidia_layers.json - - /usr/share/glvnd/egl_vendor.d/10_nvidia.json:/usr/share/glvnd/egl_vendor.d/10_nvidia.json - - /scr/omni-data/isaac-sim/cache/ov:/root/.cache/ov:rw - - /scr/omni-data/isaac-sim/cache/pip:/root/.cache/pip:rw - - /scr/omni-data/isaac-sim/cache/glcache:/root/.cache/nvidia/GLCache:rw - - /scr/omni-data/isaac-sim/cache/computecache:/root/.nv/ComputeCache:rw - - /scr/omni-data/isaac-sim/logs:/root/.nvidia-omniverse/logs:rw - - /scr/omni-data/isaac-sim/config:/root/.nvidia-omniverse/config:rw - - /scr/omni-data/isaac-sim/data:/root/.local/share/ov/data:rw - - /scr/omni-data/isaac-sim/documents:/root/Documents:rw - - defaults: - run: - shell: micromamba run -n omnigibson /bin/bash -leo pipefail {0} - - steps: - - name: Fix home - run: echo "HOME=/root" >> $GITHUB_ENV - - - name: Checkout source - uses: actions/checkout@v3 - with: - submodules: true - path: omnigibson-src - - - name: Install - working-directory: omnigibson-src - run: pip install -e . - - - name: Install dev requirements - working-directory: omnigibson-src - run: pip install -r requirements-dev.txt - - - name: Build docs - working-directory: omnigibson-src - run: source scripts/build_docs.sh - - - name: Copy benchmark index page - working-directory: omnigibson-src - run: mkdir site/benchmark && cp scripts/benchmark* site/benchmark/ && cd site/benchmark && mv benchmark.html index.html - - - name: Fetch benchmark file from gh-pages branch - working-directory: omnigibson-src - run: | - git fetch origin gh-pages:gh-pages --force - git show gh-pages:benchmark/data.js > ./site/benchmark/data.js - git diff - - - name: Deploy to gh-pages - uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - publish_dir: ./omnigibson-src/site From 15a02ce8b4c5e875734d4feb9e231d301ba7f63d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= <1408354+cgokmen@users.noreply.github.com> Date: Wed, 4 Oct 2023 16:25:05 -0700 Subject: [PATCH 02/37] Update documentation URL to point to BEHAVIOR website (#285) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3a5d623b5..d3cf03d3f 100644 --- a/README.md +++ b/README.md @@ -22,7 +22,7 @@ * 🤖 Mobile Manipulator Robots with Modular ⚙️ Controllers * 🌎 OpenAI Gym Interface -Check out [**`OmniGibson`**'s documentation](https://stanfordvl.github.io/OmniGibson/getting_started/installation.html) to get started! +Check out [**`OmniGibson`**'s documentation](https://behavior.stanford.edu/omnigibson/getting_started/installation.html) to get started! ### Citation If you use **`OmniGibson`** or its assets and models, please cite: From fcc463e15c7d7d1908474425ca7bbab06f1bbd89 Mon Sep 17 00:00:00 2001 From: Wensi Ai Date: Thu, 12 Oct 2023 14:08:16 -0700 Subject: [PATCH 03/37] Add franka allegro robot --- omnigibson/robots/franka_allegro.py | 330 ++++++++++++++++++++++++++++ 1 file changed, 330 insertions(+) create mode 100644 omnigibson/robots/franka_allegro.py diff --git a/omnigibson/robots/franka_allegro.py b/omnigibson/robots/franka_allegro.py new file mode 100644 index 000000000..66a440690 --- /dev/null +++ b/omnigibson/robots/franka_allegro.py @@ -0,0 +1,330 @@ +import os +import numpy as np + +from omnigibson.macros import gm +from omnigibson.robots.manipulation_robot import ManipulationRobot +from omnigibson.robots.active_camera_robot import ActiveCameraRobot + +from omni.isaac.core.utils.prims import get_prim_at_path + +RESET_JOINT_OPTIONS = { + "tuck", + "untuck", +} + + +class FrankaAllegro(ManipulationRobot): + """ + Franka Robot with Allegro hand + """ + + def __init__( + self, + # Shared kwargs in hierarchy + name, + prim_path=None, + class_id=None, + uuid=None, + scale=None, + visible=True, + visual_only=False, + self_collisions=True, + load_config=None, + fixed_base=True, + + # Unique to USDObject hierarchy + abilities=None, + + # Unique to ControllableObject hierarchy + control_freq=None, + controller_config=None, + action_type="continuous", + action_normalize=True, + reset_joint_pos=None, + + # Unique to BaseRobot + obs_modalities="all", + proprio_obs="default", + sensor_config=None, + + # Unique to ManipulationRobot + grasping_mode="physical", + + **kwargs, + ): + """ + Args: + name (str): Name for the object. Names need to be unique per scene + prim_path (None or str): global path in the stage to this object. If not specified, will automatically be + created at /World/ + class_id (None or int): What class ID the object should be assigned in semantic segmentation rendering mode. + If None, the ID will be inferred from this object's category. + uuid (None or int): Unique unsigned-integer identifier to assign to this object (max 8-numbers). + If None is specified, then it will be auto-generated + scale (None or float or 3-array): if specified, sets either the uniform (float) or x,y,z (3-array) scale + for this object. A single number corresponds to uniform scaling along the x,y,z axes, whereas a + 3-array specifies per-axis scaling. + visible (bool): whether to render this object or not in the stage + visual_only (bool): Whether this object should be visual only (and not collide with any other objects) + self_collisions (bool): Whether to enable self collisions for this object + load_config (None or dict): If specified, should contain keyword-mapped values that are relevant for + loading this prim at runtime. + abilities (None or dict): If specified, manually adds specific object states to this object. It should be + a dict in the form of {ability: {param: value}} containing object abilities and parameters to pass to + the object state instance constructor. + control_freq (float): control frequency (in Hz) at which to control the object. If set to be None, + simulator.import_object will automatically set the control frequency to be 1 / render_timestep by default. + controller_config (None or dict): nested dictionary mapping controller name(s) to specific controller + configurations for this object. This will override any default values specified by this class. + action_type (str): one of {discrete, continuous} - what type of action space to use + action_normalize (bool): whether to normalize inputted actions. This will override any default values + specified by this class. + reset_joint_pos (None or n-array): if specified, should be the joint positions that the object should + be set to during a reset. If None (default), self.default_joint_pos will be used instead. + obs_modalities (str or list of str): Observation modalities to use for this robot. Default is "all", which + corresponds to all modalities being used. + Otherwise, valid options should be part of omnigibson.sensors.ALL_SENSOR_MODALITIES. + Note: If @sensor_config explicitly specifies `modalities` for a given sensor class, it will + override any values specified from @obs_modalities! + proprio_obs (str or list of str): proprioception observation key(s) to use for generating proprioceptive + observations. If str, should be exactly "default" -- this results in the default proprioception + observations being used, as defined by self.default_proprio_obs. See self._get_proprioception_dict + for valid key choices + sensor_config (None or dict): nested dictionary mapping sensor class name(s) to specific sensor + configurations for this object. This will override any default values specified by this class. + grasping_mode (str): One of {"physical", "assisted", "sticky"}. + If "physical", no assistive grasping will be applied (relies on contact friction + finger force). + If "assisted", will magnetize any object touching and within the gripper's fingers. + If "sticky", will magnetize any object touching the gripper's fingers. + kwargs (dict): Additional keyword arguments that are used for other super() calls from subclasses, allowing + for flexible compositions of various object subclasses (e.g.: Robot is USDObject + ControllableObject). + """ + # Parse reset joint pos if specifying special string + if isinstance(reset_joint_pos, str): + assert ( + reset_joint_pos in RESET_JOINT_OPTIONS + ), "reset_joint_pos should be one of {} if using a string!".format(RESET_JOINT_OPTIONS) + reset_joint_pos = ( + self.tucked_default_joint_pos if reset_joint_pos == "tuck" else self.untucked_default_joint_pos + ) + + # Run super init + super().__init__( + prim_path=prim_path, + name=name, + class_id=class_id, + uuid=uuid, + scale=scale, + visible=visible, + fixed_base=fixed_base, + visual_only=visual_only, + self_collisions=self_collisions, + load_config=load_config, + abilities=abilities, + control_freq=control_freq, + controller_config=controller_config, + action_type=action_type, + action_normalize=action_normalize, + reset_joint_pos=reset_joint_pos, + obs_modalities=obs_modalities, + proprio_obs=proprio_obs, + sensor_config=sensor_config, + grasping_mode=grasping_mode, + **kwargs, + ) + + def _post_load(self): + super()._post_load() + self._world_base_fixed_joint_prim = get_prim_at_path(f"{self._prim_path}/root_joint") + + @property + def model_name(self): + return "FrankaAllegro" + + @property + def tucked_default_joint_pos(self): + return np.zeros(23) + + @property + def untucked_default_joint_pos(self): + # return np.r_[[0.012, -0.57, 0, -2.81, 0, 3.037, 0.741], np.zeros(16)] + return np.r_[[0.86, -0.27, -0.68, -1.52, -0.18, 1.29, 1.72], np.zeros(16)] + + @property + def discrete_action_list(self): + # Not supported for this robot + raise NotImplementedError() + + def _create_discrete_action_space(self): + # Fetch does not support discrete actions + raise ValueError("Fetch does not support discrete actions!") + + def tuck(self): + """ + Immediately set this robot's configuration to be in tucked mode + """ + self.set_joint_positions(self.tucked_default_joint_pos) + + def untuck(self): + """ + Immediately set this robot's configuration to be in untucked mode + """ + self.set_joint_positions(self.untucked_default_joint_pos) + + def update_controller_mode(self): + super().update_controller_mode() + # overwrite joint params here + # self.joints[f"panda_joint1"].damping = 10472 + # self.joints[f"panda_joint1"].stiffness = 104720 + # self.joints[f"panda_joint2"].damping = 1047.2 + # self.joints[f"panda_joint2"].stiffness = 10472 + # self.joints[f"panda_joint3"].damping = 5236 + # self.joints[f"panda_joint3"].stiffness = 104720 + # self.joints[f"panda_joint4"].damping = 523.6 + # self.joints[f"panda_joint4"].stiffness = 10472 + # self.joints[f"panda_joint5"].damping = 52.36 + # self.joints[f"panda_joint5"].stiffness = 436.3 + # self.joints[f"panda_joint6"].damping = 52.36 + # self.joints[f"panda_joint6"].stiffness = 261.8 + # self.joints[f"panda_joint7"].damping = 52.36 + # self.joints[f"panda_joint7"].stiffness = 872.66 + for i in range(7): + self.joints[f"panda_joint{i+1}"].damping = 1000 + self.joints[f"panda_joint{i+1}"].stiffness = 1000 + for i in range(16): + self.joints[f"joint_{i}_0"].damping = 100 + self.joints[f"joint_{i}_0"].stiffness = 300 + self.joints[f"joint_{i}_0"].max_effort = 15 + + @property + def controller_order(self): + # Ordered by general robot kinematics chain + return ["arm_{}".format(self.default_arm), "gripper_{}".format(self.default_arm)] + + @property + def _default_controllers(self): + # Always call super first + controllers = super()._default_controllers + controllers["arm_{}".format(self.default_arm)] = "InverseKinematicsController" + controllers["gripper_{}".format(self.default_arm)] = "JointController" + + return controllers + + @property + def default_joint_pos(self): + return self.untucked_default_joint_pos + + @property + def finger_lengths(self): + return {self.default_arm: 0.1} + + @property + def arm_control_idx(self): + return {self.default_arm: np.arange(7)} + + @property + def gripper_control_idx(self): + return {self.default_arm: np.arange(7, 23)} + + @property + def arm_link_names(self): + return {self.default_arm: [ + "panda_link0", + "panda_link1", + "panda_link2", + "panda_link3", + "panda_link4", + "panda_link5", + "panda_link6", + "panda_link7", + ]} + + @property + def arm_joint_names(self): + return {self.default_arm: [ + "panda_joint_1", + "panda_joint_2", + "panda_joint_3", + "panda_joint_4", + "panda_joint_5", + "panda_joint_6", + "panda_joint_7", + ]} + + @property + def eef_link_names(self): + return {self.default_arm: "base_link"} + + @property + def finger_link_names(self): + return {self.default_arm: [ + "link_0_0", + "link_1_0", + "link_2_0", + "link_3_0", + "link_4_0", + "link_5_0", + "link_6_0", + "link_7_0", + "link_8_0", + "link_9_0", + "link_10_0", + "link_11_0", + "link_12_0", + "link_13_0", + "link_14_0", + "link_15_0", + ]} + + @property + def finger_joint_names(self): + return {self.default_arm: [ + "joint_0_0", + "joint_1_0", + "joint_2_0", + "joint_3_0", + "joint_4_0", + "joint_5_0", + "joint_6_0", + "joint_7_0", + "joint_8_0", + "joint_9_0", + "joint_10_0", + "joint_11_0", + "joint_12_0", + "joint_13_0", + "joint_14_0", + "joint_15_0", + ]} + + @property + def usd_path(self): + return os.path.join(gm.ASSET_PATH, "models/franka_allegro/franka_allegro.usd") + + @property + def robot_arm_descriptor_yamls(self): + return {self.default_arm: os.path.join(gm.ASSET_PATH, "models/franka_allegro/franka_allegro_description.yaml")} + + @property + def robot_gripper_descriptor_yamls(self): + return { + finger: os.path.join(gm.ASSET_PATH, f"models/franka_allegro/allegro_{finger}_description.yaml") + for finger in ["thumb", "index", "middle", "ring"] + } + + @property + def urdf_path(self): + return os.path.join(gm.ASSET_PATH, "models/franka_allegro/franka_allegro.urdf") + + @property + def gripper_urdf_path(self): + return os.path.join(gm.ASSET_PATH, "models/franka_allegro/allegro_hand.urdf") + + @property + def disabled_collision_pairs(self): + return [ + ["link_12_0", "part_studio_link"], + ] + + def set_position(self, position): + self._world_base_fixed_joint_prim.GetAttribute("physics:localPos0").Set(tuple(position)) From d99eb8586eef155fabd276fc5ef4103282668dd5 Mon Sep 17 00:00:00 2001 From: Wensi Ai Date: Thu, 12 Oct 2023 14:08:51 -0700 Subject: [PATCH 04/37] Change init file --- omnigibson/robots/__init__.py | 1 + omnigibson/simulator.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/omnigibson/robots/__init__.py b/omnigibson/robots/__init__.py index 3c3088cdb..d44f06d23 100644 --- a/omnigibson/robots/__init__.py +++ b/omnigibson/robots/__init__.py @@ -9,3 +9,4 @@ from omnigibson.robots.fetch import Fetch from omnigibson.robots.tiago import Tiago from omnigibson.robots.two_wheel_robot import TwoWheelRobot +from omnigibson.robots.franka_allegro import FrankaAllegro diff --git a/omnigibson/simulator.py b/omnigibson/simulator.py index 9d6f9e39f..45e930b8a 100644 --- a/omnigibson/simulator.py +++ b/omnigibson/simulator.py @@ -70,7 +70,7 @@ class Simulator(SimulationContext, Serializable): def __init__( self, gravity=9.81, - physics_dt=1.0 / 60.0, + physics_dt=1.0 / 240.0, rendering_dt=1.0 / 60.0, stage_units_in_meters=1.0, viewer_width=gm.DEFAULT_VIEWER_WIDTH, From 6614ab6b155f31a00f181be025f7c40ac0f8e582 Mon Sep 17 00:00:00 2001 From: Wensi Ai Date: Thu, 12 Oct 2023 20:19:48 -0700 Subject: [PATCH 05/37] Revert simulator change --- omnigibson/simulator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/omnigibson/simulator.py b/omnigibson/simulator.py index 45e930b8a..9d6f9e39f 100644 --- a/omnigibson/simulator.py +++ b/omnigibson/simulator.py @@ -70,7 +70,7 @@ class Simulator(SimulationContext, Serializable): def __init__( self, gravity=9.81, - physics_dt=1.0 / 240.0, + physics_dt=1.0 / 60.0, rendering_dt=1.0 / 60.0, stage_units_in_meters=1.0, viewer_width=gm.DEFAULT_VIEWER_WIDTH, From 7cfb3eab026a55572895da7e759752e8051c9f18 Mon Sep 17 00:00:00 2001 From: Ikko Eltociear Ashimine Date: Mon, 16 Oct 2023 19:30:51 +0900 Subject: [PATCH 06/37] Fix typo in scene_base.py arbitary -> arbitrary --- omnigibson/scenes/scene_base.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/omnigibson/scenes/scene_base.py b/omnigibson/scenes/scene_base.py index 296814f6f..e166f9402 100644 --- a/omnigibson/scenes/scene_base.py +++ b/omnigibson/scenes/scene_base.py @@ -31,7 +31,7 @@ class Scene(Serializable, Registerable, Recreatable, ABC): """ Base class for all Scene objects. - Contains the base functionalities for an arbitary scene with an arbitrary set of added objects + Contains the base functionalities for an arbitrary scene with an arbitrary set of added objects """ def __init__( self, From 8c0e8ae8d7f09e146dca0e983d0e3654ce80113d Mon Sep 17 00:00:00 2001 From: Wensi Ai Date: Mon, 16 Oct 2023 10:21:05 -0700 Subject: [PATCH 07/37] Clean up franka allegro class --- omnigibson/robots/franka_allegro.py | 87 ++--------------------------- 1 file changed, 5 insertions(+), 82 deletions(-) diff --git a/omnigibson/robots/franka_allegro.py b/omnigibson/robots/franka_allegro.py index 66a440690..70daf4112 100644 --- a/omnigibson/robots/franka_allegro.py +++ b/omnigibson/robots/franka_allegro.py @@ -3,7 +3,6 @@ from omnigibson.macros import gm from omnigibson.robots.manipulation_robot import ManipulationRobot -from omnigibson.robots.active_camera_robot import ActiveCameraRobot from omni.isaac.core.utils.prims import get_prim_at_path @@ -133,10 +132,6 @@ def __init__( **kwargs, ) - def _post_load(self): - super()._post_load() - self._world_base_fixed_joint_prim = get_prim_at_path(f"{self._prim_path}/root_joint") - @property def model_name(self): return "FrankaAllegro" @@ -147,7 +142,7 @@ def tucked_default_joint_pos(self): @property def untucked_default_joint_pos(self): - # return np.r_[[0.012, -0.57, 0, -2.81, 0, 3.037, 0.741], np.zeros(16)] + # position where the hand is parallel to the ground return np.r_[[0.86, -0.27, -0.68, -1.52, -0.18, 1.29, 1.72], np.zeros(16)] @property @@ -174,20 +169,6 @@ def untuck(self): def update_controller_mode(self): super().update_controller_mode() # overwrite joint params here - # self.joints[f"panda_joint1"].damping = 10472 - # self.joints[f"panda_joint1"].stiffness = 104720 - # self.joints[f"panda_joint2"].damping = 1047.2 - # self.joints[f"panda_joint2"].stiffness = 10472 - # self.joints[f"panda_joint3"].damping = 5236 - # self.joints[f"panda_joint3"].stiffness = 104720 - # self.joints[f"panda_joint4"].damping = 523.6 - # self.joints[f"panda_joint4"].stiffness = 10472 - # self.joints[f"panda_joint5"].damping = 52.36 - # self.joints[f"panda_joint5"].stiffness = 436.3 - # self.joints[f"panda_joint6"].damping = 52.36 - # self.joints[f"panda_joint6"].stiffness = 261.8 - # self.joints[f"panda_joint7"].damping = 52.36 - # self.joints[f"panda_joint7"].stiffness = 872.66 for i in range(7): self.joints[f"panda_joint{i+1}"].damping = 1000 self.joints[f"panda_joint{i+1}"].stiffness = 1000 @@ -198,16 +179,12 @@ def update_controller_mode(self): @property def controller_order(self): - # Ordered by general robot kinematics chain return ["arm_{}".format(self.default_arm), "gripper_{}".format(self.default_arm)] @property def _default_controllers(self): - # Always call super first controllers = super()._default_controllers controllers["arm_{}".format(self.default_arm)] = "InverseKinematicsController" - controllers["gripper_{}".format(self.default_arm)] = "JointController" - return controllers @property @@ -228,28 +205,11 @@ def gripper_control_idx(self): @property def arm_link_names(self): - return {self.default_arm: [ - "panda_link0", - "panda_link1", - "panda_link2", - "panda_link3", - "panda_link4", - "panda_link5", - "panda_link6", - "panda_link7", - ]} + return {self.default_arm: [f"panda_link{i}" for i in range(8)]} @property def arm_joint_names(self): - return {self.default_arm: [ - "panda_joint_1", - "panda_joint_2", - "panda_joint_3", - "panda_joint_4", - "panda_joint_5", - "panda_joint_6", - "panda_joint_7", - ]} + return {self.default_arm: [f"panda_joint_{i+1}" for i in range(7)]} @property def eef_link_names(self): @@ -257,45 +217,11 @@ def eef_link_names(self): @property def finger_link_names(self): - return {self.default_arm: [ - "link_0_0", - "link_1_0", - "link_2_0", - "link_3_0", - "link_4_0", - "link_5_0", - "link_6_0", - "link_7_0", - "link_8_0", - "link_9_0", - "link_10_0", - "link_11_0", - "link_12_0", - "link_13_0", - "link_14_0", - "link_15_0", - ]} + return {self.default_arm: [f"link_{i}_0" for i in range(16)]} @property def finger_joint_names(self): - return {self.default_arm: [ - "joint_0_0", - "joint_1_0", - "joint_2_0", - "joint_3_0", - "joint_4_0", - "joint_5_0", - "joint_6_0", - "joint_7_0", - "joint_8_0", - "joint_9_0", - "joint_10_0", - "joint_11_0", - "joint_12_0", - "joint_13_0", - "joint_14_0", - "joint_15_0", - ]} + return {self.default_arm: [f"joint_{i}_0" for i in range(16)]} @property def usd_path(self): @@ -325,6 +251,3 @@ def disabled_collision_pairs(self): return [ ["link_12_0", "part_studio_link"], ] - - def set_position(self, position): - self._world_base_fixed_joint_prim.GetAttribute("physics:localPos0").Set(tuple(position)) From f00ad62c61b365f9de067fbf02feb762e113a19a Mon Sep 17 00:00:00 2001 From: Wensi Ai Date: Mon, 16 Oct 2023 14:51:06 -0700 Subject: [PATCH 08/37] Add franka panda robot --- omnigibson/robots/__init__.py | 1 + omnigibson/robots/franka.py | 229 ++++++++++++++++++++++++++++ omnigibson/robots/franka_allegro.py | 14 +- 3 files changed, 236 insertions(+), 8 deletions(-) create mode 100644 omnigibson/robots/franka.py diff --git a/omnigibson/robots/__init__.py b/omnigibson/robots/__init__.py index d44f06d23..17b4af9a0 100644 --- a/omnigibson/robots/__init__.py +++ b/omnigibson/robots/__init__.py @@ -9,4 +9,5 @@ from omnigibson.robots.fetch import Fetch from omnigibson.robots.tiago import Tiago from omnigibson.robots.two_wheel_robot import TwoWheelRobot +from omnigibson.robots.franka import FrankaPanda from omnigibson.robots.franka_allegro import FrankaAllegro diff --git a/omnigibson/robots/franka.py b/omnigibson/robots/franka.py new file mode 100644 index 000000000..0b1761838 --- /dev/null +++ b/omnigibson/robots/franka.py @@ -0,0 +1,229 @@ +import os +import numpy as np + +from omnigibson.macros import gm +from omnigibson.robots.manipulation_robot import ManipulationRobot + + +RESET_JOINT_OPTIONS = { + "tuck", + "untuck", +} + + +class FrankaPanda(ManipulationRobot): + """ + The Franka Emika Panda robot + """ + + def __init__( + self, + # Shared kwargs in hierarchy + name, + prim_path=None, + class_id=None, + uuid=None, + scale=None, + visible=True, + visual_only=False, + self_collisions=True, + load_config=None, + fixed_base=True, + + # Unique to USDObject hierarchy + abilities=None, + + # Unique to ControllableObject hierarchy + control_freq=None, + controller_config=None, + action_type="continuous", + action_normalize=True, + reset_joint_pos=None, + + # Unique to BaseRobot + obs_modalities="all", + proprio_obs="default", + sensor_config=None, + + # Unique to ManipulationRobot + grasping_mode="physical", + + **kwargs, + ): + """ + Args: + name (str): Name for the object. Names need to be unique per scene + prim_path (None or str): global path in the stage to this object. If not specified, will automatically be + created at /World/ + class_id (None or int): What class ID the object should be assigned in semantic segmentation rendering mode. + If None, the ID will be inferred from this object's category. + uuid (None or int): Unique unsigned-integer identifier to assign to this object (max 8-numbers). + If None is specified, then it will be auto-generated + scale (None or float or 3-array): if specified, sets either the uniform (float) or x,y,z (3-array) scale + for this object. A single number corresponds to uniform scaling along the x,y,z axes, whereas a + 3-array specifies per-axis scaling. + visible (bool): whether to render this object or not in the stage + visual_only (bool): Whether this object should be visual only (and not collide with any other objects) + self_collisions (bool): Whether to enable self collisions for this object + load_config (None or dict): If specified, should contain keyword-mapped values that are relevant for + loading this prim at runtime. + abilities (None or dict): If specified, manually adds specific object states to this object. It should be + a dict in the form of {ability: {param: value}} containing object abilities and parameters to pass to + the object state instance constructor. + control_freq (float): control frequency (in Hz) at which to control the object. If set to be None, + simulator.import_object will automatically set the control frequency to be 1 / render_timestep by default. + controller_config (None or dict): nested dictionary mapping controller name(s) to specific controller + configurations for this object. This will override any default values specified by this class. + action_type (str): one of {discrete, continuous} - what type of action space to use + action_normalize (bool): whether to normalize inputted actions. This will override any default values + specified by this class. + reset_joint_pos (None or n-array): if specified, should be the joint positions that the object should + be set to during a reset. If None (default), self.default_joint_pos will be used instead. + obs_modalities (str or list of str): Observation modalities to use for this robot. Default is "all", which + corresponds to all modalities being used. + Otherwise, valid options should be part of omnigibson.sensors.ALL_SENSOR_MODALITIES. + Note: If @sensor_config explicitly specifies `modalities` for a given sensor class, it will + override any values specified from @obs_modalities! + proprio_obs (str or list of str): proprioception observation key(s) to use for generating proprioceptive + observations. If str, should be exactly "default" -- this results in the default proprioception + observations being used, as defined by self.default_proprio_obs. See self._get_proprioception_dict + for valid key choices + sensor_config (None or dict): nested dictionary mapping sensor class name(s) to specific sensor + configurations for this object. This will override any default values specified by this class. + grasping_mode (str): One of {"physical", "assisted", "sticky"}. + If "physical", no assistive grasping will be applied (relies on contact friction + finger force). + If "assisted", will magnetize any object touching and within the gripper's fingers. + If "sticky", will magnetize any object touching the gripper's fingers. + kwargs (dict): Additional keyword arguments that are used for other super() calls from subclasses, allowing + for flexible compositions of various object subclasses (e.g.: Robot is USDObject + ControllableObject). + """ + # Parse reset joint pos if specifying special string + if isinstance(reset_joint_pos, str): + assert ( + reset_joint_pos in RESET_JOINT_OPTIONS + ), "reset_joint_pos should be one of {} if using a string!".format(RESET_JOINT_OPTIONS) + reset_joint_pos = ( + self.tucked_default_joint_pos if reset_joint_pos == "tuck" else self.untucked_default_joint_pos + ) + + # Run super init + super().__init__( + prim_path=prim_path, + name=name, + class_id=class_id, + uuid=uuid, + scale=scale, + visible=visible, + fixed_base=fixed_base, + visual_only=visual_only, + self_collisions=self_collisions, + load_config=load_config, + abilities=abilities, + control_freq=control_freq, + controller_config=controller_config, + action_type=action_type, + action_normalize=action_normalize, + reset_joint_pos=reset_joint_pos, + obs_modalities=obs_modalities, + proprio_obs=proprio_obs, + sensor_config=sensor_config, + grasping_mode=grasping_mode, + **kwargs, + ) + + @property + def model_name(self): + return "FrankaPanda" + + @property + def tucked_default_joint_pos(self): + return np.zeros(9) + + @property + def untucked_default_joint_pos(self): + return np.array([0.00, -1.3, 0.00, -2.87, 0.00, 2.00, 0.75, 0.00, 0.00]) + + @property + def discrete_action_list(self): + # Not supported for this robot + raise NotImplementedError() + + def _create_discrete_action_space(self): + # Fetch does not support discrete actions + raise ValueError("Franka does not support discrete actions!") + + def tuck(self): + """ + Immediately set this robot's configuration to be in tucked mode + """ + self.set_joint_positions(self.tucked_default_joint_pos) + + def untuck(self): + """ + Immediately set this robot's configuration to be in untucked mode + """ + self.set_joint_positions(self.untucked_default_joint_pos) + + def update_controller_mode(self): + super().update_controller_mode() + # overwrite joint params (e.g. damping, stiffess, max_effort) here + + @property + def controller_order(self): + return ["arm_{}".format(self.default_arm), "gripper_{}".format(self.default_arm)] + + @property + def _default_controllers(self): + controllers = super()._default_controllers + controllers["arm_{}".format(self.default_arm)] = "InverseKinematicsController" + controllers["gripper_{}".format(self.default_arm)] = "MultiFingerGripperController" + return controllers + + @property + def default_joint_pos(self): + return self.untucked_default_joint_pos + + @property + def finger_lengths(self): + return {self.default_arm: 0.1} + + @property + def arm_control_idx(self): + return {self.default_arm: np.arange(7)} + + @property + def gripper_control_idx(self): + return {self.default_arm: np.arange(7, 9)} + + @property + def arm_link_names(self): + return {self.default_arm: [f"panda_link{i}" for i in range(8)]} + + @property + def arm_joint_names(self): + return {self.default_arm: [f"panda_joint_{i+1}" for i in range(7)]} + + @property + def eef_link_names(self): + return {self.default_arm: "panda_hand"} + + @property + def finger_link_names(self): + return {self.default_arm: ["panda_leftfinger", "panda_rightfinger"]} + + @property + def finger_joint_names(self): + return {self.default_arm: ["panda_finger_joint1", "panda_finger_joint2"]} + + @property + def usd_path(self): + return os.path.join(gm.ASSET_PATH, "models/franka/franka_panda.usd") + + @property + def robot_arm_descriptor_yamls(self): + return {self.default_arm: os.path.join(gm.ASSET_PATH, "models/franka/franka_panda_description.yaml")} + + @property + def urdf_path(self): + return os.path.join(gm.ASSET_PATH, "models/franka/franka_panda.urdf") + \ No newline at end of file diff --git a/omnigibson/robots/franka_allegro.py b/omnigibson/robots/franka_allegro.py index 70daf4112..40bf953fb 100644 --- a/omnigibson/robots/franka_allegro.py +++ b/omnigibson/robots/franka_allegro.py @@ -4,8 +4,6 @@ from omnigibson.macros import gm from omnigibson.robots.manipulation_robot import ManipulationRobot -from omni.isaac.core.utils.prims import get_prim_at_path - RESET_JOINT_OPTIONS = { "tuck", "untuck", @@ -152,7 +150,7 @@ def discrete_action_list(self): def _create_discrete_action_space(self): # Fetch does not support discrete actions - raise ValueError("Fetch does not support discrete actions!") + raise ValueError("Franka does not support discrete actions!") def tuck(self): """ @@ -225,26 +223,26 @@ def finger_joint_names(self): @property def usd_path(self): - return os.path.join(gm.ASSET_PATH, "models/franka_allegro/franka_allegro.usd") + return os.path.join(gm.ASSET_PATH, "models/franka/franka_allegro.usd") @property def robot_arm_descriptor_yamls(self): - return {self.default_arm: os.path.join(gm.ASSET_PATH, "models/franka_allegro/franka_allegro_description.yaml")} + return {self.default_arm: os.path.join(gm.ASSET_PATH, "models/franka/franka_allegro_description.yaml")} @property def robot_gripper_descriptor_yamls(self): return { - finger: os.path.join(gm.ASSET_PATH, f"models/franka_allegro/allegro_{finger}_description.yaml") + finger: os.path.join(gm.ASSET_PATH, f"models/franka/allegro_{finger}_description.yaml") for finger in ["thumb", "index", "middle", "ring"] } @property def urdf_path(self): - return os.path.join(gm.ASSET_PATH, "models/franka_allegro/franka_allegro.urdf") + return os.path.join(gm.ASSET_PATH, "models/franka/franka_allegro.urdf") @property def gripper_urdf_path(self): - return os.path.join(gm.ASSET_PATH, "models/franka_allegro/allegro_hand.urdf") + return os.path.join(gm.ASSET_PATH, "models/franka/allegro_hand.urdf") @property def disabled_collision_pairs(self): From e5ba3dba73cb1a5bd8e55fcb1e7906efe0b87821 Mon Sep 17 00:00:00 2001 From: Wensi Ai Date: Mon, 16 Oct 2023 15:04:59 -0700 Subject: [PATCH 09/37] Remove tuck/untuck for Franka --- omnigibson/robots/franka.py | 25 +------------------------ omnigibson/robots/franka_allegro.py | 25 ++----------------------- 2 files changed, 3 insertions(+), 47 deletions(-) diff --git a/omnigibson/robots/franka.py b/omnigibson/robots/franka.py index 0b1761838..c4e2f9a90 100644 --- a/omnigibson/robots/franka.py +++ b/omnigibson/robots/franka.py @@ -5,12 +5,6 @@ from omnigibson.robots.manipulation_robot import ManipulationRobot -RESET_JOINT_OPTIONS = { - "tuck", - "untuck", -} - - class FrankaPanda(ManipulationRobot): """ The Franka Emika Panda robot @@ -97,15 +91,6 @@ def __init__( kwargs (dict): Additional keyword arguments that are used for other super() calls from subclasses, allowing for flexible compositions of various object subclasses (e.g.: Robot is USDObject + ControllableObject). """ - # Parse reset joint pos if specifying special string - if isinstance(reset_joint_pos, str): - assert ( - reset_joint_pos in RESET_JOINT_OPTIONS - ), "reset_joint_pos should be one of {} if using a string!".format(RESET_JOINT_OPTIONS) - reset_joint_pos = ( - self.tucked_default_joint_pos if reset_joint_pos == "tuck" else self.untucked_default_joint_pos - ) - # Run super init super().__init__( prim_path=prim_path, @@ -135,14 +120,6 @@ def __init__( def model_name(self): return "FrankaPanda" - @property - def tucked_default_joint_pos(self): - return np.zeros(9) - - @property - def untucked_default_joint_pos(self): - return np.array([0.00, -1.3, 0.00, -2.87, 0.00, 2.00, 0.75, 0.00, 0.00]) - @property def discrete_action_list(self): # Not supported for this robot @@ -181,7 +158,7 @@ def _default_controllers(self): @property def default_joint_pos(self): - return self.untucked_default_joint_pos + return np.array([0.00, -1.3, 0.00, -2.87, 0.00, 2.00, 0.75, 0.00, 0.00]) @property def finger_lengths(self): diff --git a/omnigibson/robots/franka_allegro.py b/omnigibson/robots/franka_allegro.py index 40bf953fb..9303d313c 100644 --- a/omnigibson/robots/franka_allegro.py +++ b/omnigibson/robots/franka_allegro.py @@ -4,11 +4,6 @@ from omnigibson.macros import gm from omnigibson.robots.manipulation_robot import ManipulationRobot -RESET_JOINT_OPTIONS = { - "tuck", - "untuck", -} - class FrankaAllegro(ManipulationRobot): """ @@ -96,14 +91,6 @@ def __init__( kwargs (dict): Additional keyword arguments that are used for other super() calls from subclasses, allowing for flexible compositions of various object subclasses (e.g.: Robot is USDObject + ControllableObject). """ - # Parse reset joint pos if specifying special string - if isinstance(reset_joint_pos, str): - assert ( - reset_joint_pos in RESET_JOINT_OPTIONS - ), "reset_joint_pos should be one of {} if using a string!".format(RESET_JOINT_OPTIONS) - reset_joint_pos = ( - self.tucked_default_joint_pos if reset_joint_pos == "tuck" else self.untucked_default_joint_pos - ) # Run super init super().__init__( @@ -134,15 +121,6 @@ def __init__( def model_name(self): return "FrankaAllegro" - @property - def tucked_default_joint_pos(self): - return np.zeros(23) - - @property - def untucked_default_joint_pos(self): - # position where the hand is parallel to the ground - return np.r_[[0.86, -0.27, -0.68, -1.52, -0.18, 1.29, 1.72], np.zeros(16)] - @property def discrete_action_list(self): # Not supported for this robot @@ -187,7 +165,8 @@ def _default_controllers(self): @property def default_joint_pos(self): - return self.untucked_default_joint_pos + # position where the hand is parallel to the ground + return np.r_[[0.86, -0.27, -0.68, -1.52, -0.18, 1.29, 1.72], np.zeros(16)] @property def finger_lengths(self): From e5b619f7e0158ce1cfc9d05c2caad7662d9c84ca Mon Sep 17 00:00:00 2001 From: vince-ai Date: Mon, 16 Oct 2023 22:26:19 -0700 Subject: [PATCH 10/37] linux setup fix --- scripts/setup.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/setup.sh b/scripts/setup.sh index 238369233..0c6474f2b 100755 --- a/scripts/setup.sh +++ b/scripts/setup.sh @@ -28,7 +28,8 @@ echo -e "\nUsing $conda_name as the conda environment name\n" # Get Python version from Isaac Sim ISAAC_PYTHON_VERSION=$(${ISAAC_SIM_PATH}/python.sh -c "import platform; print(platform.python_version())") -echo Using Python version $ISAAC_PYTHON_VERSION[0m matching your current Isaac Sim version +ISAAC_PYTHON_VERSION="${ISAAC_PYTHON_VERSION##*$'\n'}" # get rid of conda activation warnings +echo Using Python version $ISAAC_PYTHON_VERSION matching your current Isaac Sim version # Create a conda environment with the appropriate python version source $(conda info --base)/etc/profile.d/conda.sh From 45672eae38abe4ded29a3d37bbe963400243be30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= Date: Tue, 17 Oct 2023 14:23:17 -0700 Subject: [PATCH 11/37] Decontainerize tests --- .github/workflows/tests.yml | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index f76955536..64ed147f2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,26 +8,7 @@ concurrency: jobs: test: - runs-on: [self-hosted, linux, gpu] - container: - image: stanfordvl/omnigibson-dev:latest - options: --gpus=all --privileged --user=root - env: - DISPLAY: "" - OMNIGIBSON_HEADLESS: 1 - volumes: - - /scr/omni-data/datasets:/data - - /usr/share/vulkan/icd.d/nvidia_icd.json:/etc/vulkan/icd.d/nvidia_icd.json - - /usr/share/vulkan/icd.d/nvidia_layers.json:/etc/vulkan/implicit_layer.d/nvidia_layers.json - - /usr/share/glvnd/egl_vendor.d/10_nvidia.json:/usr/share/glvnd/egl_vendor.d/10_nvidia.json - - /scr/omni-data/isaac-sim/cache/ov:/root/.cache/ov:rw - - /scr/omni-data/isaac-sim/cache/pip:/root/.cache/pip:rw - - /scr/omni-data/isaac-sim/cache/glcache:/root/.cache/nvidia/GLCache:rw - - /scr/omni-data/isaac-sim/cache/computecache:/root/.nv/ComputeCache:rw - - /scr/omni-data/isaac-sim/logs:/root/.nvidia-omniverse/logs:rw - - /scr/omni-data/isaac-sim/config:/root/.nvidia-omniverse/config:rw - - /scr/omni-data/isaac-sim/data:/root/.local/share/ov/data:rw - - /scr/omni-data/isaac-sim/documents:/root/Documents:rw + runs-on: [self-hosted, linux, gpu, dataset-enabled] defaults: run: From 0aee03990852ef684c75cd2613410698f49d8851 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= Date: Tue, 17 Oct 2023 15:34:45 -0700 Subject: [PATCH 12/37] Retest docker build --- .github/workflows/build-push-containers.yml | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-push-containers.yml b/.github/workflows/build-push-containers.yml index aa27c728b..6f38c197e 100644 --- a/.github/workflows/build-push-containers.yml +++ b/.github/workflows/build-push-containers.yml @@ -12,26 +12,32 @@ jobs: docker: runs-on: [self-hosted, linux, gpu] steps: + - + name: Checkout + uses: actions/checkout@v4 + - + name: Set up QEMU + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 - name: Login to NVCR - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: registry: nvcr.io username: ${{ secrets.NVCR_USERNAME }} password: ${{ secrets.NVCR_PASSWORD }} - name: Login to Docker Hub - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_PASSWORD }} - name: Metadata for dev Image id: meta-dev - uses: docker/metadata-action@v4 + uses: docker/metadata-action@v5 with: images: | stanfordvl/omnigibson-dev @@ -41,7 +47,7 @@ jobs: - name: Metadata for prod Image id: meta-prod - uses: docker/metadata-action@v4 + uses: docker/metadata-action@v5 with: images: | stanfordvl/omnigibson @@ -50,7 +56,7 @@ jobs: type=semver,pattern={{version}} - name: Build and push dev image - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v5 with: push: true tags: ${{ steps.meta-dev.outputs.tags }} @@ -60,7 +66,7 @@ jobs: cache-to: type=gha,mode=max - name: Build and push prod image - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v5 with: push: true tags: ${{ steps.meta-prod.outputs.tags }} From 02268aa9552cc5407a3010064ba81ae64b638c5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= Date: Tue, 17 Oct 2023 22:59:11 -0700 Subject: [PATCH 13/37] Switch over to 2023.1.0 containers --- .github/workflows/build-push-containers.yml | 2 +- docker/dev.Dockerfile | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build-push-containers.yml b/.github/workflows/build-push-containers.yml index 6f38c197e..ed8f783e8 100644 --- a/.github/workflows/build-push-containers.yml +++ b/.github/workflows/build-push-containers.yml @@ -10,7 +10,7 @@ on: jobs: docker: - runs-on: [self-hosted, linux, gpu] + runs-on: ubuntu-latest steps: - name: Checkout diff --git a/docker/dev.Dockerfile b/docker/dev.Dockerfile index 113889b7d..1d84d0f22 100644 --- a/docker/dev.Dockerfile +++ b/docker/dev.Dockerfile @@ -1,4 +1,4 @@ -FROM nvcr.io/nvidia/isaac-sim:2022.2.0 +FROM nvcr.io/nvidia/isaac-sim:2023.1.0 # Set up all the prerequisites. RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \ @@ -19,7 +19,7 @@ ENV OMNIGIBSON_KEY_PATH /data/omnigibson.key # Install Mamba (light conda alternative) RUN curl -Ls https://micro.mamba.pm/api/micromamba/linux-64/latest | tar -xvj -C / bin/micromamba ENV MAMBA_ROOT_PREFIX /micromamba -RUN micromamba create -n omnigibson -c conda-forge python=3.7 +RUN micromamba create -n omnigibson -c conda-forge python=3.10 RUN micromamba shell init --shell=bash --prefix=/micromamba # Make sure isaac gets properly sourced every time omnigibson gets called @@ -45,8 +45,8 @@ RUN cd /ompl/build/Release && \ micromamba run -n omnigibson cmake ../.. \ -DCMAKE_INSTALL_PREFIX="$CONDA_PREFIX" \ -DBOOST_ROOT="$CONDA_PREFIX" \ - -DPYTHON_EXEC=/micromamba/envs/omnigibson/bin/python3.7 \ - -DPYTHONPATH=/micromamba/envs/omnigibson/lib/python3.7/site-packages && \ + -DPYTHON_EXEC=/micromamba/envs/omnigibson/bin/python3.10 \ + -DPYTHONPATH=/micromamba/envs/omnigibson/lib/python3.10/site-packages && \ micromamba run -n omnigibson make -j 4 update_bindings && \ micromamba run -n omnigibson make -j 4 && \ cd py-bindings && \ From 9094eb72ede1c89d267e6eaf53d5c82dc11f222d Mon Sep 17 00:00:00 2001 From: Surav Shrestha Date: Wed, 18 Oct 2023 18:02:37 +0545 Subject: [PATCH 14/37] docs: fix typos in docs/getting_started/building_blocks.md --- docs/getting_started/building_blocks.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/getting_started/building_blocks.md b/docs/getting_started/building_blocks.md index c3fce4b21..d64c57bd8 100644 --- a/docs/getting_started/building_blocks.md +++ b/docs/getting_started/building_blocks.md @@ -11,7 +11,7 @@ icon: octicons/package-16 ??? question annotate "Why macros?" - Macros enforce global behavior that is consistent within an individual python process but can differ between processes. This is useful because globally enabling all of **`OmniGibson`**'s features can cause unecessary slowdowns, and so configuring the macros for your specific use case can optimize performance. + Macros enforce global behavior that is consistent within an individual python process but can differ between processes. This is useful because globally enabling all of **`OmniGibson`**'s features can cause unnecessary slowdowns, and so configuring the macros for your specific use case can optimize performance. For example, Omniverse provides a so-called `flatcache` feature which provides significant performance boosts, but cannot be used when fluids or soft bodies are present. So, we ideally should always have `gm.USE_FLATCACHE=True` unless we have fluids or soft bodies in our environment. @@ -407,7 +407,7 @@ python -m omnigibson.examples.object_states.particle_source_sink_demo This demo loads in a sink, which is enabled with both the ParticleSource and ParticleSink states. The sink's particle source is located at the faucet spout and spawns a continuous stream of water particles, which is then destroyed ("sunk") by the sink's particle sink located at the drain. -??? note "Difference bewteen `ParticleApplier/Removers` and `ParticleSource/Sinks`" +??? note "Difference between `ParticleApplier/Removers` and `ParticleSource/Sinks`" The key difference between `ParticleApplier/Removers` and `ParticleSource/Sinks` is that `Applier/Removers` requires contact (if using `ParticleProjectionMethod.ADJACENCY`) or overlap (if using `ParticleProjectionMethod.PROJECTION`) in order to spawn / remove particles, and generally only spawn From ad5288d8cd55a06333fddab9d427774a246fdf59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= Date: Wed, 18 Oct 2023 11:13:02 -0700 Subject: [PATCH 15/37] Remove now-unnecessary driver logic --- docker/run_docker.sh | 52 -------------------------------------------- 1 file changed, 52 deletions(-) diff --git a/docker/run_docker.sh b/docker/run_docker.sh index 146ae218c..0d596cc67 100755 --- a/docker/run_docker.sh +++ b/docker/run_docker.sh @@ -26,55 +26,6 @@ do esac done -ICD_PATH_1="/usr/share/vulkan/icd.d/nvidia_icd.json" -ICD_PATH_2="/etc/vulkan/icd.d/nvidia_icd.json" -LAYERS_PATH_1="/usr/share/vulkan/icd.d/nvidia_layers.json" -LAYERS_PATH_2="/usr/share/vulkan/implicit_layer.d/nvidia_layers.json" -LAYERS_PATH_3="/etc/vulkan/implicit_layer.d/nvidia_layers.json" -EGL_VENDOR_PATH="/usr/share/glvnd/egl_vendor.d/10_nvidia.json" - -# Find the ICD file -if [ -e "$ICD_PATH_1" ]; then - ICD_PATH=$ICD_PATH_1 -elif [ -e "$ICD_PATH_2" ]; then - ICD_PATH=$ICD_PATH_2 -else - echo "Missing nvidia_icd.json file."; - echo "Typical paths:"; - echo "- /usr/share/vulkan/icd.d/nvidia_icd.json or"; - echo "- /etc/vulkan/icd.d/nvidia_icd.json"; - echo "You can google nvidia_icd.json for your distro to find the correct path."; - echo "Consider updating your driver to 525 if you cannot find the file."; - echo "To continue update the ICD_PATH_1 at the top of the run_docker.sh file and retry"; - exit; -fi - -# Find the layers file -if [ -e "$LAYERS_PATH_1" ]; then - LAYERS_PATH=$LAYERS_PATH_1 -elif [ -e "$LAYERS_PATH_2" ]; then - LAYERS_PATH=$LAYERS_PATH_2 -elif [ -e "$LAYERS_PATH_3" ]; then - LAYERS_PATH=$LAYERS_PATH_3 -else - echo "Missing nvidia_layers.json file." - echo "Typical paths:"; - echo "- /usr/share/vulkan/icd.d/nvidia_layers.json"; - echo "- /usr/share/vulkan/implicit_layer.d/nvidia_layers.json"; - echo "- /etc/vulkan/implicit_layer.d/nvidia_layers.json"; - echo "You can google nvidia_layers.json for your distro to find the correct path."; - echo "Consider updating your driver to 525 if you cannot find the file."; - echo "To continue update the LAYERS_PATH_1 at the top of the run_docker.sh file and retry"; - exit; -fi - -if [ ! -e "$EGL_VENDOR_PATH" ]; then - echo "Missing ${EGL_VENDOR_PATH} file." - echo "(default path: /usr/share/vulkan/icd.d/nvidia_icd.json)"; - echo "To continue update the EGL_VENDOR_PATH at the top of the run_docker.sh file and retry"; - exit; -fi - # Move directories from their legacy paths. if [ -e "${DATA_PATH}/og_dataset" ]; then mv "${DATA_PATH}/og_dataset" "${DATA_PATH}/datasets/og_dataset" @@ -117,9 +68,6 @@ docker run \ -e DISPLAY=${DOCKER_DISPLAY} \ -e OMNIGIBSON_HEADLESS=${OMNIGIBSON_HEADLESS} \ -v $DATA_PATH/datasets:/data \ - -v ${ICD_PATH}:/etc/vulkan/icd.d/nvidia_icd.json \ - -v ${LAYERS_PATH}:/etc/vulkan/implicit_layer.d/nvidia_layers.json \ - -v ${EGL_VENDOR_PATH}:/usr/share/glvnd/egl_vendor.d/10_nvidia.json \ -v $DATA_PATH/isaac-sim/cache/kit:/isaac-sim/kit/cache/Kit:rw \ -v $DATA_PATH/isaac-sim/cache/ov:/root/.cache/ov:rw \ -v $DATA_PATH/isaac-sim/cache/pip:/root/.cache/pip:rw \ From 1b1988b9513f84feb84474e784619dc4564945b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= Date: Wed, 18 Oct 2023 12:01:47 -0700 Subject: [PATCH 16/37] Update particle utils with support for the 2023 version --- omnigibson/utils/deprecated_utils.py | 57 ++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 16 deletions(-) diff --git a/omnigibson/utils/deprecated_utils.py b/omnigibson/utils/deprecated_utils.py index 02bcf45d0..b4df02c6b 100644 --- a/omnigibson/utils/deprecated_utils.py +++ b/omnigibson/utils/deprecated_utils.py @@ -22,7 +22,7 @@ def __init__(self, prim_type: str, **kwargs): prim_type (str): It supports Plane/Sphere/Cone/Cylinder/Disk/Torus/Cube. kwargs: - object_origin (Gf.Vec3f): Position of mesh center. + object_origin (Gf.Vec3f): Position of mesh center in stage units. u_patches (int): The number of patches to tessellate U direction. @@ -31,7 +31,7 @@ def __init__(self, prim_type: str, **kwargs): w_patches (int): The number of patches to tessellate W direction. It only works for Cone/Cylinder/Cube. - half_scale (float): Half size of mesh. Default None. + half_scale (float): Half size of mesh in centimeters. Default is None, which means it's controlled by settings. u_verts_scale (int): Tessellation Level of U. It's a multiplier of u_patches. @@ -42,23 +42,22 @@ def __init__(self, prim_type: str, **kwargs): For Cone/Cylinder, it's to tessellate the caps. For Cube, it's to tessellate along z-axis. + above_ground (bool): It will offset the center of mesh above the ground plane if it's True, + False otherwise. It's False by default. This param only works when param object_origin is not given. + Otherwise, it will be ignored. + stage (Usd.Stage): If specified, stage to create prim on """ + self._prim_type = prim_type[0:1].upper() + prim_type[1:].lower() self._usd_context = omni.usd.get_context() self._selection = self._usd_context.get_selection() self._stage = kwargs.get("stage", self._usd_context.get_stage()) self._settings = carb.settings.get_settings() - self._prim_path = None - self._default_path = None - self._prepend_default_prim = True - if "prim_path" in kwargs and kwargs["prim_path"]: - self._default_path = Sdf.Path(kwargs["prim_path"]) - self._select_new_prim = True - if "select_new_prim" in kwargs: - self._select_new_prim = bool(kwargs["select_new_prim"]) - if "prepend_default_prim" in kwargs: - self._prepend_default_prim = bool(kwargs["prepend_default_prim"]) + self._default_path = kwargs.get("prim_path", None) + self._select_new_prim = kwargs.get("select_new_prim", True) + self._prepend_default_prim = kwargs.get("prepend_default_prim", True) + self._above_round = kwargs.get("above_ground", False) self._attributes = {**kwargs} # Supported mesh types should have an associated evaluator class @@ -66,7 +65,7 @@ def __init__(self, prim_type: str, **kwargs): assert isinstance(self._evaluator_class, type) -class Utils(OmniUtils): +class Utils2022(OmniUtils): """ Subclass that overrides a specific function within Omni's Utils class to fix a bug """ @@ -101,13 +100,39 @@ def create_material(self, name): return [material_path] +class Utils2023(OmniUtils): + def create_material(self, name): + material_url = carb.settings.get_settings().get("/exts/omni.particle.system.core/material") + + # TODO: THIS IS THE ONLY LINE WE CHANGE! "/" SHOULD BE "" + material_path = "" + default_prim = self.stage.GetDefaultPrim() + if default_prim: + material_path = default_prim.GetPath().pathString + + if not self.stage.GetPrimAtPath(material_path + "/Looks"): + self.stage.DefinePrim(material_path + "/Looks", "Scope") + material_path += "/Looks/" + name + material_path = ou.get_stage_next_free_path( + self.stage, material_path, False + ) + prim = self.stage.DefinePrim(material_path, "Material") + if material_url: + prim.GetReferences().AddReference(material_url) + else: + carb.log_error("Failed to find material URL in settings") + + return [material_path] + + class Core(OmniCore): """ Subclass that overrides a specific function within Omni's Core class to fix a bug """ def __init__(self, popup_callback: Callable[[str], None], particle_system_name: str): self._popup_callback = popup_callback - self.utils = Utils() # TODO: THIS IS THE ONLY LINE THAT WE CHANGE! ONCE FIXED, REMOVE THIS + from omnigibson.utils.sim_utils import meets_minimum_isaac_version + self.utils = Utils2023() if meets_minimum_isaac_version("2023.0.0") else Utils2022() self.context = ou.get_context() self.stage = self.context.get_stage() self.selection = self.context.get_selection() @@ -123,7 +148,7 @@ def get_compute_graph(self, selected_paths, create_new_graph=True, created_paths """ graph = None graph_paths = [path for path in selected_paths - if self.stage.GetPrimAtPath(path).GetTypeName() == "ComputeGraph"] + if self.stage.GetPrimAtPath(path).GetTypeName() in ["ComputeGraph", "OmniGraph"] ] if len(graph_paths) > 0: graph = ogc.get_graph_by_path(graph_paths[0]) @@ -131,6 +156,7 @@ def get_compute_graph(self, selected_paths, create_new_graph=True, created_paths carb.log_warn(f"Multiple ComputeGraph prims selected. Only the first will be used: {graph.get_path_to_graph()}") elif create_new_graph: # If no graph was found in the selected prims, we'll make a new graph. + # TODO: THIS IS THE ONLY LINE THAT WE CHANGE! ONCE FIXED, REMOVE THIS graph_path = Sdf.Path(f"/OmniGraph/{self.particle_system_name}").MakeAbsolutePath(Sdf.Path.absoluteRootPath) graph_path = ou.get_stage_next_free_path(self.stage, graph_path, True) @@ -159,4 +185,3 @@ def get_compute_graph(self, selected_paths, create_new_graph=True, created_paths carb.log_info(f"No ComputeGraph selected. A new graph has been created at {graph.get_path_to_graph()}") return graph - From 5668ee97d1936ecf342f69e6ffa13483ae7f3feb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= Date: Wed, 18 Oct 2023 12:33:18 -0700 Subject: [PATCH 17/37] No need for QEMU --- .github/workflows/build-push-containers.yml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/build-push-containers.yml b/.github/workflows/build-push-containers.yml index ed8f783e8..59288863f 100644 --- a/.github/workflows/build-push-containers.yml +++ b/.github/workflows/build-push-containers.yml @@ -15,9 +15,6 @@ jobs: - name: Checkout uses: actions/checkout@v4 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 From bcaf3ad80a075a4971ed6f55ebf66fbfc2cbd253 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= Date: Wed, 18 Oct 2023 13:05:11 -0700 Subject: [PATCH 18/37] Remove docker image caching --- .github/workflows/build-push-containers.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/build-push-containers.yml b/.github/workflows/build-push-containers.yml index 59288863f..7ecefc460 100644 --- a/.github/workflows/build-push-containers.yml +++ b/.github/workflows/build-push-containers.yml @@ -59,8 +59,6 @@ jobs: tags: ${{ steps.meta-dev.outputs.tags }} labels: ${{ steps.meta-dev.outputs.labels }} file: docker/dev.Dockerfile - cache-from: type=gha - cache-to: type=gha,mode=max - name: Build and push prod image uses: docker/build-push-action@v5 @@ -69,5 +67,3 @@ jobs: tags: ${{ steps.meta-prod.outputs.tags }} labels: ${{ steps.meta-prod.outputs.labels }} file: docker/prod.Dockerfile - cache-from: type=gha - cache-to: type=gha,mode=max From 44a794ca5d5b22ea215b7afb3b580ec773478c84 Mon Sep 17 00:00:00 2001 From: mj-hwang Date: Wed, 18 Oct 2023 13:18:03 -0700 Subject: [PATCH 19/37] Add an option to use external camera as additional modalities in env obs --- omnigibson/envs/env_base.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/omnigibson/envs/env_base.py b/omnigibson/envs/env_base.py index 82a25747e..715384088 100644 --- a/omnigibson/envs/env_base.py +++ b/omnigibson/envs/env_base.py @@ -11,6 +11,7 @@ from omnigibson.utils.ui_utils import create_module_logger from omnigibson.utils.python_utils import assert_valid_key, merge_nested_dicts, create_class_from_registry_and_config,\ Recreatable +from omnigibson.sensors.vision_sensor import VisionSensor # Create module logger @@ -30,6 +31,8 @@ def __init__( automatic_reset=False, flatten_action_space=False, flatten_obs_space=False, + use_external_camera=False, + external_camera_pose=None, ): """ Args: @@ -42,6 +45,8 @@ def __init__( automatic_reset (bool): whether to automatic reset after an episode finishes flatten_action_space (bool): whether to flatten the action space as a sinle 1D-array flatten_obs_space (bool): whether the observation space should be flattened when generated + use_external_camera (bool): whether to use external camera as additional modalities in observation. + external_camera_pose (iterable of lists or of n-arrays): desired position and orientation of external camera. """ # Call super first super().__init__() @@ -80,6 +85,21 @@ def __init__( # Load this environment self.load() + # Set the initial camera if required. + self.use_external_camera = use_external_camera + if use_external_camera: + self.camera = VisionSensor( + prim_path="/World/viewer_camera", + name="camera", + modalities=["rgb", "depth"], # cfg is some customized config + ) + self.camera.initialize() + if external_camera_pose is not None: + self.camera.set_position_orientation( + external_camera_pose[0], + external_camera_pose[1], + ) + def reload(self, configs, overwrite_old=True): """ Reload using another set of config file(s). @@ -346,6 +366,9 @@ def get_obs(self): # Add task observations obs["task"] = self._task.get_obs(env=self) + if self.use_external_camera: + obs["external"] = self.camera.get_obs() + # Possibly flatten obs if requested if self._flatten_obs_space: obs = recursively_generate_flat_dict(dic=obs) From fe2c0930e501f9d1d3ad0c6598ab688a6657e222 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= Date: Wed, 18 Oct 2023 13:33:20 -0700 Subject: [PATCH 20/37] Revert "Add an option to use external camera as additional modalities in env obs" This reverts commit 44a794ca5d5b22ea215b7afb3b580ec773478c84 which was pushed accidentally. --- omnigibson/envs/env_base.py | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/omnigibson/envs/env_base.py b/omnigibson/envs/env_base.py index 715384088..82a25747e 100644 --- a/omnigibson/envs/env_base.py +++ b/omnigibson/envs/env_base.py @@ -11,7 +11,6 @@ from omnigibson.utils.ui_utils import create_module_logger from omnigibson.utils.python_utils import assert_valid_key, merge_nested_dicts, create_class_from_registry_and_config,\ Recreatable -from omnigibson.sensors.vision_sensor import VisionSensor # Create module logger @@ -31,8 +30,6 @@ def __init__( automatic_reset=False, flatten_action_space=False, flatten_obs_space=False, - use_external_camera=False, - external_camera_pose=None, ): """ Args: @@ -45,8 +42,6 @@ def __init__( automatic_reset (bool): whether to automatic reset after an episode finishes flatten_action_space (bool): whether to flatten the action space as a sinle 1D-array flatten_obs_space (bool): whether the observation space should be flattened when generated - use_external_camera (bool): whether to use external camera as additional modalities in observation. - external_camera_pose (iterable of lists or of n-arrays): desired position and orientation of external camera. """ # Call super first super().__init__() @@ -85,21 +80,6 @@ def __init__( # Load this environment self.load() - # Set the initial camera if required. - self.use_external_camera = use_external_camera - if use_external_camera: - self.camera = VisionSensor( - prim_path="/World/viewer_camera", - name="camera", - modalities=["rgb", "depth"], # cfg is some customized config - ) - self.camera.initialize() - if external_camera_pose is not None: - self.camera.set_position_orientation( - external_camera_pose[0], - external_camera_pose[1], - ) - def reload(self, configs, overwrite_old=True): """ Reload using another set of config file(s). @@ -366,9 +346,6 @@ def get_obs(self): # Add task observations obs["task"] = self._task.get_obs(env=self) - if self.use_external_camera: - obs["external"] = self.camera.get_obs() - # Possibly flatten obs if requested if self._flatten_obs_space: obs = recursively_generate_flat_dict(dic=obs) From 611eda8b152533404683958b206c58a7c2b1d860 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= Date: Wed, 18 Oct 2023 13:35:45 -0700 Subject: [PATCH 21/37] Try to avoid space limitations on Docker build --- .github/workflows/build-push-containers.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/.github/workflows/build-push-containers.yml b/.github/workflows/build-push-containers.yml index 7ecefc460..8190b7f49 100644 --- a/.github/workflows/build-push-containers.yml +++ b/.github/workflows/build-push-containers.yml @@ -12,6 +12,13 @@ jobs: docker: runs-on: ubuntu-latest steps: + - name: Maximize build space + uses: easimon/maximize-build-space@master + with: + remove-dotnet: 'true' + remove-android: 'true' + remove-haskell: 'true' + remove-codeql: 'true' - name: Checkout uses: actions/checkout@v4 @@ -59,6 +66,8 @@ jobs: tags: ${{ steps.meta-dev.outputs.tags }} labels: ${{ steps.meta-dev.outputs.labels }} file: docker/dev.Dockerfile + cache-from: type=gha + cache-to: type=gha,mode=max - name: Build and push prod image uses: docker/build-push-action@v5 @@ -67,3 +76,5 @@ jobs: tags: ${{ steps.meta-prod.outputs.tags }} labels: ${{ steps.meta-prod.outputs.labels }} file: docker/prod.Dockerfile + cache-from: type=gha + cache-to: type=gha,mode=max From 41810f99ac1ccf2c3b1938bfb83b19ea486db580 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= Date: Wed, 18 Oct 2023 16:04:00 -0700 Subject: [PATCH 22/37] Switch to buildah for Docker builds --- .github/workflows/build-push-containers.yml | 43 ++++++++++++--------- 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/.github/workflows/build-push-containers.yml b/.github/workflows/build-push-containers.yml index 8190b7f49..f883d3a5c 100644 --- a/.github/workflows/build-push-containers.yml +++ b/.github/workflows/build-push-containers.yml @@ -10,32 +10,23 @@ on: jobs: docker: - runs-on: ubuntu-latest + runs-on: [self-hosted, linux] steps: - - name: Maximize build space - uses: easimon/maximize-build-space@master - with: - remove-dotnet: 'true' - remove-android: 'true' - remove-haskell: 'true' - remove-codeql: 'true' - name: Checkout uses: actions/checkout@v4 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - name: Login to NVCR - uses: docker/login-action@v3 + uses: redhat-actions/podman-login@v1 with: registry: nvcr.io username: ${{ secrets.NVCR_USERNAME }} password: ${{ secrets.NVCR_PASSWORD }} - name: Login to Docker Hub - uses: docker/login-action@v3 + uses: redhat-actions/podman-login@v1 with: + registry: docker.io username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_PASSWORD }} - @@ -59,17 +50,19 @@ jobs: type=ref,event=branch type=semver,pattern={{version}} - - name: Build and push dev image - uses: docker/build-push-action@v5 + name: Build dev image + id: build-dev + uses: redhat-actions/buildah-build@v2 with: - push: true + image: stanfordvl/omnigibson-dev tags: ${{ steps.meta-dev.outputs.tags }} labels: ${{ steps.meta-dev.outputs.labels }} - file: docker/dev.Dockerfile + containerfiles: docker/dev.Dockerfile cache-from: type=gha cache-to: type=gha,mode=max - - name: Build and push prod image + name: Build prod image + id: build-prod uses: docker/build-push-action@v5 with: push: true @@ -78,3 +71,17 @@ jobs: file: docker/prod.Dockerfile cache-from: type=gha cache-to: type=gha,mode=max + - + name: Push dev image + uses: redhat-actions/push-to-registry@v2 + with: + image: ${{ steps.build-dev.outputs.image }} + tags: ${{ steps.build-dev.outputs.tags }} + registry: docker.io + - + name: Push prod image + uses: redhat-actions/push-to-registry@v2 + with: + image: ${{ steps.build-prod.outputs.image }} + tags: ${{ steps.build-prod.outputs.tags }} + registry: docker.io \ No newline at end of file From a8797ba5b3031211677ffedc14e55810fd49bc6f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= Date: Wed, 18 Oct 2023 16:21:43 -0700 Subject: [PATCH 23/37] Back to GH-hosted --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 64ed147f2..0aebd96e9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,7 +8,7 @@ concurrency: jobs: test: - runs-on: [self-hosted, linux, gpu, dataset-enabled] + runs-on: ubuntu-latest # [self-hosted, linux, gpu, dataset-enabled] defaults: run: From d44374798bfead61f0e07a3399ed11a43faf1c16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= Date: Wed, 18 Oct 2023 16:25:32 -0700 Subject: [PATCH 24/37] Fix changed runner config for wrong image --- .github/workflows/build-push-containers.yml | 2 +- .github/workflows/tests.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-push-containers.yml b/.github/workflows/build-push-containers.yml index f883d3a5c..e41d145b9 100644 --- a/.github/workflows/build-push-containers.yml +++ b/.github/workflows/build-push-containers.yml @@ -10,7 +10,7 @@ on: jobs: docker: - runs-on: [self-hosted, linux] + runs-on: ubuntu-latest # [self-hosted, linux] steps: - name: Checkout diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 0aebd96e9..64ed147f2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,7 +8,7 @@ concurrency: jobs: test: - runs-on: ubuntu-latest # [self-hosted, linux, gpu, dataset-enabled] + runs-on: [self-hosted, linux, gpu, dataset-enabled] defaults: run: From e245884bdff770ece9718f99904fec918e0e945a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= Date: Wed, 18 Oct 2023 17:22:42 -0700 Subject: [PATCH 25/37] Set auth file path --- .github/workflows/build-push-containers.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-push-containers.yml b/.github/workflows/build-push-containers.yml index e41d145b9..468e757e7 100644 --- a/.github/workflows/build-push-containers.yml +++ b/.github/workflows/build-push-containers.yml @@ -10,7 +10,7 @@ on: jobs: docker: - runs-on: ubuntu-latest # [self-hosted, linux] + runs-on: [self-hosted, linux] steps: - name: Checkout @@ -19,6 +19,7 @@ jobs: name: Login to NVCR uses: redhat-actions/podman-login@v1 with: + auth_file_path: /run/containers/0/auth.json registry: nvcr.io username: ${{ secrets.NVCR_USERNAME }} password: ${{ secrets.NVCR_PASSWORD }} @@ -26,6 +27,7 @@ jobs: name: Login to Docker Hub uses: redhat-actions/podman-login@v1 with: + auth_file_path: /run/containers/0/auth.json registry: docker.io username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_PASSWORD }} @@ -58,19 +60,15 @@ jobs: tags: ${{ steps.meta-dev.outputs.tags }} labels: ${{ steps.meta-dev.outputs.labels }} containerfiles: docker/dev.Dockerfile - cache-from: type=gha - cache-to: type=gha,mode=max - name: Build prod image id: build-prod uses: docker/build-push-action@v5 with: - push: true + image: stanfordvl/omnigibson tags: ${{ steps.meta-prod.outputs.tags }} labels: ${{ steps.meta-prod.outputs.labels }} - file: docker/prod.Dockerfile - cache-from: type=gha - cache-to: type=gha,mode=max + containerfiles: docker/prod.Dockerfile - name: Push dev image uses: redhat-actions/push-to-registry@v2 From c19b28b771450148110dcda551c90a14808258c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= Date: Wed, 18 Oct 2023 17:24:31 -0700 Subject: [PATCH 26/37] Make docker config dir --- .github/workflows/build-push-containers.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/build-push-containers.yml b/.github/workflows/build-push-containers.yml index 468e757e7..1cb7ae913 100644 --- a/.github/workflows/build-push-containers.yml +++ b/.github/workflows/build-push-containers.yml @@ -15,6 +15,9 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - + name: Make docker dir + run: mkdir /root/.docker - name: Login to NVCR uses: redhat-actions/podman-login@v1 From 8936ad04354b494d3ef1b72454e7d32468c636f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= Date: Wed, 18 Oct 2023 17:28:48 -0700 Subject: [PATCH 27/37] Make dummy docker config file --- .github/workflows/build-push-containers.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-push-containers.yml b/.github/workflows/build-push-containers.yml index 1cb7ae913..74d2ee69a 100644 --- a/.github/workflows/build-push-containers.yml +++ b/.github/workflows/build-push-containers.yml @@ -16,8 +16,8 @@ jobs: name: Checkout uses: actions/checkout@v4 - - name: Make docker dir - run: mkdir /root/.docker + name: Make dummy docker config file + run: touch /root/.docker/config.json - name: Login to NVCR uses: redhat-actions/podman-login@v1 From 0599f08f51862a2226672757d930c16250016aa2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= Date: Wed, 18 Oct 2023 17:29:52 -0700 Subject: [PATCH 28/37] Fix dummy docker config --- .github/workflows/build-push-containers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-push-containers.yml b/.github/workflows/build-push-containers.yml index 74d2ee69a..a8f7ada40 100644 --- a/.github/workflows/build-push-containers.yml +++ b/.github/workflows/build-push-containers.yml @@ -17,7 +17,7 @@ jobs: uses: actions/checkout@v4 - name: Make dummy docker config file - run: touch /root/.docker/config.json + run: echo '{}' > /root/.docker/config.json - name: Login to NVCR uses: redhat-actions/podman-login@v1 From 11e7424a35a229fd40acabf2f8775acbe773637c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= Date: Wed, 18 Oct 2023 17:32:27 -0700 Subject: [PATCH 29/37] Remove the docker config dir instead of trying to fix it --- .github/workflows/build-push-containers.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-push-containers.yml b/.github/workflows/build-push-containers.yml index a8f7ada40..88f0557f4 100644 --- a/.github/workflows/build-push-containers.yml +++ b/.github/workflows/build-push-containers.yml @@ -16,8 +16,8 @@ jobs: name: Checkout uses: actions/checkout@v4 - - name: Make dummy docker config file - run: echo '{}' > /root/.docker/config.json + name: Remove docker configs + run: rm -rf /root/.docker - name: Login to NVCR uses: redhat-actions/podman-login@v1 From b10f8070619830ff6cbbd2729f19972d8b371edd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= Date: Wed, 18 Oct 2023 17:43:06 -0700 Subject: [PATCH 30/37] Use mock docker config file --- .github/workflows/build-push-containers.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-push-containers.yml b/.github/workflows/build-push-containers.yml index 88f0557f4..610b1a30f 100644 --- a/.github/workflows/build-push-containers.yml +++ b/.github/workflows/build-push-containers.yml @@ -17,7 +17,8 @@ jobs: uses: actions/checkout@v4 - name: Remove docker configs - run: rm -rf /root/.docker + run: | + echo '{"auths": {}}' > /root/.docker/config.json - name: Login to NVCR uses: redhat-actions/podman-login@v1 From 17dbf5a49ae31181179d89e0a0d89484152c46b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= Date: Wed, 18 Oct 2023 17:44:05 -0700 Subject: [PATCH 31/37] Make the directory first --- .github/workflows/build-push-containers.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-push-containers.yml b/.github/workflows/build-push-containers.yml index 610b1a30f..19ab51546 100644 --- a/.github/workflows/build-push-containers.yml +++ b/.github/workflows/build-push-containers.yml @@ -18,7 +18,7 @@ jobs: - name: Remove docker configs run: | - echo '{"auths": {}}' > /root/.docker/config.json + mkdir /root/.docker && echo '{"auths": {}}' > /root/.docker/config.json - name: Login to NVCR uses: redhat-actions/podman-login@v1 From 03055becd6c86d5bf5b3129bda3bdf3c133302ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= Date: Wed, 18 Oct 2023 17:55:39 -0700 Subject: [PATCH 32/37] Pre-clean disk space --- .github/workflows/build-push-containers.yml | 46 +++++++++++++++++---- 1 file changed, 39 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build-push-containers.yml b/.github/workflows/build-push-containers.yml index 19ab51546..42a14a92c 100644 --- a/.github/workflows/build-push-containers.yml +++ b/.github/workflows/build-push-containers.yml @@ -10,20 +10,53 @@ on: jobs: docker: - runs-on: [self-hosted, linux] + runs-on: ubuntu-latest steps: + - + name: Check disk space + run: df . -h + - + name: Free disk space + run: | + sudo docker rmi $(docker image ls -aq) >/dev/null 2>&1 || true + sudo rm -rf \ + /usr/share/dotnet /usr/local/lib/android /opt/ghc \ + /usr/local/share/powershell /usr/share/swift /usr/local/.ghcup \ + /usr/lib/jvm || true + echo "some directories deleted" + sudo apt install aptitude -y >/dev/null 2>&1 + sudo aptitude purge aria2 ansible azure-cli shellcheck rpm xorriso zsync \ + esl-erlang firefox gfortran-8 gfortran-9 google-chrome-stable \ + google-cloud-sdk imagemagick \ + libmagickcore-dev libmagickwand-dev libmagic-dev ant ant-optional kubectl \ + mercurial apt-transport-https mono-complete libmysqlclient \ + unixodbc-dev yarn chrpath libssl-dev libxft-dev \ + libfreetype6 libfreetype6-dev libfontconfig1 libfontconfig1-dev \ + snmp pollinate libpq-dev postgresql-client powershell ruby-full \ + sphinxsearch subversion mongodb-org azure-cli microsoft-edge-stable \ + -y -f >/dev/null 2>&1 + sudo aptitude purge google-cloud-sdk -f -y >/dev/null 2>&1 + sudo aptitude purge microsoft-edge-stable -f -y >/dev/null 2>&1 || true + sudo apt purge microsoft-edge-stable -f -y >/dev/null 2>&1 || true + sudo aptitude purge '~n ^mysql' -f -y >/dev/null 2>&1 + sudo aptitude purge '~n ^php' -f -y >/dev/null 2>&1 + sudo aptitude purge '~n ^dotnet' -f -y >/dev/null 2>&1 + sudo apt-get autoremove -y >/dev/null 2>&1 + sudo apt-get autoclean -y >/dev/null 2>&1 + echo "some packages purged" + - + name: Check disk space + run: | + sudo dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -nr | head + df . -h + sudo du /usr/ -hx -d 4 --threshold=1G | sort -hr | head - name: Checkout uses: actions/checkout@v4 - - - name: Remove docker configs - run: | - mkdir /root/.docker && echo '{"auths": {}}' > /root/.docker/config.json - name: Login to NVCR uses: redhat-actions/podman-login@v1 with: - auth_file_path: /run/containers/0/auth.json registry: nvcr.io username: ${{ secrets.NVCR_USERNAME }} password: ${{ secrets.NVCR_PASSWORD }} @@ -31,7 +64,6 @@ jobs: name: Login to Docker Hub uses: redhat-actions/podman-login@v1 with: - auth_file_path: /run/containers/0/auth.json registry: docker.io username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_PASSWORD }} From 161bed0cdc81a13178dd9f529d48fb7a17f40074 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= Date: Wed, 18 Oct 2023 17:59:53 -0700 Subject: [PATCH 33/37] No need to be very precise about disk space reporting --- .github/workflows/build-push-containers.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build-push-containers.yml b/.github/workflows/build-push-containers.yml index 42a14a92c..ac61d9935 100644 --- a/.github/workflows/build-push-containers.yml +++ b/.github/workflows/build-push-containers.yml @@ -47,9 +47,7 @@ jobs: - name: Check disk space run: | - sudo dpkg-query -Wf '${Installed-Size}\t${Package}\n' | sort -nr | head df . -h - sudo du /usr/ -hx -d 4 --threshold=1G | sort -hr | head - name: Checkout uses: actions/checkout@v4 From e1f6c1ec4ba0c9d5293f2295fc279d1ace614665 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cem=20G=C3=B6kmen?= Date: Wed, 18 Oct 2023 18:11:00 -0700 Subject: [PATCH 34/37] Back to docker instead of podman --- .github/workflows/build-push-containers.yml | 42 ++++++++------------- 1 file changed, 16 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build-push-containers.yml b/.github/workflows/build-push-containers.yml index ac61d9935..b11f9b9a9 100644 --- a/.github/workflows/build-push-containers.yml +++ b/.github/workflows/build-push-containers.yml @@ -51,18 +51,20 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - name: Login to NVCR - uses: redhat-actions/podman-login@v1 + uses: docker/login-action@v3 with: registry: nvcr.io username: ${{ secrets.NVCR_USERNAME }} password: ${{ secrets.NVCR_PASSWORD }} - name: Login to Docker Hub - uses: redhat-actions/podman-login@v1 + uses: docker/login-action@v3 with: - registry: docker.io username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_PASSWORD }} - @@ -86,34 +88,22 @@ jobs: type=ref,event=branch type=semver,pattern={{version}} - - name: Build dev image - id: build-dev - uses: redhat-actions/buildah-build@v2 + name: Build and push dev image + uses: docker/build-push-action@v5 with: - image: stanfordvl/omnigibson-dev + push: true tags: ${{ steps.meta-dev.outputs.tags }} labels: ${{ steps.meta-dev.outputs.labels }} - containerfiles: docker/dev.Dockerfile + file: docker/dev.Dockerfile + cache-from: type=gha + cache-to: type=gha,mode=max - - name: Build prod image - id: build-prod + name: Build and push prod image uses: docker/build-push-action@v5 with: - image: stanfordvl/omnigibson + push: true tags: ${{ steps.meta-prod.outputs.tags }} labels: ${{ steps.meta-prod.outputs.labels }} - containerfiles: docker/prod.Dockerfile - - - name: Push dev image - uses: redhat-actions/push-to-registry@v2 - with: - image: ${{ steps.build-dev.outputs.image }} - tags: ${{ steps.build-dev.outputs.tags }} - registry: docker.io - - - name: Push prod image - uses: redhat-actions/push-to-registry@v2 - with: - image: ${{ steps.build-prod.outputs.image }} - tags: ${{ steps.build-prod.outputs.tags }} - registry: docker.io \ No newline at end of file + file: docker/prod.Dockerfile + cache-from: type=gha + cache-to: type=gha,mode=max \ No newline at end of file From 1cbc141902d31e13056ec7059107a6350fa416e5 Mon Sep 17 00:00:00 2001 From: Minjune Hwang Date: Sun, 22 Oct 2023 15:38:25 -0700 Subject: [PATCH 35/37] Update the IK Solver acccording to the lula update in 2023.1.0 --- omnigibson/utils/control_utils.py | 74 ------------------------------- 1 file changed, 74 deletions(-) delete mode 100644 omnigibson/utils/control_utils.py diff --git a/omnigibson/utils/control_utils.py b/omnigibson/utils/control_utils.py deleted file mode 100644 index ed68ee8dc..000000000 --- a/omnigibson/utils/control_utils.py +++ /dev/null @@ -1,74 +0,0 @@ -""" -Set of utilities for helping to execute robot control -""" -import lula -import numpy as np -import omnigibson.utils.transform_utils as T - - -class IKSolver: - """ - Class for thinly wrapping Lula IK solver - """ - - def __init__( - self, - robot_description_path, - robot_urdf_path, - eef_name, - default_joint_pos, - ): - # Create robot description, kinematics, and config - self.robot_description = lula.load_robot(robot_description_path, robot_urdf_path) - self.kinematics = self.robot_description.kinematics() - self.config = lula.CyclicCoordDescentIkConfig() - self.eef_name = eef_name - self.default_joint_pos = default_joint_pos - - def solve( - self, - target_pos, - target_quat=None, - tolerance_pos=0.002, - tolerance_quat=0.01, - weight_pos=1.0, - weight_quat=0.05, - max_iterations=150, - initial_joint_pos=None, - ): - """ - Backs out joint positions to achieve desired @target_pos and @target_quat - - Args: - target_pos (3-array): desired (x,y,z) local target cartesian position in robot's base coordinate frame - target_quat (4-array or None): If specified, desired (x,y,z,w) local target quaternion orientation in - robot's base coordinate frame. If None, IK will be position-only (will override settings such that - orientation's tolerance is very high and weight is 0) - tolerance_pos (float): Maximum position error (L2-norm) for a successful IK solution - tolerance_quat (float): Maximum orientation error (per-axis L2-norm) for a successful IK solution - weight_pos (float): Weight for the relative importance of position error during CCD - weight_quat (float): Weight for the relative importance of position error during CCD - max_iterations (int): Number of iterations used for each cyclic coordinate descent. - initial_joint_pos (None or n-array): If specified, will set the initial cspace seed when solving for joint - positions. Otherwise, will use self.default_joint_pos - - Returns: - None or n-array: Joint positions for reaching desired target_pos and target_quat, otherwise None if no - solution was found - """ - pos = np.array(target_pos, dtype=np.float64).reshape(3, 1) - rot = np.array(T.quat2mat(np.array([0, 0, 0, 1.0]) if target_quat is None else target_quat), dtype=np.float64) - ik_target_pose = lula.Pose3(lula.Rotation3(rot), pos) - - # Set the cspace seed and tolerance - initial_joint_pos = self.default_joint_pos if initial_joint_pos is None else np.array(initial_joint_pos) - self.config.cspace_seeds = [initial_joint_pos] - self.config.position_tolerance = tolerance_pos - self.config.orientation_tolerance = 100.0 if target_quat is None else tolerance_quat - self.config.position_weight = weight_pos - self.config.orientation_weight = 0.0 if target_quat is None else weight_quat - self.config.max_iterations_per_descent = max_iterations - - # Compute target joint positions - ik_results = lula.compute_ik_ccd(self.kinematics, ik_target_pose, self.eef_name, self.config) - return np.array(ik_results.cspace_position) From f5344f8bdafe790d9d9c9acd7a29db15fd644a2f Mon Sep 17 00:00:00 2001 From: Minjune Hwang Date: Mon, 23 Oct 2023 14:43:14 -0700 Subject: [PATCH 36/37] Add the IK Solver file for 2023.1.0 --- omnigibson/utils/control_utils.py | 74 +++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 omnigibson/utils/control_utils.py diff --git a/omnigibson/utils/control_utils.py b/omnigibson/utils/control_utils.py new file mode 100644 index 000000000..8790ed03e --- /dev/null +++ b/omnigibson/utils/control_utils.py @@ -0,0 +1,74 @@ +""" +Set of utilities for helping to execute robot control +""" +import lula +import numpy as np +import omnigibson.utils.transform_utils as T + + +class IKSolver: + """ + Class for thinly wrapping Lula IK solver + """ + + def __init__( + self, + robot_description_path, + robot_urdf_path, + eef_name, + default_joint_pos, + ): + # Create robot description, kinematics, and config + self.robot_description = lula.load_robot(robot_description_path, robot_urdf_path) + self.kinematics = self.robot_description.kinematics() + self.config = lula.CyclicCoordDescentIkConfig() + self.eef_name = eef_name + self.default_joint_pos = default_joint_pos + + def solve( + self, + target_pos, + target_quat=None, + tolerance_pos=0.002, + tolerance_quat=0.01, + weight_pos=1.0, + weight_quat=0.05, + max_iterations=150, + initial_joint_pos=None, + ): + """ + Backs out joint positions to achieve desired @target_pos and @target_quat + + Args: + target_pos (3-array): desired (x,y,z) local target cartesian position in robot's base coordinate frame + target_quat (4-array or None): If specified, desired (x,y,z,w) local target quaternion orientation in + robot's base coordinate frame. If None, IK will be position-only (will override settings such that + orientation's tolerance is very high and weight is 0) + tolerance_pos (float): Maximum position error (L2-norm) for a successful IK solution + tolerance_quat (float): Maximum orientation error (per-axis L2-norm) for a successful IK solution + weight_pos (float): Weight for the relative importance of position error during CCD + weight_quat (float): Weight for the relative importance of position error during CCD + max_iterations (int): Number of iterations used for each cyclic coordinate descent. + initial_joint_pos (None or n-array): If specified, will set the initial cspace seed when solving for joint + positions. Otherwise, will use self.default_joint_pos + + Returns: + None or n-array: Joint positions for reaching desired target_pos and target_quat, otherwise None if no + solution was found + """ + pos = np.array(target_pos, dtype=np.float64).reshape(3, 1) + rot = np.array(T.quat2mat(np.array([0, 0, 0, 1.0]) if target_quat is None else target_quat), dtype=np.float64) + ik_target_pose = lula.Pose3(lula.Rotation3(rot), pos) + + # Set the cspace seed and tolerance + initial_joint_pos = self.default_joint_pos if initial_joint_pos is None else np.array(initial_joint_pos) + self.config.cspace_seeds = [initial_joint_pos] + self.config.position_tolerance = tolerance_pos + self.config.orientation_tolerance = 100.0 if target_quat is None else tolerance_quat + self.config.ccd_position_weight = weight_pos + self.config.ccd_orientation_weight = 0.0 if target_quat is None else weight_quat + self.config.max_num_descents = max_iterations + + # Compute target joint positions + ik_results = lula.compute_ik_ccd(self.kinematics, ik_target_pose, self.eef_name, self.config) + return np.array(ik_results.cspace_position) From be8c9bdf132d3306aa4352bfed6ac0ee6ff8669f Mon Sep 17 00:00:00 2001 From: Minjune Hwang Date: Tue, 24 Oct 2023 00:58:49 -0700 Subject: [PATCH 37/37] add version check in IK solver to support old versions --- omnigibson/utils/control_utils.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/omnigibson/utils/control_utils.py b/omnigibson/utils/control_utils.py index 8790ed03e..fac1ec4d0 100644 --- a/omnigibson/utils/control_utils.py +++ b/omnigibson/utils/control_utils.py @@ -4,6 +4,7 @@ import lula import numpy as np import omnigibson.utils.transform_utils as T +from omnigibson.utils.sim_utils import meets_minimum_isaac_version class IKSolver: @@ -65,9 +66,15 @@ def solve( self.config.cspace_seeds = [initial_joint_pos] self.config.position_tolerance = tolerance_pos self.config.orientation_tolerance = 100.0 if target_quat is None else tolerance_quat - self.config.ccd_position_weight = weight_pos - self.config.ccd_orientation_weight = 0.0 if target_quat is None else weight_quat - self.config.max_num_descents = max_iterations + + if meets_minimum_isaac_version("2023.0.0"): + self.config.ccd_position_weight = weight_pos + self.config.ccd_orientation_weight = 0.0 if target_quat is None else weight_quat + self.config.max_num_descents = max_iterations + else: + self.config.position_weight = weight_pos + self.config.orientation_weight = 0.0 if target_quat is None else weight_quat + self.config.max_iterations_per_descent = max_iterations # Compute target joint positions ik_results = lula.compute_ik_ccd(self.kinematics, ik_target_pose, self.eef_name, self.config)