scene_synthesizer.exchange.export.export_urdf

scene_synthesizer.exchange.export.export_urdf(scene, fname, folder=None, mesh_dir=None, use_absolute_mesh_paths=False, include_camera_node=False, include_light_nodes=False, separate_assets=False, write_mesh_files=False, write_mesh_file_type='obj', single_geometry_per_link=False, mesh_path_prefix=None, ignore_layers=None)

Export scene to one/multiple URDF files or return URDF data as string(s).

Parameters:
  • scene (scene_synthesizer.Scene) – Scene description.

  • fname (str) – URDF filename or None. If None, the URDF data is returned as one or multiple strings.

  • folder (str, optional) – Only used if fname is None. The folder in which to export the URDF. Affects the location of textures. Defaults to None.

  • mesh_dir (str, optional) – Mesh directory to write polygon meshes to. Defaults to the directory part of fname or folder if fname is None.

  • use_absolute_mesh_paths (bool, optional) – If set to True will convert all mesh paths to absolute ones. Defaults to False.

  • mesh_path_prefix (str, optional) – Can be used to set file name prefix for meshes to “file://” or “package://”. Defaults to “”.

  • write_mesh_files (bool, optional) – If False, mesh file names in the URDF will point to the asset source files. If True, the meshes will be written to the URDF mesh directory. Defaults to True.

  • write_mesh_file_type (str, optional) – File type that will be used if write_mesh_files is True. Defaults to “obj”.

  • separate_assets (bool, optional) – If True, each asset in the scene will be exported to a separate URDF file, named according to its object identifier. Note: The scene itself will not be exported; each asset’s transformation will not be preserved. Defaults to False.

  • include_camera_node (bool, optional) – Whether to include a link for the camera node. Defaults to False.

  • include_light_nodes (bool, optional) – Whether to include a link for the light nodes. Defaults to False.

  • single_geometry_per_link (bool, optional) – If True will add only one visual/collision geometry per link. This creates a lot of links and fixed joints. Defaults to False.

  • ignore_layers (bool, optional) – If True will add all geometries as visual and collision geometries. If None, will it will be (num_layers < 2). Defaults to None.

Raises:

ValueError – Raise an exception if mesh_dir is not absolute but use_absolute_mesh_paths=True.

Returns:

If fname is None, will return the URDF data as a string. dict[str, str] (optional): If fname=None and separate_assets=True will return the additional assets as URDF strings in a dictionary.

Return type:

str (optional)