Creates a copy of this `Physics` instance. Args: share_model: If True, the copy and the original will share a common MjModel instance. By default, both model and data will both be copied. Returns: A `Physics` instance.
(self, share_model=False)
| 285 | ) |
| 286 | |
| 287 | def copy(self, share_model=False): |
| 288 | """Creates a copy of this `Physics` instance. |
| 289 | |
| 290 | Args: |
| 291 | share_model: If True, the copy and the original will share a common |
| 292 | MjModel instance. By default, both model and data will both be copied. |
| 293 | |
| 294 | Returns: |
| 295 | A `Physics` instance. |
| 296 | """ |
| 297 | new_data = self.data._make_copy(share_model=share_model) # pylint: disable=protected-access |
| 298 | cls = self.__class__ |
| 299 | new_obj = cls.__new__(cls) |
| 300 | # pylint: disable=protected-access |
| 301 | new_obj._warnings_cause_exception = True |
| 302 | new_obj._reload_from_data(new_data) |
| 303 | # pylint: enable=protected-access |
| 304 | return new_obj |
| 305 | |
| 306 | def reset(self, keyframe_id=None): |
| 307 | """Resets internal variables of the simulation, possibly to a keyframe. |