From 7413b447a1a115065a440c00a4e247959b3a54f3 Mon Sep 17 00:00:00 2001 From: cremebrule <84cremebrule@gmail.com> Date: Tue, 1 Oct 2024 00:21:03 -0700 Subject: [PATCH] make BehaviorTask compatible with vanilla Scene --- omnigibson/tasks/behavior_task.py | 4 ++-- omnigibson/utils/bddl_utils.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/omnigibson/tasks/behavior_task.py b/omnigibson/tasks/behavior_task.py index 3c4da2195..932e15639 100644 --- a/omnigibson/tasks/behavior_task.py +++ b/omnigibson/tasks/behavior_task.py @@ -18,7 +18,7 @@ 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.scenes.interactive_traversable_scene import InteractiveTraversableScene +from omnigibson.scenes.traversable_scene import TraversableScene from omnigibson.scenes.scene_base import Scene from omnigibson.tasks.task_base import BaseTask from omnigibson.termination_conditions.predicate_goal import PredicateGoal @@ -195,7 +195,7 @@ class BehaviorTask(BaseTask): # assert success, f"Failed to initialize Behavior Activity. Feedback:\n{self.feedback}" # Store the scene name - self.scene_name = env.scene.scene_model + self.scene_name = env.scene.scene_model if isinstance(env.scene, TraversableScene) else None # Highlight any task relevant objects if requested if self.highlight_task_relevant_objs: diff --git a/omnigibson/utils/bddl_utils.py b/omnigibson/utils/bddl_utils.py index 368b94dfd..7499bb100 100644 --- a/omnigibson/utils/bddl_utils.py +++ b/omnigibson/utils/bddl_utils.py @@ -566,9 +566,12 @@ class BDDLEntity(Wrapper): class BDDLSampler: def __init__(self, env, activity_conditions, object_scope, backend): + # Avoid circular imports here + from omnigibson.scenes.traversable_scene import TraversableScene + # Store internal variables from inputs self._env = env - self._scene_model = self._env.scene.scene_model + self._scene_model = self._env.scene.scene_model if isinstance(self._env.scene, TraversableScene) else None self._agent = self._env.robots[0] self._backend = backend self._activity_conditions = activity_conditions