MCPcopy Create free account
hub / github.com/google-deepmind/dm_control / get_state

Method get_state

dm_control/mujoco/engine.py:235–250  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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.

Callers 6

__init__Method · 0.80
testNstepMethod · 0.80

Calls 1

_physics_state_itemsMethod · 0.95

Tested by 5

testNstepMethod · 0.64