rofunc.utils.robolab.formatter.mjcf_parser.parser#
Functions for parsing XML into an MJCF object model.
1. Module Contents#
1.1. Functions#
Parses an XML string into an MJCF object model. |
|
Parses an XML file into an MJCF object model. |
|
Parses an XML file into an MJCF object model. |
1.2. API#
- rofunc.utils.robolab.formatter.mjcf_parser.parser.from_xml_string(xml_string, escape_separators=False, model_dir='', resolve_references=True, assets=None)[source]#
Parses an XML string into an MJCF object model.
- Args:
xml_string: An XML string representing an MJCF model. escape_separators: (optional) A boolean, whether to replace ‘/’ characters
in element identifiers. If False, any ‘/’ present in the XML causes a ValueError to be raised.
- model_dir: (optional) Path to the directory containing the model XML file.
This is used to prefix the paths of all asset files.
- resolve_references: (optional) A boolean indicating whether the parser
should attempt to resolve reference attributes to a corresponding element.
- assets: (optional) A dictionary of pre-loaded assets, of the form
{filename: bytestring}. If present, PyMJCF will search for assets in this dictionary before attempting to load them from the filesystem.
- Returns:
An mjcf.RootElement.
- rofunc.utils.robolab.formatter.mjcf_parser.parser.from_file(file_handle, escape_separators=False, model_dir='', resolve_references=True, assets=None)[source]#
Parses an XML file into an MJCF object model.
- Args:
file_handle: A Python file-like handle. escape_separators: (optional) A boolean, whether to replace ‘/’ characters
in element identifiers. If False, any ‘/’ present in the XML causes a ValueError to be raised.
- model_dir: (optional) Path to the directory containing the model XML file.
This is used to prefix the paths of all asset files.
- resolve_references: (optional) A boolean indicating whether the parser
should attempt to resolve reference attributes to a corresponding element.
- assets: (optional) A dictionary of pre-loaded assets, of the form
{filename: bytestring}. If present, PyMJCF will search for assets in this dictionary before attempting to load them from the filesystem.
- Returns:
An mjcf.RootElement.
- rofunc.utils.robolab.formatter.mjcf_parser.parser.from_path(path, escape_separators=False, resolve_references=True, assets=None)[source]#
Parses an XML file into an MJCF object model.
- Args:
- path: A path to an XML file. This path should be loadable using
resources.GetResource.
- escape_separators: (optional) A boolean, whether to replace ‘/’ characters
in element identifiers. If False, any ‘/’ present in the XML causes a ValueError to be raised.
- resolve_references: (optional) A boolean indicating whether the parser
should attempt to resolve reference attributes to a corresponding element.
- assets: (optional) A dictionary of pre-loaded assets, of the form
{filename: bytestring}. If present, PyMJCF will search for assets in this dictionary before attempting to load them from the filesystem.
- Returns:
An mjcf.RootElement.