Context manager for resetting the simulation state. Sets the internal simulation to a default state when entering the block. ```python with physics.reset_context(): # Set joint and object positions. physics.step() ``` Yields: The `Physics` instance.
(self)
| 231 | |
| 232 | @contextlib.contextmanager |
| 233 | def reset_context(self): |
| 234 | """Context manager for resetting the simulation state. |
| 235 | |
| 236 | Sets the internal simulation to a default state when entering the block. |
| 237 | |
| 238 | ```python |
| 239 | with physics.reset_context(): |
| 240 | # Set joint and object positions. |
| 241 | |
| 242 | physics.step() |
| 243 | ``` |
| 244 | |
| 245 | Yields: |
| 246 | The `Physics` instance. |
| 247 | """ |
| 248 | try: |
| 249 | self.reset() |
| 250 | except PhysicsError: |
| 251 | pass |
| 252 | yield self |
| 253 | self.after_reset() |
| 254 | |
| 255 | @abc.abstractmethod |
| 256 | def reset(self): |