Commit Graph

37 Commits

Author SHA1 Message Date
Andrew Tan Jin Shen
6f1ec7cc1b Fix issues with pygame event handling (#2684)
* Fix issues with pygame event handling

* Fix display initialization and exit for jupyter
2022-03-11 11:37:04 -05:00
Markus
8d4dff1b66 Locked framerate in human-mode rendering with PyGame (#2649)
* Locked framerate in human-mode rendering for box2d and classic_control

* Fixed pyright errors

* Use the new metadata key for FPS, add toytext environments
2022-03-02 10:37:48 -05:00
trigaten
35b78ac0ab Rename render modes/fps (#2654)
* Update pendulum.py

* version warnings

* black

* try except

* update notices version

* Exception

* nosec

* black

* no loop, stderr

* black

* convert ## to ###

* correct subheader

* black

* despace

* spacing

* frozen lake fixes

* rename render modes/fps

* fix API test

* fix API test

* fix more API tests

* black

* add render fps
2022-02-28 15:54:03 -05:00
Daniel
2aa7639431 Update box2d/toy_text docs (#2622)
* Update box2d/toy_text docs

* md format and additional fixes

* grammar
2022-02-17 13:45:51 -05:00
John Balis
15049e22d7 Adding return_info argument to reset to allow for optional info dict as a second return value (#2546)
* initial draft of optional info dict in reset function, implemented for cartpole, tests seem to be passing

* merged core.py

* updated return type annotation for reset function in core.py

* optional metadata with return_info from reset added for all first party environments, with corresponding tests. Incomplete implementation for wrappers and vector wrappers

* removed Optional type for return_info arguments

* added tests for return_info to normalize wrapper and sync_vector_env

* autoformatted using black

* added optional reset metadata tests to several wrappers

* added return_info capability to async_vector_env.py and test to verify functionality

* added optional return_info test for record_video.py

* removed tests for mujoco environments

* autoformatted

* improved test coverage for optional reset return_info

* re-removed unit test envs accidentally reintroduced in merge

* removed unnecessary import

* changes based on code-review

* small fix to core wrapper typing and autoformatted record_epsisode_stats

* small change to pass flake8 style
2022-02-06 18:28:27 -05:00
Andrew Tan Jin Shen
2e36cde12e Refactor Lunar Lander and Bipedal Walker to use Pygame (#2552)
* Refactor lunar lander to use pygame

* Fix minor rendering inconsistency

* Refactor bipedal walker to use pygame

* Reformat with black

* Remove viewer

* Fix color for obstacles

* Update dependencies for box2d

* Optimize screen initialization
2022-02-05 09:42:45 -05:00
trigaten
079c4c9527 Add version histories (#2587)
* docs+credits

* docs: refactor box2d + comment version history

* fix mujoco line lengths

* fix more env line lengths

* black

* typos

* put docstrings in base environments rather than highest version

* fix richer reacher

* black

* correct black version

* continuous mountain car docstring to markdown

* remove unneeded images

* black

* fix quote

* docs: add version history to Box2D envs

* Update lunar_lander.py

Co-authored-by: Andrea PIERRÉ <andrea_pierre@brown.edu>
2022-01-29 17:53:28 -05:00
trigaten
b9e8b6c587 Reformat some docstrings, remove unneeded image links (#2578)
* docs+credits

* docs: refactor box2d + comment version history

* fix mujoco line lengths

* fix more env line lengths

* black

* typos

* put docstrings in base environments rather than highest version

* fix richer reacher

* black

* correct black version

* continuous mountain car docstring to markdown

* remove unneeded images

* black

Co-authored-by: Andrea PIERRÉ <andrea_pierre@brown.edu>
2022-01-27 15:36:50 -05:00
trigaten
a149869bcb docs+credits (#2574)
* docs+credits

* docs: refactor box2d + comment version history

* fix mujoco line lengths

* fix more env line lengths

* black

* typos

Co-authored-by: Andrea PIERRÉ <andrea_pierre@brown.edu>
2022-01-26 16:02:42 -05:00
Ariel Kwiatkowski
925823661d Add options to the signature of env.reset (#2515)
* First find/replace, now tests

* Fixes to the vector env

* Make seed keyword only in wrappers

* (try to) fix the bug with old environments using new wrappers (with the seed keyword)

* black

* Change **kwargs to options, try to make it work; black

* Add OrderEnforcing wrapper to wrapper exports
Add a test for compatibility with old (pybullet-like) envs

* Add OrderEnforcing wrapper to wrapper exports
Add a test for compatibility with old (pybullet-like) envs
black

* Update the env checker

* Update the env checker

* Update the env checker to use inspect (might fail tests, let's see)

* Allow the signature to include kwargs in env_checker

* Minor fix
2022-01-19 17:28:59 -05:00
Carlos Luis
8a96440084 Move rendering.py to utils (#2551)
* Move rendering.py to utils

* Rename rendering.py to pyglet_rendering.py
2022-01-06 13:01:29 -05:00
Andrew Tan Jin Shen
4fe7efaacd Consolidate LunarLander and BipedalWalker envs (#2522)
* Consolidate LunarLander and BipedalWalker envs

* Update LunarLander tests

* Add type hints

* Add detailed error message on instantiating deprecated environments

* Fix formatting with black pre-commit

Co-authored-by: Andrew Tan Jin Shen <andrew.tanjs@shopee.com>
2021-12-22 13:25:07 -05:00
Ariel Kwiatkowski
c364506710 Seeding update (#2422)
* Ditch most of the seeding.py and replace np_random with the numpy default_rng. Let's see if tests pass

* Updated a bunch of RNG calls from the RandomState API to Generator API

* black; didn't expect that, did ya?

* Undo a typo

* blaaack

* More typo fixes

* Fixed setting/getting state in multidiscrete spaces

* Fix typo, fix a test to work with the new sampling

* Correctly (?) pass the randomly generated seed if np_random is called with None as seed

* Convert the Discrete sample to a python int (as opposed to np.int64)

* Remove some redundant imports

* First version of the compatibility layer for old-style RNG. Mainly to trigger tests.

* Removed redundant f-strings

* Style fixes, removing unused imports

* Try to make tests pass by removing atari from the dockerfile

* Try to make tests pass by removing atari from the setup

* Try to make tests pass by removing atari from the setup

* Try to make tests pass by removing atari from the setup

* First attempt at deprecating `env.seed` and supporting `env.reset(seed=seed)` instead. Tests should hopefully pass but throw up a million warnings.

* black; didn't expect that, didya?

* Rename the reset parameter in VecEnvs back to `seed`

* Updated tests to use the new seeding method

* Removed a bunch of old `seed` calls.

Fixed a bug in AsyncVectorEnv

* Stop Discrete envs from doing part of the setup (and using the randomness) in init (as opposed to reset)

* Add explicit seed to wrappers reset

* Remove an accidental return

* Re-add some legacy functions with a warning.

* Use deprecation instead of regular warnings for the newly deprecated methods/functions
2021-12-08 16:14:15 -05:00
Elijah K
eec6167440 Py36+ syntax in gym/envs: derived by running pyupgrade --py36-plus gym/envs/**.py and flynt gym --ll 120 (#2465)
Co-authored-by: Ilya Kamen <ilya.kamenshchikov@bosch.com>
2021-11-13 19:53:32 -05:00
Ahmed Omar
2754d9737e removed calls to reset from init (#2394)
* removed all calls to reset

* passing tests

* fix off-by-one error

* revert

* merge master into branch

* add OrderEnforcing Wrapper

* add orderenforcing to the docs

* add option for disabling

* add argument to EnvSpec
2021-09-16 10:16:49 -04:00
Ariel Kwiatkowski
d7023500f3 Fix dtypes to be consistent with observation_space (#2340)
* Changed the dtypes of classic control envs to float32

* Fixed formatting via black

* Added dtype tests

* Formatting, and test error message

* Only test dtypes for Box space

* Fix Bipedal Walker and Car Racing

* Undo the car racing dtype change

* Redo the car racing dtype change - set to np.float32, and updated observation_space to reflect it
2021-08-21 18:11:19 -04:00
J K Terry
78d2b512d8 redo black (#2272) 2021-07-29 15:39:42 -04:00
Justin Terry
e9d2c41f2b redo black 2021-07-29 12:42:48 -04:00
Christian Clauss
bb81e141ea Blacken the codebase (#2265) 2021-07-28 20:26:34 -04:00
Vasco CC
8f6eb1ebd0 BUG FIX: Bipedal Walker; Car Racing; Guessing Game; Hotter Colder - Showing Warning (#2126)
* Fixing Warning issue

Fixing an issue causing a Warning message to pop because of conversion from python standard float64 to np.float32

* car_racing.py Warning Fix

Fixed a bug generating a warning with conversion from standard `float 64` to `numpy float 32`.

* Fixing Warning issue 

Fixed a bug generating a warning with conversion from standard `float 64` to `numpy float 32`.

* Fixing Warning issue

Fixed a bug generating a warning with conversion from standard `float 64` to `numpy float 32`.

* bracket missing

* Bracket misplaced
2021-07-26 15:39:04 -04:00
Alex P-B
2d247dc93a Fix BipedalWalker - now returns closest lidar trace instead of furthest (#1789)
* Fix BipedalWalker - now returns closest lidar trace instead of furthest

* additional fix for raycast failing to get nearest point

* bump bipedal walker versions from v2 to v3
2020-01-31 05:02:05 -08:00
Antonin RAFFIN
cdd212db4b Fix autodetect dtype warnings (#1234)
* Fix autodetect dtype warnings

* Use warnings module for gym logger

* Fix warning in tests
2018-11-28 17:27:27 -08:00
Josh Achiam
769c8a75d1 Makes Box2D environments pickleable. (#1177) 2018-09-24 13:16:46 -07:00
Rui Wang
293eea787a fix 2018-04-13 13:12:06 -07:00
John Schulman
4c460ba6c8 Cleanup, removal of unmaintained code (#836)
* add dtype to Box

* remove board_game, debugging, safety, parameter_tuning environments

* massive set of breaking changes
- remove python logging module
- _step, _reset, _seed, _close => non underscored method
- remove benchmark and scoring folder

* Improve render("human"), now resizable, closable window.

* get rid of default step and reset in wrappers, so it doesn’t silently fail for people with underscore methods

* CubeCrash unit test environment

* followup fixes

* MemorizeDigits unit test envrionment

* refactored spaces a bit
fixed indentation
disabled test_env_semantics

* fix unit tests

* fixes

* CubeCrash, MemorizeDigits tested

* gym backwards compatibility patch

* gym backwards compatibility, followup fixes

* changelist, add spaces to main namespaces

* undo_logger_setup for backwards compat

* remove configuration.py
2018-01-25 18:20:14 -08:00
Jie Tang
36d476224e Assert is a keyword, not a function 2016-06-16 01:17:37 -07:00
Oleg Klimov
af5bb400fe trivial fix for #143 (#187)
* trivial fix for #143

* #143 same fix for other environments, not really necessary, but still
2016-06-14 08:32:51 -07:00
Oleg Klimov
72d89cb22f Faster video recording (#119)
* Faster video recording

* rendering.py: return_rgb_array default to False, for other environments not to break
2016-06-06 00:06:26 -07:00
Greg Brockman
8a535ca6f2 Switch to a global PRNG for action/observation spaces (#144)
cf 58e6aa95e5 (commitcomment-17669277)
2016-05-30 18:07:59 -07:00
Greg Brockman
58e6aa95e5 [WIP] add support for seeding environments (#135)
* Make environments seedable

* Fix monitor bugs

- Set monitor_id before setting the infix. This was a bug that would yield incorrect results with multiple monitors.
- Remove extra pid from stats recorder filename. This should be purely cosmetic.

* Start uploading seeds in episode_batch

* Fix _bigint_from_bytes for python3

* Set seed explicitly in random_agent

* Pass through seed argument

* Also pass through random state to spaces

* Pass random state into the observation/action spaces

* Make all _seed methods return the list of used seeds

* Switch over to np.random where possible

* Start hashing seeds, and also seed doom engine

* Fixup seeding determinism in many cases

* Seed before loading the ROM

* Make seeding more Python3 friendly

* Make the MuJoCo skipping a bit more forgiving

* Remove debugging PDB calls

* Make setInt argument into raw bytes

* Validate and upload seeds

* Skip box2d

* Make seeds smaller, and change representation of seeds in upload

* Handle long seeds

* Fix RandomAgent example to be deterministic

* Handle integer types correctly in Python2 and Python3

* Try caching pip

* Try adding swap

* Add df and free calls

* Bump swap

* Bump swap size

* Try setting overcommit

* Try other sysctls

* Try fixing overcommit

* Try just setting overcommit_memory=1

* Add explanatory comment

* Add what's new section to readme

* BUG: Mark ElevatorAction-ram-v0 as non-deterministic for now

* Document seed

* Move nondetermistic check into spec
2016-05-29 09:07:09 -07:00
Oleg Klimov
b867be4001 LunarLander, BipedalWalker now count energy spent 2016-05-26 11:44:29 -07:00
Oleg Klimov
17dd787c0b Fix for #114 (#118) 2016-05-25 01:16:15 -07:00
Oleg Klimov
c2587d2bb7 BipedalWalker, LunarLander heuristic, retuned (#101)
* bipedal_walker: trivial fixes

* lunar_lander: heuristic test code, renormalized and tested reward, longer state vector

* bipedal_walker: heuristic test code, renormalized and tested reward, legs contact with ground in state vector

* bipedal_walker: description text
2016-05-16 07:12:44 -07:00
Greg Brockman
2ae0dbc846 Discard viewer object after render with close=True
Fixes #95
2016-05-15 17:22:38 -07:00
Oleg Klimov
ba9fd3435e bipedal_walker: trivial fixes (#93) 2016-05-12 07:06:04 -07:00
Jonas Schneider
6bb2d56266 Minor Python3 compat fixes 2016-05-10 17:05:47 +02:00
Oleg Klimov
3b19acdfce Box2d initial, second attempt 2016-05-03 22:27:42 +03:00