@@ -649,76 +649,76 @@ def draw_observation(self) -> None:
649649 # do nothing in draw observation, get_observation will be called after this
650650 # run the simulation there
651651 return
652- else :
653- assert self ._sim .renderer is not None
654- # see if the sensor is attached to a scene graph, otherwise it is invalid,
655- # and cannot make any observation
656- if not self ._sensor_object .object :
657- raise habitat_sim .errors .InvalidAttachedObject (
658- "Sensor observation requested but sensor is invalid.\
652+
653+ assert self ._sim .renderer is not None
654+ # see if the sensor is attached to a scene graph, otherwise it is invalid,
655+ # and cannot make any observation
656+ if not self ._sensor_object .object :
657+ raise habitat_sim .errors .InvalidAttachedObject (
658+ "Sensor observation requested but sensor is invalid.\
659659 (has it been detached from a scene node?)"
660- )
661- self ._sim .renderer .draw (self ._sensor_object , self ._sim )
660+ )
661+ self ._sim .renderer .draw (self ._sensor_object , self ._sim )
662662
663663 def _draw_observation_async (self ) -> None :
664664 if self ._spec .sensor_type == SensorType .AUDIO :
665665 # do nothing in draw observation, get_observation will be called after this
666666 # run the simulation there
667667 return
668- else :
669- assert self ._sim .renderer is not None
670- if (
671- self ._spec .sensor_type == SensorType .SEMANTIC
672- and self ._sim .get_active_scene_graph ()
673- is not self ._sim .get_active_semantic_scene_graph ()
674- ):
675- raise RuntimeError (
676- "Async drawing doesn't support semantic rendering when there are multiple scene graphs"
677- )
678- # TODO: sync this path with renderer changes as above (render from sensor object)
679668
680- # see if the sensor is attached to a scene graph, otherwise it is invalid,
681- # and cannot make any observation
682- if not self ._sensor_object .object :
683- raise habitat_sim .errors .InvalidAttachedObject (
684- "Sensor observation requested but sensor is invalid.\
685- (has it been detached from a scene node?)"
686- )
669+ assert self ._sim .renderer is not None
670+ if (
671+ self ._spec .sensor_type == SensorType .SEMANTIC
672+ and self ._sim .get_active_scene_graph ()
673+ is not self ._sim .get_active_semantic_scene_graph ()
674+ ):
675+ raise RuntimeError (
676+ "Async drawing doesn't support semantic rendering when there are multiple scene graphs"
677+ )
678+ # TODO: sync this path with renderer changes as above (render from sensor object)
679+
680+ # see if the sensor is attached to a scene graph, otherwise it is invalid,
681+ # and cannot make any observation
682+ if not self ._sensor_object .object :
683+ raise habitat_sim .errors .InvalidAttachedObject (
684+ "Sensor observation requested but sensor is invalid.\
685+ (has it been detached from a scene node?)"
686+ )
687687
688- # get the correct scene graph based on application
689- if self ._spec .sensor_type == SensorType .SEMANTIC :
690- if self ._sim .semantic_scene is None :
691- raise RuntimeError (
692- "SemanticSensor observation requested but no SemanticScene is loaded"
693- )
694- scene = self ._sim .get_active_semantic_scene_graph ()
695- else : # SensorType is DEPTH or any other type
696- scene = self ._sim .get_active_scene_graph ()
688+ # get the correct scene graph based on application
689+ if self ._spec .sensor_type == SensorType .SEMANTIC :
690+ if self ._sim .semantic_scene is None :
691+ raise RuntimeError (
692+ "SemanticSensor observation requested but no SemanticScene is loaded"
693+ )
694+ scene = self ._sim .get_active_semantic_scene_graph ()
695+ else : # SensorType is DEPTH or any other type
696+ scene = self ._sim .get_active_scene_graph ()
697697
698- # now, connect the agent to the root node of the current scene graph
698+ # now, connect the agent to the root node of the current scene graph
699699
700- # sanity check is not needed on agent:
701- # because if a sensor is attached to a scene graph,
702- # it implies the agent is attached to the same scene graph
703- # (it assumes backend simulator will guarantee it.)
700+ # sanity check is not needed on agent:
701+ # because if a sensor is attached to a scene graph,
702+ # it implies the agent is attached to the same scene graph
703+ # (it assumes backend simulator will guarantee it.)
704704
705- agent_node = self ._agent .scene_node
706- agent_node .parent = scene .get_root_node ()
705+ agent_node = self ._agent .scene_node
706+ agent_node .parent = scene .get_root_node ()
707707
708- # get the correct scene graph based on application
709- if self ._spec .sensor_type == SensorType .SEMANTIC :
710- scene = self ._sim .get_active_semantic_scene_graph ()
711- else : # SensorType is DEPTH or any other type
712- scene = self ._sim .get_active_scene_graph ()
708+ # get the correct scene graph based on application
709+ if self ._spec .sensor_type == SensorType .SEMANTIC :
710+ scene = self ._sim .get_active_semantic_scene_graph ()
711+ else : # SensorType is DEPTH or any other type
712+ scene = self ._sim .get_active_scene_graph ()
713713
714- render_flags = habitat_sim .gfx .Camera .Flags .NONE
714+ render_flags = habitat_sim .gfx .Camera .Flags .NONE
715715
716- if self ._sim .frustum_culling :
717- render_flags |= habitat_sim .gfx .Camera .Flags .FRUSTUM_CULLING
716+ if self ._sim .frustum_culling :
717+ render_flags |= habitat_sim .gfx .Camera .Flags .FRUSTUM_CULLING
718718
719- self ._sim .renderer .enqueue_async_draw_job (
720- self ._sensor_object , scene , self .view , render_flags
721- )
719+ self ._sim .renderer .enqueue_async_draw_job (
720+ self ._sensor_object , scene , self .view , render_flags
721+ )
722722
723723 def get_observation (self ) -> Union [ndarray , "Tensor" ]:
724724 if self ._spec .sensor_type == SensorType .AUDIO :
0 commit comments