Skip to content

Commit

Permalink
use hydra to turn off all visualization features when video_option is []
Browse files Browse the repository at this point in the history
  • Loading branch information
naokiyokoyamabd committed Aug 12, 2023
1 parent 70f203e commit 0528111
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
9 changes: 7 additions & 2 deletions zsos/policy/habitat_policies.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ def from_config(cls, config: DictConfig, *args_unused, **kwargs_unused):
agent_config = config.habitat.simulator.agents.main_agent
kwargs["camera_height"] = agent_config.sim_sensors.rgb_sensor.position[1]

# Only bother visualizing if we're actually going to save the video
kwargs["visualize"] = len(config.habitat_baselines.eval.video_option) > 0

return cls(**kwargs)

def act(
Expand Down Expand Up @@ -101,6 +104,10 @@ def _get_policy_info(
"""Get policy info for logging"""
parent_cls: BaseObjectNavPolicy = super() # type: ignore
info = parent_cls._get_policy_info(observations, detections)

if not self._visualize: # type: ignore
return info

if self._start_yaw is None:
self._start_yaw = observations[HeadingSensor.cls_uuid][0].item()
info["start_yaw"] = self._start_yaw
Expand Down Expand Up @@ -168,7 +175,6 @@ class ZSOSPolicyConfig(PolicyConfig):
value_map_max_depth: float = 5.0
value_map_hfov: float = 79.0
object_map_proximity_threshold: float = 1.5
visualize: bool = True

@classmethod
def arg_names(cls) -> List[str]:
Expand All @@ -184,7 +190,6 @@ def arg_names(cls) -> List[str]:
"object_map_proximity_threshold",
"value_map_max_depth",
"value_map_hfov",
"visualize",
]


Expand Down
4 changes: 4 additions & 0 deletions zsos/policy/itm_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ def _get_policy_info(
detections: ObjectDetections,
) -> Dict[str, Any]:
policy_info = super()._get_policy_info(observations, detections)

if not self._visualize:
return policy_info

markers = []

# Draw frontiers on to the cost map
Expand Down

0 comments on commit 0528111

Please sign in to comment.