Reloads this `mjcf.Physics` from an `mjcf.RootElement`. After calling this method, the state of this `Physics` instance is the same as a new `Physics` instance created with the `from_mjcf_model` named constructor. Args: mjcf_model: An `mjcf.RootElement` instance.
(self, mjcf_model)
| 463 | debug_context.process_and_raise_last_exception() |
| 464 | |
| 465 | def reload_from_mjcf_model(self, mjcf_model): |
| 466 | """Reloads this `mjcf.Physics` from an `mjcf.RootElement`. |
| 467 | |
| 468 | After calling this method, the state of this `Physics` instance is the same |
| 469 | as a new `Physics` instance created with the `from_mjcf_model` named |
| 470 | constructor. |
| 471 | |
| 472 | Args: |
| 473 | mjcf_model: An `mjcf.RootElement` instance. |
| 474 | """ |
| 475 | debug_context = debugging.DebugContext() |
| 476 | xml_string = mjcf_model.to_xml_string(debug_context=debug_context) |
| 477 | if _pymjcf_log_xml(): |
| 478 | _log_xml(xml_string) |
| 479 | assets = mjcf_model.get_assets() |
| 480 | try: |
| 481 | self.reload_from_xml_string(xml_string=xml_string, assets=assets) |
| 482 | except ValueError: |
| 483 | debug_context.process_and_raise_last_exception() |
| 484 | |
| 485 | def _reload_from_data(self, data): |
| 486 | """Initializes a new or existing `Physics` instance from a `core.MjData`. |