A named constructor from a string containing an MJCF XML file. Args: xml_string: XML string containing an MJCF model description. assets: Optional dict containing external assets referenced by the model (such as additional XML files, textures, meshes etc.), in the form of
(cls, xml_string, assets=None)
| 450 | |
| 451 | @classmethod |
| 452 | def from_xml_string(cls, xml_string, assets=None): |
| 453 | """A named constructor from a string containing an MJCF XML file. |
| 454 | |
| 455 | Args: |
| 456 | xml_string: XML string containing an MJCF model description. |
| 457 | assets: Optional dict containing external assets referenced by the model |
| 458 | (such as additional XML files, textures, meshes etc.), in the form of |
| 459 | `{filename: contents_string}` pairs. The keys should correspond to the |
| 460 | filenames specified in the model XML. |
| 461 | |
| 462 | Returns: |
| 463 | A new `Physics` instance. |
| 464 | """ |
| 465 | model = wrapper.MjModel.from_xml_string(xml_string, assets=assets) |
| 466 | return cls.from_model(model) |
| 467 | |
| 468 | @classmethod |
| 469 | def from_byte_string(cls, byte_string): |