Commit Graph

1615 Commits

Author SHA1 Message Date
Mark Towers
bbf8f5a467 Bump the ale-py version (#2832)
* Up the ale-py version

* Updates the ale-py version
2022-05-24 10:27:22 -04:00
Rodrigo de Lazcano
3e006f3ea5 Add new MuJoCo bindings (#2762) 2022-05-24 08:47:51 -04:00
Andrew Tan
8f9b62f6a6 Fix scale for Car Racing (#2831)
* Shift relative position of coordinates in render

* Format file
2022-05-23 14:42:53 -04:00
Arjun KG
a37b956d57 Add support for including module with gym.make (#2815) 2022-05-23 08:53:59 -04:00
Mark Towers
e2266025e6 Pydocstyle utils vector docstring (#2788)
* Added pydocstyle to pre-commit

* Added docstrings for tests and updated the tests for autoreset

* Add pydocstyle exclude folder to allow slowly adding new docstrings

* Add docstrings for setup.py and gym/__init__.py, core.py, error.py and logger.py

* Check that all unwrapped environment are of a particular wrapper type

* Reverted back to import gym.spaces.Space to gym.spaces

* Fixed the __init__.py docstring

* Fixed autoreset autoreset test

* Updated gym __init__.py top docstring

* Fix examples in docstrings

* Add docstrings and type hints where known to all functions and classes in gym/utils and gym/vector

* Remove unnecessary import

* Removed "unused error" and make APIerror deprecated at gym 1.0

* Add pydocstyle description to CONTRIBUTING.md

* Added docstrings section to CONTRIBUTING.md

* Added :meth: and :attr: keywords to docstrings

* Added :meth: and :attr: keywords to docstrings

* Imported annotations from __future__ to fix python 3.7

* Add __future__ import annotations for python 3.7

* isort

* Remove utils and vectors for this PR and spaces for previous PR

* Update gym/envs/classic_control/acrobot.py

Co-authored-by: Markus Krimmel <montcyril@gmail.com>

* Update gym/envs/classic_control/acrobot.py

Co-authored-by: Markus Krimmel <montcyril@gmail.com>

* Update gym/envs/classic_control/acrobot.py

Co-authored-by: Markus Krimmel <montcyril@gmail.com>

* Update gym/spaces/dict.py

Co-authored-by: Markus Krimmel <montcyril@gmail.com>

* Update gym/utils/env_checker.py

Co-authored-by: Markus Krimmel <montcyril@gmail.com>

* Update gym/utils/env_checker.py

Co-authored-by: Markus Krimmel <montcyril@gmail.com>

* Update gym/utils/env_checker.py

Co-authored-by: Markus Krimmel <montcyril@gmail.com>

* Update gym/utils/env_checker.py

Co-authored-by: Markus Krimmel <montcyril@gmail.com>

* Update gym/utils/env_checker.py

Co-authored-by: Markus Krimmel <montcyril@gmail.com>

* Update gym/utils/ezpickle.py

Co-authored-by: Markus Krimmel <montcyril@gmail.com>

* Update gym/utils/ezpickle.py

Co-authored-by: Markus Krimmel <montcyril@gmail.com>

* Update gym/utils/play.py

Co-authored-by: Markus Krimmel <montcyril@gmail.com>

* Pre-commit

* Updated docstrings with :meth:

* Updated docstrings with :meth:

* Update gym/utils/play.py

* Update gym/utils/play.py

* Update gym/utils/play.py

* Apply suggestions from code review

Co-authored-by: Markus Krimmel <montcyril@gmail.com>

* pre-commit

* Update gym/utils/play.py

Co-authored-by: Markus Krimmel <montcyril@gmail.com>

* Updated fps and zoom parameter docstring

* Update play docstring

* Apply suggestions from code review

Added suggested corrections from @markus28

Co-authored-by: Markus Krimmel <montcyril@gmail.com>

* Pre-commit magic

* Update the `gym.make` docstring with a warning for `env_checker`

* Updated and fixed vector docstrings

* Update test names for reflect the project filename style

Co-authored-by: Markus Krimmel <montcyril@gmail.com>
2022-05-20 09:49:30 -04:00
Ariel Kwiatkowski
1b09191535 Add a compatibility layer for the new registration mechanism (#2818)
* Added some compat methods

* Some missing methods

* Update registration.py

* Style fix
2022-05-20 09:47:43 -04:00
Ariel Kwiatkowski
fd9cffedfb Add a minimal env checker on gym.make (#2807)
* Add a minimal env checker on make

* Unpack the space checker for custom messages

* Update some dummy envs to use the right API

* Try to fix observation space checking

* And again

* Wrong env

* Swap the minimal env checker to the regular env checker.

Change the argument name

* Disable env checker for two test envs

* Conver env checker exception into warnings.

* Reenable env checker for test envs, it should only raise warning, no exceptions
2022-05-18 16:56:10 -04:00
Mark Towers
5f237ac1f8 Render order enforcing (#2805) 2022-05-18 10:07:54 -04:00
Andrew Tan
64b4b31d82 Fix edge case for out of bounds (#2822)
* Fix edge case for out of bounds

This deals with the edge case where an object's corner may not be in the screen, but the object still overlaps and should be drawn.

* Calculate maximum diagonal for out of bounds calculation
2022-05-16 12:37:43 -04:00
Gianluca De Cola
6112b0d9d2 Upgrade test_action_dim. Refer to #2767 (#2802)
* Add action in bound checks.

* add correct dtype to clip_action test.

* ensure correct dtype in tests.

* action check in car_racing no more needed.

* Prune PR. parametrize tests with spec_list.

* revert changes.

* remove file.

* remove magic number.

* test both upper and lower bound for every action.

* assert oob is really out of bound. also bugfix in action performed

* valide car racing discrete action. Add docstrings. Include car racing discrete in tests.

Co-authored-by: Gianluca De Cola <gianluca.decola@ags-it.com>
2022-05-16 11:54:58 -04:00
Travis Virgil
7fc2ebf9b5 [Proposal] Add turbulance disturbance to LunarLander (#2808)
* create torque function

* create comment for torque function

* remove second arg from ApplyTorque

* lower torque mag wind power to 20%

* Add torque_power as kwarg

* Use torque_power in ApplyTorque function

* Set torque_wind kwarg default to 1.5

* Update version history for torque_power

* Updated version 2 history for 0.24

* Updated arguments to include torque_power

* Update assert for wind_power and torque_power can equal 0.0

* Update version history for v2

* Change torque_wind to turbulance_wind

* Remove assert for wind_power, turbulence_power. Add warnings for wind_power, turbulence_power. Add recommendations for wind_power, turbulence_power to docs.

* Update docs definition/recommended values for wind_power, turbulence_power

* Add `v` before `0.24` version description
2022-05-16 11:54:48 -04:00
Markus Krimmel
bf0113bfa1 Improve `play` (#2819)
* Add NOOP to play, allow for unordered key combination, strings as keys

* Extended type hint
2022-05-15 09:56:06 -04:00
Andrew Tan
58081edb41 Improve performance for car racing rendering (#2821)
* Improve performance for car racing rendering

This change eliminates unnecessary drawing by pygame if it is out of bounds

* Fix format with black

* Fix out of bounds condition
2022-05-14 15:54:03 -04:00
Mark Towers
bf688c3efe Pydocstyle wrappers docstrings (#2787) 2022-05-13 08:58:19 -04:00
Mark Towers
9a5db3b77a Remove try except from box2d __init__.py as the environment have try except natively (#2816) 2022-05-12 11:18:22 -04:00
Gianluca De Cola
350a082d2f Upgrade test_determinism. Refer to #2767 (#2814) 2022-05-12 09:33:48 -04:00
Markus Krimmel
745e7059e7 Pydocstyle spaces docstring (#2798)
* Added docstrings for spaces, WIP

* Formatting changes

* Use raw docstring for Box.sample

* Formatting fix

* Formatting fix

* Use :class:, :meth:, formatting fixes, resolve TODO, use Optional
2022-05-10 11:18:06 -04:00
Mark Towers
1c62d3c6ad Add Pydocstyle to CI (#2785)
* Added pydocstyle to pre-commit

* Added docstrings for tests and updated the tests for autoreset

* Add pydocstyle exclude folder to allow slowly adding new docstrings

* Add docstrings for setup.py and gym/__init__.py, core.py, error.py and logger.py

* Check that all unwrapped environment are of a particular wrapper type

* Reverted back to import gym.spaces.Space to gym.spaces

* Fixed the __init__.py docstring

* Fixed autoreset autoreset test

* Updated gym __init__.py top docstring

* Remove unnecessary import

* Removed "unused error" and make APIerror deprecated at gym 1.0

* Add pydocstyle description to CONTRIBUTING.md

* Added docstrings section to CONTRIBUTING.md

* Added :meth: and :attr: keywords to docstrings

* Added :meth: and :attr: keywords to docstrings

* Update the step docstring placing the return type in the as a note.

* Updated step return type to include each element

* Update maths notation to reward range

* Fixed infinity maths notation
2022-05-10 10:35:45 -04:00
Mark Towers
31e6f23e67 Add pyright to precommit (#2796) 2022-05-09 11:22:49 -04:00
Arjun KG
40c26ab9c6 BugFix - VecEnvWrapper doesn't forward call, set_attr to self.env (#2800)
* add call, set_attr, __del__ to VecEnvWrapper

* add docstring for test
2022-05-06 10:49:46 -04:00
Mark Towers
b044b9043c Fixed bug where the env could terminate while checking observations and actions (https://github.com/openai/gym/issues/2803) (#2804) 2022-05-06 09:36:35 -04:00
Ariel Kwiatkowski
971aea8502 Fixes to the new registration (#2771) 2022-05-05 09:43:53 -04:00
Gianluca De Cola
b4f40f5ab6 Add deprecation warning on PlayPlot. (#2792) 2022-05-02 11:58:23 -04:00
Mark Towers
2708d818a3 Changes the gym box2d, toy-text and classic-control entry points to their actual file not __init__.py import (#2791) 2022-05-02 11:40:20 -04:00
Mark Towers
b704d4660e Place try except around all imports of pygame (#2782)
* Place try except around all imports for pygame and optional modules in box2d, classic_control and toy_text

* Updated all ImportErrors to DependencyNotInstalled

* Re-add comment on why pygame is imported
2022-04-29 19:44:28 -04:00
Markus Krimmel
ae15f59d79 Added docstrings for wrappers, some typehints (#2784) 2022-04-29 19:43:59 -04:00
Jet
5c8ce49852 Add discrete action space for Carracing (#2761)
* 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

* add discrete environment for carracing

* update docs

* reduce acceleration magnitude

* reduce wind power to near nothing for heuristic landings

* undo change on this branch

* change actions

* remove redundant import

* fix docs
2022-04-29 18:48:19 -04:00
Mark Towers
bf093c6890 Update the flake8 pre-commit ignores (#2778)
* Remove additional ignores from flake8

* Remove all unused imports

* Remove all unused imports

* Update flake8 and pyupgrade

* F841, removed unused variables

* E731, removed lambda assignment to variables

* Remove E731, F403, F405, F524

* Remove E722, bare exceptions

* Remove E712, compare variable == True or == False to is True or is False

* Remove E402, module level import not at top of file

* Added --pre-file-ignores

* Add --per-file-ignores removing E741, E302 and E704

* Add E741, do not use variables named ‘l’, ‘O’, or ‘I’ to ignore issues in classic control

* Fixed issues for pytest==6.2

* Remove unnecessary # noqa

* Edit comment with the removal of E302

* Added warnings and declared module, attr for pyright type hinting

* Remove unused import

* Removed flake8 E302

* Updated flake8 from 3.9.2 to 4.0.1

* Remove unused variable
2022-04-26 11:18:37 -04:00
Vairo Di Pasquale
4ecc2ad35a Improved taxi documentation (#2777)
* Improved documentation to specify decode state space

* Improve taxi documentation
2022-04-26 11:17:32 -04:00
Yuji Kanagawa
0c78ea5964 Avoid using deperecated distutils package (#2770) 2022-04-25 07:58:38 -04:00
efokschaner
feb7ec3bc2 Fix docstring format on seed arg to reset (#2775)
I have a copy of this string in another project and it failed the darglint docstring style check.
This fixes that, if it's something you care to fix.
2022-04-24 13:01:20 -04:00
Ilya Kamen
3f7de05801 Remove orphan comment (#2774)
* Remove orphan comment

The comment used to be due to the line that is not there anymore, like:
```python
from gym.envs.mujoco.mujoco_env import MujocoEnv

# ^^^^^ so that user gets the correct error
# message if mujoco is not installed correctly
```

Now the comment is useless.

* Update __init__.py
2022-04-24 12:15:16 -04:00
Mark Towers
3354451300 Fixed batch spaces where the original space's seed was ignored. Issue 2680 (#2727)
* Add a case for the Box shape where the low and high values are both scalars

* Add seeding.RandomNumberGenerator parameter to Dict seed. Modify __repr__ for the dictionary space string looks similar to an actual dictionary

* Add seeding.RandomNumberGenerator parameter to Multi Binary seed

* Add seeding.RandomNumberGenerator parameter to Multi Binary seed. Modify nvec typing to include np.ndarray

* Space seed typing can be a seeding.RandomNumberGenerator. If a seeding.RNG is provided then it is assigned to _np_random and .seed is not run

* Fixed the tuple seeding type as List[int] is not a valid Space seed type

* Added typing to batch_space. The batch_space seed is equal to the space's seeding

* Fixed the seeding type

* Add test for batch space seeds are identical to the original space's seeding

* Add equivalence function for RandomNumberGenerator comparing the bit_generator.state

* The batch_space functions uses a copy of the seed for the original space

* Set the action space seed for sync_vector_env seed testing

* Add test for the seeding of the sync vector environment

* Update the test_batch_space_seed to check the resulting sampling are equivalent for testing

* Revert representation back to the original version

* Remove additional Box shape initialisation

* Remove additional typing of MultiDiscrete

* Fixed bug of Space batch space where the original space's np_random is not a complete copy of the original space

* Add CustomSpace to the batched space seed test

* Modify the CustomSpace sample to produce a random number not a static value

* Fix CustomSpace to reflect the sample function

* Copy the space.np_random for the batched_space seed to ensure that the original space doesn't sampling doesn't effect the batched_space

* Parameterized the batch_space_seed, added testing for rng_different_at_each_index and test_deterministic

* Black and isort pre-commit changes

* Pre-commit fix

* MacOS, test_read_from_shared_memory throws an error that the inner _process_write function was unpicklable. Making the function a top-level function solves this error

* Fixed typing of seed where a space's seed function differs from Space.seed's typing

* Added check that the sample lengths are equal and explicitly provided the number of batched spaces n=1

* Removed relative imports for absolute imports

* Use deepcopy instead of copy

* Replaces `from numpy.testing._private.utils import assert_array_equal` with `from numpy.testing import assert_array_equal`

* Using the seeding `__eq__` function, replace `np_random.bit_generator.state` with `np_random`

* Added docstrings and comments to the tests to explain their purpose

* Remove __eq__ from RandomNumberGenerator and add to tests/vector/utils

* Add sync vector determinism test for issue #2680

* Fixed bug for 462101d384 (r850740825)

* Made the new seeds a list of integers
2022-04-24 12:14:33 -04:00
Gianluca De Cola
dcae553204 Remove magic numbers. Imports cleanup. Remove redudant test. (#2769) 2022-04-21 18:21:44 -04:00
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