Kaynağa Gözat

Added direction/compass to observation

Maxime Chevalier-Boisvert 7 yıl önce
ebeveyn
işleme
fe1dfc2231
1 değiştirilmiş dosya ile 8 ekleme ve 2 silme
  1. 8 2
      gym_minigrid/minigrid.py

+ 8 - 2
gym_minigrid/minigrid.py

@@ -265,6 +265,9 @@ class Box(WorldObj):
         super(Box, self).__init__('box', color)
         self.contains = contains
 
+    def canPickup(self):
+        return True
+
     def render(self, r):
         c = COLORS[self.color]
         r.setLineColor(c[0], c[1], c[2])
@@ -834,10 +837,13 @@ class MiniGridEnv(gym.Env):
 
         assert hasattr(self, 'mission'), "environments must define a textual mission string"
 
-        # Observations are dictionaries with both an image
-        # and a textual mission string
+        # Observations are dictionaries containing:
+        # - an image (partially observable view of the environment)
+        # - the agent's direction/orientation (acting as a compass)
+        # - a textual mission string (instructions for the agent)
         obs = {
             'image': image,
+            'direction': self.agentDir,
             'mission': self.mission
         }