Commit Graph

1581 Commits

Author SHA1 Message Date
Ariel Kwiatkowski
00a60e6cc8 Rewriting of the registration mechanism (#2748)
* First version of the new registration

* Almost done

* Hopefully final commit

* Minor fixes

* Missing error

* Type fixes

* Type fixes

* Add some type hinting stuff

* Fix an error?

* Fix literal import

* Add a comment

* Add some docstrings

Remove old tests

* Add some docstrings, rename helper functions

* Rename a function

* Registration check fix

* Consistently use `register` instead of `envs.register` in tests

* Fix the malformed registration error message to not use a write-only format

* Change an error back to a warning when double-registering an environment
2022-04-21 14:41:15 -04:00
Rushiv Arora
0a5f543d6a Vector Api for website (#2764)
* Rephrase

* Rephrase
2022-04-21 11:15:16 -04:00
Jet
3ee7420a84 reduce wind power further for heuristic landing (#2766)
* reduce wind power further for heuristic landing

* remove wind tests for lunar lander

* don't need to reduce wind for heuristic
2022-04-21 10:53:40 -04:00
Gianluca De Cola
36a7fe5a31 Add test gym utils play. Fix #2729 (#2743)
* refactoring play function. Tests for keys to action mapping.

* Add mocking pygame events.

* partial event processing in class.

* pre-commit.

* quit pygame after tests.

* fix typos in functions names.

* Add type hint.

* Add test for play function.

* remove mockKeyEvent.

* remove unused main code.

* Adding type hints.

* catch custom exception in tests.

* Fix magic numbers.

* Add test with an actual environment.

* fix comment.

* Add TODO memo on env.render.

* change map with list comprehension.

* remove unused imports.

* Add type hint.

* typo.

* docstring.
2022-04-18 11:30:56 -04:00
Jet
613892023a Fix turn indicators not working in Carracing (#2759)
* fix impulse sample bug and add adjustable gravity

* revert weird sample thing

* assertation

* add wind

* fix wind to use applyforce

* black

* add tests for wind

* fix test bug

* run lunar lander tests over 10 runs

* reduce wind for heuristic landing

* made wind power kwarg

* reduce wind power for heuristic landing

* update doc

* remove wind power from kwarg

* fix tests by deleting tests ;)

* Add back wind power as kwarg

* the black sheep

* remove rogue plus

* slight doc fix and variable rename

* fix bug with track turn indicators

* black
2022-04-17 10:36:37 -04:00
Jet
da7b8ae8fc Made documentation for carracing more descriptive, and renamed one of the variable names (#2755) 2022-04-15 11:18:14 -04:00
Jet
c6deb81ad3 Add mild domain randomization to Car Racing Env (#2749)
* first commit domain randomize

* black

* update doc

* add some type hints and internalized some functions

* we were told, the black bear is innocent; but I should not like to trust
myself wit him

* Don't need two color conventions

* don't multiply twice

* hardcore -> domain_randomize & register

* remove rogue decorator
2022-04-15 11:04:24 -04:00
Jet
681a99296e Add gravity and wind as kwarg in Lunar Lander (#2746)
* fix impulse sample bug and add adjustable gravity

* revert weird sample thing

* assertation

* add wind

* fix wind to use applyforce

* black

* add tests for wind

* fix test bug

* run lunar lander tests over 10 runs

* reduce wind for heuristic landing

* made wind power kwarg

* reduce wind power for heuristic landing

* update doc

* remove wind power from kwarg

* fix tests by deleting tests ;)

* Add back wind power as kwarg

* the black sheep

* remove rogue plus
2022-04-15 11:03:54 -04:00
Omar Younis
1a3a891b2a fix #2723 and remove unuseful board (#2754) 2022-04-15 11:03:22 -04:00
Jet
5ae6bf9634 Bipedal fix bounds and type hints (#2750)
* Add some missing typehints for bipedal walker

* fix bounds

* fix boudns
2022-04-13 20:23:07 -04:00
Jordan Terry
33970e2b1c Update README.md 2022-04-13 16:02:46 -04:00
Andrea PIERRÉ
06072ed2cb fix: type ignore from #2739 (#2744) 2022-04-11 13:27:23 -04:00
Mark Towers
b7179241ec Update the parametrize to show the ids of the specification to make debugging easier (#2740) 2022-04-10 13:36:23 -04:00
Markus Krimmel
2ac8553c67 Added kwarg documentation for BlackJack and LunarLander (#2742) 2022-04-10 00:37:22 -04:00
John Balis
d4cda255ea AutoResetWrapper integration with gym.make() (#2728)
* added autoreset wrapper and tests

* added basic inline documentation for autoreset wrapper

* changes to comply with flake8 style

* redid autoreset wrapper

* compliance with flake8

* added final_info to info

* removed unnecessary override from autoreset wrapper

* fixed ordering mistake

* fixed flake8 compliance

* improved clarify of inline documentation

* changes to address code review

* changed autoreset terminal state keys, added message to key overlap check assert statement, updated autoreset wrapper docstring

* auto-reset integration draft

* changed arg name to autoreset for consistency

* pre commit compliance

* formatting compliance

* addressed code review

* removed commented out line
2022-04-08 10:54:49 -04:00
Omar Younis
623dd8d6a5 fix #2736 (#2737) 2022-04-08 08:57:40 -04:00
Gianluca De Cola
227e246ff6 Pyright versioning update. Fix #2700 (#2739)
* Moved pygame imports into render

* Formatting

* Make pygame optional for box2d, try to make formatting work

* fix tests, fix pre-commit.

* Update ci linter config.

* fix type hints for latest pyright version and backward compatibility with numpy <= 1.21.5

* pre-commit.

Co-authored-by: Ariel Kwiatkowski <ariel.j.kwiatkowski@gmail.com>
Co-authored-by: Gianluca De Cola <gianluca.decola@ags-it.com>
2022-04-07 21:19:52 -04:00
Jordan Terry
3fd204dc95 Update README.md 2022-04-07 19:36:05 -04:00
Markus Krimmel
bfdd2596af Changed reward_threshold from int to float (#2735) 2022-04-06 15:14:12 -04:00
Manuel Goulão
658d4081c0 fix and complete docstrings to match the documentation page (#2697) 2022-04-06 15:12:55 -04:00
Gianluca De Cola
07fd227a4f Make pygame optional for Box2D. Fix ci. Closes #2712 (#2731)
* Moved pygame imports into render

* Formatting

* Make pygame optional for box2d, try to make formatting work

* fix tests, fix pre-commit.

Co-authored-by: Ariel Kwiatkowski <ariel.j.kwiatkowski@gmail.com>
Co-authored-by: Gianluca De Cola <gianluca.decola@ags-it.com>
2022-04-05 16:13:31 -04:00
Omar Younis
e11231d84f add pygame GUI render for taxi env (#2713) 2022-04-02 10:20:35 -04:00
trigaten
752af3c57d Fix black version (#2724)
* isort

* update pre commit
2022-04-01 09:01:34 -04:00
Ariel Kwiatkowski
bc17d9f7e7 Make pygame optional in classic control and toy text envs (#2712)
* Moved pygame imports into render

* Formatting
2022-03-31 18:55:48 -04:00
Alexis DUBURCQ
214a835e76 Wrapper should not overwrite default render mode (#2706) 2022-03-31 16:28:17 -04:00
Mark Towers
4f230499af Fixed warnings produced by test_record_video.py and test_video_recorder.py (#2703)
* Fixed warnings produced by test_record_video.py and test_video_recorder.py by using the self._frames_per_sec value as default value if video.frames_per_second is missing

* The default backward compatible values if video.frames_per_second and video.output_frames_per_seconds are the updated frames_per_sec and output_frames_per_sec values
2022-03-31 16:25:37 -04:00
Markus Krimmel
1285fed2f2 Update check_env (#2717)
* Added check for return_info, only warn about missing render_fps if human mode is available

* Require render_fps if any kind of rendering is implemented
2022-03-31 16:09:43 -04:00
Andrea PIERRÉ
e913bc81b8 Improve pre-commit workflow (#2602)
* feat: add `isort` to `pre-commit`

* ci: skip `__init__.py` file for `isort`

* ci: make `isort` mandatory in lint pipeline

* docs: add a section on Git hooks

* ci: check isort diff

* fix: isort from master branch

* docs: add pre-commit badge

* ci: update black + bandit versions

* feat: add PR template

* refactor: PR template

* ci: remove bandit

* docs: add Black badge

* ci: try to remove all `|| true` statements

* ci: remove lint_python job

- Remove `lint_python` CI job
- Move `pyupgrade` job to `pre-commit` workflow

* fix: avoid messing with typing

* docs: add a note on running `pre-cpmmit` manually

* ci: apply `pre-commit` to the whole codebase
2022-03-31 15:50:38 -04:00
witoong623
d6a3431c60 call close method of Wrapper when overriding (#2711)
add a call to __del__ of parent class

Revert "add a call to __del__ of parent class"

This reverts commit 24d40d871e4a5858a4a2e70bdc2c155504b4e5a6.
2022-03-25 13:21:59 -04:00
John Balis
05df86e104 autoreset wrapper (#2650)
* added autoreset wrapper and tests

* added basic inline documentation for autoreset wrapper

* changes to comply with flake8 style

* redid autoreset wrapper

* compliance with flake8

* added final_info to info

* removed unnecessary override from autoreset wrapper

* fixed ordering mistake

* fixed flake8 compliance

* improved clarify of inline documentation

* changes to address code review

* changed autoreset terminal state keys, added message to key overlap check assert statement, updated autoreset wrapper docstring
2022-03-25 13:20:02 -04:00
H4sh3
64a0eb0193 make error message on accessing private attributes more representative (#2714) 2022-03-24 14:10:06 -04:00
Mark Towers
941e5bfea3 Fixed issue 2702 (#2705)
* Fixed bug for issue 2702 where blackjack and frozen lake won't close the render on jupyter notebook

* As screen is initialised outside __init__, close needs to check if screen exists as an attribute before quitting pygame
2022-03-20 11:32:08 -04:00
Zhiqing Xiao
aa7aebcdbd Remove duplicated import (#2708)
numpy has been import at the beginning of this file: https://github.com/openai/gym/blob/master/gym/spaces/space.py#L13
2022-03-20 10:54:17 -04:00
Andrea PIERRÉ
3e7eb2e29e fix: duplicated dependency (#2704) 2022-03-19 22:42:56 -04:00
Jordan Terry
c8c42a5d9a minor update 2022-03-16 19:55:42 -04:00
Jordan Terry
00c0c04f2f refresh notable related libraries 2022-03-16 19:52:57 -04:00
trigaten
27464d34e8 black (#2698)
* 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

* render_fps API test

* black

* Update env_checker.py

* black
2022-03-15 20:35:55 -04:00
J K Terry
f00933a0c3 fix credits 2022-03-15 00:41:02 -04:00
Mark Towers
850247f888 Reduces warnings produced by pytest from ~1500 to 13 (#2660)
* Updated cartpole-v0 to v1 to prevent warning and added pytest.mark.filterwarnings for tests where warnings are unavoidable

* Change np.bool to bool as numpy raises a warning and bool is the suggested solution

* Seeding randint is deprecated in the future, integers is new solution

* Fixed errors thrown when the video recorder is deleted but not closed

* spaces.Box expects a floating array, updated all cases where this was not true and modified float32 to float64 as float array default to float64. Otherwise space.Box raises warning that dtype precision (float32) is lower than array precision (float64).

* Added pytest.mark.filterwarnings to preventing the raising of an intended warning

* Added comment to explain why a warning is raised that can't be prevented without version update to the environment

* Added comment to explain why warning is raised

* Changed values to float as expected by the box which default to float64

* Removed --forked from pytest as the pytest-forked project is no being maintained and was not raising warnings as expected

* When AsyncVectorEnv has shared_memory=True then a ValueError is raised before _state is initialised. Therefore, on the destruction on the env an error is thrown in .close_extra as _state does not exist

* Possible fix that was causing an error in test_call_async_vector_env by ensuring that pygame resources are released

* Pygame throws an error with ALSA when closed, using a fix from PettingZoo (https://github.com/Farama-Foundation/PettingZoo/blob/master/pettingzoo/__init__.py). We use the dsp audiodriver to prevent this issue

* Modification due to running pre-commit locally

* Updated cartpole-v0 to v1 to prevent warning and added pytest.mark.filterwarnings for tests where warnings are unavoidable

* Change np.bool to bool as numpy raises a warning and bool is the suggested solution

* Seeding randint is deprecated in the future, integers is new solution

* Fixed errors thrown when the video recorder is deleted but not closed

* spaces.Box expects a floating array, updated all cases where this was not true and modified float32 to float64 as float array default to float64. Otherwise space.Box raises warning that dtype precision (float32) is lower than array precision (float64).

* Added pytest.mark.filterwarnings to preventing the raising of an intended warning

* Added comment to explain why a warning is raised that can't be prevented without version update to the environment

* Added comment to explain why warning is raised

* Changed values to float as expected by the box which default to float64

* Removed --forked from pytest as the pytest-forked project is no being maintained and was not raising warnings as expected

* When AsyncVectorEnv has shared_memory=True then a ValueError is raised before _state is initialised. Therefore, on the destruction on the env an error is thrown in .close_extra as _state does not exist

* Possible fix that was causing an error in test_call_async_vector_env by ensuring that pygame resources are released

* Pygame throws an error with ALSA when closed, using a fix from PettingZoo (https://github.com/Farama-Foundation/PettingZoo/blob/master/pettingzoo/__init__.py). We use the dsp audiodriver to prevent this issue

* Modification due to running pre-commit locally
2022-03-14 10:27:03 -04:00
Rushiv Arora
b1b0a123ec Docs pusher (#2693)
* Pusher Docs

* Fix precommit
2022-03-13 23:49:35 -04:00
Rushiv Arora
e5bac2ab51 Wipeout striker thrower (#2694)
* Pusher Docs

* Fix precommit

* remove striker and thrower archive files
2022-03-13 23:49:27 -04:00
Zhiqing Xiao
57b157b80b Fix misleading warning message. (#2690)
`pip install gym[atari]` will not install opencv. Correct way to install opencv is `pip install gym[other]` .
2022-03-13 11:58:11 -04:00
Omar Younis
6eec83cebb fix documentation cliffwalking (#2686) 2022-03-11 17:56:57 -05:00
Costa Huang
028686c61e Actually displays deprecation warnings (#2685) 2022-03-11 17:46:21 -05:00
Jordan Terry
252c333337 Update version.py 2022-03-11 12:22:18 -05:00
Michael Joseph Rosenthal
25f80c4bb0 Add py.typed to package_data (#2683)
As is described in https://peps.python.org/pep-0561/#packaging-type-information
2022-03-11 12:15:26 -05:00
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
Costa Huang
29cf1e5393 Make VideoRecorder backward-compatible to gym<0.23 (#2678)
* Make `VideoRecorder` backward-compatible to `gym<0.23`

* Format

* format
2022-03-10 13:40:49 -05:00
J K Terry
2dddaf722a Update version.py 2022-03-04 15:50:53 -05:00
Tristan Deleu
e671aa168c Fix space utils for Discrete with non-zero start (#2645)
* Fix flatten utils to handle Discrete.start

* Fix vector space utils to handle Discrete.start

* More granular dispatch in vector utils

* Fix Box including the high end of the interval
2022-03-04 15:17:16 -05:00