Skip to content

Commit

Permalink
Add cloning of observation to prevent bug
Browse files Browse the repository at this point in the history
  • Loading branch information
Bjarne-55 committed Oct 15, 2024
1 parent 7ba72ab commit cab144d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions mushroom_rl/environments/isaac_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def reset_all(self, env_mask, state=None):
# self._world.step(render=self._render) # TODO Check if we can do otherwise
task_obs = self._task.get_observations()
observation = convert_task_observation(task_obs)
return observation, [{}]*self._n_envs
return observation.clone(), [{}]*self._n_envs

def step_all(self, env_mask, action):
self._task.pre_physics_step(action)
Expand All @@ -106,7 +106,7 @@ def step_all(self, env_mask, action):

env_mask_cuda = torch.as_tensor(env_mask).cuda()

return observation, reward, torch.logical_and(done, env_mask_cuda), [info]*self._n_envs
return observation.clone(), reward, torch.logical_and(done, env_mask_cuda), [info]*self._n_envs

def render_all(self, env_mask, record=False):
self._world.render()
Expand Down

0 comments on commit cab144d

Please sign in to comment.