Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug fixes #1885

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions habitat-lab/habitat/datasets/rearrange/rearrange_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -464,9 +464,10 @@ def generate_episodes(
try:
self._scene_sampler.set_cur_episode(len(generated_episodes))
new_episode = self.generate_single_episode()
except Exception:
except Exception as e:
new_episode = None
logger.error("Generation failed with exception...")
logger.error(e)
if new_episode is None:
failed_episodes += 1
continue
Expand Down Expand Up @@ -559,7 +560,10 @@ def generate_single_episode(self) -> Optional[RearrangeEpisode]:
for sampler_name, num_targets in target_numbers.items():
new_target_receptacles: List[Receptacle] = []
failed_samplers: Dict[str, bool] = defaultdict(bool)
while len(new_target_receptacles) < num_targets:
tries = 0
max_tries = 100
while len(new_target_receptacles) < num_targets and tries < max_tries:
tries += 1
assert len(failed_samplers.keys()) < len(
targ_sampler_name_to_obj_sampler_names[sampler_name]
), f"All target samplers failed to find a match for '{sampler_name}'."
Expand Down Expand Up @@ -590,6 +594,10 @@ def generate_single_episode(self) -> Optional[RearrangeEpisode]:
) # type: ignore
if len(new_receptacle) != 0: # type: ignore
new_target_receptacles.append(new_receptacle[0]) # type: ignore

assert (
len(new_target_receptacles) >= num_targets
), "Unable to sample target Receptacles for all requested targets."

target_receptacles[obj_sampler_name].extend(new_target_receptacles)
all_target_receptacles.extend(new_target_receptacles)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import habitat_sim
from habitat.core.logging import logger
from habitat.utils.common import check_make_dir
from habitat_sim.agent.agent import AgentState


class DebugObservation:
Expand Down Expand Up @@ -147,6 +148,7 @@ def create_dbv_agent(
)
self.agent = self.sim.agents[-1]
self.agent_id = len(self.sim.agents) - 1
self.agent.initial_state = AgentState()
self.sim._Simulator__sensors.append({})
self.sim._update_simulator_sensors(self.sensor_uuid, self.agent_id)
self.sensor = self.sim._Simulator__sensors[self.agent_id][
Expand Down