
    hs
                        S r SSKrSSKrSSKr\R
                  R                  4S\R                  R                  R                  S\R
                  4S jjr	\R
                  R                  4S\R                  R                  R                  S\R                  S\R
                  4S jjrS\R
                  R                  4S\R                  R                  R                  S\R
                  4S	 jjrg)
zaA set of MujocoEnv related utilities, mainly for testing purposes.

Author: @Kallinteris-Andreas
    Nenv
state_typec                 :   [         R                  S:  d   S5       e[        R                  " [         R                  " U R
                  R                  U5      5      n[         R                  " U R
                  R                  U R
                  R                  X!5        U$ )at  Gets the state of `env`.

Arguments:
    env: Environment whose state to copy, `env.model` & `env.data` must be accessible.
    state_type: see the [documentation of mjtState](https://mujoco.readthedocs.io/en/stable/APIreference/APItypes.html#mjtstate) most users can use the default for training purposes or `mujoco.mjtState.mjSTATE_INTEGRATION` for validation purposes.
2.3.6 Feature requires `mujoco>=2.3.6`)	mujoco__version__npemptymj_stateSize	unwrappedmodelmj_getStatedata)r   r   states      U/home/james-whalen/.local/lib/python3.13/site-packages/gymnasium/envs/mujoco/utils.py	get_stater      sn     (L*LL(HHV(()<)<jIJE
s}}**CMM,>,>RL    r   c                     [         R                  S:  d   S5       e[         R                  " U R                  R                  U R                  R
                  UUS9  U$ )a  Set the state of `env`.

Arguments:
    env: Environment whose state to set, `env.model` & `env.data` must be accessible.
    state: State to set (generated from get_state).
    state_type: see the [documentation of mjtState](https://mujoco.readthedocs.io/en/stable/APIreference/APItypes.html#mjtstate) most users can use the default for training purposes or `mujoco.mjtState.mjSTATE_INTEGRATION` for validation purposes.
r   r   )spec)r   r	   mj_setStater   r   r   )r   r   r   s      r   	set_stater      sS     (L*LL(
	 Lr   i  c                 @   U R                   R                  U5        U R                   R                  5       nU R                  US9  [	        X5      nU R                  U5        U R                  US9  [	        X5      n[        R                  " XE:H  5      (       d   S5       eg)ap  Asserts that `env.reset()` properly resets the state (not affected by previous steps).

Note: assuming `check_reset_seed` has passed.

Arguments:
    env: Environment which is being tested.
    seed: the `seed` used in `env.reset(seed)`.
    state_type: see the [documentation of mjtState](https://mujoco.readthedocs.io/en/stable/APIreference/APItypes.html#mjtstate).
)seedzreset is not deterministicN)action_spacer   sampleresetr   stepr
   all)r   r   r   actionfirst_reset_statesecond_reset_states         r   check_mujoco_reset_stater#   4   s     $$$&FII4I!#2HHVII4I"3366#9::X<XX:r   )__doc__r   numpyr
   	gymnasiummjtStatemjSTATE_FULLPHYSICSenvs	MujocoEnvr   ndarrayr   mjSTATE_INTEGRATIONr#    r   r   <module>r.      s   
   
 #)//"E"E				(	(( #)//"E"E				(	(:: 2 
"(//"E"EY				(	(Y Yr   