(xml_path=None, xml_string=None, assets=None)
return ptr
Parses a model XML file, compiles it, and returns a pointer to an mjModel.

  Args:
    xml_path: None or a path to a model XML file in MJCF or URDF format.
    xml_string: None or an XML string containing an MJCF or URDF model
      description.
    assets: None or a dict containing external assets referenced by the model
      (such as additional XML files, textures, meshes etc.), in the form of
      `{filename: contents_string}` pairs. The keys should correspond to the
      filenames specified in the model XML. Ignored if `xml_string` is None.

    One of `xml_path` or `xml_string` must be specified.

  Returns:
    A `ctypes.POINTER` to a new `mjbindings.types.MJMODEL` instance.

  Raises:
    TypeError: If both or neither of `xml_path` and `xml_string` are specified.
    Error: If the model is not created successfully.
Parses a model XML file, compiles it, and returns a pointer to an mjModel.
Parses a model XML file compiles it and returns a pointer to an mjModel .
def _get_model_ptr_from_xml(xml_path=None, xml_string=None, assets=None):
  """Parses a model XML file, compiles it, and returns a pointer to an mjModel.

  Args:
    xml_path: None or a path to a model XML file in MJCF or URDF format.
    xml_string: None or an XML string containing an MJCF or URDF model
      description.
    assets: None or a dict containing external assets referenced by the model
      (such as additional XML files, textures, meshes etc.), in the form of
      `{filename: contents_string}` pairs. The keys should correspond to the
      filenames specified in the model XML. Ignored if `xml_string` is None.

    One of `xml_path` or `xml_string` must be specified.

  Returns:
    A `ctypes.POINTER` to a new `mjbindings.types.MJMODEL` instance.

  Raises:
    TypeError: If both or neither of `xml_path` and `xml_string` are specified.
    Error: If the model is not created successfully.
  """
  if xml_path is None and xml_string is None:
    raise TypeError(
        "At least one of `xml_path` or `xml_string` must be specified.")
  elif xml_path is not None and xml_string is not None:
    raise TypeError(
        "Only one of `xml_path` or `xml_string` may be specified.")

  if xml_string is not None:
    assets = {} if assets is None else assets.copy()
    # Ensure that the fake XML filename doesn't overwrite an existing asset.
    xml_path = _FAKE_XML_FILENAME
    while xml_path in assets:
      xml_path = "_" + xml_path
    assets[xml_path] = xml_string
    with _temporary_vfs(assets) as vfs:
      ptr = _load_xml(xml_path, vfs)
  else:
    ptr = _load_xml(xml_path, None)

  global _LAST_PARSED_MODEL_PTR
  _LAST_PARSED_MODEL_PTR = ptr

  return ptr
def _get_model_ptr_from_xml ( xml_path = None , xml_string = None , assets = None ) : if xml_path is None and xml_string is None : raise TypeError ( "At least one of `xml_path` or `xml_string` must be specified." ) elif xml_path is not None and xml_string is not None : raise TypeError ( "Only one of `xml_path` or `xml_string` may be specified." ) if xml_string is not None : assets = { } if assets is None else assets . copy ( ) # Ensure that the fake XML filename doesn't overwrite an existing asset. xml_path = _FAKE_XML_FILENAME while xml_path in assets : xml_path = "_" + xml_path assets [ xml_path ] = xml_string with _temporary_vfs ( assets ) as vfs : ptr = _load_xml ( xml_path , vfs ) else : ptr = _load_xml ( xml_path , None ) global _LAST_PARSED_MODEL_PTR _LAST_PARSED_MODEL_PTR = ptr return ptr