[Question] Why is episode_length_buf not initialized for use in observation functions (for a manager-based environment), but can be used to determine time outs (a termination function)? #2284
Unanswered
TheIndoorDad
asked this question in
Q&A
Replies: 1 comment 2 replies
-
Thank you for posting this, great question. The team is aware of this, would you like to submit a PR that would add this functionality? Thanks! |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hello all,
I was writing an observation function to pass the time remaining in an episode (in seconds) to an observation term in a Manager-based environment. To do so, I figured I could use episode_length_buf from the ManagerBasedRLEnv class, like is done for time out terminations (source/isaaclab/isaaclab/envs/mdp/terminations.py line 32). My function looks like:
However, when attempting to train a policy calling this observation function (using rsl_rl) I would get an error when the Observation Manager was initialized:
I think this was happening because the Observation Manager is loaded in the course of the initialization of the ManagerBasedEnv class, before episode_length_buf is initialized in ManagerBasedRLEnv, but I can't figure out why it would work for the
time_out
termination function in that case.I managed to get it working by initializing
episode_length_buf
beforeload_managers()
is called in ManagerBasedEnv (i.e., by insertingself.episode_length_buf = torch.zeros(self.num_envs, device=self.device, dtype=torch.long)
at line 162). I'd rather not have to do that, however, as otherwise my project is entirely contained in an external extension. I also suppose it would probably be easier in a direct workflow, but I'd also rather not switch just for this.Does anyone know why
episode_length_buf
works for thetime_out
termination function (source/isaaclab/isaaclab/envs/mdp/terminations.py line 32), but not for my observation function without modifying ManagerBasedEnv?Thank you in advance for your assistance, and for your patience with anything I'm likely to have misunderstood - I'm relatively new to the field and my background is not in software dev.
Beta Was this translation helpful? Give feedback.
All reactions