unilab.tasks.manipulation.allegro_inhand.grasp_gen.AllegroGraspRecorder¶
- class unilab.tasks.manipulation.allegro_inhand.grasp_gen.AllegroGraspRecorder[source]¶
Bases:
RecorderTermCollect successful timeout states and persist the canonical 23-D cache.
- Parameters:
cfg (
RecorderTermCfg)env (
_GraspEnv)
Methods
__init__(cfg, env)close()Called when the environment closes.
record_post_reset(env_ids)Called after a reset completes with fresh observations computed.
Called at the end of every
env.step()with fresh observations.record_pre_reset(env_ids)Called in
env.step()before terminated environments are reset.reset(env_ids)Resets the manager term.
Attributes
- 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.
- close()[source]¶
Called when the environment closes.
Release file handles, flush write buffers, or finalize output here.
- Return type:
- __call__()¶
Returns the value of the term required by the manager.
- record_post_reset(env_ids)¶
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()¶
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: