in gym_hil/envs/panda_arrange_boxes_gym_env.py [0:0]
def _compute_observation(self) -> dict:
"""Compute the current observation."""
# Create the dictionary structure that matches our observation space
observation = {}
# Get robot state
robot_state = self.get_robot_state().astype(np.float32)
# Assemble observation respecting the newly defined observation_space
block_pos = self._data.sensor("block1_pos").data.astype(np.float32)
if self.image_obs:
# Image observations
front_view, wrist_view = self.render()
observation = {
"pixels": {"front": front_view, "wrist": wrist_view},
"agent_pos": robot_state,
}
else:
# State-only observations
observation = {
"agent_pos": robot_state,
"environment_state": block_pos,
}
return observation