Skip to content

Commit

Permalink
bugfix - correctly pass constrain_to_largest_nav_island into ObjectSa…
Browse files Browse the repository at this point in the history
…mpler and TargetObjectSampler constructors (#1481)
  • Loading branch information
aclegg3 authored Aug 2, 2023
1 parent 5dee9a7 commit 17ec6b3
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 15 deletions.
50 changes: 35 additions & 15 deletions habitat-lab/habitat/datasets/rearrange/rearrange_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,21 +214,29 @@ def _get_obj_samplers(self) -> None:
self._obj_samplers[
obj_sampler_info["name"]
] = samplers.ObjectSampler(
object_handles,
obj_sampler_info["params"]["receptacle_sets"],
(
object_set=object_handles,
allowed_recep_set_names=obj_sampler_info["params"][
"receptacle_sets"
],
num_objects=(
obj_sampler_info["params"]["num_samples"][0],
obj_sampler_info["params"]["num_samples"][1],
),
obj_sampler_info["params"]["orientation_sampling"],
get_sample_region_ratios(obj_sampler_info),
obj_sampler_info["params"].get(
orientation_sample=obj_sampler_info["params"][
"orientation_sampling"
],
sample_region_ratio=get_sample_region_ratios(
obj_sampler_info
),
nav_to_min_distance=obj_sampler_info["params"].get(
"nav_to_min_distance", -1.0
),
obj_sampler_info["params"].get("sample_probs", None),
obj_sampler_info["params"].get(
"constrain_to_largest_nav_island", False
recep_set_sample_probs=obj_sampler_info["params"].get(
"sample_probs", None
),
constrain_to_largest_nav_island=obj_sampler_info[
"params"
].get("constrain_to_largest_nav_island", False),
)
else:
logger.info(
Expand Down Expand Up @@ -256,17 +264,29 @@ def _get_object_target_samplers(self) -> None:
target_sampler_info["name"]
] = samplers.ObjectTargetSampler(
# Add object set later
[],
target_sampler_info["params"]["receptacle_sets"],
(
object_instance_set=[],
allowed_recep_set_names=target_sampler_info["params"][
"receptacle_sets"
],
num_objects=(
target_sampler_info["params"]["num_samples"][0],
target_sampler_info["params"]["num_samples"][1],
),
target_sampler_info["params"]["orientation_sampling"],
get_sample_region_ratios(target_sampler_info),
target_sampler_info["params"].get(
orientation_sample=target_sampler_info["params"][
"orientation_sampling"
],
sample_region_ratio=get_sample_region_ratios(
target_sampler_info
),
nav_to_min_distance=target_sampler_info["params"].get(
"nav_to_min_distance", -1.0
),
recep_set_sample_probs=target_sampler_info["params"].get(
"sample_probs", None
),
constrain_to_largest_nav_island=target_sampler_info[
"params"
].get("constrain_to_largest_nav_island", False),
)
else:
logger.info(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ class RearrangeEpisodeGeneratorConfig:
# {"object_samplers":[str], "receptacle_sets":[str], "num_samples":[min, max], "orientation_sampling":str)
# NOTE: random instances are chosen from the specified, previously excecuted object sampler up to the maximum number specified in params.
# NOTE: previous samplers referenced must have: combined minimum samples >= minimum requested targets
# NOTE: "orientation_sampling" options: "none", "up", "all"
# NOTE: (optional) "constrain_to_largest_nav_island" (default False): if True, valid placements must snap to the largest navmesh island
# NOTE: (optional) "nav_to_min_distance" (default -1): if not -1, valid placements must snap to the navmesh with horizontal distance less than this value
# {
# "name": "any_one_target",
# "type": "uniform",
Expand Down

0 comments on commit 17ec6b3

Please sign in to comment.