Skip to content

Commit

Permalink
FEATURE: Proprio dict not has time as one of the keys
Browse files Browse the repository at this point in the history
  • Loading branch information
vikashplus committed Apr 13, 2023
1 parent 47f7f57 commit 8894dd5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions robohive/envs/env_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -404,17 +404,18 @@ def get_proprioception(self, obs_dict=None)->dict:
if obs_dict==None: obs_dict = self.obs_dict
proprio_vec = np.zeros(0)
proprio_dict = {}
proprio_dict['time'] = obs_dict['time']

for key in self.proprio_keys:
proprio_vec = np.concatenate([proprio_vec, obs_dict[key]])
proprio_dict[key] = obs_dict[key]

return obs_dict['time'], proprio_vec, proprio_dict
return proprio_dict['time'], proprio_vec, proprio_dict


def get_exteroception(self, **kwargs)->dict:
"""
Get robot exterioception data. Usually incudes robot's onboard (visual, tactile, acoustic) sensors
Get robot exteroception data. Usually incudes robot's onboard (visual, tactile, acoustic) sensors
"""
return self.get_visuals(**kwargs)

Expand Down
6 changes: 3 additions & 3 deletions robohive/tests/test_envs.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def check_env(self, environment_id, input_seed):
obs1, rwd1, done1, infos1 = env1.env.step(u.copy())
infos1 = copy.deepcopy(infos1) #info points to internal variables.
proprio1 = env1.env.get_proprioception()
exterio1 = env1.env.get_exteroception()
extero1 = env1.env.get_exteroception()
assert len(obs1>0)
# assert len(rwd1>0)
# test dicts
Expand All @@ -61,10 +61,10 @@ def check_env(self, environment_id, input_seed):
obs2, rwd2, done2, infos2 = env2.env.step(u)
infos2 = copy.deepcopy(infos2)
proprio2 = env2.env.get_proprioception()
exterio2 = env2.env.get_exteroception()
extero2 = env2.env.get_exteroception()
torch.testing.assert_close(obs1, obs2)
torch.testing.assert_close(proprio1, proprio2)
torch.testing.assert_close(exterio1, exterio2)
torch.testing.assert_close(extero1, extero2)
torch.testing.assert_close(rwd1, rwd2)
assert (done1==done2), (done1, done2)
assert len(infos1)==len(infos2), (infos1, infos2)
Expand Down

0 comments on commit 8894dd5

Please sign in to comment.