urdf_preprocessing
copy_robot_to_models(name, data_path, dataset_name='omnigibson-robot-assets')
Copy an imported robot from objects/robot/<name>/ into models/<name>/ (idempotent) so
REGISTERED_ROBOTS discovers it. The <name>.yaml definition is placed there separately.
Returns the destination models/<name>/ directory.
Source code in OmniGibson/omnigibson/utils/urdf_preprocessing.py
link_has_dedicated_collision(link_element)
True if the link ships a usable collision proxy: a <collision> that is a primitive, or a
mesh whose file differs from the link's visual meshes. Such collisions are preserved on import;
otherwise (missing, or the same mesh as the visual) one must be generated.
Source code in OmniGibson/omnigibson/utils/urdf_preprocessing.py
override_joint_limits(tree, limits)
Set <limit> attributes on named joints (in place), repairing zeroed/degenerate limits that
make a joint non-drivable. limits maps joint_name -> {attr: value}. Returns the count updated.
Source code in OmniGibson/omnigibson/utils/urdf_preprocessing.py
rewrite_mesh_paths(tree, replacements)
Apply ordered (old, new) substring replacements to every <mesh filename> (in place),
e.g. to turn package:// URIs or broken relative paths into resolvable absolute paths.
Returns the count of references changed.
Source code in OmniGibson/omnigibson/utils/urdf_preprocessing.py
sanitize_names(tree, invalid_chars=' ()', replacement='_')
Replace invalid_chars (space/paren) with replacement in every link/joint name and all
parent/child/mimic references (in place). The importer otherwise renames these silently, breaking
downstream name matching. Returns the {old: new} map so callers can update their own references.
Source code in OmniGibson/omnigibson/utils/urdf_preprocessing.py
set_joint_dynamics(tree, joint_names, **attrs)
Set <dynamics> attributes (e.g. friction=0) on named joints (in place); returns the count updated.
Source code in OmniGibson/omnigibson/utils/urdf_preprocessing.py
stage_meshes(tree, dest_dir, invalid_chars=' ()', replacement='_')
Copy every referenced mesh into dest_dir under a USD-safe basename (space/paren -> _),
rewriting the references (in place); returns the number of files copied. Avoids the importer's
ill-formed-SdfPath failure on mesh filenames with spaces (it names geometry prims after the
basename). Run after rewrite_mesh_paths so refs resolve. Identical sources are copied
once; distinct sources colliding on a sanitized name get a numeric suffix.
Source code in OmniGibson/omnigibson/utils/urdf_preprocessing.py
strip_mimic_joints(tree)
Remove every <mimic> element (in place); returns the count removed. The importer writes no
DriveAPI on a mimic joint, leaving that finger non-drivable -- drive both fingers at runtime instead.
Source code in OmniGibson/omnigibson/utils/urdf_preprocessing.py
urdf_audit(urdf_path)
Return a deterministic, GPU-free fact sheet for a URDF (XML-aware, so multi-line tags count
correctly). Non-resolving mesh paths are reported as broken (never raised); package:// URIs
counted separately. Keys: n_links, n_joints, joint_type_counts, mimic_joints,
mesh_refs, mesh_formats, package_uris, nonascii_paths, broken_relative_paths,
links_without_inertial, root_link.