diff --git a/omnigibson/__init__.py b/omnigibson/__init__.py index 32c474e044..dd99f15089 100644 --- a/omnigibson/__init__.py +++ b/omnigibson/__init__.py @@ -1,21 +1,21 @@ +import builtins import logging import os import shutil import signal import tempfile -import builtins + +from omnigibson.controllers import REGISTERED_CONTROLLERS +from omnigibson.envs import Environment # TODO: Need to fix somehow -- omnigibson gets imported first BEFORE we can actually modify the macros from omnigibson.macros import gm - -from omnigibson.envs import Environment -from omnigibson.scenes import REGISTERED_SCENES from omnigibson.objects import REGISTERED_OBJECTS from omnigibson.robots import REGISTERED_ROBOTS -from omnigibson.controllers import REGISTERED_CONTROLLERS -from omnigibson.tasks import REGISTERED_TASKS +from omnigibson.scenes import REGISTERED_SCENES from omnigibson.sensors import ALL_SENSOR_MODALITIES from omnigibson.simulator import launch_simulator as launch +from omnigibson.tasks import REGISTERED_TASKS # Create logger logging.basicConfig(format='[%(levelname)s] [%(name)s] %(message)s') @@ -27,6 +27,7 @@ # Always enable nest_asyncio because MaterialPrim calls asyncio.run() import nest_asyncio + nest_asyncio.apply() __version__ = "1.0.0" diff --git a/omnigibson/action_primitives/action_primitive_set_base.py b/omnigibson/action_primitives/action_primitive_set_base.py index 9d842514a2..e6ae318f28 100644 --- a/omnigibson/action_primitives/action_primitive_set_base.py +++ b/omnigibson/action_primitives/action_primitive_set_base.py @@ -4,8 +4,8 @@ from typing import List from future.utils import with_metaclass -from omnigibson import Environment +from omnigibson import Environment from omnigibson.robots import BaseRobot from omnigibson.scenes.interactive_traversable_scene import InteractiveTraversableScene from omnigibson.tasks.task_base import BaseTask diff --git a/omnigibson/action_primitives/starter_semantic_action_primitives.py b/omnigibson/action_primitives/starter_semantic_action_primitives.py index 9058c822c1..1a429c1e7d 100644 --- a/omnigibson/action_primitives/starter_semantic_action_primitives.py +++ b/omnigibson/action_primitives/starter_semantic_action_primitives.py @@ -5,50 +5,47 @@ See provided tiago_primitives.yaml config file for an example. See examples/action_primitives for runnable examples. """ -from functools import cached_property import inspect import logging import random -from aenum import IntEnum, auto +from functools import cached_property from math import ceil -import cv2 -from matplotlib import pyplot as plt +import cv2 import gym import numpy as np +from aenum import IntEnum, auto +from matplotlib import pyplot as plt from scipy.spatial.transform import Rotation, Slerp import omnigibson as og import omnigibson.lazy as lazy +import omnigibson.utils.transform_utils as T from omnigibson import object_states -from omnigibson.action_primitives.action_primitive_set_base import ActionPrimitiveError, ActionPrimitiveErrorGroup, BaseActionPrimitiveSet -from omnigibson.controllers import JointController, DifferentialDriveController +from omnigibson.action_primitives.action_primitive_set_base import ( + ActionPrimitiveError, + ActionPrimitiveErrorGroup, + BaseActionPrimitiveSet, +) +from omnigibson.controllers import DifferentialDriveController, JointController +from omnigibson.controllers.controller_base import ControlType from omnigibson.macros import create_module_macros -from omnigibson.utils.object_state_utils import sample_cuboid_for_predicate from omnigibson.objects.object_base import BaseObject +from omnigibson.objects.usd_object import USDObject from omnigibson.robots import BaseRobot, Fetch, Tiago from omnigibson.tasks.behavior_task import BehaviorTask +from omnigibson.utils.control_utils import FKSolver, IKSolver +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 ( - plan_base_motion, + detect_robot_collision_in_sim, plan_arm_motion, plan_arm_motion_ik, + plan_base_motion, set_base_and_detect_collision, - detect_robot_collision_in_sim -) - -import omnigibson.utils.transform_utils as T -from omnigibson.utils.control_utils import IKSolver -from omnigibson.utils.grasping_planning_utils import ( - get_grasp_poses_for_object_sticky, - get_grasp_position_for_open ) -from omnigibson.controllers.controller_base import ControlType -from omnigibson.utils.control_utils import FKSolver - +from omnigibson.utils.object_state_utils import sample_cuboid_for_predicate from omnigibson.utils.ui_utils import create_module_logger -from omnigibson.objects.usd_object import USDObject - m = create_module_macros(module_path=__file__) m.DEFAULT_BODY_OFFSET_FROM_FLOOR = 0.05 diff --git a/omnigibson/action_primitives/symbolic_semantic_action_primitives.py b/omnigibson/action_primitives/symbolic_semantic_action_primitives.py index 8e74428455..6a135cb25a 100644 --- a/omnigibson/action_primitives/symbolic_semantic_action_primitives.py +++ b/omnigibson/action_primitives/symbolic_semantic_action_primitives.py @@ -4,17 +4,16 @@ objects directly into their post-condition states. Useful for learning high-level methods. """ -from aenum import IntEnum, auto - import numpy as np -from omnigibson.robots.robot_base import BaseRobot -from omnigibson.systems.system_base import REGISTERED_SYSTEMS -from omnigibson.transition_rules import REGISTERED_RULES, TransitionRuleAPI +from aenum import IntEnum, auto from omnigibson import object_states from omnigibson.action_primitives.action_primitive_set_base import ActionPrimitiveError, ActionPrimitiveErrorGroup from omnigibson.action_primitives.starter_semantic_action_primitives import StarterSemanticActionPrimitives from omnigibson.objects import DatasetObject +from omnigibson.robots.robot_base import BaseRobot +from omnigibson.systems.system_base import REGISTERED_SYSTEMS +from omnigibson.transition_rules import REGISTERED_RULES, TransitionRuleAPI class SymbolicSemanticActionPrimitiveSet(IntEnum): diff --git a/omnigibson/controllers/__init__.py b/omnigibson/controllers/__init__.py index 7cdcb65b03..a56c7c54b0 100644 --- a/omnigibson/controllers/__init__.py +++ b/omnigibson/controllers/__init__.py @@ -2,18 +2,18 @@ REGISTERED_CONTROLLERS, REGISTERED_LOCOMOTION_CONTROLLERS, REGISTERED_MANIPULATION_CONTROLLERS, - IsGraspingState, ControlType, + GripperController, + IsGraspingState, LocomotionController, ManipulationController, - GripperController, ) from omnigibson.controllers.dd_controller import DifferentialDriveController -from omnigibson.controllers.osc_controller import OperationalSpaceController from omnigibson.controllers.ik_controller import InverseKinematicsController from omnigibson.controllers.joint_controller import JointController from omnigibson.controllers.multi_finger_gripper_controller import MultiFingerGripperController from omnigibson.controllers.null_joint_controller import NullJointController +from omnigibson.controllers.osc_controller import OperationalSpaceController from omnigibson.utils.python_utils import assert_valid_key diff --git a/omnigibson/controllers/controller_base.py b/omnigibson/controllers/controller_base.py index b90a56dbaa..1d5a95aa70 100644 --- a/omnigibson/controllers/controller_base.py +++ b/omnigibson/controllers/controller_base.py @@ -3,7 +3,7 @@ import numpy as np -from omnigibson.utils.python_utils import classproperty, assert_valid_key, Serializable, Registerable, Recreatable +from omnigibson.utils.python_utils import Recreatable, Registerable, Serializable, assert_valid_key, classproperty # Global dicts that will contain mappings REGISTERED_CONTROLLERS = dict() diff --git a/omnigibson/controllers/ik_controller.py b/omnigibson/controllers/ik_controller.py index 88f5538909..0c5758f709 100644 --- a/omnigibson/controllers/ik_controller.py +++ b/omnigibson/controllers/ik_controller.py @@ -1,11 +1,11 @@ import numpy as np -from omnigibson.macros import gm, create_module_macros import omnigibson.utils.transform_utils as T from omnigibson.controllers import ControlType, ManipulationController from omnigibson.controllers.joint_controller import JointController -from omnigibson.utils.processing_utils import MovingAverageFilter +from omnigibson.macros import create_module_macros, gm from omnigibson.utils.control_utils import IKSolver +from omnigibson.utils.processing_utils import MovingAverageFilter from omnigibson.utils.python_utils import assert_valid_key from omnigibson.utils.ui_utils import create_module_logger diff --git a/omnigibson/controllers/joint_controller.py b/omnigibson/controllers/joint_controller.py index 13a6554693..d117901a05 100644 --- a/omnigibson/controllers/joint_controller.py +++ b/omnigibson/controllers/joint_controller.py @@ -1,11 +1,15 @@ import numpy as np -from omnigibson.controllers import IsGraspingState, ControlType, LocomotionController, ManipulationController, \ - GripperController -from omnigibson.utils.python_utils import assert_valid_key import omnigibson.utils.transform_utils as T - +from omnigibson.controllers import ( + ControlType, + GripperController, + IsGraspingState, + LocomotionController, + ManipulationController, +) from omnigibson.macros import create_module_macros +from omnigibson.utils.python_utils import assert_valid_key # Create settings for this module m = create_module_macros(module_path=__file__) diff --git a/omnigibson/controllers/multi_finger_gripper_controller.py b/omnigibson/controllers/multi_finger_gripper_controller.py index c9dc6dbcff..0185a50ff3 100644 --- a/omnigibson/controllers/multi_finger_gripper_controller.py +++ b/omnigibson/controllers/multi_finger_gripper_controller.py @@ -1,7 +1,7 @@ import numpy as np +from omnigibson.controllers import ControlType, GripperController, IsGraspingState from omnigibson.macros import create_module_macros -from omnigibson.controllers import IsGraspingState, ControlType, GripperController from omnigibson.utils.python_utils import assert_valid_key VALID_MODES = { diff --git a/omnigibson/controllers/osc_controller.py b/omnigibson/controllers/osc_controller.py index 8b44a2932b..ef6d728955 100644 --- a/omnigibson/controllers/osc_controller.py +++ b/omnigibson/controllers/osc_controller.py @@ -5,7 +5,7 @@ from omnigibson.controllers import ControlType, ManipulationController from omnigibson.utils.control_utils import orientation_error from omnigibson.utils.processing_utils import MovingAverageFilter -from omnigibson.utils.python_utils import nums2array, assert_valid_key +from omnigibson.utils.python_utils import assert_valid_key, nums2array from omnigibson.utils.ui_utils import create_module_logger # Create module logger diff --git a/omnigibson/envs/__init__.py b/omnigibson/envs/__init__.py index a932063689..435d4e1553 100644 --- a/omnigibson/envs/__init__.py +++ b/omnigibson/envs/__init__.py @@ -1,2 +1,2 @@ from omnigibson.envs.env_base import Environment -from omnigibson.envs.env_wrapper import EnvironmentWrapper, create_wrapper, REGISTERED_ENV_WRAPPERS +from omnigibson.envs.env_wrapper import REGISTERED_ENV_WRAPPERS, EnvironmentWrapper, create_wrapper diff --git a/omnigibson/envs/env_base.py b/omnigibson/envs/env_base.py index 2cab4f78f8..93bf9e9227 100644 --- a/omnigibson/envs/env_base.py +++ b/omnigibson/envs/env_base.py @@ -1,22 +1,30 @@ +from copy import deepcopy + import gym import numpy as np -from copy import deepcopy import omnigibson as og +from omnigibson.macros import gm from omnigibson.objects import REGISTERED_OBJECTS from omnigibson.robots import REGISTERED_ROBOTS from omnigibson.scene_graphs.graph_builder import SceneGraphBuilder -from omnigibson.simulator import launch_simulator -from omnigibson.tasks import REGISTERED_TASKS from omnigibson.scenes import REGISTERED_SCENES from omnigibson.sensors import create_sensor -from omnigibson.utils.gym_utils import GymObservable, recursively_generate_flat_dict, recursively_generate_compatible_dict +from omnigibson.simulator import launch_simulator +from omnigibson.tasks import REGISTERED_TASKS from omnigibson.utils.config_utils import parse_config +from omnigibson.utils.gym_utils import ( + GymObservable, + recursively_generate_compatible_dict, + recursively_generate_flat_dict, +) +from omnigibson.utils.python_utils import ( + Recreatable, + assert_valid_key, + create_class_from_registry_and_config, + merge_nested_dicts, +) 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.macros import gm - # Create module logger log = create_module_logger(module_name=__name__) diff --git a/omnigibson/envs/env_wrapper.py b/omnigibson/envs/env_wrapper.py index 0561d6da87..cb8280a3eb 100644 --- a/omnigibson/envs/env_wrapper.py +++ b/omnigibson/envs/env_wrapper.py @@ -1,8 +1,8 @@ -from omnigibson.utils.python_utils import Wrapper -from omnigibson.utils.python_utils import Registerable, classproperty, create_class_from_registry_and_config -from omnigibson.utils.ui_utils import create_module_logger from copy import deepcopy +from omnigibson.utils.python_utils import Registerable, Wrapper, classproperty, create_class_from_registry_and_config +from omnigibson.utils.ui_utils import create_module_logger + # Global dicts that will contain mappings REGISTERED_ENV_WRAPPERS = dict() diff --git a/omnigibson/examples/action_primitives/rs_int_example.py b/omnigibson/examples/action_primitives/rs_int_example.py index a482236f0b..201207ba97 100644 --- a/omnigibson/examples/action_primitives/rs_int_example.py +++ b/omnigibson/examples/action_primitives/rs_int_example.py @@ -1,10 +1,14 @@ import os -import yaml + import numpy as np +import yaml import omnigibson as og +from omnigibson.action_primitives.starter_semantic_action_primitives import ( + StarterSemanticActionPrimitives, + StarterSemanticActionPrimitiveSet, +) from omnigibson.macros import gm -from omnigibson.action_primitives.starter_semantic_action_primitives import StarterSemanticActionPrimitives, StarterSemanticActionPrimitiveSet # Don't use GPU dynamics and use flatcache for performance boost # gm.USE_GPU_DYNAMICS = True diff --git a/omnigibson/examples/action_primitives/solve_simple_task.py b/omnigibson/examples/action_primitives/solve_simple_task.py index 7522463381..d9009ff35e 100644 --- a/omnigibson/examples/action_primitives/solve_simple_task.py +++ b/omnigibson/examples/action_primitives/solve_simple_task.py @@ -1,10 +1,14 @@ import os -import yaml + import numpy as np +import yaml import omnigibson as og +from omnigibson.action_primitives.starter_semantic_action_primitives import ( + StarterSemanticActionPrimitives, + StarterSemanticActionPrimitiveSet, +) from omnigibson.macros import gm -from omnigibson.action_primitives.starter_semantic_action_primitives import StarterSemanticActionPrimitives, StarterSemanticActionPrimitiveSet # Don't use GPU dynamics and use flatcache for performance boost # gm.USE_GPU_DYNAMICS = True diff --git a/omnigibson/examples/action_primitives/wip_solve_behavior_task.py b/omnigibson/examples/action_primitives/wip_solve_behavior_task.py index 12b49a9d41..038b7c50f8 100644 --- a/omnigibson/examples/action_primitives/wip_solve_behavior_task.py +++ b/omnigibson/examples/action_primitives/wip_solve_behavior_task.py @@ -1,10 +1,14 @@ import os -import yaml + import numpy as np +import yaml import omnigibson as og +from omnigibson.action_primitives.starter_semantic_action_primitives import ( + StarterSemanticActionPrimitives, + StarterSemanticActionPrimitiveSet, +) from omnigibson.macros import gm -from omnigibson.action_primitives.starter_semantic_action_primitives import StarterSemanticActionPrimitives, StarterSemanticActionPrimitiveSet # Don't use GPU dynamics and use flatcache for performance boost # gm.USE_GPU_DYNAMICS = True diff --git a/omnigibson/examples/learning/navigation_policy_demo.py b/omnigibson/examples/learning/navigation_policy_demo.py index d8a4f07d66..94bd668fb9 100644 --- a/omnigibson/examples/learning/navigation_policy_demo.py +++ b/omnigibson/examples/learning/navigation_policy_demo.py @@ -5,7 +5,10 @@ """ import argparse -import os, time, cv2 +import os +import time + +import cv2 import yaml import omnigibson as og @@ -15,15 +18,15 @@ try: import gym + import tensorboard import torch as th import torch.nn as nn - import tensorboard from stable_baselines3 import PPO + from stable_baselines3.common.callbacks import CallbackList, CheckpointCallback, EvalCallback from stable_baselines3.common.evaluation import evaluate_policy from stable_baselines3.common.preprocessing import maybe_transpose from stable_baselines3.common.torch_layers import BaseFeaturesExtractor from stable_baselines3.common.utils import set_random_seed - from stable_baselines3.common.callbacks import CallbackList, CheckpointCallback, EvalCallback except ModuleNotFoundError: og.log.error("torch, stable-baselines3, or tensorboard is not installed. " diff --git a/omnigibson/examples/object_states/attachment_demo.py b/omnigibson/examples/object_states/attachment_demo.py index 175121b2db..e22d1af9c2 100644 --- a/omnigibson/examples/object_states/attachment_demo.py +++ b/omnigibson/examples/object_states/attachment_demo.py @@ -1,5 +1,5 @@ -import yaml import numpy as np +import yaml import omnigibson as og from omnigibson.macros import gm diff --git a/omnigibson/examples/object_states/dicing_demo.py b/omnigibson/examples/object_states/dicing_demo.py index 92e955ae0c..c3e5a68187 100644 --- a/omnigibson/examples/object_states/dicing_demo.py +++ b/omnigibson/examples/object_states/dicing_demo.py @@ -1,8 +1,8 @@ import numpy as np import omnigibson as og -from omnigibson.macros import gm import omnigibson.utils.transform_utils as T +from omnigibson.macros import gm # Make sure object states, GPU dynamics, and transition rules are enabled gm.ENABLE_OBJECT_STATES = True diff --git a/omnigibson/examples/object_states/folded_unfolded_state_demo.py b/omnigibson/examples/object_states/folded_unfolded_state_demo.py index 8a5aff98e6..971fba42da 100644 --- a/omnigibson/examples/object_states/folded_unfolded_state_demo.py +++ b/omnigibson/examples/object_states/folded_unfolded_state_demo.py @@ -1,9 +1,9 @@ -from omnigibson.utils.constants import PrimType -from omnigibson.object_states import Folded, Unfolded -from omnigibson.macros import gm import numpy as np import omnigibson as og +from omnigibson.macros import gm +from omnigibson.object_states import Folded, Unfolded +from omnigibson.utils.constants import PrimType # Make sure object states and GPU dynamics are enabled (GPU dynamics needed for cloth) gm.ENABLE_OBJECT_STATES = True diff --git a/omnigibson/examples/object_states/heat_source_or_sink_demo.py b/omnigibson/examples/object_states/heat_source_or_sink_demo.py index 804d96e5c7..bd09494c6a 100644 --- a/omnigibson/examples/object_states/heat_source_or_sink_demo.py +++ b/omnigibson/examples/object_states/heat_source_or_sink_demo.py @@ -1,4 +1,5 @@ import numpy as np + import omnigibson as og from omnigibson import object_states from omnigibson.macros import gm diff --git a/omnigibson/examples/object_states/heated_state_demo.py b/omnigibson/examples/object_states/heated_state_demo.py index 7ec010af0c..33a43dd7e4 100644 --- a/omnigibson/examples/object_states/heated_state_demo.py +++ b/omnigibson/examples/object_states/heated_state_demo.py @@ -1,4 +1,5 @@ import numpy as np + import omnigibson as og from omnigibson import object_states from omnigibson.macros import gm diff --git a/omnigibson/examples/object_states/object_state_texture_demo.py b/omnigibson/examples/object_states/object_state_texture_demo.py index 74a0cdd769..03a173d4a8 100644 --- a/omnigibson/examples/object_states/object_state_texture_demo.py +++ b/omnigibson/examples/object_states/object_state_texture_demo.py @@ -1,4 +1,5 @@ import numpy as np + import omnigibson as og from omnigibson import object_states from omnigibson.macros import gm, macros diff --git a/omnigibson/examples/object_states/overlaid_demo.py b/omnigibson/examples/object_states/overlaid_demo.py index 52d2d35643..375ebbc43c 100644 --- a/omnigibson/examples/object_states/overlaid_demo.py +++ b/omnigibson/examples/object_states/overlaid_demo.py @@ -2,9 +2,8 @@ import omnigibson as og from omnigibson.macros import gm -from omnigibson.utils.constants import PrimType from omnigibson.object_states import Overlaid - +from omnigibson.utils.constants import PrimType # Make sure object states and GPU dynamics are enabled (GPU dynamics needed for cloth) gm.ENABLE_OBJECT_STATES = True diff --git a/omnigibson/examples/object_states/particle_applier_remover_demo.py b/omnigibson/examples/object_states/particle_applier_remover_demo.py index 83ddf56802..e5ea7ece5a 100644 --- a/omnigibson/examples/object_states/particle_applier_remover_demo.py +++ b/omnigibson/examples/object_states/particle_applier_remover_demo.py @@ -1,12 +1,13 @@ import numpy as np + import omnigibson as og +from omnigibson.macros import gm, macros from omnigibson.object_states import Covered from omnigibson.objects import DatasetObject -from omnigibson.macros import gm, macros from omnigibson.systems import get_system -from omnigibson.utils.usd_utils import create_joint -from omnigibson.utils.ui_utils import choose_from_options from omnigibson.utils.constants import ParticleModifyMethod +from omnigibson.utils.ui_utils import choose_from_options +from omnigibson.utils.usd_utils import create_joint # Set macros for this example macros.object_states.particle_modifier.VISUAL_PARTICLES_REMOVAL_LIMIT = 1000 diff --git a/omnigibson/examples/object_states/sample_kinematics_demo.py b/omnigibson/examples/object_states/sample_kinematics_demo.py index 0bd22592fd..7ec041bebd 100644 --- a/omnigibson/examples/object_states/sample_kinematics_demo.py +++ b/omnigibson/examples/object_states/sample_kinematics_demo.py @@ -7,7 +7,6 @@ from omnigibson.macros import gm from omnigibson.objects import DatasetObject - # Make sure object states are enabled gm.ENABLE_OBJECT_STATES = True diff --git a/omnigibson/examples/object_states/slicing_demo.py b/omnigibson/examples/object_states/slicing_demo.py index 98c0bb21b1..656ec2f6dc 100644 --- a/omnigibson/examples/object_states/slicing_demo.py +++ b/omnigibson/examples/object_states/slicing_demo.py @@ -1,8 +1,8 @@ import numpy as np import omnigibson as og -from omnigibson.macros import gm import omnigibson.utils.transform_utils as T +from omnigibson.macros import gm # Make sure object states and transition rules are enabled gm.ENABLE_OBJECT_STATES = True diff --git a/omnigibson/examples/objects/draw_bounding_box.py b/omnigibson/examples/objects/draw_bounding_box.py index bddb41aad1..5cfe2cf61f 100644 --- a/omnigibson/examples/objects/draw_bounding_box.py +++ b/omnigibson/examples/objects/draw_bounding_box.py @@ -1,6 +1,6 @@ import matplotlib.pyplot as plt - import numpy as np + import omnigibson as og diff --git a/omnigibson/examples/objects/highlight_objects.py b/omnigibson/examples/objects/highlight_objects.py index ef286b878b..d53d9b1415 100644 --- a/omnigibson/examples/objects/highlight_objects.py +++ b/omnigibson/examples/objects/highlight_objects.py @@ -1,4 +1,5 @@ import numpy as np + import omnigibson as og diff --git a/omnigibson/examples/objects/load_object_selector.py b/omnigibson/examples/objects/load_object_selector.py index 01530ac469..bfb08f8813 100644 --- a/omnigibson/examples/objects/load_object_selector.py +++ b/omnigibson/examples/objects/load_object_selector.py @@ -1,9 +1,10 @@ import numpy as np + import omnigibson as og from omnigibson.utils.asset_utils import ( get_all_object_categories, - get_og_avg_category_specs, get_all_object_category_models, + get_og_avg_category_specs, ) from omnigibson.utils.ui_utils import choose_from_options diff --git a/omnigibson/examples/objects/visualize_object.py b/omnigibson/examples/objects/visualize_object.py index 5270074809..f3f533ddf2 100644 --- a/omnigibson/examples/objects/visualize_object.py +++ b/omnigibson/examples/objects/visualize_object.py @@ -1,13 +1,11 @@ import argparse + import numpy as np import omnigibson as og -from omnigibson.utils.asset_utils import ( - get_all_object_categories, - get_all_object_category_models, -) -from omnigibson.utils.ui_utils import choose_from_options import omnigibson.utils.transform_utils as T +from omnigibson.utils.asset_utils import get_all_object_categories, get_all_object_category_models +from omnigibson.utils.ui_utils import choose_from_options def main(random_selection=False, headless=False, short_exec=False): diff --git a/omnigibson/examples/renderer_settings/renderer_settings_example.py b/omnigibson/examples/renderer_settings/renderer_settings_example.py index 3a1690fdc2..5446252bc4 100644 --- a/omnigibson/examples/renderer_settings/renderer_settings_example.py +++ b/omnigibson/examples/renderer_settings/renderer_settings_example.py @@ -1,4 +1,5 @@ import numpy as np + import omnigibson as og from omnigibson.renderer_settings.renderer_settings import RendererSettings diff --git a/omnigibson/examples/robots/grasping_mode_example.py b/omnigibson/examples/robots/grasping_mode_example.py index 2382c4cc0d..d675f51368 100644 --- a/omnigibson/examples/robots/grasping_mode_example.py +++ b/omnigibson/examples/robots/grasping_mode_example.py @@ -6,7 +6,7 @@ import omnigibson as og from omnigibson.macros import gm from omnigibson.sensors import VisionSensor -from omnigibson.utils.ui_utils import choose_from_options, KeyboardRobotController +from omnigibson.utils.ui_utils import KeyboardRobotController, choose_from_options GRASPING_MODES = dict( sticky="Sticky Mitten - Objects are magnetized when they touch the fingers and a CLOSE command is given", diff --git a/omnigibson/examples/robots/robot_control_example.py b/omnigibson/examples/robots/robot_control_example.py index e086679447..d0c22e695f 100644 --- a/omnigibson/examples/robots/robot_control_example.py +++ b/omnigibson/examples/robots/robot_control_example.py @@ -9,8 +9,7 @@ import omnigibson.lazy as lazy from omnigibson.macros import gm from omnigibson.robots import REGISTERED_ROBOTS -from omnigibson.utils.ui_utils import choose_from_options, KeyboardRobotController - +from omnigibson.utils.ui_utils import KeyboardRobotController, choose_from_options CONTROL_MODES = dict( random="Use autonomous random actions (default)", diff --git a/omnigibson/examples/scenes/scene_tour_demo.py b/omnigibson/examples/scenes/scene_tour_demo.py index b850882789..5160589fd9 100644 --- a/omnigibson/examples/scenes/scene_tour_demo.py +++ b/omnigibson/examples/scenes/scene_tour_demo.py @@ -4,7 +4,7 @@ import omnigibson.lazy as lazy from omnigibson.macros import gm from omnigibson.utils.asset_utils import get_available_g_scenes, get_available_og_scenes -from omnigibson.utils.ui_utils import choose_from_options, KeyboardEventHandler +from omnigibson.utils.ui_utils import KeyboardEventHandler, choose_from_options def main(random_selection=False, headless=False, short_exec=False): diff --git a/omnigibson/examples/scenes/traversability_map_example.py b/omnigibson/examples/scenes/traversability_map_example.py index 622c121ab6..ff6320bfe9 100644 --- a/omnigibson/examples/scenes/traversability_map_example.py +++ b/omnigibson/examples/scenes/traversability_map_example.py @@ -6,7 +6,7 @@ from PIL import Image import omnigibson as og -from omnigibson.utils.asset_utils import get_og_scene_path, get_available_og_scenes +from omnigibson.utils.asset_utils import get_available_og_scenes, get_og_scene_path from omnigibson.utils.ui_utils import choose_from_options diff --git a/omnigibson/examples/simulator/sim_save_load_example.py b/omnigibson/examples/simulator/sim_save_load_example.py index d9656a98e0..c2c8cb011e 100644 --- a/omnigibson/examples/simulator/sim_save_load_example.py +++ b/omnigibson/examples/simulator/sim_save_load_example.py @@ -1,4 +1,5 @@ import os + import numpy as np import omnigibson as og diff --git a/omnigibson/examples/teleoperation/robot_teleoperate_demo.py b/omnigibson/examples/teleoperation/robot_teleoperate_demo.py index 304f2852e8..ca697b643c 100644 --- a/omnigibson/examples/teleoperation/robot_teleoperate_demo.py +++ b/omnigibson/examples/teleoperation/robot_teleoperate_demo.py @@ -21,9 +21,10 @@ def main(): Spawn a robot in an empty scene with a breakfast table and some toys. Users can try pick and place the toy into the basket using selected external devices and robot of their choice. """ - from omnigibson.utils.teleop_utils import TeleopSystem - from telemoma.utils.camera_utils import RealSenseCamera from telemoma.configs.base_config import teleop_config + from telemoma.utils.camera_utils import RealSenseCamera + + from omnigibson.utils.teleop_utils import TeleopSystem robot_name = choose_from_options(options=ROBOTS, name="robot") arm_teleop_method = choose_from_options(options=TELEOP_METHOD, name="robot arm teleop method") diff --git a/omnigibson/examples/teleoperation/vr_simple_demo.py b/omnigibson/examples/teleoperation/vr_simple_demo.py index 673ebed8a8..7c2c64a75c 100644 --- a/omnigibson/examples/teleoperation/vr_simple_demo.py +++ b/omnigibson/examples/teleoperation/vr_simple_demo.py @@ -4,6 +4,7 @@ import omnigibson as og from omnigibson.utils.teleop_utils import OVXRSystem + def main(): """ Spawn a BehaviorRobot in Rs_int and users can navigate around and interact with the scene using VR. diff --git a/omnigibson/lazy.py b/omnigibson/lazy.py index a6fcaf09d2..5deaf72f04 100644 --- a/omnigibson/lazy.py +++ b/omnigibson/lazy.py @@ -1,4 +1,5 @@ import sys + from omnigibson.utils.lazy_import_utils import LazyImporter sys.modules[__name__] = LazyImporter("", None) diff --git a/omnigibson/maps/__init__.py b/omnigibson/maps/__init__.py index bad474dac2..b57ce6a5d1 100644 --- a/omnigibson/maps/__init__.py +++ b/omnigibson/maps/__init__.py @@ -1,3 +1,3 @@ from omnigibson.maps.map_base import BaseMap -from omnigibson.maps.traversable_map import TraversableMap from omnigibson.maps.segmentation_map import SegmentationMap +from omnigibson.maps.traversable_map import TraversableMap diff --git a/omnigibson/maps/segmentation_map.py b/omnigibson/maps/segmentation_map.py index 0517e5b41f..c814b40fca 100644 --- a/omnigibson/maps/segmentation_map.py +++ b/omnigibson/maps/segmentation_map.py @@ -1,8 +1,8 @@ import os import numpy as np - from PIL import Image + # Accommodate large maps (e.g. 10k x 10k) while suppressing DecompressionBombError Image.MAX_IMAGE_PIXELS = None diff --git a/omnigibson/maps/traversable_map.py b/omnigibson/maps/traversable_map.py index 603e3be43e..c72defaae5 100644 --- a/omnigibson/maps/traversable_map.py +++ b/omnigibson/maps/traversable_map.py @@ -3,12 +3,13 @@ import cv2 import numpy as np from PIL import Image + # Accommodate large maps (e.g. 10k x 10k) while suppressing DecompressionBombError Image.MAX_IMAGE_PIXELS = None from omnigibson.maps.map_base import BaseMap -from omnigibson.utils.ui_utils import create_module_logger from omnigibson.utils.motion_planning_utils import astar +from omnigibson.utils.ui_utils import create_module_logger # Create module logger log = create_module_logger(module_name=__name__) diff --git a/omnigibson/object_states/__init__.py b/omnigibson/object_states/__init__.py index 36642bda32..a731df9d14 100644 --- a/omnigibson/object_states/__init__.py +++ b/omnigibson/object_states/__init__.py @@ -1,4 +1,3 @@ -from omnigibson.object_states.object_state_base import REGISTERED_OBJECT_STATES from omnigibson.object_states.aabb import AABB from omnigibson.object_states.adjacency import HorizontalAdjacency, VerticalAdjacency from omnigibson.object_states.attached_to import AttachedTo @@ -8,28 +7,29 @@ from omnigibson.object_states.contains import ContainedParticles, Contains from omnigibson.object_states.cooked import Cooked from omnigibson.object_states.covered import Covered +from omnigibson.object_states.draped import Draped +from omnigibson.object_states.filled import Filled +from omnigibson.object_states.folded import Folded, FoldedLevel, Unfolded from omnigibson.object_states.frozen import Frozen from omnigibson.object_states.heat_source_or_sink import HeatSourceOrSink from omnigibson.object_states.heated import Heated from omnigibson.object_states.inside import Inside from omnigibson.object_states.max_temperature import MaxTemperature from omnigibson.object_states.next_to import NextTo +from omnigibson.object_states.object_state_base import REGISTERED_OBJECT_STATES from omnigibson.object_states.on_fire import OnFire from omnigibson.object_states.on_top import OnTop from omnigibson.object_states.open_state import Open from omnigibson.object_states.overlaid import Overlaid -from omnigibson.object_states.particle_modifier import ParticleRemover, ParticleApplier -from omnigibson.object_states.particle_source_or_sink import ParticleSource, ParticleSink from omnigibson.object_states.particle import ParticleRequirement +from omnigibson.object_states.particle_modifier import ParticleApplier, ParticleRemover +from omnigibson.object_states.particle_source_or_sink import ParticleSink, ParticleSource from omnigibson.object_states.pose import Pose from omnigibson.object_states.robot_related_states import IsGrasping, ObjectsInFOVOfRobot from omnigibson.object_states.saturated import Saturated -from omnigibson.object_states.slicer_active import SlicerActive from omnigibson.object_states.sliceable import SliceableRequirement +from omnigibson.object_states.slicer_active import SlicerActive from omnigibson.object_states.temperature import Temperature from omnigibson.object_states.toggle import ToggledOn from omnigibson.object_states.touching import Touching from omnigibson.object_states.under import Under -from omnigibson.object_states.filled import Filled -from omnigibson.object_states.folded import Folded, Unfolded, FoldedLevel -from omnigibson.object_states.draped import Draped diff --git a/omnigibson/object_states/adjacency.py b/omnigibson/object_states/adjacency.py index 4718b315ea..bbe40268bd 100644 --- a/omnigibson/object_states/adjacency.py +++ b/omnigibson/object_states/adjacency.py @@ -6,9 +6,8 @@ from omnigibson.macros import create_module_macros from omnigibson.object_states.aabb import AABB from omnigibson.object_states.object_state_base import AbsoluteObjectState -from omnigibson.utils.sampling_utils import raytest_batch, raytest from omnigibson.utils.constants import PrimType - +from omnigibson.utils.sampling_utils import raytest, raytest_batch # Create settings for this module m = create_module_macros(module_path=__file__) diff --git a/omnigibson/object_states/attached_to.py b/omnigibson/object_states/attached_to.py index dfd675ebb1..59616dc2f1 100644 --- a/omnigibson/object_states/attached_to.py +++ b/omnigibson/object_states/attached_to.py @@ -1,20 +1,20 @@ -import numpy as np from collections import defaultdict +import numpy as np + import omnigibson as og import omnigibson.lazy as lazy -from omnigibson.macros import create_module_macros import omnigibson.utils.transform_utils as T +from omnigibson.macros import create_module_macros +from omnigibson.object_states.contact_bodies import ContactBodies from omnigibson.object_states.contact_subscribed_state_mixin import ContactSubscribedStateMixin from omnigibson.object_states.joint_break_subscribed_state_mixin import JointBreakSubscribedStateMixin -from omnigibson.object_states.object_state_base import BooleanStateMixin, RelativeObjectState from omnigibson.object_states.link_based_state_mixin import LinkBasedStateMixin -from omnigibson.object_states.contact_bodies import ContactBodies +from omnigibson.object_states.object_state_base import BooleanStateMixin, RelativeObjectState from omnigibson.utils.constants import JointType -from omnigibson.utils.usd_utils import create_joint -from omnigibson.utils.ui_utils import create_module_logger from omnigibson.utils.python_utils import classproperty -from omnigibson.utils.usd_utils import CollisionAPI +from omnigibson.utils.ui_utils import create_module_logger +from omnigibson.utils.usd_utils import CollisionAPI, create_joint # Create module logger log = create_module_logger(module_name=__name__) diff --git a/omnigibson/object_states/burnt.py b/omnigibson/object_states/burnt.py index da837a7106..eec7840a46 100644 --- a/omnigibson/object_states/burnt.py +++ b/omnigibson/object_states/burnt.py @@ -2,7 +2,6 @@ from omnigibson.object_states.max_temperature import MaxTemperature from omnigibson.object_states.object_state_base import AbsoluteObjectState, BooleanStateMixin - # Create settings for this module m = create_module_macros(module_path=__file__) diff --git a/omnigibson/object_states/contact_particles.py b/omnigibson/object_states/contact_particles.py index 19621a889d..0aa8fb32c0 100644 --- a/omnigibson/object_states/contact_particles.py +++ b/omnigibson/object_states/contact_particles.py @@ -1,8 +1,8 @@ import omnigibson as og from omnigibson.macros import create_module_macros -from omnigibson.object_states.object_state_base import RelativeObjectState from omnigibson.object_states.aabb import AABB from omnigibson.object_states.kinematics_mixin import KinematicsMixin +from omnigibson.object_states.object_state_base import RelativeObjectState from omnigibson.systems.system_base import PhysicalParticleSystem, is_physical_particle_system # Create settings for this module diff --git a/omnigibson/object_states/contact_subscribed_state_mixin.py b/omnigibson/object_states/contact_subscribed_state_mixin.py index ba2ad3b10f..330a550337 100644 --- a/omnigibson/object_states/contact_subscribed_state_mixin.py +++ b/omnigibson/object_states/contact_subscribed_state_mixin.py @@ -1,4 +1,5 @@ from abc import abstractmethod + from omnigibson.object_states.object_state_base import BaseObjectState from omnigibson.utils.python_utils import classproperty diff --git a/omnigibson/object_states/contains.py b/omnigibson/object_states/contains.py index 5e45670ad1..7084ee124d 100644 --- a/omnigibson/object_states/contains.py +++ b/omnigibson/object_states/contains.py @@ -1,13 +1,19 @@ -import numpy as np from collections import namedtuple + +import numpy as np + +import omnigibson.utils.transform_utils as T from omnigibson.macros import create_module_macros from omnigibson.object_states.link_based_state_mixin import LinkBasedStateMixin -from omnigibson.object_states.object_state_base import RelativeObjectState, BooleanStateMixin -from omnigibson.systems.system_base import VisualParticleSystem, PhysicalParticleSystem, is_visual_particle_system, \ - is_physical_particle_system +from omnigibson.object_states.object_state_base import BooleanStateMixin, RelativeObjectState +from omnigibson.systems.system_base import ( + PhysicalParticleSystem, + VisualParticleSystem, + is_physical_particle_system, + is_visual_particle_system, +) from omnigibson.utils.geometry_utils import generate_points_in_volume_checker_function from omnigibson.utils.python_utils import classproperty -import omnigibson.utils.transform_utils as T # Create settings for this module m = create_module_macros(module_path=__file__) diff --git a/omnigibson/object_states/cooked.py b/omnigibson/object_states/cooked.py index 66e67dba99..4ebab23b1f 100644 --- a/omnigibson/object_states/cooked.py +++ b/omnigibson/object_states/cooked.py @@ -2,7 +2,6 @@ from omnigibson.object_states.max_temperature import MaxTemperature from omnigibson.object_states.object_state_base import AbsoluteObjectState, BooleanStateMixin - # Create settings for this module m = create_module_macros(module_path=__file__) diff --git a/omnigibson/object_states/covered.py b/omnigibson/object_states/covered.py index 247eec99ca..80e612521a 100644 --- a/omnigibson/object_states/covered.py +++ b/omnigibson/object_states/covered.py @@ -1,11 +1,10 @@ from omnigibson.macros import create_module_macros from omnigibson.object_states import AABB -from omnigibson.object_states.object_state_base import RelativeObjectState, BooleanStateMixin from omnigibson.object_states.contact_particles import ContactParticles -from omnigibson.systems.system_base import VisualParticleSystem, is_visual_particle_system, is_physical_particle_system +from omnigibson.object_states.object_state_base import BooleanStateMixin, RelativeObjectState +from omnigibson.systems.system_base import VisualParticleSystem, is_physical_particle_system, is_visual_particle_system from omnigibson.utils.constants import PrimType - # Create settings for this module m = create_module_macros(module_path=__file__) diff --git a/omnigibson/object_states/draped.py b/omnigibson/object_states/draped.py index ee1d6f6021..f00880bd97 100644 --- a/omnigibson/object_states/draped.py +++ b/omnigibson/object_states/draped.py @@ -1,11 +1,12 @@ +import numpy as np + +import omnigibson as og +from omnigibson.object_states.cloth_mixin import ClothStateMixin +from omnigibson.object_states.contact_bodies import ContactBodies from omnigibson.object_states.kinematics_mixin import KinematicsMixin from omnigibson.object_states.object_state_base import BooleanStateMixin, RelativeObjectState -from omnigibson.object_states.contact_bodies import ContactBodies -from omnigibson.object_states.cloth_mixin import ClothStateMixin from omnigibson.utils.constants import PrimType from omnigibson.utils.object_state_utils import sample_cloth_on_rigid -import omnigibson as og -import numpy as np class Draped(RelativeObjectState, KinematicsMixin, BooleanStateMixin, ClothStateMixin): diff --git a/omnigibson/object_states/factory.py b/omnigibson/object_states/factory.py index 272f6b5347..15cb5916f4 100644 --- a/omnigibson/object_states/factory.py +++ b/omnigibson/object_states/factory.py @@ -1,8 +1,9 @@ -import networkx as nx from collections import namedtuple -from omnigibson.object_states.kinematics_mixin import KinematicsMixin +import networkx as nx + from omnigibson.object_states import * +from omnigibson.object_states.kinematics_mixin import KinematicsMixin # states: list of ObjectBaseState # requirements: list of ObjectBaseRequirement diff --git a/omnigibson/object_states/filled.py b/omnigibson/object_states/filled.py index 380429965b..506480fa0d 100644 --- a/omnigibson/object_states/filled.py +++ b/omnigibson/object_states/filled.py @@ -1,9 +1,10 @@ import numpy as np + from omnigibson.macros import create_module_macros from omnigibson.object_states.contains import ContainedParticles -from omnigibson.object_states.object_state_base import RelativeObjectState, BooleanStateMixin -from omnigibson.systems.system_base import PhysicalParticleSystem, is_physical_particle_system +from omnigibson.object_states.object_state_base import BooleanStateMixin, RelativeObjectState from omnigibson.systems.macro_particle_system import MacroParticleSystem +from omnigibson.systems.system_base import PhysicalParticleSystem, is_physical_particle_system # Create settings for this module m = create_module_macros(module_path=__file__) diff --git a/omnigibson/object_states/folded.py b/omnigibson/object_states/folded.py index 9fd8ff4280..ceafbae69e 100644 --- a/omnigibson/object_states/folded.py +++ b/omnigibson/object_states/folded.py @@ -1,10 +1,11 @@ -import numpy as np from collections import namedtuple -from scipy.spatial import ConvexHull, distance_matrix, QhullError + +import numpy as np +from scipy.spatial import ConvexHull, QhullError, distance_matrix from omnigibson.macros import create_module_macros -from omnigibson.object_states.object_state_base import BooleanStateMixin, AbsoluteObjectState from omnigibson.object_states.cloth_mixin import ClothStateMixin +from omnigibson.object_states.object_state_base import AbsoluteObjectState, BooleanStateMixin # Create settings for this module m = create_module_macros(module_path=__file__) diff --git a/omnigibson/object_states/frozen.py b/omnigibson/object_states/frozen.py index 7c0f2a086e..b88677213e 100644 --- a/omnigibson/object_states/frozen.py +++ b/omnigibson/object_states/frozen.py @@ -4,7 +4,6 @@ from omnigibson.object_states.object_state_base import AbsoluteObjectState, BooleanStateMixin from omnigibson.object_states.temperature import Temperature - # Create settings for this module m = create_module_macros(module_path=__file__) diff --git a/omnigibson/object_states/heat_source_or_sink.py b/omnigibson/object_states/heat_source_or_sink.py index 4ee998d1f4..fd3b8710e1 100644 --- a/omnigibson/object_states/heat_source_or_sink.py +++ b/omnigibson/object_states/heat_source_or_sink.py @@ -1,3 +1,5 @@ +import numpy as np + import omnigibson as og from omnigibson.macros import create_module_macros, macros from omnigibson.object_states.aabb import AABB @@ -7,10 +9,8 @@ from omnigibson.object_states.open_state import Open from omnigibson.object_states.toggle import ToggledOn from omnigibson.object_states.update_state_mixin import UpdateStateMixin -from omnigibson.utils.python_utils import classproperty from omnigibson.utils.constants import PrimType -import numpy as np - +from omnigibson.utils.python_utils import classproperty # Create settings for this module m = create_module_macros(module_path=__file__) diff --git a/omnigibson/object_states/heated.py b/omnigibson/object_states/heated.py index d4612777b1..6e365049a1 100644 --- a/omnigibson/object_states/heated.py +++ b/omnigibson/object_states/heated.py @@ -4,7 +4,6 @@ from omnigibson.object_states.object_state_base import AbsoluteObjectState, BooleanStateMixin from omnigibson.object_states.temperature import Temperature - # Create settings for this module m = create_module_macros(module_path=__file__) diff --git a/omnigibson/object_states/inside.py b/omnigibson/object_states/inside.py index 7d5f8e44f2..9f9c12e547 100644 --- a/omnigibson/object_states/inside.py +++ b/omnigibson/object_states/inside.py @@ -1,12 +1,13 @@ import numpy as np + import omnigibson as og from omnigibson.object_states.aabb import AABB from omnigibson.object_states.adjacency import HorizontalAdjacency, VerticalAdjacency, flatten_planes from omnigibson.object_states.kinematics_mixin import KinematicsMixin from omnigibson.object_states.object_state_base import BooleanStateMixin, RelativeObjectState -from omnigibson.utils.object_state_utils import sample_kinematics from omnigibson.utils.constants import PrimType from omnigibson.utils.object_state_utils import m as os_m +from omnigibson.utils.object_state_utils import sample_kinematics class Inside(RelativeObjectState, KinematicsMixin, BooleanStateMixin): diff --git a/omnigibson/object_states/joint_break_subscribed_state_mixin.py b/omnigibson/object_states/joint_break_subscribed_state_mixin.py index 8498376923..4044da942b 100644 --- a/omnigibson/object_states/joint_break_subscribed_state_mixin.py +++ b/omnigibson/object_states/joint_break_subscribed_state_mixin.py @@ -1,5 +1,6 @@ -from omnigibson.object_states.object_state_base import BaseObjectState from abc import abstractmethod + +from omnigibson.object_states.object_state_base import BaseObjectState from omnigibson.utils.python_utils import classproperty diff --git a/omnigibson/object_states/link_based_state_mixin.py b/omnigibson/object_states/link_based_state_mixin.py index 41143f3823..8f8e13627b 100644 --- a/omnigibson/object_states/link_based_state_mixin.py +++ b/omnigibson/object_states/link_based_state_mixin.py @@ -1,8 +1,9 @@ import numpy as np + from omnigibson.object_states.object_state_base import BaseObjectState -from omnigibson.utils.ui_utils import create_module_logger -from omnigibson.utils.python_utils import classproperty from omnigibson.prims.cloth_prim import ClothPrim +from omnigibson.utils.python_utils import classproperty +from omnigibson.utils.ui_utils import create_module_logger # Create module logger log = create_module_logger(module_name=__name__) diff --git a/omnigibson/object_states/max_temperature.py b/omnigibson/object_states/max_temperature.py index 3d0d1320ce..bba0e67621 100644 --- a/omnigibson/object_states/max_temperature.py +++ b/omnigibson/object_states/max_temperature.py @@ -1,6 +1,7 @@ +import numpy as np + from omnigibson.object_states.temperature import Temperature from omnigibson.object_states.tensorized_value_state import TensorizedValueState -import numpy as np from omnigibson.utils.python_utils import classproperty diff --git a/omnigibson/object_states/object_state_base.py b/omnigibson/object_states/object_state_base.py index 5d1af901f8..bd28cb7ea9 100644 --- a/omnigibson/object_states/object_state_base.py +++ b/omnigibson/object_states/object_state_base.py @@ -1,8 +1,8 @@ -from abc import ABC import inspect -import omnigibson as og -from omnigibson.utils.python_utils import classproperty, Serializable, Registerable, Recreatable +from abc import ABC +import omnigibson as og +from omnigibson.utils.python_utils import Recreatable, Registerable, Serializable, classproperty # Global dicts that will contain mappings REGISTERED_OBJECT_STATES = dict() diff --git a/omnigibson/object_states/on_fire.py b/omnigibson/object_states/on_fire.py index e706ecde8d..af69525fc6 100644 --- a/omnigibson/object_states/on_fire.py +++ b/omnigibson/object_states/on_fire.py @@ -1,7 +1,6 @@ from omnigibson.macros import create_module_macros -from omnigibson.object_states.temperature import Temperature from omnigibson.object_states.heat_source_or_sink import HeatSourceOrSink - +from omnigibson.object_states.temperature import Temperature # Create settings for this module m = create_module_macros(module_path=__file__) diff --git a/omnigibson/object_states/on_top.py b/omnigibson/object_states/on_top.py index 2b38ed5d57..95ba5a08b2 100644 --- a/omnigibson/object_states/on_top.py +++ b/omnigibson/object_states/on_top.py @@ -1,11 +1,11 @@ import omnigibson as og -from omnigibson.object_states.kinematics_mixin import KinematicsMixin from omnigibson.object_states.adjacency import VerticalAdjacency +from omnigibson.object_states.kinematics_mixin import KinematicsMixin from omnigibson.object_states.object_state_base import BooleanStateMixin, RelativeObjectState from omnigibson.object_states.touching import Touching -from omnigibson.utils.object_state_utils import sample_kinematics -from omnigibson.utils.object_state_utils import m as os_m from omnigibson.utils.constants import PrimType +from omnigibson.utils.object_state_utils import m as os_m +from omnigibson.utils.object_state_utils import sample_kinematics class OnTop(KinematicsMixin, RelativeObjectState, BooleanStateMixin): diff --git a/omnigibson/object_states/open_state.py b/omnigibson/object_states/open_state.py index d48b7a9959..506bebdf1c 100644 --- a/omnigibson/object_states/open_state.py +++ b/omnigibson/object_states/open_state.py @@ -1,7 +1,7 @@ import numpy as np from omnigibson.macros import create_module_macros -from omnigibson.object_states.object_state_base import BooleanStateMixin, AbsoluteObjectState +from omnigibson.object_states.object_state_base import AbsoluteObjectState, BooleanStateMixin from omnigibson.utils.constants import JointType from omnigibson.utils.ui_utils import create_module_logger diff --git a/omnigibson/object_states/overlaid.py b/omnigibson/object_states/overlaid.py index fff7d51079..ae07bdf46f 100644 --- a/omnigibson/object_states/overlaid.py +++ b/omnigibson/object_states/overlaid.py @@ -1,17 +1,17 @@ +import itertools + +import numpy as np +import trimesh +from scipy.spatial import ConvexHull, HalfspaceIntersection, QhullError + +import omnigibson as og +import omnigibson.utils.transform_utils as T +from omnigibson.macros import create_module_macros from omnigibson.object_states.kinematics_mixin import KinematicsMixin from omnigibson.object_states.object_state_base import BooleanStateMixin, RelativeObjectState from omnigibson.object_states.touching import Touching from omnigibson.utils.constants import PrimType -import omnigibson.utils.transform_utils as T from omnigibson.utils.object_state_utils import sample_cloth_on_rigid -from omnigibson.macros import create_module_macros - -import omnigibson as og - -from scipy.spatial import ConvexHull, HalfspaceIntersection, QhullError -import numpy as np -import trimesh -import itertools # Create settings for this module m = create_module_macros(module_path=__file__) diff --git a/omnigibson/object_states/particle.py b/omnigibson/object_states/particle.py index f125265ad0..ea8c463629 100644 --- a/omnigibson/object_states/particle.py +++ b/omnigibson/object_states/particle.py @@ -1,4 +1,5 @@ import numpy as np + from omnigibson.object_states.object_state_base import BaseObjectRequirement diff --git a/omnigibson/object_states/particle_modifier.py b/omnigibson/object_states/particle_modifier.py index db117eed36..5ec3a79b50 100644 --- a/omnigibson/object_states/particle_modifier.py +++ b/omnigibson/object_states/particle_modifier.py @@ -1,11 +1,12 @@ from abc import abstractmethod from collections import defaultdict + import numpy as np import omnigibson as og import omnigibson.lazy as lazy -from omnigibson.macros import create_module_macros, macros, gm -from omnigibson.prims.geom_prim import VisualGeomPrim +import omnigibson.utils.transform_utils as T +from omnigibson.macros import create_module_macros, gm, macros from omnigibson.object_states.aabb import AABB from omnigibson.object_states.contact_bodies import ContactBodies from omnigibson.object_states.contact_particles import ContactParticles @@ -15,18 +16,29 @@ from omnigibson.object_states.saturated import ModifiedParticles, Saturated from omnigibson.object_states.toggle import ToggledOn from omnigibson.object_states.update_state_mixin import UpdateStateMixin +from omnigibson.prims.geom_prim import VisualGeomPrim from omnigibson.prims.prim_base import BasePrim -from omnigibson.systems.system_base import BaseSystem, VisualParticleSystem, PhysicalParticleSystem, get_system, \ - is_visual_particle_system, is_physical_particle_system, is_fluid_system, is_system_active, REGISTERED_SYSTEMS -from omnigibson.utils.constants import ParticleModifyMethod, ParticleModifyCondition, PrimType -from omnigibson.utils.geometry_utils import generate_points_in_volume_checker_function, \ - get_particle_positions_in_frame, get_particle_positions_from_frame +from omnigibson.systems.system_base import ( + REGISTERED_SYSTEMS, + BaseSystem, + PhysicalParticleSystem, + VisualParticleSystem, + get_system, + is_fluid_system, + is_physical_particle_system, + is_system_active, + is_visual_particle_system, +) +from omnigibson.utils.constants import ParticleModifyCondition, ParticleModifyMethod, PrimType +from omnigibson.utils.geometry_utils import ( + generate_points_in_volume_checker_function, + get_particle_positions_from_frame, + get_particle_positions_in_frame, +) from omnigibson.utils.python_utils import classproperty -from omnigibson.utils.ui_utils import suppress_omni_log -from omnigibson.utils.usd_utils import create_primitive_mesh, FlatcacheAPI -import omnigibson.utils.transform_utils as T from omnigibson.utils.sampling_utils import sample_cuboid_on_object - +from omnigibson.utils.ui_utils import suppress_omni_log +from omnigibson.utils.usd_utils import FlatcacheAPI, create_primitive_mesh # Create settings for this module m = create_module_macros(module_path=__file__) diff --git a/omnigibson/object_states/robot_related_states.py b/omnigibson/object_states/robot_related_states.py index d922baadb2..95917d186d 100644 --- a/omnigibson/object_states/robot_related_states.py +++ b/omnigibson/object_states/robot_related_states.py @@ -1,9 +1,9 @@ import numpy as np + import omnigibson as og from omnigibson.object_states.object_state_base import AbsoluteObjectState, BooleanStateMixin, RelativeObjectState from omnigibson.sensors import VisionSensor - _IN_REACH_DISTANCE_THRESHOLD = 2.0 _IN_FOV_PIXEL_FRACTION_THRESHOLD = 0.05 diff --git a/omnigibson/object_states/saturated.py b/omnigibson/object_states/saturated.py index e6981bb878..91215135d1 100644 --- a/omnigibson/object_states/saturated.py +++ b/omnigibson/object_states/saturated.py @@ -1,10 +1,10 @@ import numpy as np + from omnigibson.macros import create_module_macros -from omnigibson.object_states.object_state_base import RelativeObjectState, BooleanStateMixin -from omnigibson.systems.system_base import UUID_TO_SYSTEMS, REGISTERED_SYSTEMS +from omnigibson.object_states.object_state_base import BooleanStateMixin, RelativeObjectState +from omnigibson.systems.system_base import REGISTERED_SYSTEMS, UUID_TO_SYSTEMS from omnigibson.utils.python_utils import get_uuid - # Create settings for this module m = create_module_macros(module_path=__file__) diff --git a/omnigibson/object_states/sliceable.py b/omnigibson/object_states/sliceable.py index aa6be7b104..f16695ae76 100644 --- a/omnigibson/object_states/sliceable.py +++ b/omnigibson/object_states/sliceable.py @@ -1,4 +1,5 @@ import numpy as np + from omnigibson.object_states.object_state_base import BaseObjectRequirement @@ -11,6 +12,7 @@ class SliceableRequirement(BaseObjectRequirement): def is_compatible(cls, obj, **kwargs): # Avoid circular imports from omnigibson.objects.dataset_object import DatasetObject + # Make sure object is dataset object if not isinstance(obj, DatasetObject): return False, f"Only compatible with DatasetObject, but {obj} is of type {type(obj)}" diff --git a/omnigibson/object_states/slicer_active.py b/omnigibson/object_states/slicer_active.py index ae36f2aaa6..a14598986e 100644 --- a/omnigibson/object_states/slicer_active.py +++ b/omnigibson/object_states/slicer_active.py @@ -1,13 +1,13 @@ import numpy as np + +import omnigibson as og from omnigibson.macros import create_module_macros -from omnigibson.object_states.object_state_base import BooleanStateMixin from omnigibson.object_states.contact_bodies import ContactBodies +from omnigibson.object_states.object_state_base import BooleanStateMixin from omnigibson.object_states.tensorized_value_state import TensorizedValueState -import omnigibson as og from omnigibson.utils.python_utils import classproperty from omnigibson.utils.usd_utils import RigidContactAPI - # Create settings for this module m = create_module_macros(module_path=__file__) m.REACTIVATION_DELAY = 0.5 # number of seconds to wait before reactivating the slicer diff --git a/omnigibson/object_states/temperature.py b/omnigibson/object_states/temperature.py index a211ea08f1..cd9cf4abc9 100644 --- a/omnigibson/object_states/temperature.py +++ b/omnigibson/object_states/temperature.py @@ -1,9 +1,10 @@ import numpy as np + +import omnigibson as og from omnigibson.macros import create_module_macros -from omnigibson.object_states.heat_source_or_sink import HeatSourceOrSink from omnigibson.object_states.aabb import AABB +from omnigibson.object_states.heat_source_or_sink import HeatSourceOrSink from omnigibson.object_states.tensorized_value_state import TensorizedValueState -import omnigibson as og from omnigibson.utils.python_utils import classproperty # Create settings for this module diff --git a/omnigibson/object_states/tensorized_value_state.py b/omnigibson/object_states/tensorized_value_state.py index 35f4d53b3e..1826d5a2d0 100644 --- a/omnigibson/object_states/tensorized_value_state.py +++ b/omnigibson/object_states/tensorized_value_state.py @@ -1,7 +1,8 @@ +import numpy as np + from omnigibson.object_states.object_state_base import AbsoluteObjectState from omnigibson.object_states.update_state_mixin import GlobalUpdateStateMixin from omnigibson.utils.python_utils import classproperty -import numpy as np class TensorizedValueState(AbsoluteObjectState, GlobalUpdateStateMixin): diff --git a/omnigibson/object_states/toggle.py b/omnigibson/object_states/toggle.py index 8e8f75b8ac..e47a56db81 100644 --- a/omnigibson/object_states/toggle.py +++ b/omnigibson/object_states/toggle.py @@ -3,14 +3,13 @@ import omnigibson as og import omnigibson.lazy as lazy from omnigibson.macros import create_module_macros -from omnigibson.prims.geom_prim import VisualGeomPrim from omnigibson.object_states.link_based_state_mixin import LinkBasedStateMixin from omnigibson.object_states.object_state_base import AbsoluteObjectState, BooleanStateMixin -from omnigibson.object_states.update_state_mixin import UpdateStateMixin, GlobalUpdateStateMixin -from omnigibson.utils.python_utils import classproperty -from omnigibson.utils.usd_utils import create_primitive_mesh, RigidContactAPI +from omnigibson.object_states.update_state_mixin import GlobalUpdateStateMixin, UpdateStateMixin +from omnigibson.prims.geom_prim import VisualGeomPrim from omnigibson.utils.constants import PrimType - +from omnigibson.utils.python_utils import classproperty +from omnigibson.utils.usd_utils import RigidContactAPI, create_primitive_mesh # Create settings for this module m = create_module_macros(module_path=__file__) diff --git a/omnigibson/object_states/under.py b/omnigibson/object_states/under.py index a9858d14bc..dd6ae1ea16 100644 --- a/omnigibson/object_states/under.py +++ b/omnigibson/object_states/under.py @@ -2,9 +2,9 @@ from omnigibson.object_states.adjacency import VerticalAdjacency from omnigibson.object_states.kinematics_mixin import KinematicsMixin from omnigibson.object_states.object_state_base import BooleanStateMixin, RelativeObjectState -from omnigibson.utils.object_state_utils import sample_kinematics -from omnigibson.utils.object_state_utils import m as os_m from omnigibson.utils.constants import PrimType +from omnigibson.utils.object_state_utils import m as os_m +from omnigibson.utils.object_state_utils import sample_kinematics class Under(RelativeObjectState, KinematicsMixin, BooleanStateMixin): diff --git a/omnigibson/object_states/update_state_mixin.py b/omnigibson/object_states/update_state_mixin.py index 7778de85a6..fd88000cb3 100644 --- a/omnigibson/object_states/update_state_mixin.py +++ b/omnigibson/object_states/update_state_mixin.py @@ -1,6 +1,7 @@ from omnigibson.object_states.object_state_base import BaseObjectState from omnigibson.utils.python_utils import classproperty + class UpdateStateMixin(BaseObjectState): """ A state-mixin that allows for per-sim-step updates via the update() call diff --git a/omnigibson/objects/__init__.py b/omnigibson/objects/__init__.py index e0546fda95..e2c6356725 100644 --- a/omnigibson/objects/__init__.py +++ b/omnigibson/objects/__init__.py @@ -1,8 +1,7 @@ -from omnigibson.objects.object_base import REGISTERED_OBJECTS, BaseObject from omnigibson.objects.controllable_object import ControllableObject from omnigibson.objects.dataset_object import DatasetObject from omnigibson.objects.light_object import LightObject +from omnigibson.objects.object_base import REGISTERED_OBJECTS, BaseObject from omnigibson.objects.primitive_object import PrimitiveObject from omnigibson.objects.stateful_object import StatefulObject from omnigibson.objects.usd_object import USDObject - diff --git a/omnigibson/objects/controllable_object.py b/omnigibson/objects/controllable_object.py index 60301dd137..9cb5534cb5 100644 --- a/omnigibson/objects/controllable_object.py +++ b/omnigibson/objects/controllable_object.py @@ -1,13 +1,15 @@ from abc import abstractmethod from copy import deepcopy -import numpy as np + import gym +import numpy as np + import omnigibson as og -from omnigibson.objects.object_base import BaseObject from omnigibson.controllers import create_controller from omnigibson.controllers.controller_base import ControlType -from omnigibson.utils.python_utils import assert_valid_key, merge_nested_dicts, CachedFunctions +from omnigibson.objects.object_base import BaseObject from omnigibson.utils.constants import PrimType +from omnigibson.utils.python_utils import CachedFunctions, assert_valid_key, merge_nested_dicts from omnigibson.utils.ui_utils import create_module_logger # Create module logger diff --git a/omnigibson/objects/dataset_object.py b/omnigibson/objects/dataset_object.py index 2136d76344..95668931ba 100644 --- a/omnigibson/objects/dataset_object.py +++ b/omnigibson/objects/dataset_object.py @@ -1,16 +1,21 @@ import math import os + import numpy as np import omnigibson as og import omnigibson.lazy as lazy -from omnigibson.macros import gm -from omnigibson.objects.usd_object import USDObject -from omnigibson.utils.constants import AVERAGE_CATEGORY_SPECS, DEFAULT_JOINT_FRICTION, SPECIAL_JOINT_FRICTIONS, JointType import omnigibson.utils.transform_utils as T +from omnigibson.macros import create_module_macros, gm +from omnigibson.objects.usd_object import USDObject from omnigibson.utils.asset_utils import get_all_object_category_models -from omnigibson.utils.constants import PrimType -from omnigibson.macros import gm, create_module_macros +from omnigibson.utils.constants import ( + AVERAGE_CATEGORY_SPECS, + DEFAULT_JOINT_FRICTION, + SPECIAL_JOINT_FRICTIONS, + JointType, + PrimType, +) from omnigibson.utils.ui_utils import create_module_logger # Create module logger diff --git a/omnigibson/objects/light_object.py b/omnigibson/objects/light_object.py index 4421a08eb3..1d7e799e30 100644 --- a/omnigibson/objects/light_object.py +++ b/omnigibson/objects/light_object.py @@ -1,11 +1,12 @@ +import numpy as np + import omnigibson as og import omnigibson.lazy as lazy from omnigibson.objects.stateful_object import StatefulObject from omnigibson.prims.xform_prim import XFormPrim -from omnigibson.utils.python_utils import assert_valid_key from omnigibson.utils.constants import PrimType +from omnigibson.utils.python_utils import assert_valid_key from omnigibson.utils.ui_utils import create_module_logger -import numpy as np # Create module logger log = create_module_logger(module_name=__name__) diff --git a/omnigibson/objects/object_base.py b/omnigibson/objects/object_base.py index 673f33f5c0..31c86a55ce 100644 --- a/omnigibson/objects/object_base.py +++ b/omnigibson/objects/object_base.py @@ -1,19 +1,19 @@ from abc import ABCMeta -import numpy as np from collections.abc import Iterable + +import numpy as np import trimesh from scipy.spatial.transform import Rotation import omnigibson as og import omnigibson.lazy as lazy +import omnigibson.utils.transform_utils as T from omnigibson.macros import create_module_macros, gm -from omnigibson.utils.usd_utils import create_joint, CollisionAPI from omnigibson.prims.entity_prim import EntityPrim -from omnigibson.utils.python_utils import Registerable, classproperty, get_uuid from omnigibson.utils.constants import PrimType, semantic_class_name_to_id +from omnigibson.utils.python_utils import Registerable, classproperty, get_uuid from omnigibson.utils.ui_utils import create_module_logger, suppress_omni_log -import omnigibson.utils.transform_utils as T - +from omnigibson.utils.usd_utils import CollisionAPI, create_joint # Global dicts that will contain mappings REGISTERED_OBJECTS = dict() diff --git a/omnigibson/objects/primitive_object.py b/omnigibson/objects/primitive_object.py index ea24026183..8395383b38 100644 --- a/omnigibson/objects/primitive_object.py +++ b/omnigibson/objects/primitive_object.py @@ -1,14 +1,14 @@ import numpy as np -from omnigibson.objects.stateful_object import StatefulObject -from omnigibson.utils.python_utils import assert_valid_key import omnigibson as og import omnigibson.lazy as lazy -from omnigibson.utils.constants import PrimType, PRIMITIVE_MESH_TYPES -from omnigibson.utils.usd_utils import create_primitive_mesh -from omnigibson.utils.render_utils import create_pbr_material +from omnigibson.objects.stateful_object import StatefulObject +from omnigibson.utils.constants import PRIMITIVE_MESH_TYPES, PrimType from omnigibson.utils.physx_utils import bind_material +from omnigibson.utils.python_utils import assert_valid_key +from omnigibson.utils.render_utils import create_pbr_material from omnigibson.utils.ui_utils import create_module_logger +from omnigibson.utils.usd_utils import create_primitive_mesh # Create module logger log = create_module_logger(module_name=__name__) diff --git a/omnigibson/objects/stateful_object.py b/omnigibson/objects/stateful_object.py index 20bc82003a..c34fa3c531 100644 --- a/omnigibson/objects/stateful_object.py +++ b/omnigibson/objects/stateful_object.py @@ -2,33 +2,32 @@ from collections import defaultdict import numpy as np - from bddl.object_taxonomy import ObjectTaxonomy import omnigibson as og import omnigibson.lazy as lazy from omnigibson.macros import create_module_macros, gm +from omnigibson.object_states import Saturated from omnigibson.object_states.factory import ( get_default_states, - get_state_name, + get_fire_states, get_requirements_for_ability, - get_states_for_ability, + get_state_name, get_states_by_dependency_order, - get_texture_change_states, - get_fire_states, + get_states_for_ability, get_steam_states, - get_visual_states, get_texture_change_priority, + get_texture_change_states, + get_visual_states, ) -from omnigibson.object_states.object_state_base import REGISTERED_OBJECT_STATES from omnigibson.object_states.heat_source_or_sink import HeatSourceOrSink +from omnigibson.object_states.object_state_base import REGISTERED_OBJECT_STATES from omnigibson.object_states.on_fire import OnFire from omnigibson.object_states.particle_modifier import ParticleRemover from omnigibson.objects.object_base import BaseObject from omnigibson.renderer_settings.renderer_settings import RendererSettings -from omnigibson.utils.constants import PrimType, EmitterType +from omnigibson.utils.constants import EmitterType, PrimType from omnigibson.utils.python_utils import classproperty, extract_class_init_kwargs_from_dict -from omnigibson.object_states import Saturated from omnigibson.utils.ui_utils import create_module_logger # Create module logger diff --git a/omnigibson/objects/usd_object.py b/omnigibson/objects/usd_object.py index f614929ccc..e9b5591eda 100644 --- a/omnigibson/objects/usd_object.py +++ b/omnigibson/objects/usd_object.py @@ -3,9 +3,9 @@ import omnigibson as og from omnigibson.objects.stateful_object import StatefulObject +from omnigibson.utils.asset_utils import decrypt_file from omnigibson.utils.constants import PrimType from omnigibson.utils.usd_utils import add_asset_to_stage -from omnigibson.utils.asset_utils import decrypt_file class USDObject(StatefulObject): diff --git a/omnigibson/prims/__init__.py b/omnigibson/prims/__init__.py index c6b0bb47b2..ec7f6a9f6f 100644 --- a/omnigibson/prims/__init__.py +++ b/omnigibson/prims/__init__.py @@ -1,7 +1,7 @@ -from omnigibson.prims.prim_base import BasePrim from omnigibson.prims.cloth_prim import ClothPrim from omnigibson.prims.entity_prim import EntityPrim -from omnigibson.prims.geom_prim import GeomPrim, VisualGeomPrim, CollisionGeomPrim, CollisionVisualGeomPrim +from omnigibson.prims.geom_prim import CollisionGeomPrim, CollisionVisualGeomPrim, GeomPrim, VisualGeomPrim from omnigibson.prims.joint_prim import JointPrim +from omnigibson.prims.prim_base import BasePrim from omnigibson.prims.rigid_prim import RigidPrim from omnigibson.prims.xform_prim import XFormPrim diff --git a/omnigibson/prims/cloth_prim.py b/omnigibson/prims/cloth_prim.py index 996aae7f88..c1d9e1eac1 100644 --- a/omnigibson/prims/cloth_prim.py +++ b/omnigibson/prims/cloth_prim.py @@ -7,20 +7,19 @@ # license agreement from NVIDIA CORPORATION is strictly prohibited. # -import omnigibson.lazy as lazy +from collections.abc import Iterable + +import numpy as np +import omnigibson as og +import omnigibson.lazy as lazy +import omnigibson.utils.transform_utils as T from omnigibson.macros import create_module_macros, gm from omnigibson.prims.geom_prim import GeomPrim from omnigibson.systems import get_system -import omnigibson.utils.transform_utils as T +from omnigibson.utils.python_utils import classproperty from omnigibson.utils.sim_utils import CsRawData from omnigibson.utils.usd_utils import array_to_vtarray, mesh_prim_to_trimesh_mesh, sample_mesh_keypoints -from omnigibson.utils.python_utils import classproperty -import omnigibson as og - -import numpy as np -from collections.abc import Iterable - # Create settings for this module m = create_module_macros(module_path=__file__) diff --git a/omnigibson/prims/entity_prim.py b/omnigibson/prims/entity_prim.py index 90a8276d52..a6436c03d6 100644 --- a/omnigibson/prims/entity_prim.py +++ b/omnigibson/prims/entity_prim.py @@ -1,22 +1,20 @@ -import numpy as np -import networkx as nx from functools import cached_property +import networkx as nx +import numpy as np + import omnigibson as og import omnigibson.lazy as lazy import omnigibson.utils.transform_utils as T - +from omnigibson.macros import create_module_macros, gm from omnigibson.prims.cloth_prim import ClothPrim from omnigibson.prims.joint_prim import JointPrim from omnigibson.prims.rigid_prim import RigidPrim from omnigibson.prims.xform_prim import XFormPrim -from omnigibson.utils.constants import PrimType, JointType, JointAxis +from omnigibson.utils.constants import JointAxis, JointType, PrimType from omnigibson.utils.ui_utils import suppress_omni_log from omnigibson.utils.usd_utils import PoseAPI -from omnigibson.macros import gm, create_module_macros - - # Create settings for this module m = create_module_macros(module_path=__file__) diff --git a/omnigibson/prims/geom_prim.py b/omnigibson/prims/geom_prim.py index 64f034db9e..a66edaa022 100644 --- a/omnigibson/prims/geom_prim.py +++ b/omnigibson/prims/geom_prim.py @@ -1,14 +1,15 @@ from functools import cached_property + import numpy as np import trimesh import omnigibson as og import omnigibson.lazy as lazy +import omnigibson.utils.transform_utils as T from omnigibson.macros import gm from omnigibson.prims.xform_prim import XFormPrim from omnigibson.utils.python_utils import assert_valid_key from omnigibson.utils.usd_utils import PoseAPI, mesh_prim_shape_to_trimesh_mesh -import omnigibson.utils.transform_utils as T class GeomPrim(XFormPrim): diff --git a/omnigibson/prims/joint_prim.py b/omnigibson/prims/joint_prim.py index 19d64bb8df..13cd2d2051 100644 --- a/omnigibson/prims/joint_prim.py +++ b/omnigibson/prims/joint_prim.py @@ -1,16 +1,16 @@ from collections.abc import Iterable + import numpy as np + import omnigibson as og import omnigibson.lazy as lazy +import omnigibson.utils.transform_utils as T +from omnigibson.controllers.controller_base import ControlType from omnigibson.macros import create_module_macros from omnigibson.prims.prim_base import BasePrim -from omnigibson.utils.usd_utils import PoseAPI, create_joint -from omnigibson.utils.constants import JointType, JointAxis +from omnigibson.utils.constants import JointAxis, JointType from omnigibson.utils.python_utils import assert_valid_key -import omnigibson.utils.transform_utils as T - -from omnigibson.controllers.controller_base import ControlType - +from omnigibson.utils.usd_utils import PoseAPI, create_joint # Create settings for this module m = create_module_macros(module_path=__file__) diff --git a/omnigibson/prims/material_prim.py b/omnigibson/prims/material_prim.py index d7bbac6303..0812d8d7df 100644 --- a/omnigibson/prims/material_prim.py +++ b/omnigibson/prims/material_prim.py @@ -1,11 +1,12 @@ -import numpy as np import asyncio import os +import numpy as np + import omnigibson as og import omnigibson.lazy as lazy -from omnigibson.utils.physx_utils import bind_material from omnigibson.prims.prim_base import BasePrim +from omnigibson.utils.physx_utils import bind_material class MaterialPrim(BasePrim): diff --git a/omnigibson/prims/prim_base.py b/omnigibson/prims/prim_base.py index 251808a230..74ec05c93e 100644 --- a/omnigibson/prims/prim_base.py +++ b/omnigibson/prims/prim_base.py @@ -2,7 +2,7 @@ import omnigibson as og import omnigibson.lazy as lazy -from omnigibson.utils.python_utils import Serializable, UniquelyNamed, Recreatable +from omnigibson.utils.python_utils import Recreatable, Serializable, UniquelyNamed from omnigibson.utils.sim_utils import check_deletable_prim from omnigibson.utils.ui_utils import create_module_logger diff --git a/omnigibson/prims/rigid_prim.py b/omnigibson/prims/rigid_prim.py index 184e4d2e67..8028d7b987 100644 --- a/omnigibson/prims/rigid_prim.py +++ b/omnigibson/prims/rigid_prim.py @@ -1,17 +1,18 @@ from functools import cached_property -from scipy.spatial import ConvexHull, QhullError + import numpy as np +from scipy.spatial import ConvexHull, QhullError import omnigibson as og import omnigibson.lazy as lazy -from omnigibson.macros import gm, create_module_macros -from omnigibson.prims.xform_prim import XFormPrim +import omnigibson.utils.transform_utils as T +from omnigibson.macros import create_module_macros, gm from omnigibson.prims.geom_prim import CollisionGeomPrim, VisualGeomPrim +from omnigibson.prims.xform_prim import XFormPrim from omnigibson.utils.constants import GEOM_TYPES from omnigibson.utils.sim_utils import CsRawData -from omnigibson.utils.usd_utils import PoseAPI, get_mesh_volume_and_com, check_extent_radius_ratio -import omnigibson.utils.transform_utils as T from omnigibson.utils.ui_utils import create_module_logger +from omnigibson.utils.usd_utils import PoseAPI, check_extent_radius_ratio, get_mesh_volume_and_com # Create module logger log = create_module_logger(module_name=__name__) diff --git a/omnigibson/prims/xform_prim.py b/omnigibson/prims/xform_prim.py index 929d0ebf15..1211342eeb 100644 --- a/omnigibson/prims/xform_prim.py +++ b/omnigibson/prims/xform_prim.py @@ -1,16 +1,18 @@ from collections.abc import Iterable + import numpy as np +import trimesh.transformations +from scipy.spatial.transform import Rotation as R + import omnigibson as og -from omnigibson.macros import gm import omnigibson.lazy as lazy -from omnigibson.prims.prim_base import BasePrim +import omnigibson.utils.transform_utils as T +from omnigibson.macros import gm from omnigibson.prims.material_prim import MaterialPrim +from omnigibson.prims.prim_base import BasePrim from omnigibson.utils.transform_utils import quat2euler from omnigibson.utils.usd_utils import PoseAPI -import omnigibson.utils.transform_utils as T -from scipy.spatial.transform import Rotation as R -from omnigibson.macros import gm -import trimesh.transformations + class XFormPrim(BasePrim): """ diff --git a/omnigibson/renderer_settings/common_settings.py b/omnigibson/renderer_settings/common_settings.py index 70ff00d40e..d5380da410 100644 --- a/omnigibson/renderer_settings/common_settings.py +++ b/omnigibson/renderer_settings/common_settings.py @@ -1,5 +1,4 @@ import omnigibson.lazy as lazy - from omnigibson.renderer_settings.settings_base import SettingItem, SettingsBase, SubSettingsBase diff --git a/omnigibson/renderer_settings/path_tracing_settings.py b/omnigibson/renderer_settings/path_tracing_settings.py index c1b96fa90e..6a70136ae1 100644 --- a/omnigibson/renderer_settings/path_tracing_settings.py +++ b/omnigibson/renderer_settings/path_tracing_settings.py @@ -1,5 +1,4 @@ import omnigibson.lazy as lazy - from omnigibson.renderer_settings.settings_base import SettingItem, SettingsBase, SubSettingsBase diff --git a/omnigibson/renderer_settings/post_processing_settings.py b/omnigibson/renderer_settings/post_processing_settings.py index 56dc952f73..efdd257d4d 100644 --- a/omnigibson/renderer_settings/post_processing_settings.py +++ b/omnigibson/renderer_settings/post_processing_settings.py @@ -1,5 +1,4 @@ import omnigibson.lazy as lazy - from omnigibson.renderer_settings.settings_base import SettingItem, SettingsBase, SubSettingsBase diff --git a/omnigibson/renderer_settings/real_time_settings.py b/omnigibson/renderer_settings/real_time_settings.py index ef123b1b0a..643e76bd67 100644 --- a/omnigibson/renderer_settings/real_time_settings.py +++ b/omnigibson/renderer_settings/real_time_settings.py @@ -1,5 +1,4 @@ import omnigibson.lazy as lazy - from omnigibson.renderer_settings.settings_base import SettingItem, SettingsBase, SubSettingsBase diff --git a/omnigibson/renderer_settings/settings_base.py b/omnigibson/renderer_settings/settings_base.py index 851a1a9c8c..b39badee32 100644 --- a/omnigibson/renderer_settings/settings_base.py +++ b/omnigibson/renderer_settings/settings_base.py @@ -1,6 +1,7 @@ from abc import ABCMeta import numpy as np + import omnigibson.lazy as lazy diff --git a/omnigibson/reward_functions/__init__.py b/omnigibson/reward_functions/__init__.py index d667bfd0b5..9f670d95e1 100644 --- a/omnigibson/reward_functions/__init__.py +++ b/omnigibson/reward_functions/__init__.py @@ -1,5 +1,5 @@ -from omnigibson.reward_functions.reward_function_base import BaseRewardFunction, REGISTERED_REWARD_FUNCTIONS from omnigibson.reward_functions.collision_reward import CollisionReward from omnigibson.reward_functions.point_goal_reward import PointGoalReward from omnigibson.reward_functions.potential_reward import PotentialReward from omnigibson.reward_functions.reaching_goal_reward import ReachingGoalReward +from omnigibson.reward_functions.reward_function_base import REGISTERED_REWARD_FUNCTIONS, BaseRewardFunction diff --git a/omnigibson/reward_functions/collision_reward.py b/omnigibson/reward_functions/collision_reward.py index b1a5f66ba6..55c52c0f5f 100644 --- a/omnigibson/reward_functions/collision_reward.py +++ b/omnigibson/reward_functions/collision_reward.py @@ -1,5 +1,5 @@ -from omnigibson.reward_functions.reward_function_base import BaseRewardFunction from omnigibson.object_states.contact_bodies import ContactBodies +from omnigibson.reward_functions.reward_function_base import BaseRewardFunction class CollisionReward(BaseRewardFunction): diff --git a/omnigibson/reward_functions/reaching_goal_reward.py b/omnigibson/reward_functions/reaching_goal_reward.py index ec398919ef..6a69ac20f2 100644 --- a/omnigibson/reward_functions/reaching_goal_reward.py +++ b/omnigibson/reward_functions/reaching_goal_reward.py @@ -1,5 +1,5 @@ -from omnigibson.reward_functions.reward_function_base import BaseRewardFunction import omnigibson.utils.transform_utils as T +from omnigibson.reward_functions.reward_function_base import BaseRewardFunction class ReachingGoalReward(BaseRewardFunction): diff --git a/omnigibson/reward_functions/reward_function_base.py b/omnigibson/reward_functions/reward_function_base.py index d21d1780dd..03b22164fa 100644 --- a/omnigibson/reward_functions/reward_function_base.py +++ b/omnigibson/reward_functions/reward_function_base.py @@ -1,6 +1,7 @@ from abc import ABCMeta, abstractmethod from copy import deepcopy -from omnigibson.utils.python_utils import classproperty, Registerable + +from omnigibson.utils.python_utils import Registerable, classproperty REGISTERED_REWARD_FUNCTIONS = dict() diff --git a/omnigibson/robots/__init__.py b/omnigibson/robots/__init__.py index f2a4145c81..18b29fd780 100644 --- a/omnigibson/robots/__init__.py +++ b/omnigibson/robots/__init__.py @@ -1,16 +1,16 @@ from omnigibson.robots.active_camera_robot import ActiveCameraRobot +from omnigibson.robots.behavior_robot import BehaviorRobot +from omnigibson.robots.fetch import Fetch +from omnigibson.robots.franka import FrankaPanda +from omnigibson.robots.franka_allegro import FrankaAllegro +from omnigibson.robots.franka_leap import FrankaLeap from omnigibson.robots.freight import Freight from omnigibson.robots.husky import Husky from omnigibson.robots.locobot import Locobot from omnigibson.robots.locomotion_robot import LocomotionRobot from omnigibson.robots.manipulation_robot import ManipulationRobot from omnigibson.robots.robot_base import REGISTERED_ROBOTS, BaseRobot -from omnigibson.robots.turtlebot import Turtlebot -from omnigibson.robots.fetch import Fetch from omnigibson.robots.tiago import Tiago +from omnigibson.robots.turtlebot import Turtlebot from omnigibson.robots.two_wheel_robot import TwoWheelRobot -from omnigibson.robots.franka import FrankaPanda -from omnigibson.robots.franka_allegro import FrankaAllegro -from omnigibson.robots.franka_leap import FrankaLeap from omnigibson.robots.vx300s import VX300S -from omnigibson.robots.behavior_robot import BehaviorRobot diff --git a/omnigibson/robots/active_camera_robot.py b/omnigibson/robots/active_camera_robot.py index adb6958ad1..a0e707de71 100644 --- a/omnigibson/robots/active_camera_robot.py +++ b/omnigibson/robots/active_camera_robot.py @@ -1,4 +1,5 @@ from abc import abstractmethod + import numpy as np from omnigibson.robots.robot_base import BaseRobot diff --git a/omnigibson/robots/behavior_robot.py b/omnigibson/robots/behavior_robot.py index 652cf70d4c..2cd36d0af4 100644 --- a/omnigibson/robots/behavior_robot.py +++ b/omnigibson/robots/behavior_robot.py @@ -1,19 +1,20 @@ +import itertools +import os from abc import ABC from collections import OrderedDict -import itertools +from typing import Iterable, List, Tuple + import numpy as np -import os from scipy.spatial.transform import Rotation as R -from typing import List, Tuple, Iterable import omnigibson as og import omnigibson.lazy as lazy import omnigibson.utils.transform_utils as T -from omnigibson.macros import gm, create_module_macros -from omnigibson.robots.locomotion_robot import LocomotionRobot -from omnigibson.robots.manipulation_robot import ManipulationRobot, GraspingPoint -from omnigibson.robots.active_camera_robot import ActiveCameraRobot +from omnigibson.macros import create_module_macros, gm from omnigibson.objects.usd_object import USDObject +from omnigibson.robots.active_camera_robot import ActiveCameraRobot +from omnigibson.robots.locomotion_robot import LocomotionRobot +from omnigibson.robots.manipulation_robot import GraspingPoint, ManipulationRobot m = create_module_macros(module_path=__file__) # component suffixes for the 6-DOF arm joint names diff --git a/omnigibson/robots/fetch.py b/omnigibson/robots/fetch.py index dcab8c631e..b0ad3b8c3d 100644 --- a/omnigibson/robots/fetch.py +++ b/omnigibson/robots/fetch.py @@ -1,14 +1,15 @@ import os + import numpy as np -from omnigibson.macros import gm from omnigibson.controllers import ControlType +from omnigibson.macros import gm from omnigibson.robots.active_camera_robot import ActiveCameraRobot from omnigibson.robots.manipulation_robot import GraspingPoint, ManipulationRobot from omnigibson.robots.two_wheel_robot import TwoWheelRobot from omnigibson.utils.python_utils import assert_valid_key -from omnigibson.utils.ui_utils import create_module_logger from omnigibson.utils.transform_utils import euler2quat +from omnigibson.utils.ui_utils import create_module_logger from omnigibson.utils.usd_utils import JointType log = create_module_logger(module_name=__name__) diff --git a/omnigibson/robots/franka.py b/omnigibson/robots/franka.py index 7fa6fd7e4b..b27fa64cdc 100644 --- a/omnigibson/robots/franka.py +++ b/omnigibson/robots/franka.py @@ -1,8 +1,9 @@ import os + import numpy as np from omnigibson.macros import gm -from omnigibson.robots.manipulation_robot import ManipulationRobot, GraspingPoint +from omnigibson.robots.manipulation_robot import GraspingPoint, ManipulationRobot from omnigibson.utils.transform_utils import euler2quat diff --git a/omnigibson/robots/franka_allegro.py b/omnigibson/robots/franka_allegro.py index fd3a8ecf2b..3833612496 100644 --- a/omnigibson/robots/franka_allegro.py +++ b/omnigibson/robots/franka_allegro.py @@ -1,9 +1,10 @@ import os + import numpy as np import omnigibson.utils.transform_utils as T from omnigibson.macros import gm -from omnigibson.robots.manipulation_robot import ManipulationRobot, GraspingPoint +from omnigibson.robots.manipulation_robot import GraspingPoint, ManipulationRobot class FrankaAllegro(ManipulationRobot): diff --git a/omnigibson/robots/franka_leap.py b/omnigibson/robots/franka_leap.py index 7356e28f05..641d7e958b 100644 --- a/omnigibson/robots/franka_leap.py +++ b/omnigibson/robots/franka_leap.py @@ -1,10 +1,11 @@ import os -import numpy as np from typing import Dict, Iterable +import numpy as np + import omnigibson.utils.transform_utils as T from omnigibson.macros import gm -from omnigibson.robots.manipulation_robot import ManipulationRobot, GraspingPoint +from omnigibson.robots.manipulation_robot import GraspingPoint, ManipulationRobot class FrankaLeap(ManipulationRobot): diff --git a/omnigibson/robots/freight.py b/omnigibson/robots/freight.py index 475b446fe4..b79cf9696a 100644 --- a/omnigibson/robots/freight.py +++ b/omnigibson/robots/freight.py @@ -1,4 +1,5 @@ import os + import numpy as np from omnigibson.macros import gm diff --git a/omnigibson/robots/husky.py b/omnigibson/robots/husky.py index 37f3021940..90ae868e6f 100644 --- a/omnigibson/robots/husky.py +++ b/omnigibson/robots/husky.py @@ -1,4 +1,5 @@ import os + import numpy as np from omnigibson.macros import gm diff --git a/omnigibson/robots/locobot.py b/omnigibson/robots/locobot.py index 2f027a2738..fff9d101d2 100644 --- a/omnigibson/robots/locobot.py +++ b/omnigibson/robots/locobot.py @@ -1,4 +1,5 @@ import os + import numpy as np from omnigibson.macros import gm diff --git a/omnigibson/robots/manipulation_robot.py b/omnigibson/robots/manipulation_robot.py index bbed134602..824d111576 100644 --- a/omnigibson/robots/manipulation_robot.py +++ b/omnigibson/robots/manipulation_robot.py @@ -1,26 +1,29 @@ from abc import abstractmethod from collections import namedtuple -import numpy as np + import networkx as nx +import numpy as np import omnigibson as og import omnigibson.lazy as lazy -from omnigibson.controllers import InverseKinematicsController, MultiFingerGripperController, OperationalSpaceController -from omnigibson.macros import gm, create_module_macros -from omnigibson.object_states import ContactBodies import omnigibson.utils.transform_utils as T from omnigibson.controllers import ( - IsGraspingState, ControlType, - ManipulationController, GripperController, + InverseKinematicsController, + IsGraspingState, + ManipulationController, + MultiFingerGripperController, + OperationalSpaceController, ) +from omnigibson.macros import create_module_macros, gm +from omnigibson.object_states import ContactBodies from omnigibson.robots.robot_base import BaseRobot -from omnigibson.utils.python_utils import classproperty, assert_valid_key -from omnigibson.utils.geometry_utils import generate_points_in_volume_checker_function from omnigibson.utils.constants import JointType, PrimType -from omnigibson.utils.usd_utils import create_joint +from omnigibson.utils.geometry_utils import generate_points_in_volume_checker_function +from omnigibson.utils.python_utils import assert_valid_key, classproperty from omnigibson.utils.sampling_utils import raytest_batch +from omnigibson.utils.usd_utils import create_joint # Create settings for this module m = create_module_macros(module_path=__file__) diff --git a/omnigibson/robots/robot_base.py b/omnigibson/robots/robot_base.py index 5e188f44a7..9261529351 100644 --- a/omnigibson/robots/robot_base.py +++ b/omnigibson/robots/robot_base.py @@ -1,18 +1,25 @@ from abc import abstractmethod from copy import deepcopy -import numpy as np + import matplotlib.pyplot as plt +import numpy as np from omnigibson.macros import create_module_macros -from omnigibson.sensors import create_sensor, SENSOR_PRIMS_TO_SENSOR_CLS, ALL_SENSOR_MODALITIES, VisionSensor, ScanSensor -from omnigibson.objects.usd_object import USDObject -from omnigibson.objects.object_base import BaseObject from omnigibson.objects.controllable_object import ControllableObject +from omnigibson.objects.object_base import BaseObject +from omnigibson.objects.usd_object import USDObject +from omnigibson.sensors import ( + ALL_SENSOR_MODALITIES, + SENSOR_PRIMS_TO_SENSOR_CLS, + ScanSensor, + VisionSensor, + create_sensor, +) +from omnigibson.utils.constants import PrimType from omnigibson.utils.gym_utils import GymObservable -from omnigibson.utils.usd_utils import add_asset_to_stage from omnigibson.utils.python_utils import classproperty, merge_nested_dicts +from omnigibson.utils.usd_utils import add_asset_to_stage from omnigibson.utils.vision_utils import segmentation_to_rgb -from omnigibson.utils.constants import PrimType # Global dicts that will contain mappings REGISTERED_ROBOTS = dict() diff --git a/omnigibson/robots/tiago.py b/omnigibson/robots/tiago.py index 878d50ccde..0f49ba72ea 100644 --- a/omnigibson/robots/tiago.py +++ b/omnigibson/robots/tiago.py @@ -1,13 +1,14 @@ import os + import numpy as np + import omnigibson as og import omnigibson.lazy as lazy -from omnigibson.macros import gm import omnigibson.utils.transform_utils as T -from omnigibson.macros import create_module_macros +from omnigibson.macros import create_module_macros, gm from omnigibson.robots.active_camera_robot import ActiveCameraRobot -from omnigibson.robots.manipulation_robot import GraspingPoint, ManipulationRobot from omnigibson.robots.locomotion_robot import LocomotionRobot +from omnigibson.robots.manipulation_robot import GraspingPoint, ManipulationRobot from omnigibson.utils.python_utils import assert_valid_key from omnigibson.utils.usd_utils import JointType diff --git a/omnigibson/robots/turtlebot.py b/omnigibson/robots/turtlebot.py index a77a288650..f5afa73cdd 100644 --- a/omnigibson/robots/turtlebot.py +++ b/omnigibson/robots/turtlebot.py @@ -1,4 +1,5 @@ import os + import numpy as np from omnigibson.macros import gm diff --git a/omnigibson/robots/two_wheel_robot.py b/omnigibson/robots/two_wheel_robot.py index 73bb7cb262..427931b7ff 100644 --- a/omnigibson/robots/two_wheel_robot.py +++ b/omnigibson/robots/two_wheel_robot.py @@ -1,4 +1,5 @@ from abc import abstractmethod + import gym import numpy as np diff --git a/omnigibson/robots/vx300s.py b/omnigibson/robots/vx300s.py index 202912b513..3cf8d7abdf 100644 --- a/omnigibson/robots/vx300s.py +++ b/omnigibson/robots/vx300s.py @@ -1,8 +1,9 @@ import os + import numpy as np from omnigibson.macros import gm -from omnigibson.robots.manipulation_robot import ManipulationRobot, GraspingPoint +from omnigibson.robots.manipulation_robot import GraspingPoint, ManipulationRobot from omnigibson.utils.transform_utils import euler2quat diff --git a/omnigibson/scene_graphs/graph_builder.py b/omnigibson/scene_graphs/graph_builder.py index 802632d27c..281b1d44d6 100644 --- a/omnigibson/scene_graphs/graph_builder.py +++ b/omnigibson/scene_graphs/graph_builder.py @@ -3,14 +3,14 @@ import networkx as nx import numpy as np -from PIL import Image from matplotlib import pyplot as plt +from PIL import Image from omnigibson import object_states from omnigibson.macros import create_module_macros -from omnigibson.sensors import VisionSensor from omnigibson.object_states.factory import get_state_name from omnigibson.object_states.object_state_base import AbsoluteObjectState, BooleanStateMixin, RelativeObjectState +from omnigibson.sensors import VisionSensor from omnigibson.utils import transform_utils as T diff --git a/omnigibson/scenes/__init__.py b/omnigibson/scenes/__init__.py index 7b5ff7944a..9eade9bd22 100644 --- a/omnigibson/scenes/__init__.py +++ b/omnigibson/scenes/__init__.py @@ -1,4 +1,4 @@ -from omnigibson.scenes.scene_base import Scene, REGISTERED_SCENES -from omnigibson.scenes.traversable_scene import TraversableScene -from omnigibson.scenes.static_traversable_scene import StaticTraversableScene from omnigibson.scenes.interactive_traversable_scene import InteractiveTraversableScene +from omnigibson.scenes.scene_base import REGISTERED_SCENES, Scene +from omnigibson.scenes.static_traversable_scene import StaticTraversableScene +from omnigibson.scenes.traversable_scene import TraversableScene diff --git a/omnigibson/scenes/interactive_traversable_scene.py b/omnigibson/scenes/interactive_traversable_scene.py index d49e213f6b..5e46977a02 100644 --- a/omnigibson/scenes/interactive_traversable_scene.py +++ b/omnigibson/scenes/interactive_traversable_scene.py @@ -1,8 +1,9 @@ import os + +from omnigibson.maps.segmentation_map import SegmentationMap from omnigibson.robots.robot_base import REGISTERED_ROBOTS from omnigibson.robots.robot_base import m as robot_macros from omnigibson.scenes.traversable_scene import TraversableScene -from omnigibson.maps.segmentation_map import SegmentationMap from omnigibson.utils.asset_utils import get_og_scene_path from omnigibson.utils.constants import STRUCTURE_CATEGORIES from omnigibson.utils.ui_utils import create_module_logger diff --git a/omnigibson/scenes/scene_base.py b/omnigibson/scenes/scene_base.py index 4c5faec905..db607f8209 100644 --- a/omnigibson/scenes/scene_base.py +++ b/omnigibson/scenes/scene_base.py @@ -1,24 +1,30 @@ import json from abc import ABC from itertools import combinations + import numpy as np import omnigibson as og import omnigibson.lazy as lazy from omnigibson.macros import create_module_macros, gm -from omnigibson.prims.xform_prim import XFormPrim +from omnigibson.objects.dataset_object import DatasetObject +from omnigibson.objects.light_object import LightObject +from omnigibson.objects.object_base import BaseObject from omnigibson.prims.material_prim import MaterialPrim +from omnigibson.prims.xform_prim import XFormPrim +from omnigibson.robots.robot_base import m as robot_macros +from omnigibson.systems.system_base import SYSTEM_REGISTRY, clear_all_systems, get_system from omnigibson.utils.constants import STRUCTURE_CATEGORIES -from omnigibson.utils.python_utils import classproperty, Serializable, Registerable, Recreatable, \ - create_object_from_init_info +from omnigibson.utils.python_utils import ( + Recreatable, + Registerable, + Serializable, + classproperty, + create_object_from_init_info, +) from omnigibson.utils.registry_utils import SerializableRegistry from omnigibson.utils.ui_utils import create_module_logger from omnigibson.utils.usd_utils import CollisionAPI -from omnigibson.objects.object_base import BaseObject -from omnigibson.objects.dataset_object import DatasetObject -from omnigibson.systems.system_base import SYSTEM_REGISTRY, clear_all_systems, get_system -from omnigibson.objects.light_object import LightObject -from omnigibson.robots.robot_base import m as robot_macros # Create module logger log = create_module_logger(module_name=__name__) diff --git a/omnigibson/scenes/static_traversable_scene.py b/omnigibson/scenes/static_traversable_scene.py index 99be51731f..7ef5271667 100644 --- a/omnigibson/scenes/static_traversable_scene.py +++ b/omnigibson/scenes/static_traversable_scene.py @@ -2,11 +2,11 @@ import numpy as np -from omnigibson.scenes.traversable_scene import TraversableScene from omnigibson.prims.geom_prim import CollisionVisualGeomPrim +from omnigibson.scenes.traversable_scene import TraversableScene from omnigibson.utils.asset_utils import get_scene_path -from omnigibson.utils.usd_utils import add_asset_to_stage from omnigibson.utils.ui_utils import create_module_logger +from omnigibson.utils.usd_utils import add_asset_to_stage # Create module logger log = create_module_logger(module_name=__name__) diff --git a/omnigibson/scenes/traversable_scene.py b/omnigibson/scenes/traversable_scene.py index ecb26b9d9e..a2ba982652 100644 --- a/omnigibson/scenes/traversable_scene.py +++ b/omnigibson/scenes/traversable_scene.py @@ -1,5 +1,5 @@ -from omnigibson.scenes.scene_base import Scene from omnigibson.maps.traversable_map import TraversableMap +from omnigibson.scenes.scene_base import Scene from omnigibson.utils.ui_utils import create_module_logger # Create module logger diff --git a/omnigibson/sensors/__init__.py b/omnigibson/sensors/__init__.py index 215aa09244..be8e4e1f11 100644 --- a/omnigibson/sensors/__init__.py +++ b/omnigibson/sensors/__init__.py @@ -1,11 +1,9 @@ -from omnigibson.utils.python_utils import assert_valid_key - -from omnigibson.sensors.sensor_base import BaseSensor, REGISTERED_SENSORS, ALL_SENSOR_MODALITIES +from omnigibson.sensors.dropout_sensor_noise import DropoutSensorNoise from omnigibson.sensors.scan_sensor import ScanSensor +from omnigibson.sensors.sensor_base import ALL_SENSOR_MODALITIES, REGISTERED_SENSORS, BaseSensor +from omnigibson.sensors.sensor_noise_base import REGISTERED_SENSOR_NOISES, BaseSensorNoise from omnigibson.sensors.vision_sensor import VisionSensor -from omnigibson.sensors.sensor_noise_base import BaseSensorNoise, REGISTERED_SENSOR_NOISES -from omnigibson.sensors.dropout_sensor_noise import DropoutSensorNoise - +from omnigibson.utils.python_utils import assert_valid_key # Map sensor prim names to corresponding sensor classes SENSOR_PRIMS_TO_SENSOR_CLS = { diff --git a/omnigibson/sensors/scan_sensor.py b/omnigibson/sensors/scan_sensor.py index 5c88063a02..a524a29966 100644 --- a/omnigibson/sensors/scan_sensor.py +++ b/omnigibson/sensors/scan_sensor.py @@ -1,7 +1,7 @@ -import cv2 -import numpy as np from collections.abc import Iterable +import cv2 +import numpy as np from transforms3d.quaternions import quat2mat import omnigibson.lazy as lazy diff --git a/omnigibson/sensors/sensor_base.py b/omnigibson/sensors/sensor_base.py index a516b5bec1..1e12f27d59 100644 --- a/omnigibson/sensors/sensor_base.py +++ b/omnigibson/sensors/sensor_base.py @@ -1,9 +1,10 @@ from abc import ABCMeta -from omnigibson.prims.xform_prim import XFormPrim -from omnigibson.utils.python_utils import classproperty, assert_valid_key, Registerable -from omnigibson.utils.gym_utils import GymObservable + from gym.spaces import Space +from omnigibson.prims.xform_prim import XFormPrim +from omnigibson.utils.gym_utils import GymObservable +from omnigibson.utils.python_utils import Registerable, assert_valid_key, classproperty # Registered sensors REGISTERED_SENSORS = dict() diff --git a/omnigibson/sensors/sensor_noise_base.py b/omnigibson/sensors/sensor_noise_base.py index cf7b8220d9..d5c165ddca 100644 --- a/omnigibson/sensors/sensor_noise_base.py +++ b/omnigibson/sensors/sensor_noise_base.py @@ -1,7 +1,6 @@ from abc import ABCMeta, abstractmethod -from omnigibson.utils.python_utils import classproperty, Registerable - +from omnigibson.utils.python_utils import Registerable, classproperty # Registered sensor noises REGISTERED_SENSOR_NOISES = dict() diff --git a/omnigibson/sensors/vision_sensor.py b/omnigibson/sensors/vision_sensor.py index b53cdb55c6..480ebd89b3 100644 --- a/omnigibson/sensors/vision_sensor.py +++ b/omnigibson/sensors/vision_sensor.py @@ -1,12 +1,19 @@ -import numpy as np import time + import gym +import numpy as np import omnigibson as og import omnigibson.lazy as lazy from omnigibson.sensors.sensor_base import BaseSensor from omnigibson.systems.system_base import REGISTERED_SYSTEMS -from omnigibson.utils.constants import MAX_CLASS_COUNT, MAX_INSTANCE_COUNT, MAX_VIEWER_SIZE, semantic_class_name_to_id, semantic_class_id_to_name +from omnigibson.utils.constants import ( + MAX_CLASS_COUNT, + MAX_INSTANCE_COUNT, + MAX_VIEWER_SIZE, + semantic_class_id_to_name, + semantic_class_name_to_id, +) from omnigibson.utils.python_utils import assert_valid_key, classproperty from omnigibson.utils.sim_utils import set_carb_setting from omnigibson.utils.ui_utils import dock_window diff --git a/omnigibson/simulator.py b/omnigibson/simulator.py index 8c2462d06a..f9137c8a37 100644 --- a/omnigibson/simulator.py +++ b/omnigibson/simulator.py @@ -1,39 +1,49 @@ -from collections import defaultdict -import itertools +import atexit import contextlib +import itertools +import json import logging import os import shutil -import socket -from pathlib import Path -import atexit import signal +import socket +from collections import defaultdict from contextlib import nullcontext +from pathlib import Path import numpy as np -import json import omnigibson as og import omnigibson.lazy as lazy -from omnigibson.macros import gm, create_module_macros -from omnigibson.utils.constants import LightingMode -from omnigibson.utils.config_utils import NumpyEncoder -from omnigibson.utils.python_utils import clear as clear_pu, create_object_from_init_info, Serializable -from omnigibson.utils.sim_utils import meets_minimum_isaac_version -from omnigibson.utils.usd_utils import clear as clear_uu, FlatcacheAPI, RigidContactAPI, PoseAPI -from omnigibson.utils.ui_utils import (CameraMover, disclaimer, create_module_logger, suppress_omni_log, - print_icon, print_logo, logo_small) -from omnigibson.scenes import Scene -from omnigibson.objects.object_base import BaseObject -from omnigibson.objects.stateful_object import StatefulObject +from omnigibson.macros import create_module_macros, gm from omnigibson.object_states.contact_subscribed_state_mixin import ContactSubscribedStateMixin -from omnigibson.object_states.joint_break_subscribed_state_mixin import JointBreakSubscribedStateMixin from omnigibson.object_states.factory import get_states_by_dependency_order -from omnigibson.object_states.update_state_mixin import UpdateStateMixin, GlobalUpdateStateMixin +from omnigibson.object_states.joint_break_subscribed_state_mixin import JointBreakSubscribedStateMixin +from omnigibson.object_states.update_state_mixin import GlobalUpdateStateMixin, UpdateStateMixin +from omnigibson.objects.object_base import BaseObject +from omnigibson.objects.stateful_object import StatefulObject from omnigibson.prims.material_prim import MaterialPrim +from omnigibson.scenes import Scene from omnigibson.sensors.vision_sensor import VisionSensor from omnigibson.systems.macro_particle_system import MacroPhysicalParticleSystem from omnigibson.transition_rules import TransitionRuleAPI +from omnigibson.utils.config_utils import NumpyEncoder +from omnigibson.utils.constants import LightingMode +from omnigibson.utils.python_utils import Serializable +from omnigibson.utils.python_utils import clear as clear_pu +from omnigibson.utils.python_utils import create_object_from_init_info +from omnigibson.utils.sim_utils import meets_minimum_isaac_version +from omnigibson.utils.ui_utils import ( + CameraMover, + create_module_logger, + disclaimer, + logo_small, + print_icon, + print_logo, + suppress_omni_log, +) +from omnigibson.utils.usd_utils import FlatcacheAPI, PoseAPI, RigidContactAPI +from omnigibson.utils.usd_utils import clear as clear_uu # Create module logger log = create_module_logger(module_name=__name__) @@ -66,8 +76,10 @@ def _launch_app(): # Omni's logging is super annoying and overly verbose, so suppress it by modifying the logging levels if not gm.DEBUG: import sys - from numba.core.errors import NumbaPerformanceWarning import warnings + + from numba.core.errors import NumbaPerformanceWarning + # TODO: Find a more elegant way to prune omni logging # sys.argv.append("--/log/level=warning") # sys.argv.append("--/log/fileLogLevel=warning") diff --git a/omnigibson/systems/__init__.py b/omnigibson/systems/__init__.py index 1ec98f2a4b..32b53985df 100644 --- a/omnigibson/systems/__init__.py +++ b/omnigibson/systems/__init__.py @@ -1,8 +1,17 @@ -from omnigibson.systems.system_base import get_system, is_system_active, is_visual_particle_system, \ - is_physical_particle_system, SYSTEM_REGISTRY, add_callback_on_system_init, add_callback_on_system_clear, \ - remove_callback_on_system_init, remove_callback_on_system_clear, import_og_systems -from omnigibson.systems.micro_particle_system import * from omnigibson.systems.macro_particle_system import * +from omnigibson.systems.micro_particle_system import * +from omnigibson.systems.system_base import ( + SYSTEM_REGISTRY, + add_callback_on_system_clear, + add_callback_on_system_init, + get_system, + import_og_systems, + is_physical_particle_system, + is_system_active, + is_visual_particle_system, + remove_callback_on_system_clear, + remove_callback_on_system_init, +) # Import all OG systems from dataset import_og_systems() diff --git a/omnigibson/systems/macro_particle_system.py b/omnigibson/systems/macro_particle_system.py index 6bb131da91..51d572949e 100644 --- a/omnigibson/systems/macro_particle_system.py +++ b/omnigibson/systems/macro_particle_system.py @@ -1,21 +1,22 @@ import os + import matplotlib.pyplot as plt +import numpy as np import trimesh +from scipy.spatial.transform import Rotation as R import omnigibson as og import omnigibson.lazy as lazy -from omnigibson.macros import gm, create_module_macros +import omnigibson.utils.transform_utils as T +from omnigibson.macros import create_module_macros, gm +from omnigibson.prims.geom_prim import CollisionVisualGeomPrim, VisualGeomPrim from omnigibson.prims.xform_prim import XFormPrim -from omnigibson.systems.system_base import BaseSystem, VisualParticleSystem, PhysicalParticleSystem, REGISTERED_SYSTEMS +from omnigibson.systems.system_base import REGISTERED_SYSTEMS, BaseSystem, PhysicalParticleSystem, VisualParticleSystem from omnigibson.utils.constants import PrimType -from omnigibson.utils.python_utils import classproperty, subclass_factory, snake_case_to_camel_case +from omnigibson.utils.python_utils import classproperty, snake_case_to_camel_case, subclass_factory from omnigibson.utils.sampling_utils import sample_cuboid_on_object_symmetric_bimodal_distribution -import omnigibson.utils.transform_utils as T -from omnigibson.utils.usd_utils import FlatcacheAPI -from omnigibson.prims.geom_prim import VisualGeomPrim, CollisionVisualGeomPrim -import numpy as np -from scipy.spatial.transform import Rotation as R from omnigibson.utils.ui_utils import create_module_logger, suppress_omni_log +from omnigibson.utils.usd_utils import FlatcacheAPI # Create module logger log = create_module_logger(module_name=__name__) diff --git a/omnigibson/systems/micro_particle_system.py b/omnigibson/systems/micro_particle_system.py index ac4c84880f..e4dd45db2d 100644 --- a/omnigibson/systems/micro_particle_system.py +++ b/omnigibson/systems/micro_particle_system.py @@ -1,26 +1,27 @@ +import datetime +import os +import tempfile import uuid +from collections import defaultdict +from pathlib import Path + +import numpy as np +import pymeshlab +import trimesh + import omnigibson as og import omnigibson.lazy as lazy -from omnigibson.macros import gm, create_module_macros -from omnigibson.prims.prim_base import BasePrim +from omnigibson.macros import create_module_macros, gm from omnigibson.prims.geom_prim import VisualGeomPrim from omnigibson.prims.material_prim import MaterialPrim -from omnigibson.systems.system_base import BaseSystem, PhysicalParticleSystem, REGISTERED_SYSTEMS +from omnigibson.prims.prim_base import BasePrim +from omnigibson.systems.system_base import REGISTERED_SYSTEMS, BaseSystem, PhysicalParticleSystem from omnigibson.utils.geometry_utils import generate_points_in_volume_checker_function -from omnigibson.utils.python_utils import classproperty, assert_valid_key, subclass_factory, snake_case_to_camel_case -from omnigibson.utils.sampling_utils import sample_cuboid_on_object_full_grid_topdown -from omnigibson.utils.usd_utils import mesh_prim_to_trimesh_mesh, PoseAPI from omnigibson.utils.physx_utils import create_physx_particle_system, create_physx_particleset_pointinstancer -from omnigibson.utils.ui_utils import disclaimer, create_module_logger - -from pathlib import Path -import os -import tempfile -import datetime -import trimesh -import pymeshlab -import numpy as np -from collections import defaultdict +from omnigibson.utils.python_utils import assert_valid_key, classproperty, snake_case_to_camel_case, subclass_factory +from omnigibson.utils.sampling_utils import sample_cuboid_on_object_full_grid_topdown +from omnigibson.utils.ui_utils import create_module_logger, disclaimer +from omnigibson.utils.usd_utils import PoseAPI, mesh_prim_to_trimesh_mesh # Create module logger log = create_module_logger(module_name=__name__) diff --git a/omnigibson/systems/system_base.py b/omnigibson/systems/system_base.py index a5b73dcbf4..3f40d81789 100644 --- a/omnigibson/systems/system_base.py +++ b/omnigibson/systems/system_base.py @@ -1,17 +1,26 @@ -import os import json +import os + import numpy as np import omnigibson as og -from omnigibson.macros import gm, create_module_macros +import omnigibson.lazy as lazy +from omnigibson.macros import create_module_macros, gm from omnigibson.utils.asset_utils import get_all_system_categories from omnigibson.utils.geometry_utils import generate_points_in_volume_checker_function -from omnigibson.utils.python_utils import classproperty, assert_valid_key, get_uuid, camel_case_to_snake_case, \ - snake_case_to_camel_case, subclass_factory, SerializableNonInstance, UniquelyNamedNonInstance +from omnigibson.utils.python_utils import ( + SerializableNonInstance, + UniquelyNamedNonInstance, + assert_valid_key, + camel_case_to_snake_case, + classproperty, + get_uuid, + snake_case_to_camel_case, + subclass_factory, +) from omnigibson.utils.registry_utils import SerializableRegistry from omnigibson.utils.sampling_utils import sample_cuboid_on_object_full_grid_topdown from omnigibson.utils.ui_utils import create_module_logger -import omnigibson.lazy as lazy # Create module logger log = create_module_logger(module_name=__name__) diff --git a/omnigibson/tasks/__init__.py b/omnigibson/tasks/__init__.py index 2a6bfaa8f9..8773a1226f 100644 --- a/omnigibson/tasks/__init__.py +++ b/omnigibson/tasks/__init__.py @@ -1,5 +1,5 @@ -from omnigibson.tasks.task_base import REGISTERED_TASKS +from omnigibson.tasks.behavior_task import BehaviorTask from omnigibson.tasks.dummy_task import DummyTask from omnigibson.tasks.point_navigation_task import PointNavigationTask from omnigibson.tasks.point_reaching_task import PointReachingTask -from omnigibson.tasks.behavior_task import BehaviorTask +from omnigibson.tasks.task_base import REGISTERED_TASKS diff --git a/omnigibson/tasks/behavior_task.py b/omnigibson/tasks/behavior_task.py index 083e895a46..995b10685f 100644 --- a/omnigibson/tasks/behavior_task.py +++ b/omnigibson/tasks/behavior_task.py @@ -1,31 +1,36 @@ -import numpy as np import os + +import numpy as np from bddl.activity import ( Conditions, evaluate_goal_conditions, get_goal_conditions, get_ground_goal_state_options, - get_natural_initial_conditions, get_initial_conditions, get_natural_goal_conditions, + get_natural_initial_conditions, get_object_scope, ) import omnigibson as og +import omnigibson.utils.transform_utils as T from omnigibson.macros import gm from omnigibson.object_states import Pose from omnigibson.reward_functions.potential_reward import PotentialReward from omnigibson.robots.robot_base import BaseRobot -from omnigibson.systems.system_base import get_system, add_callback_on_system_init, add_callback_on_system_clear, \ - REGISTERED_SYSTEMS -from omnigibson.scenes.scene_base import Scene from omnigibson.scenes.interactive_traversable_scene import InteractiveTraversableScene -from omnigibson.utils.bddl_utils import OmniGibsonBDDLBackend, BDDLEntity, BEHAVIOR_ACTIVITIES, BDDLSampler +from omnigibson.scenes.scene_base import Scene +from omnigibson.systems.system_base import ( + REGISTERED_SYSTEMS, + add_callback_on_system_clear, + add_callback_on_system_init, + get_system, +) from omnigibson.tasks.task_base import BaseTask from omnigibson.termination_conditions.predicate_goal import PredicateGoal from omnigibson.termination_conditions.timeout import Timeout -import omnigibson.utils.transform_utils as T -from omnigibson.utils.python_utils import classproperty, assert_valid_key +from omnigibson.utils.bddl_utils import BEHAVIOR_ACTIVITIES, BDDLEntity, BDDLSampler, OmniGibsonBDDLBackend +from omnigibson.utils.python_utils import assert_valid_key, classproperty from omnigibson.utils.ui_utils import create_module_logger # Create module logger diff --git a/omnigibson/tasks/dummy_task.py b/omnigibson/tasks/dummy_task.py index 43b9482a0a..d711a32c8a 100644 --- a/omnigibson/tasks/dummy_task.py +++ b/omnigibson/tasks/dummy_task.py @@ -1,7 +1,7 @@ import numpy as np -from omnigibson.tasks.task_base import BaseTask from omnigibson.scenes.scene_base import Scene +from omnigibson.tasks.task_base import BaseTask from omnigibson.utils.python_utils import classproperty from omnigibson.utils.sim_utils import land_object diff --git a/omnigibson/tasks/point_navigation_task.py b/omnigibson/tasks/point_navigation_task.py index b1ad9ff1d5..8e3fc52ab1 100644 --- a/omnigibson/tasks/point_navigation_task.py +++ b/omnigibson/tasks/point_navigation_task.py @@ -1,6 +1,7 @@ import numpy as np import omnigibson as og +import omnigibson.utils.transform_utils as T from omnigibson.object_states import Pose from omnigibson.objects.primitive_object import PrimitiveObject from omnigibson.reward_functions.collision_reward import CollisionReward @@ -8,13 +9,12 @@ from omnigibson.reward_functions.potential_reward import PotentialReward from omnigibson.scenes.traversable_scene import TraversableScene from omnigibson.tasks.task_base import BaseTask -from omnigibson.termination_conditions.max_collision import MaxCollision from omnigibson.termination_conditions.falling import Falling +from omnigibson.termination_conditions.max_collision import MaxCollision from omnigibson.termination_conditions.point_goal import PointGoal from omnigibson.termination_conditions.timeout import Timeout -from omnigibson.utils.python_utils import classproperty, assert_valid_key +from omnigibson.utils.python_utils import assert_valid_key, classproperty from omnigibson.utils.sim_utils import land_object, test_valid_pose -import omnigibson.utils.transform_utils as T from omnigibson.utils.ui_utils import create_module_logger # Create module logger diff --git a/omnigibson/tasks/point_reaching_task.py b/omnigibson/tasks/point_reaching_task.py index 8c26e9940d..41f92f9bbd 100644 --- a/omnigibson/tasks/point_reaching_task.py +++ b/omnigibson/tasks/point_reaching_task.py @@ -1,9 +1,8 @@ import numpy as np +import omnigibson.utils.transform_utils as T from omnigibson.tasks.point_navigation_task import PointNavigationTask from omnigibson.termination_conditions.point_goal import PointGoal -import omnigibson.utils.transform_utils as T - # Valid point navigation reward types POINT_NAVIGATION_REWARD_TYPES = {"l2", "geodesic"} diff --git a/omnigibson/tasks/task_base.py b/omnigibson/tasks/task_base.py index 46d3eed04a..956d578384 100644 --- a/omnigibson/tasks/task_base.py +++ b/omnigibson/tasks/task_base.py @@ -1,9 +1,10 @@ from abc import ABCMeta, abstractmethod from copy import deepcopy + import numpy as np -from omnigibson.utils.python_utils import classproperty, Registerable -from omnigibson.utils.gym_utils import GymObservable +from omnigibson.utils.gym_utils import GymObservable +from omnigibson.utils.python_utils import Registerable, classproperty REGISTERED_TASKS = dict() diff --git a/omnigibson/termination_conditions/__init__.py b/omnigibson/termination_conditions/__init__.py index 2e5e423eb4..ae1add4ed3 100644 --- a/omnigibson/termination_conditions/__init__.py +++ b/omnigibson/termination_conditions/__init__.py @@ -1,8 +1,12 @@ -from omnigibson.termination_conditions.termination_condition_base import REGISTERED_TERMINATION_CONDITIONS, \ - REGISTERED_SUCCESS_CONDITIONS, REGISTERED_FAILURE_CONDITIONS, BaseTerminationCondition from omnigibson.termination_conditions.falling import Falling from omnigibson.termination_conditions.max_collision import MaxCollision from omnigibson.termination_conditions.point_goal import PointGoal from omnigibson.termination_conditions.predicate_goal import PredicateGoal from omnigibson.termination_conditions.reaching_goal import ReachingGoal +from omnigibson.termination_conditions.termination_condition_base import ( + REGISTERED_FAILURE_CONDITIONS, + REGISTERED_SUCCESS_CONDITIONS, + REGISTERED_TERMINATION_CONDITIONS, + BaseTerminationCondition, +) from omnigibson.termination_conditions.timeout import Timeout diff --git a/omnigibson/termination_conditions/max_collision.py b/omnigibson/termination_conditions/max_collision.py index 854ea25f88..501d82a2b1 100644 --- a/omnigibson/termination_conditions/max_collision.py +++ b/omnigibson/termination_conditions/max_collision.py @@ -1,5 +1,5 @@ -from omnigibson.termination_conditions.termination_condition_base import FailureCondition from omnigibson.object_states.contact_bodies import ContactBodies +from omnigibson.termination_conditions.termination_condition_base import FailureCondition class MaxCollision(FailureCondition): diff --git a/omnigibson/termination_conditions/point_goal.py b/omnigibson/termination_conditions/point_goal.py index ec681c4e2e..bc2b9f7374 100644 --- a/omnigibson/termination_conditions/point_goal.py +++ b/omnigibson/termination_conditions/point_goal.py @@ -1,5 +1,5 @@ -from omnigibson.termination_conditions.termination_condition_base import SuccessCondition import omnigibson.utils.transform_utils as T +from omnigibson.termination_conditions.termination_condition_base import SuccessCondition class PointGoal(SuccessCondition): diff --git a/omnigibson/termination_conditions/reaching_goal.py b/omnigibson/termination_conditions/reaching_goal.py index f7aa477cf5..2afdba5223 100644 --- a/omnigibson/termination_conditions/reaching_goal.py +++ b/omnigibson/termination_conditions/reaching_goal.py @@ -1,5 +1,5 @@ -from omnigibson.termination_conditions.termination_condition_base import SuccessCondition import omnigibson.utils.transform_utils as T +from omnigibson.termination_conditions.termination_condition_base import SuccessCondition class ReachingGoal(SuccessCondition): diff --git a/omnigibson/termination_conditions/termination_condition_base.py b/omnigibson/termination_conditions/termination_condition_base.py index f0860fd46e..aa7e8bd129 100644 --- a/omnigibson/termination_conditions/termination_condition_base.py +++ b/omnigibson/termination_conditions/termination_condition_base.py @@ -1,5 +1,6 @@ from abc import ABCMeta, abstractmethod -from omnigibson.utils.python_utils import classproperty, Registerable + +from omnigibson.utils.python_utils import Registerable, classproperty REGISTERED_TERMINATION_CONDITIONS = dict() REGISTERED_SUCCESS_CONDITIONS = dict() diff --git a/omnigibson/transition_rules.py b/omnigibson/transition_rules.py index 9f223d741c..b1c9c27fca 100644 --- a/omnigibson/transition_rules.py +++ b/omnigibson/transition_rules.py @@ -1,30 +1,36 @@ +import itertools +import json import operator +import os from abc import ABCMeta, abstractmethod -from collections import namedtuple, defaultdict -import numpy as np -import json +from collections import defaultdict, namedtuple from copy import copy -import itertools -import os -from collections import defaultdict + +import bddl import networkx as nx +import numpy as np import omnigibson as og -from omnigibson.macros import gm, create_module_macros -from omnigibson.systems import get_system, is_system_active, PhysicalParticleSystem, VisualParticleSystem, REGISTERED_SYSTEMS -from omnigibson.objects.dataset_object import DatasetObject +import omnigibson.utils.transform_utils as T +from omnigibson.macros import create_module_macros, gm from omnigibson.object_states import * from omnigibson.object_states.factory import get_system_states from omnigibson.object_states.object_state_base import AbsoluteObjectState, RelativeObjectState +from omnigibson.objects.dataset_object import DatasetObject +from omnigibson.systems import ( + REGISTERED_SYSTEMS, + PhysicalParticleSystem, + VisualParticleSystem, + get_system, + is_system_active, +) from omnigibson.utils.asset_utils import get_all_object_category_models +from omnigibson.utils.bddl_utils import translate_bddl_recipe_to_og_recipe, translate_bddl_washer_rule_to_og_washer_rule from omnigibson.utils.constants import PrimType from omnigibson.utils.python_utils import Registerable, classproperty, subclass_factory from omnigibson.utils.registry_utils import Registry -import omnigibson.utils.transform_utils as T -from omnigibson.utils.ui_utils import disclaimer, create_module_logger +from omnigibson.utils.ui_utils import create_module_logger, disclaimer from omnigibson.utils.usd_utils import RigidContactAPI -from omnigibson.utils.bddl_utils import translate_bddl_recipe_to_og_recipe, translate_bddl_washer_rule_to_og_washer_rule -import bddl # Create module logger log = create_module_logger(module_name=__name__) diff --git a/omnigibson/utils/asset_utils.py b/omnigibson/utils/asset_utils.py index 5082717bb2..9c4eea0e63 100644 --- a/omnigibson/utils/asset_utils.py +++ b/omnigibson/utils/asset_utils.py @@ -1,20 +1,23 @@ import argparse +import contextlib +import inspect import json import os import subprocess import tempfile -import contextlib -import inspect +from collections import defaultdict from copy import deepcopy from pathlib import Path -from cryptography.fernet import Fernet -from collections import defaultdict from urllib.request import urlretrieve -import yaml + import progressbar +import yaml +from cryptography.fernet import Fernet + import omnigibson as og from omnigibson.macros import gm from omnigibson.utils.ui_utils import create_module_logger + if os.getenv("OMNIGIBSON_NO_OMNIVERSE", default=0) != "1": import omnigibson.lazy as lazy @@ -230,8 +233,8 @@ def get_all_object_category_models_with_abilities(category, abilities): to support the requested list of @abilities """ # Avoid circular imports - from omnigibson.objects.dataset_object import DatasetObject from omnigibson.object_states.factory import get_requirements_for_ability, get_states_for_ability + from omnigibson.objects.dataset_object import DatasetObject # Get all valid models all_models = get_all_object_category_models(category=category) @@ -298,8 +301,8 @@ def get_attachment_metalinks(category, model): list of str: all attachment metalinks for the object model """ # Avoid circular imports - from omnigibson.objects.dataset_object import DatasetObject from omnigibson.object_states import AttachedTo + from omnigibson.objects.dataset_object import DatasetObject usd_path = DatasetObject.get_usd_path(category=category, model=model) usd_path = usd_path.replace(".usd", ".encrypted.usd") diff --git a/omnigibson/utils/bddl_utils.py b/omnigibson/utils/bddl_utils.py index 0356e3c99f..e1c0e71a87 100644 --- a/omnigibson/utils/bddl_utils.py +++ b/omnigibson/utils/bddl_utils.py @@ -1,32 +1,34 @@ import json -import bddl import os import random -import numpy as np -import networkx as nx from collections import defaultdict -from bddl.activity import ( - get_goal_conditions, - get_ground_goal_state_options, - get_initial_conditions, -) + +import bddl +import networkx as nx +import numpy as np +from bddl.activity import get_goal_conditions, get_ground_goal_state_options, get_initial_conditions from bddl.backend_abc import BDDLBackend from bddl.condition_evaluation import Negation -from bddl.logic_base import BinaryAtomicFormula, UnaryAtomicFormula, AtomicFormula +from bddl.logic_base import AtomicFormula, BinaryAtomicFormula, UnaryAtomicFormula from bddl.object_taxonomy import ObjectTaxonomy + import omnigibson as og -from omnigibson.macros import gm, create_module_macros -from omnigibson.utils.constants import PrimType -from omnigibson.utils.asset_utils import get_attachment_metalinks, get_all_object_categories, get_all_object_category_models_with_abilities -from omnigibson.utils.ui_utils import create_module_logger -from omnigibson.utils.python_utils import Wrapper -from omnigibson.objects.dataset_object import DatasetObject -from omnigibson.robots import BaseRobot from omnigibson import object_states -from omnigibson.object_states.object_state_base import AbsoluteObjectState, RelativeObjectState +from omnigibson.macros import create_module_macros, gm from omnigibson.object_states.factory import _KINEMATIC_STATE_SET, get_system_states -from omnigibson.systems.system_base import is_system_active, get_system +from omnigibson.object_states.object_state_base import AbsoluteObjectState, RelativeObjectState +from omnigibson.objects.dataset_object import DatasetObject +from omnigibson.robots import BaseRobot from omnigibson.scenes.interactive_traversable_scene import InteractiveTraversableScene +from omnigibson.systems.system_base import get_system, is_system_active +from omnigibson.utils.asset_utils import ( + get_all_object_categories, + get_all_object_category_models_with_abilities, + get_attachment_metalinks, +) +from omnigibson.utils.constants import PrimType +from omnigibson.utils.python_utils import Wrapper +from omnigibson.utils.ui_utils import create_module_logger # Create module logger log = create_module_logger(module_name=__name__) diff --git a/omnigibson/utils/config_utils.py b/omnigibson/utils/config_utils.py index 5980912e0c..dda1e25400 100644 --- a/omnigibson/utils/config_utils.py +++ b/omnigibson/utils/config_utils.py @@ -1,6 +1,7 @@ import collections.abc import json import os + import numpy as np import yaml diff --git a/omnigibson/utils/constants.py b/omnigibson/utils/constants.py index 90d394428a..bfa0cacab7 100644 --- a/omnigibson/utils/constants.py +++ b/omnigibson/utils/constants.py @@ -1,15 +1,16 @@ """ Constant Definitions """ -from functools import cache import hashlib import os -import numpy as np from enum import Enum, IntEnum +from functools import cache + +import numpy as np import omnigibson as og from omnigibson.macros import gm -from omnigibson.utils.asset_utils import get_og_avg_category_specs, get_all_object_categories +from omnigibson.utils.asset_utils import get_all_object_categories, get_og_avg_category_specs MAX_INSTANCE_COUNT = np.iinfo(np.uint32).max MAX_CLASS_COUNT = np.iinfo(np.uint32).max diff --git a/omnigibson/utils/control_utils.py b/omnigibson/utils/control_utils.py index d6c5c7b0dc..0549171969 100644 --- a/omnigibson/utils/control_utils.py +++ b/omnigibson/utils/control_utils.py @@ -1,11 +1,13 @@ """ Set of utilities for helping to execute robot control """ -import omnigibson.lazy as lazy import numpy as np from numba import jit + +import omnigibson.lazy as lazy import omnigibson.utils.transform_utils as T + class FKSolver: """ Class for thinly wrapping Lula Forward Kinematics solver diff --git a/omnigibson/utils/deprecated_utils.py b/omnigibson/utils/deprecated_utils.py index 8865a00fe5..13eee2e9d3 100644 --- a/omnigibson/utils/deprecated_utils.py +++ b/omnigibson/utils/deprecated_utils.py @@ -1,26 +1,27 @@ """ A set of utility functions slated to be deprecated once Omniverse bugs are fixed """ +import math +from typing import Callable, List, Optional, Tuple, Union + import carb -from typing import List, Optional, Tuple, Union, Callable -import omni.usd as ou -from omni.particle.system.core.scripts.core import Core as OmniCore -from omni.particle.system.core.scripts.utils import Utils as OmniUtils -from pxr import Sdf, UsdShade, PhysxSchema, Usd, UsdGeom, UsdPhysics +import numpy as np import omni import omni.graph.core as ogc -from omni.kit.primitive.mesh.command import _get_all_evaluators -from omni.kit.primitive.mesh.command import CreateMeshPrimWithDefaultXformCommand as CMPWDXC import omni.timeline -from omni.isaac.core.utils.prims import get_prim_at_path -import numpy as np +import omni.usd as ou import torch import warp as wp -import math from omni.isaac.core.articulations import ArticulationView as _ArticulationView from omni.isaac.core.prims import RigidPrimView as _RigidPrimView -from PIL import Image, ImageDraw +from omni.isaac.core.utils.prims import get_prim_at_path +from omni.kit.primitive.mesh.command import CreateMeshPrimWithDefaultXformCommand as CMPWDXC +from omni.kit.primitive.mesh.command import _get_all_evaluators +from omni.particle.system.core.scripts.core import Core as OmniCore +from omni.particle.system.core.scripts.utils import Utils as OmniUtils from omni.replicator.core import random_colours +from PIL import Image, ImageDraw +from pxr import PhysxSchema, Sdf, Usd, UsdGeom, UsdPhysics, UsdShade DEG2RAD = math.pi / 180.0 diff --git a/omnigibson/utils/geometry_utils.py b/omnigibson/utils/geometry_utils.py index 2130efbdcc..0a2486f4ea 100644 --- a/omnigibson/utils/geometry_utils.py +++ b/omnigibson/utils/geometry_utils.py @@ -2,6 +2,7 @@ A set of helper utility functions for dealing with 3D geometry """ import numpy as np + import omnigibson.utils.transform_utils as T from omnigibson.utils.usd_utils import mesh_prim_mesh_to_trimesh_mesh diff --git a/omnigibson/utils/grasping_planning_utils.py b/omnigibson/utils/grasping_planning_utils.py index 6b9bc41b92..7686ddf87e 100644 --- a/omnigibson/utils/grasping_planning_utils.py +++ b/omnigibson/utils/grasping_planning_utils.py @@ -1,13 +1,14 @@ -import numpy as np -from scipy.spatial.transform import Rotation as R, Slerp from math import ceil -from omnigibson.macros import create_module_macros +import numpy as np +from scipy.spatial.transform import Rotation as R +from scipy.spatial.transform import Slerp + +import omnigibson.lazy as lazy import omnigibson.utils.transform_utils as T +from omnigibson.macros import create_module_macros from omnigibson.object_states.open_state import _get_relevant_joints -from omnigibson.utils.constants import JointType, JointAxis -import omnigibson.lazy as lazy - +from omnigibson.utils.constants import JointAxis, JointType m = create_module_macros(module_path=__file__) diff --git a/omnigibson/utils/gym_utils.py b/omnigibson/utils/gym_utils.py index 89e91e2aa6..9d05caae69 100644 --- a/omnigibson/utils/gym_utils.py +++ b/omnigibson/utils/gym_utils.py @@ -1,5 +1,6 @@ -import gym from abc import ABCMeta, abstractmethod + +import gym import numpy as np from omnigibson.utils.ui_utils import create_module_logger diff --git a/omnigibson/utils/motion_planning_utils.py b/omnigibson/utils/motion_planning_utils.py index ad9131d042..59b7be791a 100644 --- a/omnigibson/utils/motion_planning_utils.py +++ b/omnigibson/utils/motion_planning_utils.py @@ -1,13 +1,14 @@ -import numpy as np -from math import ceil import heapq +from math import ceil + +import numpy as np import omnigibson as og +import omnigibson.lazy as lazy +import omnigibson.utils.transform_utils as T from omnigibson.macros import create_module_macros from omnigibson.object_states import ContactBodies -import omnigibson.utils.transform_utils as T from omnigibson.utils.control_utils import IKSolver -import omnigibson.lazy as lazy m = create_module_macros(module_path=__file__) m.ANGLE_DIFF = 0.3 diff --git a/omnigibson/utils/object_state_utils.py b/omnigibson/utils/object_state_utils.py index 701cec533f..16065deb93 100644 --- a/omnigibson/utils/object_state_utils.py +++ b/omnigibson/utils/object_state_utils.py @@ -1,19 +1,17 @@ import cv2 import numpy as np - from IPython import embed -from scipy.spatial.transform import Rotation as R from scipy.spatial import ConvexHull, distance_matrix +from scipy.spatial.transform import Rotation as R import omnigibson as og -from omnigibson.macros import create_module_macros, Dict, macros +import omnigibson.utils.transform_utils as T +from omnigibson.macros import Dict, create_module_macros, macros from omnigibson.object_states.aabb import AABB from omnigibson.object_states.contact_bodies import ContactBodies from omnigibson.utils import sampling_utils from omnigibson.utils.constants import PrimType from omnigibson.utils.ui_utils import debug_breakpoint -import omnigibson.utils.transform_utils as T - # Create settings for this module m = create_module_macros(module_path=__file__) diff --git a/omnigibson/utils/object_utils.py b/omnigibson/utils/object_utils.py index ad35c6bf50..a249ff13d4 100644 --- a/omnigibson/utils/object_utils.py +++ b/omnigibson/utils/object_utils.py @@ -1,10 +1,11 @@ """ Helper utility functions for computing relevant object information """ -import omnigibson as og import numpy as np -import omnigibson.utils.transform_utils as T from scipy.spatial.transform import Rotation as R + +import omnigibson as og +import omnigibson.utils.transform_utils as T from omnigibson.utils.geometry_utils import get_particle_positions_from_frame diff --git a/omnigibson/utils/physx_utils.py b/omnigibson/utils/physx_utils.py index 1f583cfb5c..1c9462ff25 100644 --- a/omnigibson/utils/physx_utils.py +++ b/omnigibson/utils/physx_utils.py @@ -1,9 +1,9 @@ import numpy as np -from omnigibson.macros import gm, create_module_macros -from omnigibson.utils.ui_utils import suppress_omni_log import omnigibson as og import omnigibson.lazy as lazy +from omnigibson.macros import create_module_macros, gm +from omnigibson.utils.ui_utils import suppress_omni_log # Create settings for this module m = create_module_macros(module_path=__file__) diff --git a/omnigibson/utils/processing_utils.py b/omnigibson/utils/processing_utils.py index 563ffc643b..24657224fc 100644 --- a/omnigibson/utils/processing_utils.py +++ b/omnigibson/utils/processing_utils.py @@ -1,4 +1,5 @@ import numpy as np + from omnigibson.utils.python_utils import Serializable diff --git a/omnigibson/utils/profiling_utils.py b/omnigibson/utils/profiling_utils.py index 0de91063ee..1b28275051 100644 --- a/omnigibson/utils/profiling_utils.py +++ b/omnigibson/utils/profiling_utils.py @@ -1,9 +1,11 @@ -import gym -import omnigibson as og import os +from time import time + +import gym import psutil from pynvml.smi import nvidia_smi -from time import time + +import omnigibson as og class ProfilingEnv(og.Environment): diff --git a/omnigibson/utils/python_utils.py b/omnigibson/utils/python_utils.py index 02edbd06f3..c43382de84 100644 --- a/omnigibson/utils/python_utils.py +++ b/omnigibson/utils/python_utils.py @@ -4,9 +4,9 @@ import inspect import re from abc import ABCMeta -from copy import deepcopy from collections.abc import Iterable -from functools import wraps, cache +from copy import deepcopy +from functools import cache, wraps from importlib import import_module import numpy as np diff --git a/omnigibson/utils/registry_utils.py b/omnigibson/utils/registry_utils.py index 2a9dc154be..b0dce8edde 100644 --- a/omnigibson/utils/registry_utils.py +++ b/omnigibson/utils/registry_utils.py @@ -1,9 +1,11 @@ """ A set of utility functions for registering and tracking objects """ +from collections.abc import Iterable from inspect import isclass + import numpy as np -from collections.abc import Iterable + from omnigibson.macros import create_module_macros from omnigibson.utils.python_utils import Serializable, SerializableNonInstance, UniquelyNamed from omnigibson.utils.ui_utils import create_module_logger diff --git a/omnigibson/utils/render_utils.py b/omnigibson/utils/render_utils.py index 0e033d474b..2cf7b4b4ad 100644 --- a/omnigibson/utils/render_utils.py +++ b/omnigibson/utils/render_utils.py @@ -2,11 +2,13 @@ Set of rendering utility functions when working with Omni """ import numpy as np + import omnigibson as og +import omnigibson.lazy as lazy +import omnigibson.utils.transform_utils as T from omnigibson.prims import EntityPrim, RigidPrim, VisualGeomPrim from omnigibson.utils.physx_utils import bind_material -import omnigibson.utils.transform_utils as T -import omnigibson.lazy as lazy + def make_glass(prim): """ diff --git a/omnigibson/utils/sampling_utils.py b/omnigibson/utils/sampling_utils.py index 679dde7f29..623c7ce7e5 100644 --- a/omnigibson/utils/sampling_utils.py +++ b/omnigibson/utils/sampling_utils.py @@ -1,16 +1,15 @@ import itertools +import time from collections import Counter, defaultdict import numpy as np - -import time import trimesh from scipy.spatial.transform import Rotation as R from scipy.stats import truncnorm import omnigibson as og -from omnigibson.macros import create_module_macros, gm import omnigibson.utils.transform_utils as T +from omnigibson.macros import create_module_macros, gm from omnigibson.utils.ui_utils import create_module_logger # Create module logger diff --git a/omnigibson/utils/sim_utils.py b/omnigibson/utils/sim_utils.py index 356518830e..4fab432abf 100644 --- a/omnigibson/utils/sim_utils.py +++ b/omnigibson/utils/sim_utils.py @@ -1,12 +1,13 @@ -import numpy as np from collections import namedtuple from collections.abc import Iterable +import numpy as np + import omnigibson as og +import omnigibson.lazy as lazy +import omnigibson.utils.transform_utils as T from omnigibson.macros import gm from omnigibson.utils import python_utils -import omnigibson.utils.transform_utils as T -import omnigibson.lazy as lazy from omnigibson.utils.ui_utils import create_module_logger # Create module logger diff --git a/omnigibson/utils/teleop_utils.py b/omnigibson/utils/teleop_utils.py index ffc4ecd15e..dbb58ccb9f 100644 --- a/omnigibson/utils/teleop_utils.py +++ b/omnigibson/utils/teleop_utils.py @@ -1,7 +1,8 @@ -import numpy as np import time from typing import Iterable, Optional, Tuple +import numpy as np + import omnigibson as og import omnigibson.lazy as lazy import omnigibson.utils.transform_utils as T @@ -10,10 +11,10 @@ from omnigibson.robots.robot_base import BaseRobot try: + from telemoma.configs.base_config import teleop_config from telemoma.human_interface.teleop_core import TeleopAction, TeleopObservation from telemoma.human_interface.teleop_policy import TeleopPolicy from telemoma.utils.general_utils import AttrDict - from telemoma.configs.base_config import teleop_config except ImportError as e: raise e from ValueError("For teleoperation, install telemoma by running 'pip install telemoma'") diff --git a/omnigibson/utils/ui_utils.py b/omnigibson/utils/ui_utils.py index 2d5ef3e2b5..b01daf08ae 100644 --- a/omnigibson/utils/ui_utils.py +++ b/omnigibson/utils/ui_utils.py @@ -2,23 +2,24 @@ Helper classes and functions for streamlining user interactions """ import contextlib - +import datetime import logging -import numpy as np import sys -import datetime from pathlib import Path + +import imageio +import numpy as np +from IPython import embed from PIL import Image +from scipy.integrate import quad +from scipy.interpolate import CubicSpline +from scipy.spatial.transform import Rotation as R from termcolor import colored + import omnigibson as og -from omnigibson.macros import gm -import omnigibson.utils.transform_utils as T import omnigibson.lazy as lazy -from scipy.spatial.transform import Rotation as R -from scipy.interpolate import CubicSpline -from scipy.integrate import quad -import imageio -from IPython import embed +import omnigibson.utils.transform_utils as T +from omnigibson.macros import gm def print_icon(): diff --git a/omnigibson/utils/usd_utils.py b/omnigibson/utils/usd_utils.py index db1d925465..7c461e8b3e 100644 --- a/omnigibson/utils/usd_utils.py +++ b/omnigibson/utils/usd_utils.py @@ -1,20 +1,18 @@ import math -from collections.abc import Iterable import os - -import omnigibson.lazy as lazy +from collections.abc import Iterable import numpy as np import trimesh import omnigibson as og +import omnigibson.lazy as lazy +import omnigibson.utils.transform_utils as T from omnigibson.macros import gm -from omnigibson.utils.constants import JointType, PRIMITIVE_MESH_TYPES, PrimType +from omnigibson.utils.constants import PRIMITIVE_MESH_TYPES, JointType, PrimType from omnigibson.utils.python_utils import assert_valid_key from omnigibson.utils.ui_utils import suppress_omni_log -import omnigibson.utils.transform_utils as T - def array_to_vtarray(arr, element_type): """ diff --git a/scripts/download_datasets.py b/scripts/download_datasets.py index 30700c78ba..4d3ac2af49 100644 --- a/scripts/download_datasets.py +++ b/scripts/download_datasets.py @@ -2,12 +2,14 @@ Helper script to download OmniGibson dataset and assets. """ import os + os.environ["OMNIGIBSON_NO_OMNIVERSE"] = "1" -from omnigibson.macros import gm -from omnigibson.utils.asset_utils import download_og_dataset, download_assets import click +from omnigibson.macros import gm +from omnigibson.utils.asset_utils import download_assets, download_og_dataset + def main(): # Only execute if the dataset path or asset path does not exist diff --git a/tests/benchmark/benchmark_interactive_scene.py b/tests/benchmark/benchmark_interactive_scene.py index 446ca126d0..9171223526 100644 --- a/tests/benchmark/benchmark_interactive_scene.py +++ b/tests/benchmark/benchmark_interactive_scene.py @@ -2,18 +2,19 @@ import os import time + import matplotlib.pyplot as plt import numpy as np import omnigibson as og -from omnigibson.objects import DatasetObject from omnigibson.macros import gm +from omnigibson.objects import DatasetObject from omnigibson.robots.turtlebot import Turtlebot from omnigibson.scenes.interactive_traversable_scene import InteractiveTraversableScene from omnigibson.simulator import launch_simulator +from omnigibson.systems import get_system from omnigibson.utils.asset_utils import get_og_assets_version from omnigibson.utils.constants import PrimType -from omnigibson.systems import get_system # Params to be set as needed. SCENES = ["Rs_int"] # house_single_floor diff --git a/tests/benchmark/benchmark_object_count.py b/tests/benchmark/benchmark_object_count.py index 319a78b21b..9e8c92da90 100644 --- a/tests/benchmark/benchmark_object_count.py +++ b/tests/benchmark/benchmark_object_count.py @@ -13,7 +13,6 @@ from omnigibson.scenes.scene_base import Scene from omnigibson.utils.asset_utils import get_og_assets_version - # Params to be set as needed. MAX_NUM_OBJS = 400 # Maximum no. of objects to add. NUM_OBJS_PER_ITER = 20 # No. of objects to add per iteration. diff --git a/tests/benchmark/profiling.py b/tests/benchmark/profiling.py index 6720cf693a..1b8d2b35b7 100644 --- a/tests/benchmark/profiling.py +++ b/tests/benchmark/profiling.py @@ -1,16 +1,17 @@ -import os import argparse import json -import omnigibson as og -import numpy as np -import omnigibson.utils.transform_utils as T +import os import time +import numpy as np + +import omnigibson as og +import omnigibson.utils.transform_utils as T from omnigibson.macros import gm -from omnigibson.systems import get_system from omnigibson.object_states import Covered -from omnigibson.utils.profiling_utils import ProfilingEnv +from omnigibson.systems import get_system from omnigibson.utils.constants import PrimType +from omnigibson.utils.profiling_utils import ProfilingEnv parser = argparse.ArgumentParser() diff --git a/tests/conftest.py b/tests/conftest.py index 5b700bb3e3..c9162fe65d 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,4 +1,5 @@ import omnigibson as og + def pytest_unconfigure(config): og.shutdown() diff --git a/tests/test_dump_load_states.py b/tests/test_dump_load_states.py index 7a2715fccc..ea6cc3bf56 100644 --- a/tests/test_dump_load_states.py +++ b/tests/test_dump_load_states.py @@ -1,10 +1,10 @@ +import pytest +from utils import SYSTEM_EXAMPLES, og_test + import omnigibson as og -from omnigibson.systems import * from omnigibson.object_states import Covered +from omnigibson.systems import * -from utils import og_test, SYSTEM_EXAMPLES - -import pytest @og_test def test_dump_load(): diff --git a/tests/test_object_removal.py b/tests/test_object_removal.py index c15c6ed58a..f08eacf526 100644 --- a/tests/test_object_removal.py +++ b/tests/test_object_removal.py @@ -1,10 +1,9 @@ -from omnigibson.objects import DatasetObject -import omnigibson as og -from omnigibson.utils.python_utils import NAMES - +import pytest from utils import og_test -import pytest +import omnigibson as og +from omnigibson.objects import DatasetObject +from omnigibson.utils.python_utils import NAMES @og_test diff --git a/tests/test_object_states.py b/tests/test_object_states.py index 4adb2a99a6..3ad181d6e8 100644 --- a/tests/test_object_states.py +++ b/tests/test_object_states.py @@ -1,15 +1,14 @@ +import numpy as np +import pytest +from utils import SYSTEM_EXAMPLES, get_random_pose, og_test, place_obj_on_floor_plane, place_objA_on_objB_bbox + +import omnigibson as og +import omnigibson.utils.transform_utils as T from omnigibson.macros import macros as m from omnigibson.object_states import * -from omnigibson.systems import get_system, is_physical_particle_system, is_visual_particle_system, VisualParticleSystem +from omnigibson.systems import VisualParticleSystem, get_system, is_physical_particle_system, is_visual_particle_system from omnigibson.utils.constants import PrimType from omnigibson.utils.physx_utils import apply_force_at_pos, apply_torque -import omnigibson.utils.transform_utils as T -import omnigibson as og - -from utils import og_test, get_random_pose, place_objA_on_objB_bbox, place_obj_on_floor_plane, SYSTEM_EXAMPLES - -import pytest -import numpy as np @og_test diff --git a/tests/test_primitives.py b/tests/test_primitives.py index a8eddc064f..c25170b376 100644 --- a/tests/test_primitives.py +++ b/tests/test_primitives.py @@ -1,11 +1,16 @@ import numpy as np import pytest + import omnigibson as og -from omnigibson.macros import gm -from omnigibson.action_primitives.starter_semantic_action_primitives import StarterSemanticActionPrimitives, StarterSemanticActionPrimitiveSet import omnigibson.utils.transform_utils as T +from omnigibson.action_primitives.starter_semantic_action_primitives import ( + StarterSemanticActionPrimitives, + StarterSemanticActionPrimitiveSet, +) +from omnigibson.macros import gm from omnigibson.objects.dataset_object import DatasetObject + def execute_controller(ctrl_gen, env): for action in ctrl_gen: env.step(action) diff --git a/tests/test_robot_states.py b/tests/test_robot_states.py index fe812f92e4..14bcae57a9 100644 --- a/tests/test_robot_states.py +++ b/tests/test_robot_states.py @@ -1,14 +1,14 @@ import numpy as np import omnigibson as og -from omnigibson.macros import gm - import omnigibson.lazy as lazy -from omnigibson.sensors import VisionSensor +from omnigibson.macros import gm from omnigibson.object_states import ObjectsInFOVOfRobot -from omnigibson.utils.transform_utils import pose2mat, mat2pose, relative_pose_transform -from omnigibson.utils.usd_utils import PoseAPI +from omnigibson.sensors import VisionSensor from omnigibson.utils.constants import semantic_class_name_to_id +from omnigibson.utils.transform_utils import mat2pose, pose2mat, relative_pose_transform +from omnigibson.utils.usd_utils import PoseAPI + def setup_environment(flatcache=True): """ diff --git a/tests/test_robot_teleoperation.py b/tests/test_robot_teleoperation.py index 10830b4f33..e081c30f96 100644 --- a/tests/test_robot_teleoperation.py +++ b/tests/test_robot_teleoperation.py @@ -1,9 +1,11 @@ -import omnigibson as og import numpy as np -from omnigibson.macros import gm +import pytest from telemoma.human_interface.teleop_core import TeleopAction + +import omnigibson as og +from omnigibson.macros import gm from omnigibson.utils.transform_utils import quat2euler -import pytest + @pytest.mark.skip(reason="test hangs on CI") def test_teleop(): diff --git a/tests/test_sensors.py b/tests/test_sensors.py index 40937a82fd..4675d71a79 100644 --- a/tests/test_sensors.py +++ b/tests/test_sensors.py @@ -1,12 +1,12 @@ -from omnigibson.systems import get_system, is_physical_particle_system, is_visual_particle_system -import omnigibson.utils.transform_utils as T +import numpy as np +import pytest +from utils import SYSTEM_EXAMPLES, og_test, place_obj_on_floor_plane + import omnigibson as og +import omnigibson.utils.transform_utils as T from omnigibson.sensors import VisionSensor +from omnigibson.systems import get_system, is_physical_particle_system, is_visual_particle_system -from utils import og_test, place_obj_on_floor_plane, SYSTEM_EXAMPLES - -import pytest -import numpy as np @og_test def test_seg(): diff --git a/tests/test_symbolic_primitives.py b/tests/test_symbolic_primitives.py index 1659ff382c..983d6bf45a 100644 --- a/tests/test_symbolic_primitives.py +++ b/tests/test_symbolic_primitives.py @@ -1,14 +1,19 @@ import os + import pytest import yaml from omnigibson.macros import gm + gm.USE_GPU_DYNAMICS = True gm.USE_FLATCACHE = True import omnigibson as og from omnigibson import object_states -from omnigibson.action_primitives.symbolic_semantic_action_primitives import SymbolicSemanticActionPrimitiveSet, SymbolicSemanticActionPrimitives +from omnigibson.action_primitives.symbolic_semantic_action_primitives import ( + SymbolicSemanticActionPrimitives, + SymbolicSemanticActionPrimitiveSet, +) from omnigibson.systems import get_system diff --git a/tests/test_systems.py b/tests/test_systems.py index d893eda62d..a65ad9ddd6 100644 --- a/tests/test_systems.py +++ b/tests/test_systems.py @@ -1,10 +1,10 @@ +import pytest +from utils import SYSTEM_EXAMPLES, og_test + import omnigibson as og -from omnigibson.systems import * from omnigibson.object_states import Covered +from omnigibson.systems import * -from utils import og_test, SYSTEM_EXAMPLES - -import pytest @og_test def test_system_clear(): diff --git a/tests/test_transition_rules.py b/tests/test_transition_rules.py index 2e33b3ff1d..4394d1a7f2 100644 --- a/tests/test_transition_rules.py +++ b/tests/test_transition_rules.py @@ -1,19 +1,25 @@ +import numpy as np +import pytest +from scipy.spatial.transform import Rotation as R +from utils import ( + get_random_pose, + og_test, + place_obj_on_floor_plane, + place_objA_on_objB_bbox, + remove_all_systems, + retrieve_obj_cfg, +) + +import omnigibson as og +import omnigibson.utils.transform_utils as T from omnigibson.macros import macros as m from omnigibson.object_states import * +from omnigibson.objects import DatasetObject from omnigibson.systems import get_system, is_physical_particle_system, is_visual_particle_system +from omnigibson.transition_rules import REGISTERED_RULES from omnigibson.utils.constants import PrimType from omnigibson.utils.physx_utils import apply_force_at_pos, apply_torque -import omnigibson.utils.transform_utils as T -from omnigibson.objects import DatasetObject -from omnigibson.transition_rules import REGISTERED_RULES -import omnigibson as og -from omnigibson.macros import macros as m -from scipy.spatial.transform import Rotation as R - -from utils import og_test, get_random_pose, place_objA_on_objB_bbox, place_obj_on_floor_plane, retrieve_obj_cfg, remove_all_systems -import pytest -import numpy as np @pytest.mark.skip(reason="dryer is not fillable yet.") @og_test diff --git a/tests/utils.py b/tests/utils.py index 5d469ce748..2d6f61cb37 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -1,12 +1,11 @@ -import omnigibson as og +import numpy as np +import omnigibson as og +import omnigibson.utils.transform_utils as T from omnigibson.macros import gm from omnigibson.object_states import * -from omnigibson.utils.constants import PrimType, ParticleModifyCondition, ParticleModifyMethod from omnigibson.systems import * -import omnigibson.utils.transform_utils as T -import numpy as np - +from omnigibson.utils.constants import ParticleModifyCondition, ParticleModifyMethod, PrimType TEMP_RELATED_ABILITIES = {"cookable": {}, "freezable": {}, "burnable": {}, "heatable": {}}