index.html 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721
  1. <!doctype html>
  2. <html class="no-js" lang="en" data-content_root="../../">
  3. <head><meta charset="utf-8"/>
  4. <meta name="viewport" content="width=device-width,initial-scale=1"/>
  5. <meta name="color-scheme" content="light dark">
  6. <meta name="description" content="Minigrid contains simple and easily configurable grid world environments to conduct Reinforcement Learning research. This library was previously known as gym-minigrid.">
  7. <meta property="og:title" content="MiniGrid Documentation" />
  8. <meta property="og:type" content="website" />
  9. <meta property="og:description" content="Minigrid contains simple and easily configurable grid world environments to conduct Reinforcement Learning research. This library was previously known as gym-minigrid." />
  10. <meta property="og:url" content="https://minigrid.farama.org/content/basic_usage.html" /><meta property="og:image" content="https://minigrid.farama.org//_static/img/minigrid-github.png" /><meta name="twitter:card" content="summary_large_image"><meta name="viewport" content="width=device-width, initial-scale=1" />
  11. <link rel="index" title="Index" href="../../genindex/" /><link rel="search" title="Search" href="../../search/" /><link rel="next" title="List of Publications" href="../publications/" /><link rel="prev" title="&lt;no title&gt;" href="../../" />
  12. <link rel="canonical" href="https://minigrid.farama.org/content/basic_usage.html" />
  13. <link rel="shortcut icon" href="../../_static/minigrid-favicon.png"/><!-- Generated with Sphinx 7.2.6 and Furo 2023.08.19.dev1 -->
  14. <title>Basic Usage - MiniGrid Documentation</title>
  15. <link rel="stylesheet" type="text/css" href="../../_static/pygments.css?v=a746c00c" />
  16. <link rel="stylesheet" type="text/css" href="../../_static/styles/furo.css?v=3e7f4c72" />
  17. <link rel="stylesheet" type="text/css" href="../../_static/styles/furo-extensions.css?v=49cbaffd" />
  18. <style>
  19. body {
  20. --color-code-background: #f8f8f8;
  21. --color-code-foreground: black;
  22. }
  23. @media not print {
  24. body[data-theme="dark"] {
  25. --color-code-background: #202020;
  26. --color-code-foreground: #d0d0d0;
  27. }
  28. @media (prefers-color-scheme: dark) {
  29. body:not([data-theme="light"]) {
  30. --color-code-background: #202020;
  31. --color-code-foreground: #d0d0d0;
  32. }
  33. }
  34. }
  35. </style></head>
  36. <body>
  37. <header class="farama-header" aria-label="Farama header">
  38. <div class="farama-header__container">
  39. <div class="farama-header__left--mobile">
  40. <label class="nav-overlay-icon" for="__navigation">
  41. <div class="visually-hidden">Toggle site navigation sidebar</div>
  42. <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
  43. <defs></defs>
  44. <line x1="0.5" y1="4" x2="23.5" y2="4"></line>
  45. <line x1="0.232" y1="12" x2="23.5" y2="12"></line>
  46. <line x1="0.232" y1="20" x2="23.5" y2="20"></line>
  47. </svg>
  48. </label>
  49. </div>
  50. <div class="farama-header__left farama-header__center--mobile">
  51. <a href="../../">
  52. <img class="farama-header__logo only-light" src="../../_static/img/minigrid.svg" alt="Light Logo"/>
  53. <img class="farama-header__logo only-dark" src="../../_static/img/minigrid-white.svg" alt="Dark Logo"/>
  54. <span class="farama-header__title">MiniGrid Documentation</span>
  55. </a>
  56. </div>
  57. <div class="farama-header__right">
  58. <div class="farama-header-menu">
  59. <button class="farama-header-menu__btn" aria-label="Open Farama Menu" aria-expanded="false" aria-haspopup="true" aria-controls="farama-menu">
  60. <img class="farama-black-logo-invert" src="../../_static/img/farama-logo-header.svg">
  61. <svg viewBox="0 0 24 24" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
  62. <polyline style="stroke-linecap: round; stroke-linejoin: round; fill: none; stroke-width: 2px;" points="1 7 12 18 23 7"></polyline>
  63. </svg>
  64. </button>
  65. <div class="farama-header-menu-container farama-hidden" aria-hidden="true" id="farama-menu">
  66. <div class="farama-header-menu__header">
  67. <a href="https://farama.org">
  68. <img class="farama-header-menu__logo farama-white-logo-invert" src="../../_static/img/farama_solid_white.svg" alt="Farama Foundation logo">
  69. <span>Farama Foundation</span>
  70. </a>
  71. <div class="farama-header-menu-header__right">
  72. <button id="farama-close-menu">
  73. <svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor"
  74. stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="icon-close">
  75. <line x1="3" y1="21" x2="21" y2="3"></line>
  76. <line x1="3" y1="3" x2="21" y2="21"></line>
  77. </svg>
  78. </button>
  79. </div>
  80. </div>
  81. <div class="farama-header-menu__body">
  82. <!-- Response from farama.org/api/projects.json -->
  83. </div>
  84. </div>
  85. </div>
  86. </div>
  87. </div>
  88. </header>
  89. <script>
  90. document.body.dataset.theme = localStorage.getItem("theme") || "auto";
  91. </script>
  92. <svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
  93. <symbol id="svg-toc" viewBox="0 0 24 24">
  94. <title>Contents</title>
  95. <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 1024 1024">
  96. <path d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 0 0 0 13.8z"/>
  97. </svg>
  98. </symbol>
  99. <symbol id="svg-menu" viewBox="0 0 24 24">
  100. <title>Menu</title>
  101. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
  102. stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-menu">
  103. <line x1="3" y1="12" x2="21" y2="12"></line>
  104. <line x1="3" y1="6" x2="21" y2="6"></line>
  105. <line x1="3" y1="18" x2="21" y2="18"></line>
  106. </svg>
  107. </symbol>
  108. <symbol id="svg-arrow-right" viewBox="0 0 24 24">
  109. <title>Expand</title>
  110. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
  111. stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather-chevron-right">
  112. <polyline points="9 18 15 12 9 6"></polyline>
  113. </svg>
  114. </symbol>
  115. <symbol id="svg-sun" viewBox="0 0 24 24">
  116. <title>Light mode</title>
  117. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
  118. stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="feather-sun">
  119. <circle cx="12" cy="12" r="5"></circle>
  120. <line x1="12" y1="1" x2="12" y2="3"></line>
  121. <line x1="12" y1="21" x2="12" y2="23"></line>
  122. <line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line>
  123. <line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line>
  124. <line x1="1" y1="12" x2="3" y2="12"></line>
  125. <line x1="21" y1="12" x2="23" y2="12"></line>
  126. <line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line>
  127. <line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line>
  128. </svg>
  129. </symbol>
  130. <symbol id="svg-moon" viewBox="0 0 24 24">
  131. <title>Dark mode</title>
  132. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
  133. stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-moon">
  134. <path stroke="none" d="M0 0h24v24H0z" fill="none" />
  135. <path d="M12 3c.132 0 .263 0 .393 0a7.5 7.5 0 0 0 7.92 12.446a9 9 0 1 1 -8.313 -12.454z" />
  136. </svg>
  137. </symbol>
  138. <symbol id="svg-sun-half" viewBox="0 0 24 24">
  139. <title>Auto light/dark mode</title>
  140. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor"
  141. stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="icon-tabler-shadow">
  142. <path stroke="none" d="M0 0h24v24H0z" fill="none"/>
  143. <circle cx="12" cy="12" r="9" />
  144. <path d="M13 12h5" />
  145. <path d="M13 15h4" />
  146. <path d="M13 18h1" />
  147. <path d="M13 9h4" />
  148. <path d="M13 6h1" />
  149. </svg>
  150. </symbol>
  151. </svg>
  152. <input type="checkbox" class="sidebar-toggle" name="__navigation" id="__navigation">
  153. <input type="checkbox" class="sidebar-toggle" name="__toc" id="__toc">
  154. <label class="overlay sidebar-overlay" for="__navigation">
  155. <div class="visually-hidden">Hide navigation sidebar</div>
  156. </label>
  157. <label class="overlay toc-overlay" for="__toc">
  158. <div class="visually-hidden">Hide table of contents sidebar</div>
  159. </label>
  160. <div class="page">
  161. <!--<header class="mobile-header">
  162. <div class="header-left">
  163. <label class="nav-overlay-icon" for="__navigation">
  164. <div class="visually-hidden">Toggle site navigation sidebar</div>
  165. <i class="icon"><svg><use href="#svg-menu"></use></svg></i>
  166. </label>
  167. </div>
  168. <div class="header-center">
  169. <a href="../../"><div class="brand">MiniGrid Documentation</div></a>
  170. </div>
  171. <div class="header-right">
  172. <div class="theme-toggle-container theme-toggle-header">
  173. <button class="theme-toggle">
  174. <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div>
  175. <svg class="theme-icon-when-auto"><use href="#svg-sun-half"></use></svg>
  176. <svg class="theme-icon-when-dark"><use href="#svg-moon"></use></svg>
  177. <svg class="theme-icon-when-light"><use href="#svg-sun"></use></svg>
  178. </button>
  179. </div>
  180. <label class="toc-overlay-icon toc-header-icon no-toc" for="__toc">
  181. <div class="visually-hidden">Toggle table of contents sidebar</div>
  182. <i class="icon"><svg><use href="#svg-toc"></use></svg></i>
  183. </label>
  184. </div>
  185. </header>-->
  186. <aside class="sidebar-drawer">
  187. <div class="sidebar-container">
  188. <div class="sidebar-sticky"><a class="farama-sidebar__title" href="../../">
  189. <img class="farama-header__logo only-light" src="../../_static/img/minigrid.svg" alt="Light Logo"/>
  190. <img class="farama-header__logo only-dark" src="../../_static/img/minigrid-white.svg" alt="Dark Logo"/>
  191. <span class="farama-header__title">MiniGrid Documentation</span>
  192. </a><form class="sidebar-search-container" method="get" action="../../search/" role="search">
  193. <input class="sidebar-search" placeholder="Search" name="q" aria-label="Search">
  194. <input type="hidden" name="check_keywords" value="yes">
  195. <input type="hidden" name="area" value="default">
  196. </form>
  197. <div id="searchbox"></div><div class="sidebar-scroll"><div class="sidebar-tree">
  198. <p class="caption" role="heading"><span class="caption-text">Introduction</span></p>
  199. <ul class="current">
  200. <li class="toctree-l1 current current-page"><a class="current reference internal" href="#">Basic Usage</a></li>
  201. <li class="toctree-l1"><a class="reference internal" href="#installation">Installation</a></li>
  202. <li class="toctree-l1"><a class="reference internal" href="../publications/">List of Publications</a></li>
  203. <li class="toctree-l1"><a class="reference internal" href="../create_env_tutorial/">Tutorial on Creating Environments</a></li>
  204. <li class="toctree-l1"><a class="reference internal" href="../training/">Training Minigrid Environments</a></li>
  205. </ul>
  206. <p class="caption" role="heading"><span class="caption-text">Wrappers</span></p>
  207. <ul>
  208. <li class="toctree-l1 has-children"><a class="reference internal" href="../../api/wrapper/">Wrapper</a><input class="toctree-checkbox" id="toctree-checkbox-1" name="toctree-checkbox-1" role="switch" type="checkbox"/><label for="toctree-checkbox-1"><div class="visually-hidden">Toggle navigation of Wrapper</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
  209. <li class="toctree-l2"><a class="reference internal" href="../../api/wrappers/">Action Bonus</a></li>
  210. <li class="toctree-l2"><a class="reference internal" href="../../api/wrappers/#dict-observation-space">Dict Observation Space</a></li>
  211. <li class="toctree-l2"><a class="reference internal" href="../../api/wrappers/#direction-obs">Direction Obs</a></li>
  212. <li class="toctree-l2"><a class="reference internal" href="../../api/wrappers/#flatobs">FlatObs</a></li>
  213. <li class="toctree-l2"><a class="reference internal" href="../../api/wrappers/#fully-obs">Fully Obs</a></li>
  214. <li class="toctree-l2"><a class="reference internal" href="../../api/wrappers/#image-observation">Image Observation</a></li>
  215. <li class="toctree-l2"><a class="reference internal" href="../../api/wrappers/#no-death">No Death</a></li>
  216. <li class="toctree-l2"><a class="reference internal" href="../../api/wrappers/#observation">Observation</a></li>
  217. <li class="toctree-l2"><a class="reference internal" href="../../api/wrappers/#one-hot-partial-obs">One Hot Partial Obs</a></li>
  218. <li class="toctree-l2"><a class="reference internal" href="../../api/wrappers/#reseed">Reseed</a></li>
  219. <li class="toctree-l2"><a class="reference internal" href="../../api/wrappers/#rgb-img-obs">RGB Img Obs</a></li>
  220. <li class="toctree-l2"><a class="reference internal" href="../../api/wrappers/#rgb-partial-img-obs">RGB Partial Img Obs</a></li>
  221. <li class="toctree-l2"><a class="reference internal" href="../../api/wrappers/#position-bonus">Position Bonus</a></li>
  222. <li class="toctree-l2"><a class="reference internal" href="../../api/wrappers/#stochastic-action">Stochastic Action</a></li>
  223. <li class="toctree-l2"><a class="reference internal" href="../../api/wrappers/#symbolic-obs">Symbolic Obs</a></li>
  224. <li class="toctree-l2"><a class="reference internal" href="../../api/wrappers/#view-size">View Size</a></li>
  225. </ul>
  226. </li>
  227. </ul>
  228. <p class="caption" role="heading"><span class="caption-text">Environments</span></p>
  229. <ul>
  230. <li class="toctree-l1 has-children"><a class="reference internal" href="../../environments/minigrid/">Minigrid Environments</a><input class="toctree-checkbox" id="toctree-checkbox-2" name="toctree-checkbox-2" role="switch" type="checkbox"/><label for="toctree-checkbox-2"><div class="visually-hidden">Toggle navigation of Minigrid Environments</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
  231. <li class="toctree-l2"><a class="reference internal" href="../../environments/minigrid/BlockedUnlockPickupEnv/">Blocked Unlock Pickup</a></li>
  232. <li class="toctree-l2"><a class="reference internal" href="../../environments/minigrid/CrossingEnv/">Crossing</a></li>
  233. <li class="toctree-l2"><a class="reference internal" href="../../environments/minigrid/DistShiftEnv/">Dist Shift</a></li>
  234. <li class="toctree-l2"><a class="reference internal" href="../../environments/minigrid/DoorKeyEnv/">Door Key</a></li>
  235. <li class="toctree-l2"><a class="reference internal" href="../../environments/minigrid/DynamicObstaclesEnv/">Dynamic Obstacles</a></li>
  236. <li class="toctree-l2"><a class="reference internal" href="../../environments/minigrid/EmptyEnv/">Empty</a></li>
  237. <li class="toctree-l2"><a class="reference internal" href="../../environments/minigrid/FetchEnv/">Fetch</a></li>
  238. <li class="toctree-l2"><a class="reference internal" href="../../environments/minigrid/FourRoomsEnv/">Four Rooms</a></li>
  239. <li class="toctree-l2"><a class="reference internal" href="../../environments/minigrid/GoToDoorEnv/">Go To Door</a></li>
  240. <li class="toctree-l2"><a class="reference internal" href="../../environments/minigrid/GoToObjectEnv/">Go To Object</a></li>
  241. <li class="toctree-l2"><a class="reference internal" href="../../environments/minigrid/KeyCorridorEnv/">Key Corridor</a></li>
  242. <li class="toctree-l2"><a class="reference internal" href="../../environments/minigrid/LavaGapEnv/">Lava Gap</a></li>
  243. <li class="toctree-l2"><a class="reference internal" href="../../environments/minigrid/LockedRoomEnv/">Locked Room</a></li>
  244. <li class="toctree-l2"><a class="reference internal" href="../../environments/minigrid/MemoryEnv/">Memory</a></li>
  245. <li class="toctree-l2"><a class="reference internal" href="../../environments/minigrid/MultiRoomEnv/">Multi Room</a></li>
  246. <li class="toctree-l2"><a class="reference internal" href="../../environments/minigrid/ObstructedMaze_1Dlhb/">Obstructed Maze Dlhb</a></li>
  247. <li class="toctree-l2"><a class="reference internal" href="../../environments/minigrid/ObstructedMaze_Full/">Obstructed Maze Full</a></li>
  248. <li class="toctree-l2"><a class="reference internal" href="../../environments/minigrid/PlaygroundEnv/">Playground</a></li>
  249. <li class="toctree-l2"><a class="reference internal" href="../../environments/minigrid/PutNearEnv/">Put Near</a></li>
  250. <li class="toctree-l2"><a class="reference internal" href="../../environments/minigrid/RedBlueDoorEnv/">Red Blue Door</a></li>
  251. <li class="toctree-l2"><a class="reference internal" href="../../environments/minigrid/UnlockEnv/">Unlock</a></li>
  252. <li class="toctree-l2"><a class="reference internal" href="../../environments/minigrid/UnlockPickupEnv/">Unlock Pickup</a></li>
  253. </ul>
  254. </li>
  255. <li class="toctree-l1 has-children"><a class="reference internal" href="../../environments/babyai/">BabyAI Environments</a><input class="toctree-checkbox" id="toctree-checkbox-3" name="toctree-checkbox-3" role="switch" type="checkbox"/><label for="toctree-checkbox-3"><div class="visually-hidden">Toggle navigation of BabyAI Environments</div><i class="icon"><svg><use href="#svg-arrow-right"></use></svg></i></label><ul>
  256. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/GoToRedBallGrey/">Go To Red Ball Grey</a></li>
  257. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/GoToRedBall/">Go To Red Ball</a></li>
  258. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/GoToRedBallNoDists/">Go To Red Ball No Dists</a></li>
  259. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/GoToObj/">Go To Obj</a></li>
  260. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/GoToLocal/">Go To Local</a></li>
  261. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/GoTo/">Go To</a></li>
  262. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/GoToImpUnlock/">Go To Imp Unlock</a></li>
  263. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/GoToSeq/">Go To Seq</a></li>
  264. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/GoToRedBlueBall/">Go To Red Blue Ball</a></li>
  265. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/GoToDoor/">Go To Door</a></li>
  266. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/GoToObjDoor/">Go To Obj Door</a></li>
  267. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/Open/">Open</a></li>
  268. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/OpenRedDoor/">Open Red Door</a></li>
  269. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/OpenDoor/">Open Door</a></li>
  270. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/OpenTwoDoors/">Open Two Doors</a></li>
  271. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/OpenDoorsOrder/">Open Doors Order</a></li>
  272. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/Pickup/">Pickup</a></li>
  273. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/UnblockPickup/">Unblock Pickup</a></li>
  274. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/PickupLoc/">Pickup Loc</a></li>
  275. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/PickupDist/">Pickup Dist</a></li>
  276. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/PickupAbove/">Pickup Above</a></li>
  277. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/PutNextLocal/">Put Next Local</a></li>
  278. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/PutNext/">Put Next</a></li>
  279. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/Unlock/">Unlock</a></li>
  280. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/UnlockLocal/">Unlock Local</a></li>
  281. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/KeyInBox/">Key In Box</a></li>
  282. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/UnlockPickup/">Unlock Pickup</a></li>
  283. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/BlockedUnlockPickup/">Blocked Unlock Pickup</a></li>
  284. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/UnlockToUnlock/">Unlock To Unlock</a></li>
  285. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/ActionObjDoor/">Action Obj Door</a></li>
  286. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/FindObjS5/">Find Obj</a></li>
  287. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/KeyCorridor/">Key Corridor</a></li>
  288. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/OneRoomS8/">One Room</a></li>
  289. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/MoveTwoAcross/">Move Two Across</a></li>
  290. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/Synth/">Synth</a></li>
  291. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/SynthLoc/">Synth Loc</a></li>
  292. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/SynthSeq/">Synth Seq</a></li>
  293. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/MiniBossLevel/">Mini Boss Level</a></li>
  294. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/BossLevel/">Boss Level</a></li>
  295. <li class="toctree-l2"><a class="reference internal" href="../../environments/babyai/BossLevelNoUnlock/">Boss Level No Unlock</a></li>
  296. </ul>
  297. </li>
  298. </ul>
  299. <p class="caption" role="heading"><span class="caption-text">Development</span></p>
  300. <ul>
  301. <li class="toctree-l1"><a class="reference internal" href="../../release_notes/">Release Notes</a></li>
  302. <li class="toctree-l1"><a class="reference external" href="https://github.com/Farama-Foundation/MiniGrid">Github</a></li>
  303. </ul>
  304. </div>
  305. </div>
  306. </div>
  307. </div>
  308. </aside>
  309. <div class="main-container">
  310. <div class="main">
  311. <div class="content">
  312. <div class="article-container">
  313. <a href="#" class="back-to-top muted-link">
  314. <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
  315. <path d="M13 20h-2V8l-5.5 5.5-1.42-1.42L12 4.16l7.92 7.92-1.42 1.42L13 8v12z"></path>
  316. </svg>
  317. <span>Back to top</span>
  318. </a>
  319. <div class="content-icon-container"><div class="edit-this-page">
  320. <a class="muted-link" href="https://github.com/Farama-Foundation/Minigrid/edit/master/docs/content/basic_usage.md" title="Edit this page">
  321. <svg aria-hidden="true" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" fill="none" stroke-linecap="round" stroke-linejoin="round">
  322. <path stroke="none" d="M0 0h24v24H0z" fill="none"/>
  323. <path d="M4 20h4l10.5 -10.5a1.5 1.5 0 0 0 -4 -4l-10.5 10.5v4" />
  324. <line x1="13.5" y1="6.5" x2="17.5" y2="10.5" />
  325. </svg>
  326. <span class="visually-hidden">Edit this page</span>
  327. </a>
  328. </div><div class="theme-toggle-container theme-toggle-content">
  329. <button class="theme-toggle" title="Toggle color theme">
  330. <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div>
  331. <svg class="theme-icon-when-auto">
  332. <use href="#svg-sun-half"></use>
  333. </svg>
  334. <svg class="theme-icon-when-dark">
  335. <use href="#svg-moon"></use>
  336. </svg>
  337. <svg class="theme-icon-when-light">
  338. <use href="#svg-sun"></use>
  339. </svg>
  340. </button>
  341. </div>
  342. <label class="toc-overlay-icon toc-content-icon no-toc" for="__toc">
  343. <div class="visually-hidden">Toggle table of contents sidebar</div>
  344. <i class="icon"><svg>
  345. <use href="#svg-toc"></use>
  346. </svg></i>
  347. </label>
  348. </div>
  349. <article role="main">
  350. <section id="basic-usage">
  351. <h1>Basic Usage<a class="headerlink" href="#basic-usage" title="Link to this heading">#</a></h1>
  352. <p>There is a UI application which allows you to manually control the agent with the arrow keys:</p>
  353. <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>./minigrid/manual_control.py
  354. </pre></div>
  355. </div>
  356. <p>The environment being run can be selected with the <code class="docutils literal notranslate"><span class="pre">--env</span></code> option, eg:</p>
  357. <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>./minigrid/manual_control.py<span class="w"> </span>--env<span class="w"> </span>MiniGrid-Empty-8x8-v0
  358. </pre></div>
  359. </div>
  360. </section>
  361. <section id="installation">
  362. <h1>Installation<a class="headerlink" href="#installation" title="Link to this heading">#</a></h1>
  363. <p>Minigrid call be installed via <code class="docutils literal notranslate"><span class="pre">pip</span></code>:</p>
  364. <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>python3<span class="w"> </span>-m<span class="w"> </span>pip<span class="w"> </span>install<span class="w"> </span>minigrid
  365. </pre></div>
  366. </div>
  367. <p>To modify the codebase or contribute to Minigrid, you would need to install Minigrid from source:</p>
  368. <div class="highlight-bash notranslate"><div class="highlight"><pre><span></span>git<span class="w"> </span>clone<span class="w"> </span>https://github.com/Farama-Foundation/Minigrid.git
  369. <span class="nb">cd</span><span class="w"> </span>Minigrid
  370. python3<span class="w"> </span>-m<span class="w"> </span>pip<span class="w"> </span>install<span class="w"> </span>-e<span class="w"> </span>.
  371. </pre></div>
  372. </div>
  373. </section>
  374. </article>
  375. </div>
  376. <footer>
  377. <div class="related-pages">
  378. <a class="next-page" href="../publications/">
  379. <div class="page-info">
  380. <div class="context">
  381. <span>Next</span>
  382. </div>
  383. <div class="title">List of Publications</div>
  384. </div>
  385. <svg class="furo-related-icon">
  386. <use href="#svg-arrow-right"></use>
  387. </svg>
  388. </a>
  389. </div>
  390. <div class="bottom-of-page">
  391. <div class="left-details">
  392. <div class="copyright">
  393. Copyright &#169; 2023 Farama Foundation
  394. </div>
  395. <!--
  396. Made with <a href="https://www.sphinx-doc.org/">Sphinx</a> and <a class="muted-link" href="https://pradyunsg.me">@pradyunsg</a>'s
  397. <a href="https://github.com/pradyunsg/furo">Furo</a>
  398. -->
  399. </div>
  400. <div class="right-details">
  401. <div class="icons">
  402. <a class="muted-link" href="https://github.com/Farama-Foundation/Minigrid/"
  403. aria-label="On GitHub">
  404. <svg stroke="currentColor" fill="currentColor" stroke-width="0" viewBox="0 0 16 16">
  405. <path fill-rule="evenodd"
  406. d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0 0 16 8c0-4.42-3.58-8-8-8z">
  407. </path>
  408. </svg>
  409. </a>
  410. </div>
  411. </div>
  412. </div>
  413. </footer>
  414. </div>
  415. <aside class="toc-drawer no-toc">
  416. </aside>
  417. </div>
  418. </div>
  419. </div>
  420. <script>
  421. const toggleMenu = () => {
  422. const menuBtn = document.querySelector(".farama-header-menu__btn");
  423. const menuContainer = document.querySelector(".farama-header-menu-container");
  424. if (document.querySelector(".farama-header-menu").classList.contains("active")) {
  425. menuBtn.setAttribute("aria-expanded", "false");
  426. menuContainer.setAttribute("aria-hidden", "true");
  427. } else {
  428. menuBtn.setAttribute("aria-expanded", "true");
  429. menuContainer.setAttribute("aria-hidden", "false");
  430. }
  431. document.querySelector(".farama-header-menu").classList.toggle("active");
  432. }
  433. document.querySelector(".farama-header-menu__btn").addEventListener("click", toggleMenu);
  434. document.getElementById("farama-close-menu").addEventListener("click", toggleMenu);
  435. </script>
  436. <script async src="https://www.googletagmanager.com/gtag/js?id=G-FBXJQQLXKD"></script>
  437. <script>
  438. const enableGtag = () => {
  439. window.dataLayer = window.dataLayer || [];
  440. function gtag(){dataLayer.push(arguments);}
  441. gtag('js', new Date());
  442. gtag('config', 'G-FBXJQQLXKD');
  443. }
  444. (() => {
  445. if (!localStorage.getItem("acceptedCookieAlert")) {
  446. const boxElem = document.createElement("div");
  447. boxElem.classList.add("cookie-alert");
  448. const containerElem = document.createElement("div");
  449. containerElem.classList.add("cookie-alert__container");
  450. const textElem = document.createElement("p");
  451. textElem.innerHTML = `This page uses <a href="https://analytics.google.com/">
  452. Google Analytics</a> to collect statistics.`;
  453. containerElem.appendChild(textElem);
  454. const declineBtn = Object.assign(document.createElement("button"),
  455. {
  456. innerText: "Deny",
  457. className: "farama-btn cookie-alert__button",
  458. id: "cookie-alert__decline",
  459. }
  460. );
  461. declineBtn.addEventListener("click", () => {
  462. localStorage.setItem("acceptedCookieAlert", false);
  463. boxElem.remove();
  464. });
  465. const acceptBtn = Object.assign(document.createElement("button"),
  466. {
  467. innerText: "Allow",
  468. className: "farama-btn cookie-alert__button",
  469. id: "cookie-alert__accept",
  470. }
  471. );
  472. acceptBtn.addEventListener("click", () => {
  473. localStorage.setItem("acceptedCookieAlert", true);
  474. boxElem.remove();
  475. enableGtag();
  476. });
  477. containerElem.appendChild(declineBtn);
  478. containerElem.appendChild(acceptBtn);
  479. boxElem.appendChild(containerElem);
  480. document.body.appendChild(boxElem);
  481. } else if (localStorage.getItem("acceptedCookieAlert") === "true") {
  482. enableGtag();
  483. }
  484. })()
  485. </script>
  486. <script src="../../_static/documentation_options.js?v=7fa42598"></script>
  487. <script src="../../_static/doctools.js?v=888ff710"></script>
  488. <script src="../../_static/sphinx_highlight.js?v=dc90522c"></script>
  489. <script src="../../_static/scripts/furo.js?v=7660844c"></script>
  490. <script>
  491. const createProjectsList = (projects, displayImages) => {
  492. const ulElem = Object.assign(document.createElement('ul'),
  493. {
  494. className:'farama-header-menu-list',
  495. }
  496. )
  497. for (let project of projects) {
  498. const liElem = document.createElement("li");
  499. const aElem = Object.assign(document.createElement("a"),
  500. {
  501. href: project.link
  502. }
  503. );
  504. liElem.appendChild(aElem);
  505. if (displayImages) {
  506. const imgElem = Object.assign(document.createElement("img"),
  507. {
  508. src: project.image ? imagesBasepath + project.image : imagesBasepath + "/farama_black.svg",
  509. alt: `${project.name} logo`,
  510. className: "farama-black-logo-invert"
  511. }
  512. );
  513. aElem.appendChild(imgElem);
  514. }
  515. aElem.appendChild(document.createTextNode(project.name));
  516. ulElem.appendChild(liElem);
  517. }
  518. return ulElem;
  519. }
  520. // Create menu with Farama projects by using the API at farama.org/api/projects.json
  521. const createCORSRequest = (method, url) => {
  522. let xhr = new XMLHttpRequest();
  523. xhr.responseType = 'json';
  524. if ("withCredentials" in xhr) {
  525. xhr.open(method, url, true);
  526. } else if (typeof XDomainRequest != "undefined") {
  527. // IE8 & IE9
  528. xhr = new XDomainRequest();
  529. xhr.open(method, url);
  530. } else {
  531. // CORS not supported.
  532. xhr = null;
  533. }
  534. return xhr;
  535. };
  536. const url = 'https://farama.org/api/projects.json';
  537. const imagesBasepath = "https://farama.org/assets/images"
  538. const method = 'GET';
  539. let xhr = createCORSRequest(method, url);
  540. xhr.onload = () => {
  541. const jsonResponse = xhr.response;
  542. const sections = {
  543. "Core Projects": [],
  544. "Mature Projects": {
  545. "Documentation": [],
  546. "Repositories": [],
  547. },
  548. "Incubating Projects": {
  549. "Documentation": [],
  550. "Repositories": [],
  551. },
  552. "Foundation": [
  553. {
  554. name: "About",
  555. link: "https://farama.org/about"
  556. },
  557. {
  558. name: "Standards",
  559. link: "https://farama.org/project_standards",
  560. },
  561. {
  562. name: "Donate",
  563. link: "https://farama.org/donations"
  564. }
  565. ]
  566. }
  567. // Categorize projects
  568. Object.keys(jsonResponse).forEach(key => {
  569. projectJson = jsonResponse[key];
  570. if (projectJson.website !== null) {
  571. projectJson.link = projectJson.website;
  572. } else {
  573. projectJson.link = projectJson.github;
  574. }
  575. if (projectJson.type === "core") {
  576. sections["Core Projects"].push(projectJson)
  577. } else if (projectJson.type == "mature") {
  578. if (projectJson.website !== null) {
  579. sections["Mature Projects"]["Documentation"].push(projectJson)
  580. } else {
  581. sections["Mature Projects"]["Repositories"].push(projectJson)
  582. }
  583. } else {
  584. if (projectJson.website !== null) {
  585. sections["Incubating Projects"]["Documentation"].push(projectJson)
  586. } else {
  587. sections["Incubating Projects"]["Repositories"].push(projectJson)
  588. }
  589. }
  590. })
  591. const menuContainer = document.querySelector(".farama-header-menu__body");
  592. Object.keys(sections).forEach((key, i) => {
  593. const sectionElem = Object.assign(
  594. document.createElement('div'), {
  595. className:'farama-header-menu__section',
  596. }
  597. )
  598. sectionElem.appendChild(Object.assign(document.createElement('span'),
  599. {
  600. className:'farama-header-menu__section-title' ,
  601. innerText: key
  602. }
  603. ))
  604. // is not a list
  605. if (sections[key].constructor !== Array) {
  606. const subSections = sections[key];
  607. const subSectionContainerElem = Object.assign(
  608. document.createElement('div'), {
  609. className:'farama-header-menu__subsections-container',
  610. style: 'display: flex'
  611. }
  612. )
  613. Object.keys(subSections).forEach((subKey, i) => {
  614. const subSectionElem = Object.assign(
  615. document.createElement('div'), {
  616. className:'farama-header-menu__subsection',
  617. }
  618. )
  619. subSectionElem.appendChild(Object.assign(document.createElement('span'),
  620. {
  621. className:'farama-header-menu__subsection-title' ,
  622. innerText: subKey
  623. }
  624. ))
  625. const ulElem = createProjectsList(subSections[subKey], key !== 'Foundation');
  626. subSectionElem.appendChild(ulElem);
  627. subSectionContainerElem.appendChild(subSectionElem);
  628. })
  629. sectionElem.appendChild(subSectionContainerElem);
  630. } else {
  631. const projects = sections[key];
  632. const ulElem = createProjectsList(projects, true);
  633. sectionElem.appendChild(ulElem);
  634. }
  635. menuContainer.appendChild(sectionElem)
  636. });
  637. }
  638. xhr.onerror = function() {
  639. console.error("Unable to load projects");
  640. };
  641. xhr.send();
  642. </script>
  643. <script>
  644. const versioningConfig = {
  645. githubUser: 'Farama-Foundation',
  646. githubRepo: 'Minigrid',
  647. };
  648. fetch('/main/_static/versioning/versioning_menu.html').then(response => {
  649. if (response.status === 200) {
  650. response.text().then(text => {
  651. const container = document.createElement("div");
  652. container.innerHTML = text;
  653. document.querySelector("body").appendChild(container);
  654. // innerHtml doenst evaluate scripts, we need to add them dynamically
  655. Array.from(container.querySelectorAll("script")).forEach(oldScript => {
  656. const newScript = document.createElement("script");
  657. Array.from(oldScript.attributes).forEach(attr => newScript.setAttribute(attr.name, attr.value));
  658. newScript.appendChild(document.createTextNode(oldScript.innerHTML));
  659. oldScript.parentNode.replaceChild(newScript, oldScript);
  660. });
  661. });
  662. } else {
  663. console.warn("Unable to load versioning menu", response);
  664. }
  665. });
  666. </script>
  667. </body>
  668. </html>