From 8894dd5d96eb7f0cb320bb949431ced52c3ee3ce Mon Sep 17 00:00:00 2001 From: Vikash Kumar <vikashplus@gmail.com> Date: Thu, 13 Apr 2023 18:47:19 -0400 Subject: [PATCH] FEATURE: Proprio dict not has time as one of the keys --- robohive/envs/env_base.py | 5 +++-- robohive/tests/test_envs.py | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/robohive/envs/env_base.py b/robohive/envs/env_base.py index a218c12b..0834f7ff 100644 --- a/robohive/envs/env_base.py +++ b/robohive/envs/env_base.py @@ -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) diff --git a/robohive/tests/test_envs.py b/robohive/tests/test_envs.py index fbc7dff9..ca75b87c 100644 --- a/robohive/tests/test_envs.py +++ b/robohive/tests/test_envs.py @@ -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 @@ -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)