Skip to content

novaphy.UrdfParser

Read / write entry point for URDF. Parses URDF documents into UrdfModelData, and serializes a Model back out to URDF for round-trip workflows.

The parser is stateless — no per-instance configuration is required; options that influence parsing belong on UrdfImportOptions and are consumed by SceneBuilderEngine.

Methods

Method Description
parse_file(urdf_path) -> UrdfModelData Parse a URDF file from disk.
write_string(model) -> str Serialize a NovaPhy Model back into a URDF XML string.
write_file(model, urdf_path) -> None Serialize a Model to a URDF file at urdf_path.

Example

import novaphy

parser = novaphy.UrdfParser()
data = parser.parse_file("robot.urdf")

engine = novaphy.SceneBuilderEngine()
result = engine.build_from_urdf(data, novaphy.UrdfImportOptions())

# Round-trip the finalized model back to URDF.
parser.write_file(result.model, "robot_roundtrip.urdf")

Notes

  • Mesh references (<mesh filename="...">) are loaded relative to the URDF file's directory.
  • parse_file raises a Python exception on malformed XML; wrap the call in a try / except if you accept user-supplied URDF.

See Also