unilab.envs.mdp.recorders¶
Reusable recorder terms for the NumPy Manager-Based runtime.
Classes
Count recorder lifecycle calls without performing I/O. |
- class unilab.envs.mdp.recorders.LifecycleCounterRecorder[source]¶
Bases:
RecorderTermCount recorder lifecycle calls without performing I/O.
- Parameters:
cfg (
RecorderTermCfg)env (
ManagerBasedRlEnv)
- record_pre_reset(env_ids)[source]¶
Called in
env.step()before terminated environments are reset.What is available:
obs_bufcontains the observation from the end of the previous step (the input the agent used to choose the terminal action). It does not contain the post-action terminal observation (the state reached after applying the action), which is never computed for resetting environments.action_manager.actioncontains the action applied during this step. This is the correct terminal action. It will be zeroed for these environments by_reset_idximmediately after this hook returns, so capture it here if you need it later.reward_bufcontains the reward for this terminal step.reset_terminatedandreset_time_outsreflect why each environment is resetting.
This is the right hook to record the terminal transition
(obs_t, action_t, reward_t, done=True)for each resetting environment.
- record_post_reset(env_ids)[source]¶
Called after a reset completes with fresh observations computed.
Fires at the end of
env.reset()(covering all environments on the initial call) and withinenv.step()for each batch of environments that terminates, after state has been overwritten and new observations computed.At this point
obs_buf[env_ids]holds the initial observation of the new episode andaction_manager.action[env_ids]is zero (no action has been taken in the new episode yet).Use this hook to initialize per-episode state or record the first observation of a new episode.
- record_post_step()[source]¶
Called at the end of every
env.step()with fresh observations.At this point
obs_bufholds the new observation for every environment andaction_manager.actionholds the action that was applied during this step. Exception: for environments that reset during this step,action_manager.actionhas been zeroed by_reset_idxandobs_bufholds the initial observation of the new episode rather than the post-action terminal observation. Userecord_pre_resetto capture the terminal(obs, action)pair for those environments. Resetting environments are identified byself._env.reset_buf.- Return type: