From 40f91766d3e6b4dbaa4cef0f8ca4009f0dcb8942 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 5 Aug 2024 21:18:47 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- omnigibson/__init__.py | 13 ++--- .../action_primitive_set_base.py | 2 +- .../starter_semantic_action_primitives.py | 39 +++++++------- .../symbolic_semantic_action_primitives.py | 9 ++-- omnigibson/controllers/__init__.py | 6 +-- omnigibson/controllers/controller_base.py | 2 +- omnigibson/controllers/ik_controller.py | 4 +- omnigibson/controllers/joint_controller.py | 12 +++-- .../multi_finger_gripper_controller.py | 2 +- omnigibson/controllers/osc_controller.py | 2 +- omnigibson/envs/__init__.py | 2 +- omnigibson/envs/env_base.py | 24 ++++++--- omnigibson/envs/env_wrapper.py | 6 +-- .../action_primitives/rs_int_example.py | 8 ++- .../action_primitives/solve_simple_task.py | 8 ++- .../wip_solve_behavior_task.py | 8 ++- .../learning/navigation_policy_demo.py | 9 ++-- .../examples/object_states/attachment_demo.py | 2 +- .../examples/object_states/dicing_demo.py | 2 +- .../folded_unfolded_state_demo.py | 6 +-- .../object_states/heat_source_or_sink_demo.py | 1 + .../object_states/heated_state_demo.py | 1 + .../object_state_texture_demo.py | 1 + .../examples/object_states/overlaid_demo.py | 3 +- .../particle_applier_remover_demo.py | 7 +-- .../object_states/sample_kinematics_demo.py | 1 - .../examples/object_states/slicing_demo.py | 2 +- .../examples/objects/draw_bounding_box.py | 2 +- .../examples/objects/highlight_objects.py | 1 + .../examples/objects/load_object_selector.py | 3 +- .../examples/objects/visualize_object.py | 8 ++- .../renderer_settings_example.py | 1 + .../examples/robots/grasping_mode_example.py | 2 +- .../examples/robots/robot_control_example.py | 3 +- omnigibson/examples/scenes/scene_tour_demo.py | 2 +- .../scenes/traversability_map_example.py | 2 +- .../simulator/sim_save_load_example.py | 1 + .../teleoperation/robot_teleoperate_demo.py | 5 +- .../examples/teleoperation/vr_simple_demo.py | 1 + omnigibson/lazy.py | 1 + omnigibson/maps/__init__.py | 2 +- omnigibson/maps/segmentation_map.py | 2 +- omnigibson/maps/traversable_map.py | 3 +- omnigibson/object_states/__init__.py | 14 ++--- omnigibson/object_states/adjacency.py | 3 +- omnigibson/object_states/attached_to.py | 14 ++--- omnigibson/object_states/burnt.py | 1 - omnigibson/object_states/contact_particles.py | 2 +- .../contact_subscribed_state_mixin.py | 1 + omnigibson/object_states/contains.py | 16 ++++-- omnigibson/object_states/cooked.py | 1 - omnigibson/object_states/covered.py | 5 +- omnigibson/object_states/draped.py | 9 ++-- omnigibson/object_states/factory.py | 5 +- omnigibson/object_states/filled.py | 5 +- omnigibson/object_states/folded.py | 7 +-- omnigibson/object_states/frozen.py | 1 - .../object_states/heat_source_or_sink.py | 6 +-- omnigibson/object_states/heated.py | 1 - omnigibson/object_states/inside.py | 3 +- .../joint_break_subscribed_state_mixin.py | 3 +- .../object_states/link_based_state_mixin.py | 5 +- omnigibson/object_states/max_temperature.py | 3 +- omnigibson/object_states/object_state_base.py | 6 +-- omnigibson/object_states/on_fire.py | 3 +- omnigibson/object_states/on_top.py | 6 +-- omnigibson/object_states/open_state.py | 2 +- omnigibson/object_states/overlaid.py | 18 +++---- omnigibson/object_states/particle.py | 1 + omnigibson/object_states/particle_modifier.py | 34 ++++++++---- .../object_states/robot_related_states.py | 2 +- omnigibson/object_states/saturated.py | 6 +-- omnigibson/object_states/sliceable.py | 2 + omnigibson/object_states/slicer_active.py | 6 +-- omnigibson/object_states/temperature.py | 5 +- .../object_states/tensorized_value_state.py | 3 +- omnigibson/object_states/toggle.py | 9 ++-- omnigibson/object_states/under.py | 4 +- .../object_states/update_state_mixin.py | 1 + omnigibson/objects/__init__.py | 3 +- omnigibson/objects/controllable_object.py | 8 +-- omnigibson/objects/dataset_object.py | 15 ++++-- omnigibson/objects/light_object.py | 5 +- omnigibson/objects/object_base.py | 10 ++-- omnigibson/objects/primitive_object.py | 10 ++-- omnigibson/objects/stateful_object.py | 17 +++--- omnigibson/objects/usd_object.py | 2 +- omnigibson/prims/__init__.py | 4 +- omnigibson/prims/cloth_prim.py | 15 +++--- omnigibson/prims/entity_prim.py | 12 ++--- omnigibson/prims/geom_prim.py | 3 +- omnigibson/prims/joint_prim.py | 12 ++--- omnigibson/prims/material_prim.py | 5 +- omnigibson/prims/prim_base.py | 2 +- omnigibson/prims/rigid_prim.py | 11 ++-- omnigibson/prims/xform_prim.py | 14 ++--- .../renderer_settings/common_settings.py | 1 - .../path_tracing_settings.py | 1 - .../post_processing_settings.py | 1 - .../renderer_settings/real_time_settings.py | 1 - omnigibson/renderer_settings/settings_base.py | 1 + omnigibson/reward_functions/__init__.py | 2 +- .../reward_functions/collision_reward.py | 2 +- .../reward_functions/reaching_goal_reward.py | 2 +- .../reward_functions/reward_function_base.py | 3 +- omnigibson/robots/__init__.py | 12 ++--- omnigibson/robots/active_camera_robot.py | 1 + omnigibson/robots/behavior_robot.py | 15 +++--- omnigibson/robots/fetch.py | 5 +- omnigibson/robots/franka.py | 3 +- omnigibson/robots/franka_allegro.py | 3 +- omnigibson/robots/franka_leap.py | 5 +- omnigibson/robots/freight.py | 1 + omnigibson/robots/husky.py | 1 + omnigibson/robots/locobot.py | 1 + omnigibson/robots/manipulation_robot.py | 21 ++++---- omnigibson/robots/robot_base.py | 19 ++++--- omnigibson/robots/tiago.py | 7 +-- omnigibson/robots/turtlebot.py | 1 + omnigibson/robots/two_wheel_robot.py | 1 + omnigibson/robots/vx300s.py | 3 +- omnigibson/scene_graphs/graph_builder.py | 4 +- omnigibson/scenes/__init__.py | 6 +-- .../scenes/interactive_traversable_scene.py | 3 +- omnigibson/scenes/scene_base.py | 22 +++++--- omnigibson/scenes/static_traversable_scene.py | 4 +- omnigibson/scenes/traversable_scene.py | 2 +- omnigibson/sensors/__init__.py | 10 ++-- omnigibson/sensors/scan_sensor.py | 4 +- omnigibson/sensors/sensor_base.py | 7 +-- omnigibson/sensors/sensor_noise_base.py | 3 +- omnigibson/sensors/vision_sensor.py | 11 +++- omnigibson/simulator.py | 52 ++++++++++++------- omnigibson/systems/__init__.py | 17 ++++-- omnigibson/systems/macro_particle_system.py | 17 +++--- omnigibson/systems/micro_particle_system.py | 33 ++++++------ omnigibson/systems/system_base.py | 19 +++++-- omnigibson/tasks/__init__.py | 4 +- omnigibson/tasks/behavior_task.py | 21 +++++--- omnigibson/tasks/dummy_task.py | 2 +- omnigibson/tasks/point_navigation_task.py | 6 +-- omnigibson/tasks/point_reaching_task.py | 3 +- omnigibson/tasks/task_base.py | 5 +- omnigibson/termination_conditions/__init__.py | 8 ++- .../termination_conditions/max_collision.py | 2 +- .../termination_conditions/point_goal.py | 2 +- .../termination_conditions/reaching_goal.py | 2 +- .../termination_condition_base.py | 3 +- omnigibson/transition_rules.py | 32 +++++++----- omnigibson/utils/asset_utils.py | 17 +++--- omnigibson/utils/bddl_utils.py | 38 +++++++------- omnigibson/utils/config_utils.py | 1 + omnigibson/utils/constants.py | 7 +-- omnigibson/utils/control_utils.py | 4 +- omnigibson/utils/deprecated_utils.py | 23 ++++---- omnigibson/utils/geometry_utils.py | 1 + omnigibson/utils/grasping_planning_utils.py | 13 ++--- omnigibson/utils/gym_utils.py | 3 +- omnigibson/utils/motion_planning_utils.py | 9 ++-- omnigibson/utils/object_state_utils.py | 8 ++- omnigibson/utils/object_utils.py | 5 +- omnigibson/utils/physx_utils.py | 4 +- omnigibson/utils/processing_utils.py | 1 + omnigibson/utils/profiling_utils.py | 8 +-- omnigibson/utils/python_utils.py | 4 +- omnigibson/utils/registry_utils.py | 4 +- omnigibson/utils/render_utils.py | 6 ++- omnigibson/utils/sampling_utils.py | 5 +- omnigibson/utils/sim_utils.py | 7 +-- omnigibson/utils/teleop_utils.py | 5 +- omnigibson/utils/ui_utils.py | 21 ++++---- omnigibson/utils/usd_utils.py | 10 ++-- scripts/download_datasets.py | 6 ++- .../benchmark/benchmark_interactive_scene.py | 5 +- tests/benchmark/benchmark_object_count.py | 1 - tests/benchmark/profiling.py | 13 ++--- tests/conftest.py | 1 + tests/test_dump_load_states.py | 8 +-- tests/test_object_removal.py | 9 ++-- tests/test_object_states.py | 15 +++--- tests/test_primitives.py | 9 +++- tests/test_robot_states.py | 10 ++-- tests/test_robot_teleoperation.py | 8 +-- tests/test_sensors.py | 12 ++--- tests/test_symbolic_primitives.py | 7 ++- tests/test_systems.py | 8 +-- tests/test_transition_rules.py | 26 ++++++---- tests/utils.py | 9 ++-- 188 files changed, 767 insertions(+), 583 deletions(-) diff --git a/omnigibson/__init__.py b/omnigibson/__init__.py index 32c474e04..dd99f1508 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 9d842514a..e6ae318f2 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 9058c822c..1a429c1e7 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 8e7442845..6a135cb25 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 7cdcb65b0..a56c7c54b 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 b90a56dba..1d5a95aa7 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 88f553890..0c5758f70 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 13a655469..d117901a0 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 c9dc6dbcf..0185a50ff 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 8b44a2932..ef6d72895 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 a93206368..435d4e155 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 2cab4f78f..93bf9e922 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 0561d6da8..cb8280a3e 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 a482236f0..201207ba9 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 752246338..d9009ff35 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 12b49a9d4..038b7c50f 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 d8a4f07d6..94bd668fb 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 175121b2d..e22d1af9c 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 92e955ae0..c3e5a6818 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 8a5aff98e..971fba42d 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 804d96e5c..bd09494c6 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 7ec010af0..33a43dd7e 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 74a0cdd76..03a173d4a 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 52d2d3564..375ebbc43 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 83ddf5680..e5ea7ece5 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 0bd22592f..7ec041beb 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 98c0bb21b..656ec2f6d 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 bddb41aad..5cfe2cf61 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 ef286b878..d53d9b141 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 01530ac46..bfb08f881 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 527007480..f3f533ddf 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 3a1690fdc..5446252bc 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 2382c4cc0..d675f5136 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 e08667944..d0c22e695 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 b85088278..5160589fd 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 622c121ab..ff6320bfe 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 d9656a98e..c2c8cb011 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 304f2852e..ca697b643 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 673ebed8a..7c2c64a75 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 a6fcaf09d..5deaf72f0 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 bad474dac..b57ce6a5d 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 0517e5b41..c814b40fc 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 603e3be43..c72defaae 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 36642bda3..a731df9d1 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 4718b315e..bbe40268b 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 dfd675ebb..59616dc2f 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 da837a710..eec7840a4 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 19621a889..0aa8fb32c 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 ba2ad3b10..330a55033 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 5e45670ad..7084ee124 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 66e67dba9..4ebab23b1 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 247eec99c..80e612521 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 ee1d6f602..f00880bd9 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 272f6b534..15cb5916f 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 380429965..506480fa0 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 9fd8ff428..ceafbae69 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 7c0f2a086..b88677213 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 4ee998d1f..fd3b8710e 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 d4612777b..6e365049a 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 7d5f8e44f..9f9c12e54 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 849837692..4044da942 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 41143f382..8f8e13627 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 3d0d1320c..bba0e6762 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 5d1af901f..bd28cb7ea 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 e706ecde8..af69525fc 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 2b38ed5d5..95ba5a08b 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 d48b7a995..506bebdf1 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 fff7d5107..ae07bdf46 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 f125265ad..ea8c46362 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 db117eed3..5ec3a79b5 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 d922baadb..95917d186 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 e6981bb87..91215135d 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 aa6be7b10..f16695ae7 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 ae36f2aaa..a14598986 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 a211ea08f..cd9cf4abc 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 35f4d53b3..1826d5a2d 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 8e8f75b8a..e47a56db8 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 a9858d14b..dd6ae1ea1 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 7778de85a..fd88000cb 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 e0546fda9..e2c635672 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 60301dd13..9cb5534cb 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 2136d7634..95668931b 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 4421a08eb..1d7e799e3 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 673f33f5c..31c86a55c 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 ea2402618..8395383b3 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 20bc82003..c34fa3c53 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 f614929cc..e9b5591ed 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 c6b0bb47b..ec7f6a9f6 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 996aae7f8..c1d9e1eac 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 90a8276d5..a6436c03d 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 64f034db9..a66edaa02 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 19d64bb8d..13cd2d205 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 d7bbac630..0812d8d7d 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 251808a23..74ec05c93 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 184e4d2e6..8028d7b98 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 929d0ebf1..1211342ee 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 70ff00d40..d5380da41 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 c1b96fa90..6a70136ae 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 56dc952f7..efdd257d4 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 ef123b1b0..643e76bd6 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 851a1a9c8..b39badee3 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 d667bfd0b..9f670d95e 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 b1a5f66ba..55c52c0f5 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 ec398919e..6a69ac20f 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 d21d1780d..03b22164f 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 f2a4145c8..18b29fd78 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 adb6958ad..a0e707de7 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 652cf70d4..2cd36d0af 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 dcab8c631..b0ad3b8c3 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 7fa6fd7e4..b27fa64cd 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 fd3a8ecf2..383361249 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 7356e28f0..641d7e958 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 475b446fe..b79cf9696 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 37f302194..90ae868e6 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 2f027a273..fff9d101d 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 bbed13460..824d11157 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 5e188f44a..926152935 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 878d50ccd..0f49ba72e 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 a77a28865..f5afa73cd 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 73bb7cb26..427931b7f 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 202912b51..3cf8d7abd 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 802632d27..281b1d44d 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 7b5ff7944..9eade9bd2 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 d49e213f6..5e46977a0 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 4c5faec90..db607f820 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 99be51731..7ef527166 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 ecb26b9d9..a2ba98265 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 215aa0924..be8e4e1f1 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 5c88063a0..a524a2996 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 a516b5bec..1e12f27d5 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 cf7b8220d..d5c165ddc 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 b53cdb55c..480ebd89b 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 8c2462d06..f9137c8a3 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 1ec98f2a4..32b53985d 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 6bb131da9..51d572949 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 ac4c84880..e4dd45db2 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 a5b73dcbf..3f40d8178 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 2a6bfaa8f..8773a1226 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 083e895a4..995b10685 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 43b9482a0..d711a32c8 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 b1ad9ff1d..8e3fc52ab 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 8c26e9940..41f92f9bb 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 46d3eed04..956d57838 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 2e5e423eb..ae1add4ed 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 854ea25f8..501d82a2b 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 ec681c4e2..bc2b9f737 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 f7aa477cf..2afdba522 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 f0860fd46..aa7e8bd12 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 9f223d741..b1c9c27fc 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 5082717bb..9c4eea0e6 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 0356e3c99..e1c0e71a8 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 5980912e0..dda1e2540 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 90d394428..bfa0cacab 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 d6c5c7b0d..054917196 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 8865a00fe..13eee2e9d 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 2130efbdc..0a2486f4e 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 6b9bc41b9..7686ddf87 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 89e91e2aa..9d05caae6 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 ad9131d04..59b7be791 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 701cec533..16065deb9 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 ad35c6bf5..a249ff13d 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 1f583cfb5..1c9462ff2 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 563ffc643..24657224f 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 0de91063e..1b2827505 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 02edbd06f..c43382de8 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 2a9dc154b..b0dce8edd 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 0e033d474..2cf7b4b4a 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 679dde7f2..623c7ce7e 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 356518830..4fab432ab 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 ffc4ecd15..dbb58ccb9 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 2d5ef3e2b..b01daf08a 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 db1d92546..7c461e8b3 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 30700c78b..4d3ac2af4 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 446ca126d..917122352 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 319a78b21..9e8c92da9 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 6720cf693..1b8d2b35b 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 5b700bb3e..c9162fe65 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 7a2715fcc..ea6cc3bf5 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 c15c6ed58..f08eacf52 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 4adb2a99a..3ad181d6e 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 a8eddc064..c25170b37 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 fe812f92e..14bcae57a 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 10830b4f3..e081c30f9 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 40937a82f..4675d71a7 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 1659ff382..983d6bf45 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 d893eda62..a65ad9ddd 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 2e33b3ff1..4394d1a7f 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 5d469ce74..2d6f61cb3 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": {}}