Returns the physics state. Args: sig: Optional integer, if specified then the returned array corresponds to the state obtained by calling `mj_getState` with `sig`. Returns: NumPy array containing full physics simulation state.
(self, sig=None)
| 233 | return image |
| 234 | |
| 235 | def get_state(self, sig=None): |
| 236 | """Returns the physics state. |
| 237 | |
| 238 | Args: |
| 239 | sig: Optional integer, if specified then the returned array corresponds to |
| 240 | the state obtained by calling `mj_getState` with `sig`. |
| 241 | |
| 242 | Returns: |
| 243 | NumPy array containing full physics simulation state. |
| 244 | """ |
| 245 | if sig is None: |
| 246 | return np.concatenate(self._physics_state_items()) |
| 247 | else: |
| 248 | retval = np.empty(mujoco.mj_stateSize(self.model.ptr, sig), np.float64) |
| 249 | mujoco.mj_getState(self.model.ptr, self.data.ptr, retval, sig) |
| 250 | return retval |
| 251 | |
| 252 | def set_state(self, physics_state, sig=None): |
| 253 | """Sets the physics state. |