Skip to content

Commit

Permalink
Code cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
0mdc committed Mar 15, 2023
1 parent f2fbc07 commit 295825c
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src_python/habitat_sim/simulator.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,12 +440,16 @@ def get_sensor_observations(
# As backport. All Dicts are ordered in Python >= 3.7.
observations: Dict[int, ObservationDict] = OrderedDict()

# Draw observations for classic non-batched renderer.
# Draw observations (for classic non-batched renderer).
if not self.config.enable_batch_renderer:
for agent_id in agent_ids:
agent_sensorsuite = self.__sensors[agent_id]
for _sensor_uuid, sensor in agent_sensorsuite.items():
sensor.draw_observation()
else:
# The batch renderer draws observations from external code.
# Sensors are only used as data containers.
pass

# Get observations.
for agent_id in agent_ids:
Expand Down Expand Up @@ -588,9 +592,13 @@ def __init__(self, sim: Simulator, agent: Agent, sensor_id: str) -> None:
self._spec = self._sensor_object.specification()

# When using the batch renderer, no memory is allocated here.
if self._sim.config.enable_batch_renderer:
return
if not self._sim.config.enable_batch_renderer:
self._initialize_sensor()

def _initialize_sensor(self):
r"""
Allocate buffers and initialize noise model in preparation for rendering.
"""
if self._spec.sensor_type == SensorType.AUDIO:
return

Expand Down

0 comments on commit 295825c

Please sign in to comment.