class_docstr: Adds physics simulation on top of kb.Scene using PyBullet.
class_docstr_tok: ["Adds","physics","simulation","on","top","of","kb.Scene","using","PyBullet","."]
code: def _add_object(self, obj: core.FileBasedObject) -> Optional[int]:
      # TODO: support other file-formats
      if obj.simulation_filename is None:
          return None  # if there is no simulation file, then ignore this object
      path = pathlib.Path(obj.simulation_filename).resolve()
      logger.debug("Loading '%s' in the simulator", path)
  
      if not path.exists():
          raise IOError(f"File '{path}' does not exist.")
  
      scale = obj.scale[0]
      assert (
          obj.scale[1] == obj.scale[2] == scale
      ), "Pybullet does not support non-uniform scaling"
  
      # useMaximalCoordinates and contactProcessingThreshold are required to
      # fix the sticky walls issue;
      # see https://github.com/bulletphysics/bullet3/issues/3094
      if path.suffix == ".urdf":
          obj_idx = self._physics_client.loadURDF(
              str(path),
              useFixedBase=obj.static,
              globalScaling=scale,
              useMaximalCoordinates=True,
          )
      else:
          raise IOError(
              "Unsupported format '{path.suffix}' of file '{path}'"
          )
  
      if obj_idx < 0:
          raise IOError(f"Failed to load '{path}'")
  
      self._physics_client.changeDynamics(
          obj_idx, -1, contactProcessingThreshold=0
      )
  
      register_physical_object_setters(
          obj, obj_idx, self._physics_client
      )
      return obj_idx
  
imports: import functools
  import inspect
  import logging
  import pathlib
  import sys
  import tempfile
  from typing import Dict, List, Optional, Tuple, Union
  import tensorflow
  from singledispatchmethod import singledispatchmethod
  from kubric import core
  from kubric.redirect_io import RedirectStream
label_desc: Use image node_id 10 for calling the PyBullet obj's underlying member method code with example usage: obj._add_object(obj) and returns: obj_idx, None