in mujoco_worldgen/env.py [0:0]
def set_state(self, state, call_forward=True):
"""
Sets the state of the enviroment to the given value. It does not
set time.
Warning: This only sets the MuJoCo state by setting qpos/qvel
(and the user-defined state "udd_state"). It doesn't set
the state of objects which don't have joints.
Args:
- state (MjSimState): desired state.
- call_forward (bool): if True, forward simulation after setting
state.
"""
if not isinstance(state, MjSimState):
raise TypeError("state must be an MjSimState")
if self.sim is None:
raise EmptyEnvException(
"You must call reset() or reset_to_state() before setting the "
"state the first time")
# Call forward to write out values in the MuJoCo data.
# Note: if udd_callback is set on the MjSim instance, then the
# user will need to call forward() manually before calling step.
self.sim.set_state(state)
if call_forward:
self.sim.forward()