Giter VIP home page Giter VIP logo

miniworld's Introduction

Miniworld is being maintained by the Farama Foundation (https://farama.org/project_standards). See the Project Roadmap for details regarding the long-term plans.

Build Status

Contents:

Introduction

MiniWorld is a minimalistic 3D interior environment simulator for reinforcement learning & robotics research. It can be used to simulate environments with rooms, doors, hallways and various objects (eg: office and home environments, mazes). MiniWorld can be seen as a simpler alternative to VizDoom or DMLab. It is written 100% in Python and designed to be easily modified or extended by students.

Figure of Maze environment from top view Figure of Sidewalk environment Figure of Collect Health environment

Features:

  • Few dependencies, less likely to break, easy to install
  • Easy to create your own levels, or modify existing ones
  • Good performance, high frame rate, support for multiple processes
  • Lightweight, small download, low memory requirements
  • Provided under a permissive MIT license
  • Comes with a variety of free 3D models and textures
  • Fully observable top-down/overhead view available
  • Domain randomization support, for sim-to-real transfer
  • Ability to display alphanumeric strings on walls
  • Ability to produce depth maps matching camera images (RGB-D)

Limitations:

  • Graphics are basic, nowhere near photorealism
  • Physics are very basic, not sufficient for robot arms or manipulation

List of publications & submissions using MiniWorld (please open a pull request to add missing entries):

This simulator was created as part of work done at Mila.

Installation

Requirements:

  • Python 3.7+
  • Gymnasium
  • NumPy
  • Pyglet (OpenGL 3D graphics)
  • GPU for 3D graphics acceleration (optional)

You can install it from PyPI using:

python3 -m pip install miniworld

You can also install from source:

git clone https://github.com/Farama-Foundation/Miniworld.git
cd Miniworld
python3 -m pip install -e .

If you run into any problems, please take a look at the troubleshooting guide.

Usage

There is a simple UI application which allows you to control the simulation or real robot manually. The manual_control.py application will launch the Gym environment, display camera images and send actions (keyboard commands) back to the simulator or robot. The --env-name argument specifies which environment to load. See the list of available environments for more information.

./manual_control.py --env-name MiniWorld-Hallway-v0

# Display an overhead view of the environment
./manual_control.py --env-name MiniWorld-Hallway-v0 --top_view

There is also a script to run automated tests (run_tests.py) and a script to gather performance metrics (benchmark.py).

Offscreen Rendering (Clusters and Colab)

When running MiniWorld on a cluster or in a Colab environment, you need to render to an offscreen display. You can run gym-miniworld offscreen by setting the environment variable PYOPENGL_PLATFORM to egl before running MiniWorld, e.g.

PYOPENGL_PLATFORM=egl python3 your_script.py

Alternatively, if this doesn't work, you can also try running MiniWorld with xvfb, e.g.

xvfb-run -a -s "-screen 0 1024x768x24 -ac +extension GLX +render -noreset" python3 your_script.py

Citation

To cite this project please use:

@article{MinigridMiniworld23,
  author       = {Maxime Chevalier-Boisvert and Bolun Dai and Mark Towers and Rodrigo de Lazcano and Lucas Willems and Salem Lahlou and Suman Pal and Pablo Samuel Castro and Jordan Terry},
  title        = {Minigrid \& Miniworld: Modular \& Customizable Reinforcement Learning Environments for Goal-Oriented Tasks},
  journal      = {CoRR},
  volume       = {abs/2306.13831},
  year         = {2023},
}

miniworld's People

Contributors

bolundai0216 avatar daochenzha avatar dongyeongkim avatar ezliu avatar idigitopia avatar jjshoots avatar jkterry1 avatar maximecb avatar mgoulao avatar mhtsbt avatar pseudo-rnd-thoughts avatar ptigas avatar redtachyon avatar rodrigodelazcano avatar shagunsodhani avatar shijiegu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

miniworld's Issues

Can we train an agent without opening a window?

Hi there, is it possible to train an RL agent without opening the simulation window? I'm trying to do training on my server but it can be problematic to open a window there.

Any help or response will be highly appreciated. Thanks!

ValueError using the latest numpy (1.21.5)

Similar to #51 I get an error on the following envs when using the latest numpy (1.21.5). Works fine on version 1.20.
TMazeLeft, TMazeRight, YMazeLeft, YMazeRight

Code snippet to reproduce:

import gym
import gym_miniworld

env = gym.make("MiniWorld-TMazeRight-v0")
env.reset()

Error:

Falling back to num_samples=1
Falling back to num_samples=1
Traceback (most recent call last):
  File "test_world.py", line 4, in <module>
    env = gym.make("MiniWorld-TMazeRight-v0")
  File "/usr/local/lib/python3.7/dist-packages/gym/envs/registration.py", line 676, in make
    return registry.make(id, **kwargs)
  File "/usr/local/lib/python3.7/dist-packages/gym/envs/registration.py", line 520, in make
    return spec.make(**kwargs)
  File "/usr/local/lib/python3.7/dist-packages/gym/envs/registration.py", line 140, in make
    env = cls(**_kwargs)
  File "/content/gym-miniworld/gym_miniworld/envs/tmaze.py", line 79, in __init__
    super().__init__(goal_pos=[10, 0, 6])
  File "/content/gym-miniworld/gym_miniworld/envs/tmaze.py", line 21, in __init__
    **kwargs
  File "/content/gym-miniworld/gym_miniworld/miniworld.py", line 523, in __init__
    self.reset()
  File "/content/gym-miniworld/gym_miniworld/miniworld.py", line 555, in reset
    self._gen_world()
  File "/content/gym-miniworld/gym_miniworld/envs/tmaze.py", line 48, in _gen_world
    max_z=self.goal_pos[2],
  File "/content/gym-miniworld/gym_miniworld/miniworld.py", line 887, in place_entity
    high=[hx - ent.radius, 0, hz - ent.radius]
  File "/content/gym-miniworld/gym_miniworld/random.py", line 24, in float
    return self.np_random.uniform(low, high, size=shape)
  File "_generator.pyx", line 958, in numpy.random._generator.Generator.uniform
  File "_common.pyx", line 562, in numpy.random._common.cont
  File "_common.pyx", line 467, in numpy.random._common.cont_broadcast_2
  File "_common.pyx", line 350, in numpy.random._common.check_array_constraint
ValueError: high - low < 0

It may have to do with how gym's random seeding is implemented. I find that numpy itself does not throw errors for the values passed (for e.g. np.random.uniform(low=[4,7], high=[3,6]) works).

Maze environment

It's pretty common to see papers with maze-like environments where the agent has to navigate to a goal. This issue is about creating an environment like this for MiniWorld. I will probably go with an algorithm that starts with a grid of rooms and randomly removes walls between the rooms.

ValueError: high - low < 0

Hello,

I am very new to gym-miniworld and trying this out on MacOS Monterey, 12.2.1.

I am using this command on the terminal:
python3 run_tests.py

And I initially got this output:
2022-04-18 22:01:20.365 Python[57416:1430113] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/4_/g2nfzmx935zc9j92ywczb8rc0000gn/T/org.python.python.savedState
Falling back to num_samples=4
Falling back to non-multisampled frame buffer
Falling back to num_samples=4
Falling back to non-multisampled frame buffer
Traceback (most recent call last):
File "/Users/WilliamHwang/gym-miniworld/run_tests.py", line 15, in
obs, _, _, _ = env.step(0)
File "/Users/WilliamHwang/Library/Python/3.9/lib/python/site-packages/gym/wrappers/order_enforcing.py", line 12, in step
assert self._has_reset, "Cannot call env.step() before calling reset()"
AssertionError: Cannot call env.step() before calling reset()

After fixing this error by adding a call to env.reset() before the first call to env.step():

Try stepping a few times

env.reset()
for i in range(0, 10):
obs, _, _, _ = env.step(0)

I am running into this output error:

2022-04-18 22:10:41.972 Python[57709:1436825] ApplePersistenceIgnoreState: Existing state will not be touched. New state will be written to /var/folders/4_/g2nfzmx935zc9j92ywczb8rc0000gn/T/org.python.python.savedState
Falling back to num_samples=4
Falling back to non-multisampled frame buffer
Falling back to num_samples=4
Falling back to non-multisampled frame buffer
Falling back to num_samples=4
Falling back to non-multisampled frame buffer
Falling back to num_samples=4
Falling back to non-multisampled frame buffer
Falling back to num_samples=4
Falling back to non-multisampled frame buffer
Falling back to num_samples=4
Falling back to non-multisampled frame buffer
Testing "MiniWorld-CollectHealth-v0"
Falling back to num_samples=4
Falling back to non-multisampled frame buffer
Falling back to num_samples=4
Falling back to non-multisampled frame buffer
/Users/WilliamHwang/Library/Python/3.9/lib/python/site-packages/gym/utils/seeding.py:47: DeprecationWarning: WARN: Function rng.randint(low, [high, size, dtype]) is marked as deprecated and will be removed in the future. Please use rng.integers(low, [high, size, dtype]) instead.
deprecation(
Testing "MiniWorld-FourRooms-v0"
Falling back to num_samples=4
Falling back to non-multisampled frame buffer
Falling back to num_samples=4
Falling back to non-multisampled frame buffer
Testing "MiniWorld-Hallway-v0"
Falling back to num_samples=4
Falling back to non-multisampled frame buffer
Falling back to num_samples=4
Falling back to non-multisampled frame buffer
Testing "MiniWorld-Maze-v0"
Falling back to num_samples=4
Falling back to non-multisampled frame buffer
Falling back to num_samples=4
Falling back to non-multisampled frame buffer
Traceback (most recent call last):
File "/Users/WilliamHwang/gym-miniworld/run_tests.py", line 72, in
env.reset()
File "/Users/WilliamHwang/Library/Python/3.9/lib/python/site-packages/gym/wrappers/order_enforcing.py", line 18, in reset
return self.env.reset(**kwargs)
File "/Users/WilliamHwang/gym-miniworld/gym_miniworld/miniworld.py", line 555, in reset
self._gen_world()
File "/Users/WilliamHwang/gym-miniworld/gym_miniworld/envs/maze.py", line 104, in _gen_world
self.place_agent()
File "/Users/WilliamHwang/gym-miniworld/gym_miniworld/miniworld.py", line 923, in place_agent
return self.place_entity(
File "/Users/WilliamHwang/gym-miniworld/gym_miniworld/miniworld.py", line 885, in place_entity
pos = self.rand.float(
File "/Users/WilliamHwang/gym-miniworld/gym_miniworld/random.py", line 24, in float
return self.np_random.uniform(low, high, size=shape)
File "_generator.pyx", line 960, in numpy.random._generator.Generator.uniform
File "_common.pyx", line 579, in numpy.random._common.cont
File "_common.pyx", line 484, in numpy.random._common.cont_broadcast_2
File "_common.pyx", line 369, in numpy.random._common.check_array_constraint
ValueError: high - low < 0

Is there a fix for this?

Secondary question, would this be feasible for testing transfer learning of RL algorithms of robots/agents?
Maybe using the T-maze and Y-maze environments?

thanks

Windows and glEnd(GL_QUADS) TypeError

Hello, I installed on windows 10 and got this error from running manual_control.py or run_tests.py. Does it only work on linux? I'll try that soon as well.

Traceback (most recent call last):
  File "run_tests.py", line 9, in <module>
    env = gym.make('MiniWorld-Hallway-v0')
  File "C:\Users\benjamin.duffy\AppData\Local\Continuum\anaconda3\envs\py36\lib\site-packages\gym\envs\registration.py", line 167, in make
    return registry.make(id)
  File "C:\Users\benjamin.duffy\AppData\Local\Continuum\anaconda3\envs\py36\lib\site-packages\gym\envs\registration.py", line 119, in make
    env = spec.make()
  File "C:\Users\benjamin.duffy\AppData\Local\Continuum\anaconda3\envs\py36\lib\site-packages\gym\envs\registration.py", line 86, in make
    env = cls(**self._kwargs)
  File "C:\Users\benjamin.duffy\all_projects\gym-miniworld\gym_miniworld\envs\hallway.py", line 19, in __init__
    **kwargs
  File "C:\Users\benjamin.duffy\all_projects\gym-miniworld\gym_miniworld\miniworld.py", line 524, in __init__
    self.reset()
  File "C:\Users\benjamin.duffy\all_projects\gym-miniworld\gym_miniworld\miniworld.py", line 589, in reset
    obs = self.render_obs()
  File "C:\Users\benjamin.duffy\all_projects\gym-miniworld\gym_miniworld\miniworld.py", line 1197, in render_obs
    render_agent=False
  File "C:\Users\benjamin.duffy\all_projects\gym-miniworld\gym_miniworld\miniworld.py", line 1071, in _render_world
    ent.render()
  File "C:\Users\benjamin.duffy\all_projects\gym-miniworld\gym_miniworld\entity.py", line 429, in render
    glEnd(GL_QUADS)
TypeError: this function takes 0 arguments (1 given)

LIDAR Simulation

There have been a few requests to implement a LIDAR simulation, eg: simulating the LIDAR on something like a turtlebot.

For this, I would like some help in getting more info about:

  1. What is the format of the data provided by a turtlebot LIDAR. Does it return 2D data (eg: row of distances) or a 3D grid? Does it produce a 360 degree view?
  2. What are the limitations of LIDARs. I've heard that walls couldn't be detected at some angles? How does that work? How close/far can it detect something?

ERROR: "Connection reset by peer"

Hello! Thank you so much for creating this awesome resource for the community, it has been a really great help!

I am encountering a problem: I am using the main.py RL script with the Hallway maze, and it seems to work well. However, trying any other maze, for example -- 4 rooms, yields the following error: (see attached image). Does anyone know the source of this error and how to fix it?

Thank you!

image

Reset FourRooms environment

Currently, when I reset the FourRooms environment, both the agent's start position and the goal position are changing. How can I change only the agent's start position and not the goal position on reset?

assert res == GL_FRAMEBUFFER_COMPLETE

I want to make my Pytorch-a2c-ppo work for your environment.

I cloned and installed the package but when I do:

./manual_control.py --env-name MiniWorld-Hallway-v0

I get this:

Registered env: MiniWorld-CollectHealth-v0
Registered env: MiniWorld-FourRooms-v0
Registered env: MiniWorld-Hallway-v0
Registered env: MiniWorld-Maze-v0
Registered env: MiniWorld-MazeS3-v0
Registered env: MiniWorld-OneRoom-v0
Registered env: MiniWorld-PutNext-v0
Registered env: MiniWorld-TMaze-v0
Registered env: MiniWorld-ThreeRooms-v0
Registered env: MiniWorld-WallGap-v0
Traceback (most recent call last):
  File "./manual_control.py", line 23, in <module>
    env = gym.make(args.env_name)
  File "/home/lcswillems/miniconda3/lib/python3.6/site-packages/gym/envs/registration.py", line 167, in make
    return registry.make(id)
  File "/home/lcswillems/miniconda3/lib/python3.6/site-packages/gym/envs/registration.py", line 119, in make
    env = spec.make()
  File "/home/lcswillems/miniconda3/lib/python3.6/site-packages/gym/envs/registration.py", line 86, in make
    env = cls(**self._kwargs)
  File "/mnt/Data/Documents/Education/2017 2018 - M1/Stage/Code/gym-miniworld/gym_miniworld/envs/oneroom.py", line 18, in __init__
    **kwargs
  File "/mnt/Data/Documents/Education/2017 2018 - M1/Stage/Code/gym-miniworld/gym_miniworld/miniworld.py", line 517, in __init__
    self.obs_fb = FrameBuffer(obs_width, obs_height, 8)
  File "/mnt/Data/Documents/Education/2017 2018 - M1/Stage/Code/gym-miniworld/gym_miniworld/opengl.py", line 183, in __init__
    assert res == GL_FRAMEBUFFER_COMPLETE
AssertionError

Do you know what I did wrong?

Git clone path collision on case-insensitive filesystems

Cloning the project results in a path collision on filesystems that are case-insensitive (like MacOS, by default). This seems to be due to the fact that gym_miniworld/textures/chars/ contains filenames that differ only by their capitalization.

One workaround that I've discovered is to create a case-sensitive disk image, mount it, and clone the repository there instead. (See here for more information.)

$ git clone https://github.com/maximecb/gym-miniworld.git
Cloning into 'gym-miniworld'...
remote: Enumerating objects: 71, done.
remote: Counting objects: 100% (71/71), done.
remote: Compressing objects: 100% (57/57), done.
remote: Total 6981 (delta 39), reused 31 (delta 14), pack-reused 6910
Receiving objects: 100% (6981/6981), 136.82 MiB | 11.97 MiB/s, done.
Resolving deltas: 100% (1920/1920), done.
Updating files: 100% (3458/3458), done.
warning: the following paths have collided (e.g. case-sensitive paths
on a case-insensitive filesystem) and only one from the same
colliding group is in the working tree:

  'gym_miniworld/textures/chars/ch_A_1.png'
  'gym_miniworld/textures/chars/ch_a_1.png'
  'gym_miniworld/textures/chars/ch_A_10.png'
  'gym_miniworld/textures/chars/ch_a_10.png'
  'gym_miniworld/textures/chars/ch_A_11.png'
  'gym_miniworld/textures/chars/ch_a_11.png'
[...]
  'gym_miniworld/textures/chars/ch_Z_8.png'
  'gym_miniworld/textures/chars/ch_z_8.png'
  'gym_miniworld/textures/chars/ch_Z_9.png'
  'gym_miniworld/textures/chars/ch_z_9.png'

can not run run_test.py

Hello, I connected ubantu server via ssh, I installed the corresponding library as you instructed, when I run with command: xvfb-run -a -s "-screen 0 1024x768x24 -ac +extension GLX +render -noreset" . When /run_tests.py goes to run the file run_test.py, the following error appears:
Falling back to num_samples=1
Falling back to num_samples=1
Traceback (most recent call last):
File "/home/lab1207/liujiong/gym-miniworld-master/./run_tests.py", line 15, in
obs, _, _, _ = env.step(0)
File "/home/lab1207/anaconda3/lib/python3.9/site-packages/gym/wrappers/order_enforcing.py", line 10, in step
assert self._has_reset, "Cannot call env.step() before calling reset()"
AssertionError: Cannot call env.step() before calling reset()

Hope to get your answer, thank you very much!

Doom-like door texture

I would like to find one or more textures for a doom-like sliding door. Ideally, this texture should be CC0 (public domain license), and have either a 1:1 or 1:2 aspect ratio (eg: 512x512 or 512x1024). Also looking for other CC0 doom-like textures if you happen to find them :)

Modify environments so they can be deepcopied

First of all, thank you very much for your work and contribution to the reinforcement learning community! ๐Ÿค 

Problem

I am trying to use the Mazes environments into garage library. However, I've been strugling a lot until I found what I think it is the main issue. In garage, some algorithms implement a task sampler to create different instances of the environments. To achieve this, they do a deepcopy of the environments. Here is where I found that MiniWorld environments can't be deepcopied. I just would like to know how to modify them in order to be deepcopied.

Code Snippet

Here you are a code snippet to reproduce the issue:

import gym
import gym_miniworld
import copy

env = gym.make('MiniWorld-MazeS3Fast-v0')
copy.deepcopy(env)

Traceback

If you execute the previous code, you will see an error traceback like this one:

Traceback (most recent call last):
  File "/home/carlos/repositorios/garage/development/pruebas_envdeepcopy.py", line 6, in <module>
    copy.deepcopy(env)
  File "/home/carlos/miniconda3/envs/garage/lib/python3.7/copy.py", line 180, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/home/carlos/miniconda3/envs/garage/lib/python3.7/copy.py", line 281, in _reconstruct
    state = deepcopy(state, memo)
  File "/home/carlos/miniconda3/envs/garage/lib/python3.7/copy.py", line 150, in deepcopy
    y = copier(x, memo)
  File "/home/carlos/miniconda3/envs/garage/lib/python3.7/copy.py", line 241, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/home/carlos/miniconda3/envs/garage/lib/python3.7/copy.py", line 180, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/home/carlos/miniconda3/envs/garage/lib/python3.7/copy.py", line 281, in _reconstruct
    state = deepcopy(state, memo)
  File "/home/carlos/miniconda3/envs/garage/lib/python3.7/copy.py", line 150, in deepcopy
    y = copier(x, memo)
  File "/home/carlos/miniconda3/envs/garage/lib/python3.7/copy.py", line 241, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/home/carlos/miniconda3/envs/garage/lib/python3.7/copy.py", line 180, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/home/carlos/miniconda3/envs/garage/lib/python3.7/copy.py", line 281, in _reconstruct
    state = deepcopy(state, memo)
  File "/home/carlos/miniconda3/envs/garage/lib/python3.7/copy.py", line 150, in deepcopy
    y = copier(x, memo)
  File "/home/carlos/miniconda3/envs/garage/lib/python3.7/copy.py", line 241, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/home/carlos/miniconda3/envs/garage/lib/python3.7/copy.py", line 180, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/home/carlos/miniconda3/envs/garage/lib/python3.7/copy.py", line 281, in _reconstruct
    state = deepcopy(state, memo)
  File "/home/carlos/miniconda3/envs/garage/lib/python3.7/copy.py", line 150, in deepcopy
    y = copier(x, memo)
  File "/home/carlos/miniconda3/envs/garage/lib/python3.7/copy.py", line 241, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/home/carlos/miniconda3/envs/garage/lib/python3.7/copy.py", line 180, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/home/carlos/miniconda3/envs/garage/lib/python3.7/copy.py", line 281, in _reconstruct
    state = deepcopy(state, memo)
  File "/home/carlos/miniconda3/envs/garage/lib/python3.7/copy.py", line 150, in deepcopy
    y = copier(x, memo)
  File "/home/carlos/miniconda3/envs/garage/lib/python3.7/copy.py", line 241, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/home/carlos/miniconda3/envs/garage/lib/python3.7/copy.py", line 180, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/home/carlos/miniconda3/envs/garage/lib/python3.7/copy.py", line 281, in _reconstruct
    state = deepcopy(state, memo)
  File "/home/carlos/miniconda3/envs/garage/lib/python3.7/copy.py", line 150, in deepcopy
    y = copier(x, memo)
  File "/home/carlos/miniconda3/envs/garage/lib/python3.7/copy.py", line 241, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/home/carlos/miniconda3/envs/garage/lib/python3.7/copy.py", line 180, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/home/carlos/miniconda3/envs/garage/lib/python3.7/copy.py", line 281, in _reconstruct
    state = deepcopy(state, memo)
  File "/home/carlos/miniconda3/envs/garage/lib/python3.7/copy.py", line 150, in deepcopy
    y = copier(x, memo)
  File "/home/carlos/miniconda3/envs/garage/lib/python3.7/copy.py", line 241, in _deepcopy_dict
    y[deepcopy(key, memo)] = deepcopy(value, memo)
  File "/home/carlos/miniconda3/envs/garage/lib/python3.7/copy.py", line 169, in deepcopy
    rv = reductor(4)
ValueError: ctypes objects containing pointers cannot be pickled

Solution

For the moment I haven't been able to find any solution to this problem. It is the first time I use deepcopy, so I am not an expert. Also, I do not know enough of the MiniWorld internal workings, so I can't figure where to start out. I just would like to ask you to suggest me some hints in order to know where to start modifying the environments. Maybe just some kind of wrapper will make it work.

Thanks in advance! ๐Ÿ˜ธ

Command?

Hi again,
What is the position command of target for print output in python?
Is it print(self.box.pos[()])?

Domain-randomization API

MiniWorld will have domain randomizaton so that we can transfer policies to small robots, to be used in miniature cardboard rooms. I would like to have an API for domain randomization that is a bit more principled, less ad-hoc than what's in gym-duckietown.

We probably want a class DomainParams, which stores a list of parameters that can be sampled. Each parameter should have a unique name, as well as min, max and default values, with the default value being assigned when domain randomization is turned off. Values will also have types/shapes (eg: int, float, rgb_color, vector). This system will allow someone to instantiate simulator and easily control the range of randomized values if they want to.

It might be useful to have a mechanism to sample all values at once, eg:

vals = params.sample(rng)

However, it may also be useful to be able to sample a subset of the parameters, possibly by specifying the names of all values to be sampled:

vals = params.sample(rng, ['cam_height', 'cam_angle'])

The use case for this is that there will be various objects/entities in the world, and we may want to randomize various parameters for each object independently.

@liampaull @bhairavmehta95

Textures/meshes folder missing when installing using github

Thank you for creating the repo. It is extremely useful. I notice that installing using the github code ( pip install git+https://github.com/maximecb/gym-miniworld.git@ad817b83cfdf1dfac04e2d8871f58fa04214cd2f#egg=gym-miniworld) does not include the textures and meshes directory.

(mtrl) โžœ  projects  ls -lh /private/home/sodhani/.conda/envs/mtrl/lib/python3.8/site-packages/gym_miniworld
total 85K
-rw-rw-r-- 1 sodhani sodhani  189 Jan  8 04:22 __init__.py
drwxrwsr-x 2 sodhani sodhani    0 Jan  8 04:22 __pycache__
-rw-rw-r-- 1 sodhani sodhani  13K Jan  8 04:22 entity.py
drwxrwsr-x 3 sodhani sodhani    0 Jan  8 04:22 envs
-rw-rw-r-- 1 sodhani sodhani 1.4K Jan  8 04:22 math.py
-rw-rw-r-- 1 sodhani sodhani  40K Jan  8 04:22 miniworld.py
-rw-rw-r-- 1 sodhani sodhani 8.7K Jan  8 04:22 objmesh.py
-rw-rw-r-- 1 sodhani sodhani  14K Jan  8 04:22 opengl.py
-rw-rw-r-- 1 sodhani sodhani 3.9K Jan  8 04:22 params.py
-rw-rw-r-- 1 sodhani sodhani 1.4K Jan  8 04:22 random.py
-rw-rw-r-- 1 sodhani sodhani 1005 Jan  8 04:22 utils.py
-rw-rw-r-- 1 sodhani sodhani 1.3K Jan  8 04:22 wrappers.py

This leads to errors like AssertionError: failed to load textures for name "brick_wall"

problems when using recent numpy 1.21.5, had to downgrade to lower numpy 1.18

After installing Miniworld on my virtual environment (Python 3.7.9), several errors appeared while running the main.py ppo training script. Apparently it was related to the numpy 1.21.5 library I had installed by default using pip install numpy) on my virtual environment. I then tried to downgrade numpy to a lower version (numpy 1.18.5) and everything worked fine. Could you test this on your side? Thanks!

New ML hobbyist

Hi,

ML noob here. I've been looking at different projects on the web, mostly for fun and to learn something new.

I love your gym-miniworld project b/c I can see its progress (cones, wall, sidewalk, a building in the distance, etc.)

Please see the screenshot. Does "success rate" > 0 mean it's touched the block? I've been running gym-miniworld all night, and I've seen a success rate of 0.01 or 0.02 only a few times.

Because of its low success rate, I don't know if I did something wrong, or if I should be more patient. What should I expect?

Thank you!

Edit: I entered this command to start:

administrator@ubuntu:~/Desktop/gym-miniworld/pytorch-a2c-ppo-acktr$` python3 main.py --algo ppo --num-frames 5000000 --num-processes 16 --num-steps 80 --lr 0.00005 --env-name MiniWorld-Sidewalk-v0

miniworld-ss

Position of target

It was asked by other friends, but I did not understand clearly, for example, on the map of the four rooms, the target and the agent are defined as random. I want to set target position myself. so the target will always start at the same place as the agent randomly. How can I do that?
Please explain clearly, thx for help.

Panoramic observation

Hi,

I am writing to ask whether it is possible to get panoramic observation given the current position? I notice there is a function in miniworld.py called render_obs(). In the function, there is a method called
gluLookAt(
# Eye position
*self.agent.cam_pos,
# Target
*(self.agent.cam_pos + self.agent.cam_dir),
# Up vector
0, 1.0, 0.0
)
I try to modify the self.agent.cam_dir. However, it seems only modify cam_dir can not get a 360 view. I have the following thoughts:

  1. Turning the agent 360 and capture the observations.
  2. Place 4 cameras on the agent
  3. Changing the camera yaw of the current agent
    Could you please tell me which is doable in this repo? If nothing works, could you give me any suggestions?

Best,

episode_rewards in the RL demo

A quick question. When I'm using the code to do some preliminary RL experiment, I found these in the main.py.

            # FIXME: works only for environments with sparse rewards
            for idx, eps_done in enumerate(done):
                if eps_done:
                    episode_rewards.append(reward[idx])

Does this only used to collect episode reward to show statistics and have nothing to do with the training part?

Does the FIXME means it intends to collect the accumulated reward of the whole episode just ended but currently it assume the reward at last step is the accumulated reward?

Thanks!

error when trying to import gym_miniworld on Google Colab

Before, I had no problems in running minigrid over Colab, however I have tried several options in order to run Miniworld over Colab but have not succeeded. At the beginning of my Colab notebook, I first install the following libraries:

!pip install rarfile --quiet
!pip install stable-baselines3 > /dev/null
!pip install box2d-py > /dev/null
!pip install gym pyvirtualdisplay > /dev/null 2>&1
!sudo apt-get install -y xvfb python-opengl ffmpeg > /dev/null 2>&1
!pip install gym-miniworld > /dev/null 2>&1

Then, the error appears right when importing the libraries:

import gym
import gym_miniworld

The error I get is the following:

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
[<ipython-input-13-7f542eec6530>](https://fv0dqg4ruxm-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab-20220224-060059-RC00_430667398#) in <module>()
      1 import gym
----> 2 import gym_miniworld

3 frames
[/usr/local/lib/python3.7/dist-packages/pyglet/gl/__init__.py](https://fv0dqg4ruxm-496ff2e9c6d22116-0-colab.googleusercontent.com/outputframe.html?vrz=colab-20220224-060059-RC00_430667398#) in <module>()
    233 elif compat_platform == 'darwin':
    234     from .cocoa import CocoaConfig as Config
--> 235 del base  # noqa: F821
    236 
    237 

NameError: name 'base' is not defined

Any suggestion on how to handle this? Many thanks!

running problem

hello!when I follow your instruction :::::

python3 main.py --algo ppo --num-frames 5000000 --num-processes 16 --num-steps 80 --lr 0.00005 --env-name MiniWorld-Hallway-v0

it went wrong as follow::::::::
Failed to establish dbus connectionFailed to establish dbus connectionFailed to establish dbus connectionFailed to establish dbus connectionFailed to establish dbus connectionFailed to establish dbus connectionFailed to establish dbus connectionFailed to establish dbus connectionFailed to establish dbus connectionFailed to establish dbus connectionFailed to establish dbus connectionFailed to establish dbus connectionFailed to establish dbus connectionFailed to establish dbus connectionFailed to establish dbus connectionFailed to establish dbus connectionFailed to establish dbus connectionCreating frame stacking wrapper
Saving model

/home/lab1207/anaconda3/lib/python3.9/site-packages/numpy/core/_asarray.py:171: FutureWarning: The input object of type 'Tensor' is an array-like implementing one of the corresponding protocols (__array__, __array_interface__ or __array_struct__); but not a sequence (or 0-D). In the future, this object will be coerced as if it was first converted using np.array(obj). To retain the old behaviour, you have to either modify the type 'Tensor', or assign to an empty array created with np.empty(correct_shape, dtype=object).
return array(a, dtype, copy=False, order=order, subok=True)
/home/lab1207/anaconda3/lib/python3.9/site-packages/numpy/core/_asarray.py:171: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.
return array(a, dtype, copy=False, order=order, subok=True)
Traceback (most recent call last):
File "/home/lab1207/liujiong/gym-miniworld/pytorch-a2c-ppo-acktr/main.py", line 227, in
main()
File "/home/lab1207/liujiong/gym-miniworld/pytorch-a2c-ppo-acktr/main.py", line 163, in main
np.mean(episode_rewards),
File "<array_function internals>", line 5, in mean
File "/home/lab1207/anaconda3/lib/python3.9/site-packages/numpy/core/fromnumeric.py", line 3419, in mean
return _methods._mean(a, axis=axis, dtype=dtype,
File "/home/lab1207/anaconda3/lib/python3.9/site-packages/numpy/core/_methods.py", line 188, in _mean
ret = ret.dtype.type(ret / rcount)
AttributeError: 'torch.dtype' object has no attribute 'type'

I dont know what does it mean,could you please help me solve this problem?
hoping for your reply,thanks again for your notice!!!!

Repeat an action when key is held

If I hold the up arrow, it would be nice if the agent continues to go forward. Otherwise, if I want the agent to cross the room, I need to press the up arrow a lot of times. This can also be done for all the actions triggered by a key press event.

assert res == GL_FRAMEBUFFER_COMPLETE failing

Hi,

I'm trying to run MiniWorld remotely on a Ubuntu machine. I've followed the Installation guide. Following the Troubleshooting guide, I've installed xvfb and mesa-utils, but I'm running into the following error:

(venv) evanliu@iris:/iris/u/evanliu/code/gym-miniworld$ xvfb-run -a -s "-screen 0 1024x768x24 -ac +extension GLX +render -noreset" ./run_tests.py                                                                                                    [0/1951]
Falling back to non-multisampled frame buffer
Traceback (most recent call last):
  File "./run_tests.py", line 9, in <module>
    env = gym.make('MiniWorld-Hallway-v0')
  File "/iris/u/evanliu/code/venv/lib/python3.5/site-packages/gym/envs/registration.py", line 142, in make
    return registry.make(id, **kwargs)
  File "/iris/u/evanliu/code/venv/lib/python3.5/site-packages/gym/envs/registration.py", line 87, in make
    env = spec.make(**kwargs)  
  File "/iris/u/evanliu/code/venv/lib/python3.5/site-packages/gym/envs/registration.py", line 59, in make
    env = cls(**_kwargs)       
  File "/iris/u/evanliu/code/gym-miniworld/gym_miniworld/envs/hallway.py", line 19, in __init__
    **kwargs                   
  File "/iris/u/evanliu/code/gym-miniworld/gym_miniworld/miniworld.py", line 502, in __init__
    self.obs_fb = FrameBuffer(obs_width, obs_height, 8)
  File "/iris/u/evanliu/code/gym-miniworld/gym_miniworld/opengl.py", line 216, in __init__
    assert res == GL_FRAMEBUFFER_COMPLETE, FB_ERROR_ENUMS.get(res, res)
AssertionError: 0

Thanks for the help!

Oracle solution / Shortest path algorithm

Hi,

very nice project! I'm using it for an exploration task and I was wondering whether an oracle exists to determine the shortest path between the agent and the goal state (or any other position on the map)? Or how such an implementation could best be approached?

Best,

Running over SSH

Hi there,
I am trying to run the environment over ssh on a linux server where I don't have sudo rights, and I'm getting this error:

~/gym-miniworld/pytorch-a2c-ppo-acktr $ python main.py --algo ppo --num-frames 5000000 --num-processes 16 --num-steps 80 --lr 0.00005 --env-name MiniWorld-Hallway-v0
Traceback (most recent call last):
  File "main.py", line 17, in <module>
    from envs import make_vec_envs
  File "/home/ml/mklissa/gym-miniworld/pytorch-a2c-ppo-acktr/envs.py", line 28, in <module>
    import gym_miniworld
  File "/home/ml/mklissa/gym-miniworld/gym_miniworld/__init__.py", line 1, in <module>
    from . import miniworld
  File "/home/ml/mklissa/gym-miniworld/gym_miniworld/miniworld.py", line 7, in <module>
    from .opengl import *
  File "/home/ml/mklissa/gym-miniworld/gym_miniworld/opengl.py", line 5, in <module>
    from pyglet.gl import *
  File "/home/ml/mklissa/miniconda2/envs/kag/lib/python3.6/site-packages/pyglet/gl/__init__.py", line 239, in <module>
    import pyglet.window
  File "/home/ml/mklissa/miniconda2/envs/kag/lib/python3.6/site-packages/pyglet/window/__init__.py", line 1896, in <module>
    gl._create_shadow_window()
  File "/home/ml/mklissa/miniconda2/envs/kag/lib/python3.6/site-packages/pyglet/gl/__init__.py", line 208, in _create_shadow_window
    _shadow_window = Window(width=1, height=1, visible=False)
  File "/home/ml/mklissa/miniconda2/envs/kag/lib/python3.6/site-packages/pyglet/window/xlib/__init__.py", line 166, in __init__
    super(XlibWindow, self).__init__(*args, **kwargs)
  File "/home/ml/mklissa/miniconda2/envs/kag/lib/python3.6/site-packages/pyglet/window/__init__.py", line 501, in __init__
    display = get_platform().get_default_display()
  File "/home/ml/mklissa/miniconda2/envs/kag/lib/python3.6/site-packages/pyglet/window/__init__.py", line 1845, in get_default_display
    return pyglet.canvas.get_display()
  File "/home/ml/mklissa/miniconda2/envs/kag/lib/python3.6/site-packages/pyglet/canvas/__init__.py", line 82, in get_display
    return Display()
  File "/home/ml/mklissa/miniconda2/envs/kag/lib/python3.6/site-packages/pyglet/canvas/xlib.py", line 86, in __init__
    raise NoSuchDisplayException('Cannot connect to "%s"' % name)
pyglet.canvas.xlib.NoSuchDisplayException: Cannot connect to "None"

I'm not too sure how to resolve this

Thanks!

Empty chunks & faces variable when executing run_tests.py

When script gets to PickupObjs environment, end up getting an index error since chunks variable in objmesh.py never gets anything successfully appended. Looks like the faces variable also ends up empty in this case.

Testing "MiniWorld-CollectHealth-v0"
Testing "MiniWorld-FourRooms-v0"
Testing "MiniWorld-Hallway-v0"
Testing "MiniWorld-Maze-v0"
Testing "MiniWorld-MazeS2-v0"
Testing "MiniWorld-MazeS3-v0"
Testing "MiniWorld-MazeS3Fast-v0"
Testing "MiniWorld-OneRoom-v0"
Testing "MiniWorld-OneRoomS6-v0"
Testing "MiniWorld-OneRoomS6Fast-v0"
Testing "MiniWorld-PickupObjs-v0"
Traceback (most recent call last):
  File "run_tests.py", line 53, in <module>
    env = gym.make(env_id)
  File "C:\Users\texmex657\AppData\Local\conda\conda\envs\dto\lib\site-packages\gym\envs\registration.py", line 156, in make
    return registry.make(id, **kwargs)
  File "C:\Users\texmex657\AppData\Local\conda\conda\envs\dto\lib\site-packages\gym\envs\registration.py", line 101, in make
    env = spec.make(**kwargs)
  File "C:\Users\texmex657\AppData\Local\conda\conda\envs\dto\lib\site-packages\gym\envs\registration.py", line 73, in make
    env = cls(**_kwargs)
  File "C:\Users\texmex657\git\gym_miniworld\envs\pickupobjs.py", line 20, in __init__
    **kwargs
  File "C:\Users\texmex657\git\gym_miniworld\miniworld.py", line 523, in __init__
    self.reset()
  File "C:\Users\texmex657\git\gym_miniworld\miniworld.py", line 555, in reset
    self._gen_world()
  File "C:\Users\texmex657\git\gym_miniworld\envs\pickupobjs.py", line 48, in _gen_world
    self.place_entity(Key(color=color))
  File "C:\Users\texmex657\git\gym_miniworld\entity.py", line 420, in __init__
    static=False
  File "C:\Users\texmex657\git\gym_miniworld\entity.py", line 119, in __init__
    self.mesh = ObjMesh.get(mesh_name)
  File "C:\Users\texmex657\git\gym_miniworld\objmesh.py", line 28, in get
    mesh = ObjMesh(file_path)
  File "C:\Users\texmex657\git\gym_miniworld\objmesh.py", line 128, in __init__
    chunks[-1]['end_idx'] = len(faces)
IndexError: list index out of range

Position of goal and agent

how can we get goal and agent position in environment?
For example My goal is a box.
How can I set the box's position as x,y,z manually?
I'm trying but I get different output in self.box.pos command. what is the reason of this?

Top-down, fully-observable overhead view

This is a commonly requested feature. Many people would like to have a top-down-view/map where the agent's position is visible. This view would be fully observable.

Could be implemented as a method on environments, eg get_top_view() that returns a numpy RGB array. Once this is implemented, we will also want to update the human view produced by env.render('human') to always show the top-down view on the side, in addition to the first-person view.

We will most likely want the resolution of the top view to be configurable in the environment's constructor. However, the small top view produced for the human render will necessarily be smaller. As a result, we will probably want to render these separately, in two separate frame buffers.

Parallel environment with multiprocessing.Pipe?

Hi there, thank you so much for sharing the code! I was trying to run parallel environment using pipe as done in: https://github.com/lcswillems/rl-starter-files. However, that doesn't seem to work. I got EOFerror for all process other than the main one. Any idea why and how to fix it? Thanks in advanced!

Here's the relevant code:

class ParallelEnv(gym.Env):
    def __init__(self, envs):
        assert len(envs) >= 1,
        self.envs = envs
        self.observation_space = self.envs[0].observation_space
        self.action_space = self.envs[0].action_space

        self.locals = []
        for env in self.envs[1:]:
            local, remote = Pipe()
            self.locals.append(local)
            p = Process(target=worker, args=(remote, env))
            p.daemon = True
            p.start()
            remote.close()

    def reset(self):
        for local in self.locals:
            local.send(("reset", None))
        results = [self.envs[0].reset()] + [local.recv() for local in self.locals]
        return results

    def step(self, actions):
        for local, action in zip(self.locals, actions[1:]):
            local.send(("step", action))
        obs, reward, done, info = self.envs[0].step(actions[0])
        print(obs.shape)
        if done:
            obs = self.envs[0].reset()
        results = zip(*[(obs, reward, done, info)] + [local.recv() for local in self.locals])
        return results

    def render(self):
        raise NotImplementedError

Camera intrinsic and extrinsic matrices

Hi, I am doing some research work where I have to do the inverse perspective projection of the front view depth image. In particular, given a front-view depth image I, I am trying to use it to reconstruct the 3D positions of each pixel on the image. A common solution is to use the camera intrinsic matrix and extrinsic matrix.

Could you please give me any suggestions about where I can find those matrices or how to do the projection in a more simple way?

Best,

Default verbose-off

Hello,

The terminal gets quite cluttered with all of the textual information being printed out during runtime. If this text is there for debugging purposes, is it possible for it to be turned on/off with some kind of verbosity flag?

Thanks!

Train and test

Hello,
For example, I want to train an environment using the ppo algorithm and test other environments with the network I trained. How can I do that?
What does the run_tests file do in your file?
Thanks.

ACTIONS in "make_vec_envs" vs regular Actions

Hi :) Thank you again for this great resource. I have a question about the definition of actions in the manual control script vs the definition of actions in the RL training script. I hope to be able to use the "learned" policy, with defined actions --> and be able to visualize the policy learned in a "agent" point of view like the manual control script.

For this purpose (I don't know if this is a particularly dumb solution, or if there is a more miraculous and easier solution), but I imagined I would feed the actions from the trained policy --> into the manual control script, but the problem is that the actions from the RL script are integers [0], [1], [2] in the Hallway problem. How do these correspond to actions like move_forward, move_left etc.? What is the mapping?

Thank you very much for the kind help!

image

image

render() problem

When i run manual_control.py ,there has a erroe:"render() takes 1 positional argument but 2 were given"
Maybe the env.render('pyglet', view=view_model) need change to env.render(model=view_model)

Trained models --tests

How do I save my data in the program I prepared? Is it necessary to save as a model for testing or just model weights?
How can I load the latest data I trained and write the test code for any environment? I want to see success in another environment with testing. For example, how can I test my trained data by making changes in the run_tests.py file you shared. Thank you so much for help

Occlusion queries, ability to get list of visible objects

@mweiss17 has requested this feature for his navigation research project, and there are many other legitimate use cases, so it's time to take a deeper look.

Proposed API:

def get_visible_entities(self):
    raise NotImplemented
    return list of visible entities

Doing this will necessarily involve performing an extra rendering pass so that we can check if pixels from any object end up being drawn on the screen.

There is a standard OpenGL way of doing this using occlusion queries:
https://vertostudio.com/gamedev/?p=177

One technique to speed this up is to use results from the previous frame (previous camera and object position) which are slightly out of date:
https://www.reddit.com/r/opengl/comments/1pv8qe/how_do_occlusion_queries_work/
http://www.visualizationlibrary.org/documentation/pag_guide_occlusion_culling.html

The rendering pass for occlusion queries should be done with texturing disabled. It should also ideally use some kind of a bounding volume for objects. Right now the bounding volume in MiniWorld is a bounding cylinder. The downside is that this is any bounding volume is an approximation. In some cases, it will report objects as visible when they are not. Note that even without this definition, the OpenGL definition of an object being visible is if any single pixel is visible.

@mweiss17 It could be a problem for navigation if one single pixel being drawn makes an object "visible". One way we might be able to get around it is by having bounding volumes that are slightly too small, or to check if objects are visible in N successive frames. That is, don't expect the follower to have seen the object unless we are "really extra sure" that this object has been visible for a little while and from multiple camera positions while the agent was moving. In other words, MiniWorld will use the OpenGL definition of visible, but you can do some post-processing to be more conservative as for that it means for your agent to consider something visible. You can also use other heuristics such as distance between the agent and the object, and approximate size of the object on screen (based on distance + height, trigonometry).

Step 1 for me in implementing this is probably to refactor MiniWorld a bit so that we have a better architecture for doing multiple rendering passes. Otherwise, we can do occlusion queries based on the rendering of the last frame, and using more conservative heuristics, this may work fairly well.

Radius or Height of MeshEnt objects

Was wondering how to get the radius of a ball entity as both the radius & height properties return a list of values vs a single value. Is the radius essentially the declared size / 2?

Entity for displaying digits/text strings

Following discussions with @mweiss17, it would be useful to have an entity that can be used to display digits (and eventually arbitrary text strings) with some randomization in the appearance of the characters.

I would like for MiniWorld to avoid any kind of restrictive licensing, so that means we should also avoid including datasets with licenses more restrictive than MIT/BSD. Fortunately, it seems like the original NIST dataset (what MNIST is based on) is public domain, and includes PNG images of characters.

We could use MiniWorld's built-in texture randomization to randomly pick among digit and character textures. We could also use OpenGL tricks to randomize the color/background when rendering the TextFrame entities. Each entity has a randomize method which allows it to pick domain randomization parameters.

RL algo implementation

Hello,
I saw that you had a previous RL implementation that is not supported anymore. I'm wondering if it is feasible for testing transfer learning of RL algorithms of robots/agents now from the ground up?

I'm writing my Bachelor's Thesis and this seems like the perfect repo.

Thanks,
Will

Customizing maze from txt files and retrieve depth image

Hi,

Nice work! I am happy to see simple and customizable domains like this. I have the following questions:

  1. It seems the maze env is created by creating #(row x col) rooms and then they are connected using the backtracking algorithm. Is it possible to generate the maze from a txt file similar to deepmind lab? If not, could u please give me some hints of how to change it?
  2. I still wonder if there is a way to retrieve the depth image. However, when I read the code in miniworld.py and maze.py. It seems the current version only provides RGB images. Could u please tell me how to obtain a depth image? (I resolve this question thanks.)
    Best,

EOFError with multiprocessing

Thanks for your great work. I find this environment very useful for our research. When I tried the training example, I got EOFError whenever the num-processes > 1. The error happens when the training is finished and seems to related to the multiprocessing. The same error seems also happens in a Macbook.

I find some similar problem through search as below, but none of them solve the problem. Could you please take a look at that? Thanks.

duckietown/gym-duckietown#75
openai/baselines#640

Linux

Environment info:
Ubuntu 18.04.2 LTS
python 3.7.3
gym 0.13.0
pyglet 1.2.4

Error message:
(tensorflow_yukun) akash@a1:~/Documents/yukun/miniWorld/gym-miniworld/pytorch-a2c-ppo-acktr$ python main.py --algo ppo --num-frames 4000 --num-processes 2 --num-steps 80 --lr 0.00005 --env-name MiniWorld-Hallway-v0
Falling back to num_samples=1
Falling back to num_samples=1
Falling back to num_samples=1
Falling back to num_samples=1
Creating frame stacking wrapper
Saving model

Updates 10, num timesteps 1760, FPS 61
Last 7 training episodes: mean/median reward 0.14/0.00, min/max reward 0.00/0.96, success rate 0.14

Updates 20, num timesteps 3360, FPS 61
Last 14 training episodes: mean/median reward 0.14/0.00, min/max reward 0.00/0.98, success rate 0.14

Process Process-2:
Process Process-1:
Traceback (most recent call last):
Traceback (most recent call last):
File "/home/akash/.conda/envs/tensorflow_yukun/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
self.run()
File "/home/akash/.conda/envs/tensorflow_yukun/lib/python3.7/multiprocessing/process.py", line 297, in _bootstrap
self.run()
File "/home/akash/.conda/envs/tensorflow_yukun/lib/python3.7/multiprocessing/process.py", line 99, in run
self._target(*self._args, **self._kwargs)
File "/home/akash/.conda/envs/tensorflow_yukun/lib/python3.7/multiprocessing/process.py", line 99, in run
self._target(*self._args, **self._kwargs)
File "/home/akash/Documents/yukun/miniWorld/gym-miniworld/pytorch-a2c-ppo-acktr/vec_env/subproc_vec_env.py", line 9, in worker
cmd, data = remote.recv()
File "/home/akash/Documents/yukun/miniWorld/gym-miniworld/pytorch-a2c-ppo-acktr/vec_env/subproc_vec_env.py", line 9, in worker
cmd, data = remote.recv()
File "/home/akash/.conda/envs/tensorflow_yukun/lib/python3.7/multiprocessing/connection.py", line 250, in recv
buf = self._recv_bytes()
File "/home/akash/.conda/envs/tensorflow_yukun/lib/python3.7/multiprocessing/connection.py", line 250, in recv
buf = self._recv_bytes()
File "/home/akash/.conda/envs/tensorflow_yukun/lib/python3.7/multiprocessing/connection.py", line 407, in _recv_bytes
buf = self._recv(4)
File "/home/akash/.conda/envs/tensorflow_yukun/lib/python3.7/multiprocessing/connection.py", line 407, in _recv_bytes
buf = self._recv(4)
File "/home/akash/.conda/envs/tensorflow_yukun/lib/python3.7/multiprocessing/connection.py", line 383, in _recv
raise EOFError
File "/home/akash/.conda/envs/tensorflow_yukun/lib/python3.7/multiprocessing/connection.py", line 383, in _recv
raise EOFError
EOFError
EOFError

Mac

macOS 10.14.5 (18F132)
python 3.6.8
gym 0.13.1
pyglet 1.4.1

(miniWorld1) yukuns-mbp:pytorch-a2c-ppo-acktr [email protected]$ python main.py --algo ppo --num-frames 2000 --num-processes 2 --num-steps 80 --lr 0.00005 --env-name MiniWorld-Hallway-v0
Falling back to non-multisampled frame buffer
Falling back to num_samples=8
Falling back to non-multisampled frame buffer
Falling back to non-multisampled frame buffer
Falling back to num_samples=8
Falling back to non-multisampled frame buffer
Creating frame stacking wrapper
Saving model

Updates 0, num timesteps 160, FPS 53
Last 4 training episodes: mean/median reward 0.98/0.98, min/max reward 0.97/1.00, success rate 1.00

Updates 10, num timesteps 1760, FPS 56
Last 12 training episodes: mean/median reward 0.64/0.94, min/max reward 0.00/1.00, success rate 0.67

Process Process-2:
Process Process-1:
Traceback (most recent call last):
File "/anaconda3/envs/miniWorld1/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/anaconda3/envs/miniWorld1/lib/python3.6/multiprocessing/process.py", line 93, in run
self._target(*self._args, **self._kwargs)
File "/Users/[email protected]/Documents/Code/yding5/miniWorld/gym-miniworld/pytorch-a2c-ppo-acktr/vec_env/subproc_vec_env.py", line 9, in worker
cmd, data = remote.recv()
File "/anaconda3/envs/miniWorld1/lib/python3.6/multiprocessing/connection.py", line 250, in recv
buf = self._recv_bytes()
File "/anaconda3/envs/miniWorld1/lib/python3.6/multiprocessing/connection.py", line 407, in _recv_bytes
buf = self._recv(4)
File "/anaconda3/envs/miniWorld1/lib/python3.6/multiprocessing/connection.py", line 383, in _recv
raise EOFError
Traceback (most recent call last):
EOFError
File "/anaconda3/envs/miniWorld1/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/anaconda3/envs/miniWorld1/lib/python3.6/multiprocessing/process.py", line 93, in run
self._target(*self._args, **self._kwargs)
File "/Users/[email protected]/Documents/Code/yding5/miniWorld/gym-miniworld/pytorch-a2c-ppo-acktr/vec_env/subproc_vec_env.py", line 9, in worker
cmd, data = remote.recv()
File "/anaconda3/envs/miniWorld1/lib/python3.6/multiprocessing/connection.py", line 250, in recv
buf = self._recv_bytes()
File "/anaconda3/envs/miniWorld1/lib/python3.6/multiprocessing/connection.py", line 407, in _recv_bytes
buf = self._recv(4)
File "/anaconda3/envs/miniWorld1/lib/python3.6/multiprocessing/connection.py", line 383, in _recv
raise EOFError
EOFError

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.