Commit Graph

48 Commits

Author SHA1 Message Date
Omar Younis
f2aeb823f7 check render_mode in make (#2896) 2022-06-16 12:29:44 -04:00
Omar Younis
9acf9cd367 Render API (#2671)
* add pygame GUI for frozen_lake.py env

* add new line at EOF

* pre-commit reformat

* improve graphics

* new images and dynamic window size

* darker tile borders and fix ICC profile

* pre-commit hook

* adjust elf and stool size

* Update frozen_lake.py

* reformat

* fix #2600

* #2600

* add rgb_array support

* reformat

* test render api change on FrozenLake

* add render support for reset on frozenlake

* add clock on pygame render

* new render api for blackjack

* new render api for cliffwalking

* new render api for Env class

* update reset method, lunar and Env

* fix wrapper

* fix reset lunar

* new render api for box2d envs

* new render api for mujoco envs

* fix bug

* new render api for classic control envs

* fix tests

* add render_mode None for CartPole

* new render api for test fake envs

* pre-commit hook

* fix FrozenLake

* fix FrozenLake

* more render_mode to super - frozenlake

* remove kwargs from frozen_lake new

* pre-commit hook

* add deprecated render method

* add backwards compatibility

* fix test

* add _render

* move pygame.init() (avoid pygame dependency on init)

* fix pygame dependencies

* remove collect_render() maintain multi-behaviours .render()

* add type hints

* fix renderer

* don't call .render() with None

* improve docstring

* add single_rgb_array to all envs

* remove None from metadata["render_modes"]

* add type hints to test_env_checkers

* fix lint

* add comments to renderer

* add comments to single_depth_array and single_state_pixels

* reformat

* add deprecation warnings and env.render_mode declaration

* fix lint

* reformat

* fix tests

* add docs

* fix car racing determinism

* remove warning test envs, customizable modes on renderer

* remove commments and add todo for env_checker

* fix car racing

* replace render mode check with assert

* update new mujoco

* reformat

* reformat

* change metaclass definition

* fix tests

* implement mark suggestions (test, docs, sets)

* check_render

Co-authored-by: J K Terry <jkterry0@gmail.com>
2022-06-07 18:20:56 -04:00
Rodrigo de Lazcano
8a323c9479 Fix issue #2860 (#2861)
* fix arguments key callback

	* close env in renderer

	* mujoco_rendering close base method
2022-06-04 14:28:31 -04:00
Mark Towers
273e3f22ce Updated docstrings using darglint (#2827)
* Updated docstrings using darglint, ignoring 402 and 202 plus shortened lines into multiple where they were overflowing

* Remove abstract method decorators, for a future PR

* Add __future__ import annotation for python 3.7+ notion

* Added missing bracket

* Fix minor docstring tables
2022-05-25 09:46:41 -04:00
Rodrigo de Lazcano
3e006f3ea5 Add new MuJoCo bindings (#2762) 2022-05-24 08:47:51 -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
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
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
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
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
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
Minghuan Liu
01b4519d9d Fix action dimension check bugs (#2469)
* fix action dimension check bugs

* black codes, add test function

* clear codes for simplicity

* update check mujoco install
2021-11-17 18:11:40 -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
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
ryota-mo
e02ed92b44 Specify the camera of depth_array (#1960)
* specify the camera of depth_array

* exclude human
2020-06-19 14:42:26 -07: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
Peter Zhokhov
5fef6458a7 fix mujoco tests 2019-08-23 15:39:03 -07:00
Kristian Hartikainen
a49c3e0fc8 Feature/pixel observation wrapper (#1499)
* Implement PixelObservationWrapper

* Change MujocoEnv.render to support custom camera_{name,id}

* Implement tests for PixelObservationWrapper

* Use env.get_pixels instead of direct env.render

* Fix camera_{id,name} check in pixel observation wrapper

* Fix rendering with explicit camera_id

* Add Wrapperget_pixels to allow call to be propagated to wrapped env

* Remove use of unnecessary `get_pixels` method

* Update PixelObservationWrapper to support multiple pixel keys

* Remove unnecessary `rgb_rendering_tracking` argument

* Remove rgb_rendering_tracking logic
2019-08-23 15:02:33 -07:00
Kristian Hartikainen
f6209d4e17 Allow observation and action spaces to be customized in MujocoEnv (#1498)
* Add new _set_{observation,_action}_space methods for MujocoEnv,
  allowing customized spaces.
* Implement automatic handling of dict observation spaces
2019-06-07 14:43:05 -07:00
Peter Zhokhov
dbab98c367 rgb_rendering_tracking default value set to True 2019-03-25 12:25:06 -07:00
pzhokhov
663515c8d2 add optional tracking for mujoco locomotion in the rgb rendering mode (issue 1135) (#1405)
* switch rgb_array camera to 0

* merge latest master

* add tracking camera for swimmer

* test track camera name to be in valid names

* add rgb_rendering_tracking kwarg to locomotion mujoco envs; fixes 1135

* fix track camera logic in mujoco_env.py
2019-03-25 12:17:38 -07:00
pzhokhov
a9d7fc7dd1 remove vertical camera motion on env.reset() (#1174)
* remove vertical camera motion on env.reset()

* In MuJoCo envs, don't reset viewers on environment reset. If the user moves around the camera in the viewer, allow them to keep the camera wherever they put it.

* Docstring update.
2018-09-24 14:53:23 -07:00
Norman Mu
4053e6068a specify explicit dtype in Box objects (#994) 2018-09-21 11:55:52 -07:00
pzhokhov
69f5f98330 test dockerfiles for ubuntu 14.04 and 18.04 (#1168)
* pass device_id=-1 when rendering mujoco in rgb_array mode

* trying ubuntu18.04 build

* use travis build matrix

* use travis build matrix

* use travis build matrix

* use fix 18.04 installation steps

* use fix 18.04 installation steps

* try py3 instead of py35

* trying the 14.04 build; cleaning up the 16.04 package list

* fixes to dockerfile.14.04

* fixes to dockerfile.14.04

* fixes to dockerfile.14.04

* fixes to dockerfile.14.04

* fixes to dockerfile.14.04

* fixing system package list for 14.04

* 16.04 build working

* clean up test.dockerfile.16.04

* adding python-numpy system package

* add patchelf

* remove python-numpy from 16.04 dockerfile

* 14.04 does not use mujoco (patchelf problem)

* cleaning up 18.04 dockerfile

* added comment to 14.04 dockerfile

* fix syntax in 14.04 dockerfile

* being fancy and switching from apt-get to apt command in 18.04 dockerfile

* update README.rst to use apt (instead of apt-get) on ubuntu 18.04
2018-09-21 11:53:58 -07:00
Daniel Angelov
7bbe486893 Add depth rendering from camera (#1114)
* Add depth rendering from camera

Allow the mujoco renderer to return the depth image using the `depth_array` mode. 

It follows the `rgb_array` extraction method.

* Depth data is a 2d array.

* Add depth_array to render modes.
2018-09-20 17:51:58 -07:00
Ge Yang
d99d5bcc17 Add dtype to Box initialization, fixes #868 (#1092)
Otherwise it generates warnings:

#868
2018-09-17 10:27:31 -07:00
pzhokhov
4d7136c8b1 pass device_id=-1 when rendering mujoco in rgb_array mode (#1167) 2018-09-17 09:54:11 -07:00
Adam Gleave
d5300b5714 MuJoCo render (fix #1000) (#1013) 2018-05-30 10:39:49 +02:00
pzhokhov
74229c8dc2 travis build and test failure fixes (#1031)
* build test image from scratch from ubuntu:16.04

* removed pulling old image from .travis.yml

* try installing keyboard-configuration on docker on travis

* trying install keyboard-configuration before rest of the packages

* upgrading dockerfile and entrypoint to work with ubuntu16.04

* fixing dummy display config wip

* install keyboard-properties first in dockerfile

* pass mujoco_key in .travis.yml

* skipsdist in tox.ini

* removed unpacking of the mujoco bundle in entrypoint

* using xvfb for fake display

* comment out self.viewer.close

* install ffmpeg

* squash run commands in dockerfile

* fixed typo in dockerfile

* fixed typo in dockerfile

* fixed typo in dockerfile

* use self.np_random in robotics/hand/manipulate

* some cleanups in .travis.yml

* cleaning up accidental changes

* cleaning up accidental changes

* inject mujoco key on runtime (instead of container buildtime)

* remove webhooks section from .travis.yml
2018-05-14 17:39:56 -07:00
Peter Welinder
c5b624c6a6 Fix rgb_array mode for MujocoEnv (#909) 2018-02-26 10:48:44 +01: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
Matthias Plappert
6af4a5b9b2 Migrate to mujoco-py 1.50 (#834)
* all envs run offscreen

* render works

* changed mujoco-py version

* Bump versions

* Update version and README

* Same versioning for all mujoco envs

* Fix typo

* Fix version

* Bump version again

* Revert "Fix version"

This reverts commit decc5779811801deb6ae9fad697dfe247d2bdd94.
2018-01-24 15:42:29 -08:00
Alex Ray
f724a72006 Lint fixes to mujoco environment (#377) 2017-02-22 17:24:27 -08: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
Jonas Schneider
cda4518b1e Bump mujoco-py for Python3 compat 2016-05-10 17:05:04 +02:00
Josh Marlow
9529fa731b Replaced is string comparison with == (#77) 2016-05-09 17:51:04 -07:00
Jonas Schneider
fad0065931 Call _step instead of step when fake-stepping a mujoco env on initialize 2016-05-03 22:20:41 -04:00
John Schulman
795640dfe8 fix mujoco _reset method 2016-05-01 10:57:19 -07:00
John Schulman
3d9ad4f71c update mujoco and bump version 2016-05-01 10:57:19 -07:00
Jonas Schneider
fd18ec3507 Merge remote-tracking branch 'origin/master' into py3
Conflicts:
	gym/envs/atari/atari_env.py
2016-04-29 18:07:47 -07:00
Jonas Schneider
bd63f7547e Correctly encode mujoco arguments as binary 2016-04-28 22:32:17 -07:00
Dominik Mueller
d3d23f3455 Fix readme example, documentation and error messages 2016-04-28 14:01:24 +02:00
OpenAI server
8fffddcb23 if viewer is None then no need to close it. 2016-04-27 09:41:15 -07:00
Greg Brockman
e8f2980603 Initial release. Hello world :). 2016-04-27 08:00:58 -07:00