Farama-Foundation / Miniworld

Simple and easily configurable 3D FPS-game-like environments for reinforcement learning
http://miniworld.farama.org/
Apache License 2.0
703 stars 131 forks source link

ValueError: high - low < 0 #56

Closed whwang8 closed 2 years ago

whwang8 commented 2 years ago

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/runtests.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

whwang8 commented 2 years ago

I realized this was fixed in #51