Commit Graph

31 Commits

Author SHA1 Message Date
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
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
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
Ishan Manchanda
103b7633f5 Readded overwritten changes for offset functionality for Discrete spaces (#2470)
Co-authored-by: J K Terry <justinkterry@gmail.com>
2021-10-30 12:12:01 -04:00
J K Terry
531d4d02db Revert "Update pendulum.py (#2444)" (#2475)
This reverts commit 7869eca817.
2021-10-30 11:52:01 -04:00
Zeeshan Ali
7869eca817 Update pendulum.py (#2444)
* Update pendulum.py

I have added the description of the class as much as I could, it needs to be completed.

* Update pendulum.py

* Update pendulum.py

* Update pendulum.py

* Update pendulum.py

* Update pendulum.py

I think the observation space is Box(1) as per the __init__ func.
2021-10-29 16:45:54 -04:00
Ariel Kwiatkowski
d199778b9e Pendulum updates (#2423)
* Pendulum env updates

Simplify the math a bit (no difference in behavior)

* Reorder the clipping of angular velocity

* Bump version of Pendulum

* black

* Update mentions of Pendulum-v0 to Pendulum-v1.
2021-09-25 14:00:28 -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
Oliver Limoyo
06e16dd586 Fix pendulum rendering when sending zero control (#2307) 2021-08-20 22:22:47 -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
InstanceLabs
9e9bb2830f Clean up pendulum environment. (#1877) 2020-04-24 16:56:04 -05:00
Xingdong Zuo
a14e1c7292 Fix unnecessary warnings (#1800)
* Update pendulum.py

* Update continuous_mountain_car.py

* Update cartpole.py

* Update mujoco_env.py

* Update mountain_car.py

* Update acrobot.py
2020-02-29 01:11:29 +01:00
marload
72a400a594 fix: Invalud argument format (#1822) 2020-02-29 00:55:13 +01:00
Ben Wiener
af6d98fd98 Unified the physical constants in the constructor (#1716)
Thought this was more readable.
2019-10-25 14:22:10 -07:00
Abhinav Sagar
c3becbbf0c Fix gravity constant (#1515)
* Added pendulumV2 with SI units

* Added pendulumV2 with SI units

* Fix gravity constant

* Delete pendulumV2.py

* Update pendulum.py

* Update pendulum.py

* Update pendulum.py
2019-06-21 16:30:04 -07:00
Xingdong Zuo
924d134939 Update pendulum.py (#1073) 2018-09-17 10:33:25 -07:00
cfperez
243226bee0 Fix env.close() to allow re-opening window (#1155) 2018-09-14 13:36:57 -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
Olivier Sigaud
c97551e8e5 added continuous mountain car v0 (#306)
* added continuous mountain car v0

* spotted that the action should be a vector, not a scalar

* fixed bug on action format

* bug fixed in scoreboard registering

* the observation (aka state) should be a numpy array

* added comment on reward range as requested
2016-08-24 14:10:58 -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
Greg Brockman
2ae0dbc846 Discard viewer object after render with close=True
Fixes #95
2016-05-15 17:22:38 -07:00
Josh Marlow
7908761a60 Removed legacy super() rendering calls (#78) 2016-05-09 18:06:48 -07:00
Josh Marlow
9529fa731b Replaced is string comparison with == (#77) 2016-05-09 17:51:04 -07:00
Greg Brockman
e8f2980603 Initial release. Hello world :). 2016-04-27 08:00:58 -07:00