@@ -600,6 +600,7 @@ def initialize_agent(
600600 return agent
601601
602602 def start_async_render (self , agent_ids : Union [int , List [int ]] = 0 ):
603+ assert not self .config .enable_batch_renderer
603604 if self ._async_draw_agent_ids is not None :
604605 raise RuntimeError (
605606 "start_async_render_and_step_physics was already called. "
@@ -626,6 +627,8 @@ def start_async_render_and_step_physics(
626627 def get_sensor_observations_async_finish (
627628 self ,
628629 ) -> Union [Dict [str , SensorObservation ], Dict [int , Dict [str , SensorObservation ]],]:
630+ assert not self .config .enable_batch_renderer
631+
629632 if self ._async_draw_agent_ids is None :
630633 raise RuntimeError (
631634 "get_sensor_observations_async_finish was called before calling start_async_render_and_step_physics."
@@ -673,11 +676,16 @@ def get_sensor_observations(
673676 else :
674677 return_single = False
675678
676- # draw observation to render target
677- for agent_id in agent_ids :
678- agent_sensor_dict = self .__sensors [agent_id ]
679- for sensor in agent_sensor_dict .values ():
680- self .draw_observation (sensor )
679+ # Draw observations (for classic non-batched renderer).
680+ if not self .config .enable_batch_renderer :
681+ for agent_id in agent_ids :
682+ agent_sensor_dict = self .__sensors [agent_id ]
683+ for sensor in agent_sensor_dict .values ():
684+ self .draw_observation (sensor )
685+ else :
686+ # The batch renderer draws observations from external code.
687+ # Sensors are only used as data containers.
688+ pass
681689
682690 # As backport. All Dicts are ordered in Python >= 3.7
683691 per_agent_observations : Dict [int , Dict [str , SensorObservation ]] = OrderedDict ()
@@ -817,6 +825,10 @@ def get_observation(
817825 if sensor_spec .sensor_type == SensorType .AUDIO :
818826 return self ._get_audio_observation (sensor , agent_id )
819827
828+ # Placeholder until batch renderer emplaces the final value.
829+ if self ._sim .config .enable_batch_renderer :
830+ return None
831+
820832 assert self .renderer is not None
821833 tgt = sensor .render_target
822834
@@ -899,6 +911,9 @@ def _get_audio_observation(
899911 return observation
900912
901913 def draw_observation (self , sensor : Sensor ) -> None :
914+ # Batch rendering happens elsewhere.
915+ assert not self ._sim .config .enable_batch_renderer
916+
902917 if sensor .specification ().sensor_type == SensorType .AUDIO :
903918 # do nothing in draw observation, get_observation will be called after this
904919 # run the simulation there
@@ -919,6 +934,9 @@ def _draw_observation_async(
919934 sensor : Sensor ,
920935 agent_id : Optional [int ] = 0 , # TODO change this to None eventually
921936 ) -> None :
937+ # Batch rendering happens elsewhere.
938+ assert not self ._sim .config .enable_batch_renderer
939+
922940 sensor_spec = sensor .specification ()
923941 if sensor_spec .sensor_type == SensorType .AUDIO :
924942 # do nothing in draw observation, get_observation will be called after this
0 commit comments