Merge pull request #3 from pseudo-rnd-thoughts/rename
Renames Gym to Gymnasium
2
.github/ISSUE_TEMPLATE/bug.md
vendored
@@ -15,7 +15,7 @@ Please try to provide a minimal example to reproduce the bug. Error messages and
|
|||||||
|
|
||||||
**System Info**
|
**System Info**
|
||||||
Describe the characteristic of your environment:
|
Describe the characteristic of your environment:
|
||||||
* Describe how Gym was installed (pip, docker, source, ...)
|
* Describe how Gymnasium was installed (pip, docker, source, ...)
|
||||||
* What OS/version of Linux you're using. Note that while we will accept PRs to improve Window's support, we do not officially support it.
|
* What OS/version of Linux you're using. Note that while we will accept PRs to improve Window's support, we do not officially support it.
|
||||||
* Python version
|
* Python version
|
||||||
|
|
||||||
|
4
.github/workflows/build.yml
vendored
@@ -12,6 +12,6 @@ jobs:
|
|||||||
- run: |
|
- run: |
|
||||||
docker build -f py.Dockerfile \
|
docker build -f py.Dockerfile \
|
||||||
--build-arg PYTHON_VERSION=${{ matrix.python-version }} \
|
--build-arg PYTHON_VERSION=${{ matrix.python-version }} \
|
||||||
--tag gym-docker .
|
--tag gymnasium-docker .
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: docker run gym-docker pytest
|
run: docker run gymnasium-docker pytest
|
||||||
|
@@ -15,7 +15,7 @@ repos:
|
|||||||
hooks:
|
hooks:
|
||||||
- id: flake8
|
- id: flake8
|
||||||
args:
|
args:
|
||||||
- '--per-file-ignores=*/__init__.py:F401 gym/envs/registration.py:E704'
|
- '--per-file-ignores=*/__init__.py:F401 gymnasium/envs/registration.py:E704'
|
||||||
- --ignore=E203,W503,E741
|
- --ignore=E203,W503,E741
|
||||||
- --max-complexity=30
|
- --max-complexity=30
|
||||||
- --max-line-length=456
|
- --max-line-length=456
|
||||||
@@ -30,7 +30,7 @@ repos:
|
|||||||
rev: 6.1.1 # pick a git hash / tag to point to
|
rev: 6.1.1 # pick a git hash / tag to point to
|
||||||
hooks:
|
hooks:
|
||||||
- id: pydocstyle
|
- id: pydocstyle
|
||||||
exclude: ^(gym/version.py)|(gym/envs/)|(tests/)
|
exclude: ^(gymnasium/version.py)|(gymnasium/envs/)|(tests/)
|
||||||
args:
|
args:
|
||||||
- --source
|
- --source
|
||||||
- --explain
|
- --explain
|
||||||
|
@@ -1,21 +1,15 @@
|
|||||||
# Gym Contribution Guidelines
|
# Gymnasium Contribution Guidelines
|
||||||
|
|
||||||
At this time we are currently accepting the current forms of contributions:
|
At this time we are currently accepting the current forms of contributions:
|
||||||
|
|
||||||
- Bug reports (keep in mind that changing environment behavior should be minimized as that requires releasing a new version of the environment and makes results hard to compare across versions)
|
- Bug reports (keep in mind that changing environment behavior should be minimized as that requires releasing a new version of the environment and makes results hard to compare across versions)
|
||||||
- Pull requests for bug fixes
|
- Pull requests for bug fixes
|
||||||
- Documentation improvements
|
- Documentation improvements
|
||||||
|
- Features
|
||||||
|
|
||||||
Notably, we are not accepting these forms of contributions:
|
Notably, we are not accepting these forms of contributions:
|
||||||
|
|
||||||
- New environments
|
- New environments
|
||||||
- New features
|
|
||||||
|
|
||||||
This may change in the future.
|
|
||||||
If you wish to make a Gym environment, follow the instructions in [Creating Environments](https://github.com/openai/gym/blob/master/docs/creating_environments.md). When your environment works, you can make a PR to add it to the bottom of the [List of Environments](https://github.com/openai/gym/blob/master/docs/third_party_environments.md).
|
|
||||||
|
|
||||||
|
|
||||||
Edit July 27, 2021: Please see https://github.com/openai/gym/issues/2259 for new contributing standards
|
|
||||||
|
|
||||||
# Development
|
# Development
|
||||||
This section contains technical instructions & hints for the contributors.
|
This section contains technical instructions & hints for the contributors.
|
||||||
@@ -33,7 +27,7 @@ the list of included, excluded and strict files can be found in pyproject.toml (
|
|||||||
To run `pyright` for the project, run the pre-commit process (`pre-commit run --all-files`) or `pyright`
|
To run `pyright` for the project, run the pre-commit process (`pre-commit run --all-files`) or `pyright`
|
||||||
|
|
||||||
## Git hooks
|
## Git hooks
|
||||||
The CI will run several checks on the new code pushed to the Gym repository. These checks can also be run locally without waiting for the CI by following the steps below:
|
The CI will run several checks on the new code pushed to the Gymnasium repository. These checks can also be run locally without waiting for the CI by following the steps below:
|
||||||
1. [install `pre-commit`](https://pre-commit.com/#install),
|
1. [install `pre-commit`](https://pre-commit.com/#install),
|
||||||
2. Install the Git hooks by running `pre-commit install`.
|
2. Install the Git hooks by running `pre-commit install`.
|
||||||
|
|
||||||
|
16
README.md
@@ -4,9 +4,9 @@
|
|||||||
|
|
||||||
### Due to issues with the domain registration, the documentation has been moved to [https://www.gymlibrary.dev/](https://www.gymlibrary.dev/) as opposed to the old .ml address.
|
### Due to issues with the domain registration, the documentation has been moved to [https://www.gymlibrary.dev/](https://www.gymlibrary.dev/) as opposed to the old .ml address.
|
||||||
|
|
||||||
## Gym
|
## Gymnasium
|
||||||
|
|
||||||
Gym is an open source Python library for developing and comparing reinforcement learning algorithms by providing a standard API to communicate between learning algorithms and environments, as well as a standard set of environments compliant with that API. Since its release, Gym's API has become the field standard for doing this.
|
Gymnasium is an open source Python library for developing and comparing reinforcement learning algorithms by providing a standard API to communicate between learning algorithms and environments, as well as a standard set of environments compliant with that API. Since its release, Gym's API has become the field standard for doing this.
|
||||||
|
|
||||||
Gym documentation website is at [https://www.gymlibrary.dev/](https://www.gymlibrary.dev/), and you can propose fixes and changes to it [here](https://github.com/Farama-Foundation/gym-docs).
|
Gym documentation website is at [https://www.gymlibrary.dev/](https://www.gymlibrary.dev/), and you can propose fixes and changes to it [here](https://github.com/Farama-Foundation/gym-docs).
|
||||||
|
|
||||||
@@ -25,13 +25,13 @@ We support Python 3.7, 3.8, 3.9 and 3.10 on Linux and macOS. We will accept PRs
|
|||||||
The Gym API's API models environments as simple Python `env` classes. Creating environment instances and interacting with them is very simple- here's an example using the "CartPole-v1" environment:
|
The Gym API's API models environments as simple Python `env` classes. Creating environment instances and interacting with them is very simple- here's an example using the "CartPole-v1" environment:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
import gym
|
import gymnasium as gym
|
||||||
env = gym.make("CartPole-v1")
|
env = gym.make("CartPole-v1")
|
||||||
observation, info = env.reset(seed=42)
|
observation, info = env.reset(seed=42)
|
||||||
|
|
||||||
for _ in range(1000):
|
for _ in range(1000):
|
||||||
action = env.action_space.sample()
|
action = env.action_space.sample()
|
||||||
observation, reward, terminated, truncarted, info = env.step(action)
|
observation, reward, terminated, truncated, info = env.step(action)
|
||||||
|
|
||||||
if terminated or truncated:
|
if terminated or truncated:
|
||||||
observation, info = env.reset()
|
observation, info = env.reset()
|
||||||
@@ -43,7 +43,7 @@ env.close()
|
|||||||
* [Stable Baselines 3](https://github.com/DLR-RM/stable-baselines3) is a learning library based on the Gym API. It is designed to cater to complete beginners in the field who want to start learning things quickly.
|
* [Stable Baselines 3](https://github.com/DLR-RM/stable-baselines3) is a learning library based on the Gym API. It is designed to cater to complete beginners in the field who want to start learning things quickly.
|
||||||
* [RL Baselines3 Zoo](https://github.com/DLR-RM/rl-baselines3-zoo) builds upon SB3, containing optimal hyperparameters for Gym environments as well as code to easily find new ones.
|
* [RL Baselines3 Zoo](https://github.com/DLR-RM/rl-baselines3-zoo) builds upon SB3, containing optimal hyperparameters for Gym environments as well as code to easily find new ones.
|
||||||
* [Tianshou](https://github.com/thu-ml/tianshou) is a learning library that's geared towards very experienced users and is design to allow for ease in complex algorithm modifications.
|
* [Tianshou](https://github.com/thu-ml/tianshou) is a learning library that's geared towards very experienced users and is design to allow for ease in complex algorithm modifications.
|
||||||
* [RLlib](https://docs.ray.io/en/latest/rllib/index.html) is a learning library that allows for distributed training and inferencing and supports an extraordinarily large number of features throughout the reinforcement learning space.
|
* [RLlib](https://docs.ray.io/en/latest/rllib/index.html) is a learning library that allows for distributed training and inference and supports an extraordinarily large number of features throughout the reinforcement learning space.
|
||||||
* [PettingZoo](https://github.com/Farama-Foundation/PettingZoo) is like Gym, but for environments with multiple agents.
|
* [PettingZoo](https://github.com/Farama-Foundation/PettingZoo) is like Gym, but for environments with multiple agents.
|
||||||
|
|
||||||
## Environment Versioning
|
## Environment Versioning
|
||||||
@@ -52,8 +52,8 @@ Gym keeps strict versioning for reproducibility reasons. All environments end in
|
|||||||
|
|
||||||
## MuJoCo Environments
|
## MuJoCo Environments
|
||||||
|
|
||||||
The latest "\_v4" and future versions of the MuJoCo environments will no longer depend on `mujoco-py`. Instead `mujoco` will be the required dependency for future gym MuJoCo environment versions. Old gym MuJoCo environment versions that depend on `mujoco-py` will still be kept but unmaintained.
|
The latest "\_v4" and future versions of the MuJoCo environments will no longer depend on `mujoco-py`. Instead `mujoco` will be the required dependency for future gymnasiumMuJoCo environment versions. Old gymnasiumMuJoCo environment versions that depend on `mujoco-py` will still be kept but unmaintained.
|
||||||
To install the dependencies for the latest gym MuJoCo environments use `pip install gym[mujoco]`. Dependencies for old MuJoCo environments can still be installed by `pip install gym[mujoco_py]`.
|
To install the dependencies for the latest gymnasium MuJoCo environments use `pip install gym[mujoco]`. Dependencies for old MuJoCo environments can still be installed by `pip install gym[mujoco_py]`.
|
||||||
|
|
||||||
## Citation
|
## Citation
|
||||||
|
|
||||||
@@ -70,4 +70,4 @@ A whitepaper from when Gym just came out is available https://arxiv.org/pdf/1606
|
|||||||
|
|
||||||
## Release Notes
|
## Release Notes
|
||||||
|
|
||||||
There used to be release notes for all the new Gym versions here. New release notes are being moved to [releases page](https://github.com/openai/gym/releases) on GitHub, like most other libraries do. Old notes can be viewed [here](https://github.com/openai/gym/blob/31be35ecd460f670f0c4b653a14c9996b7facc6c/README.rst).
|
There used to be release notes for all the new Gym versions here. New release notes are being moved to [releases page](https://github.com/Farama-Foundation/Gymnasium/releases) on GitHub, like most other libraries do.
|
||||||
|
@@ -1,3 +0,0 @@
|
|||||||
from gym.envs.box2d.bipedal_walker import BipedalWalker, BipedalWalkerHardcore
|
|
||||||
from gym.envs.box2d.car_racing import CarRacing
|
|
||||||
from gym.envs.box2d.lunar_lander import LunarLander, LunarLanderContinuous
|
|
@@ -1,5 +0,0 @@
|
|||||||
from gym.envs.classic_control.acrobot import AcrobotEnv
|
|
||||||
from gym.envs.classic_control.cartpole import CartPoleEnv
|
|
||||||
from gym.envs.classic_control.continuous_mountain_car import Continuous_MountainCarEnv
|
|
||||||
from gym.envs.classic_control.mountain_car import MountainCarEnv
|
|
||||||
from gym.envs.classic_control.pendulum import PendulumEnv
|
|
@@ -1,19 +0,0 @@
|
|||||||
from gym.envs.mujoco.mujoco_env import MujocoEnv, MuJocoPyEnv # isort:skip
|
|
||||||
from gym.envs.mujoco.mujoco_rendering import ( # isort:skip
|
|
||||||
RenderContextOffscreen,
|
|
||||||
Viewer,
|
|
||||||
)
|
|
||||||
|
|
||||||
# ^^^^^ so that user gets the correct error
|
|
||||||
# message if mujoco is not installed correctly
|
|
||||||
from gym.envs.mujoco.ant import AntEnv
|
|
||||||
from gym.envs.mujoco.half_cheetah import HalfCheetahEnv
|
|
||||||
from gym.envs.mujoco.hopper import HopperEnv
|
|
||||||
from gym.envs.mujoco.humanoid import HumanoidEnv
|
|
||||||
from gym.envs.mujoco.humanoidstandup import HumanoidStandupEnv
|
|
||||||
from gym.envs.mujoco.inverted_double_pendulum import InvertedDoublePendulumEnv
|
|
||||||
from gym.envs.mujoco.inverted_pendulum import InvertedPendulumEnv
|
|
||||||
from gym.envs.mujoco.pusher import PusherEnv
|
|
||||||
from gym.envs.mujoco.reacher import ReacherEnv
|
|
||||||
from gym.envs.mujoco.swimmer import SwimmerEnv
|
|
||||||
from gym.envs.mujoco.walker2d import Walker2dEnv
|
|
@@ -1,4 +0,0 @@
|
|||||||
from gym.envs.toy_text.blackjack import BlackjackEnv
|
|
||||||
from gym.envs.toy_text.cliffwalking import CliffWalkingEnv
|
|
||||||
from gym.envs.toy_text.frozen_lake import FrozenLakeEnv
|
|
||||||
from gym.envs.toy_text.taxi import TaxiEnv
|
|
@@ -1,23 +0,0 @@
|
|||||||
"""Module for gym vector utils."""
|
|
||||||
from gym.vector.utils.misc import CloudpickleWrapper, clear_mpi_env_vars
|
|
||||||
from gym.vector.utils.numpy_utils import concatenate, create_empty_array
|
|
||||||
from gym.vector.utils.shared_memory import (
|
|
||||||
create_shared_memory,
|
|
||||||
read_from_shared_memory,
|
|
||||||
write_to_shared_memory,
|
|
||||||
)
|
|
||||||
from gym.vector.utils.spaces import _BaseGymSpaces # pyright: reportPrivateUsage=false
|
|
||||||
from gym.vector.utils.spaces import BaseGymSpaces, batch_space, iterate
|
|
||||||
|
|
||||||
__all__ = [
|
|
||||||
"CloudpickleWrapper",
|
|
||||||
"clear_mpi_env_vars",
|
|
||||||
"concatenate",
|
|
||||||
"create_empty_array",
|
|
||||||
"create_shared_memory",
|
|
||||||
"read_from_shared_memory",
|
|
||||||
"write_to_shared_memory",
|
|
||||||
"BaseGymSpaces",
|
|
||||||
"batch_space",
|
|
||||||
"iterate",
|
|
||||||
]
|
|
@@ -1,23 +0,0 @@
|
|||||||
"""Module of wrapper classes."""
|
|
||||||
from gym import error
|
|
||||||
from gym.wrappers.atari_preprocessing import AtariPreprocessing
|
|
||||||
from gym.wrappers.autoreset import AutoResetWrapper
|
|
||||||
from gym.wrappers.clip_action import ClipAction
|
|
||||||
from gym.wrappers.filter_observation import FilterObservation
|
|
||||||
from gym.wrappers.flatten_observation import FlattenObservation
|
|
||||||
from gym.wrappers.frame_stack import FrameStack, LazyFrames
|
|
||||||
from gym.wrappers.gray_scale_observation import GrayScaleObservation
|
|
||||||
from gym.wrappers.human_rendering import HumanRendering
|
|
||||||
from gym.wrappers.normalize import NormalizeObservation, NormalizeReward
|
|
||||||
from gym.wrappers.order_enforcing import OrderEnforcing
|
|
||||||
from gym.wrappers.record_episode_statistics import RecordEpisodeStatistics
|
|
||||||
from gym.wrappers.record_video import RecordVideo, capped_cubic_video_schedule
|
|
||||||
from gym.wrappers.render_collection import RenderCollection
|
|
||||||
from gym.wrappers.rescale_action import RescaleAction
|
|
||||||
from gym.wrappers.resize_observation import ResizeObservation
|
|
||||||
from gym.wrappers.step_api_compatibility import StepAPICompatibility
|
|
||||||
from gym.wrappers.time_aware_observation import TimeAwareObservation
|
|
||||||
from gym.wrappers.time_limit import TimeLimit
|
|
||||||
from gym.wrappers.transform_observation import TransformObservation
|
|
||||||
from gym.wrappers.transform_reward import TransformReward
|
|
||||||
from gym.wrappers.vector_list_info import VectorListInfo
|
|
@@ -1,21 +1,21 @@
|
|||||||
"""Root __init__ of the gym module setting the __all__ of gym modules."""
|
"""Root __init__ of the gymnasium module setting the __all__ of gymnasium modules."""
|
||||||
# isort: skip_file
|
# isort: skip_file
|
||||||
|
|
||||||
from gym import error
|
from gymnasium import error
|
||||||
from gym.version import VERSION as __version__
|
from gymnasium.version import VERSION as __version__
|
||||||
|
|
||||||
from gym.core import (
|
from gymnasium.core import (
|
||||||
Env,
|
Env,
|
||||||
Wrapper,
|
Wrapper,
|
||||||
ObservationWrapper,
|
ObservationWrapper,
|
||||||
ActionWrapper,
|
ActionWrapper,
|
||||||
RewardWrapper,
|
RewardWrapper,
|
||||||
)
|
)
|
||||||
from gym.spaces import Space
|
from gymnasium.spaces import Space
|
||||||
from gym.envs import make, spec, register
|
from gymnasium.envs import make, spec, register
|
||||||
from gym import logger
|
from gymnasium import logger
|
||||||
from gym import vector
|
from gymnasium import vector
|
||||||
from gym import wrappers
|
from gymnasium import wrappers
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
@@ -15,16 +15,16 @@ from typing import (
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import spaces
|
from gymnasium import spaces
|
||||||
from gym.logger import warn
|
from gymnasium.logger import warn
|
||||||
from gym.utils import seeding
|
from gymnasium.utils import seeding
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
from gym.envs.registration import EnvSpec
|
from gymnasium.envs.registration import EnvSpec
|
||||||
|
|
||||||
if sys.version_info[0:2] == (3, 6):
|
if sys.version_info[0:2] == (3, 6):
|
||||||
warn(
|
warn(
|
||||||
"Gym minimally supports python 3.6 as the python foundation not longer supports the version, please update your version to 3.7+"
|
"Gymnasium minimally supports python 3.6 as the python foundation not longer supports the version, please update your version to 3.7+"
|
||||||
)
|
)
|
||||||
|
|
||||||
ObsType = TypeVar("ObsType")
|
ObsType = TypeVar("ObsType")
|
||||||
@@ -33,7 +33,7 @@ RenderFrame = TypeVar("RenderFrame")
|
|||||||
|
|
||||||
|
|
||||||
class Env(Generic[ObsType, ActType]):
|
class Env(Generic[ObsType, ActType]):
|
||||||
r"""The main OpenAI Gym class.
|
r"""The main Gymnasium class.
|
||||||
|
|
||||||
It encapsulates an environment with arbitrary behind-the-scenes dynamics.
|
It encapsulates an environment with arbitrary behind-the-scenes dynamics.
|
||||||
An environment can be partially or fully observed.
|
An environment can be partially or fully observed.
|
||||||
@@ -51,7 +51,7 @@ class Env(Generic[ObsType, ActType]):
|
|||||||
- :attr:`action_space` - The Space object corresponding to valid actions
|
- :attr:`action_space` - The Space object corresponding to valid actions
|
||||||
- :attr:`observation_space` - The Space object corresponding to valid observations
|
- :attr:`observation_space` - The Space object corresponding to valid observations
|
||||||
- :attr:`reward_range` - A tuple corresponding to the minimum and maximum possible rewards
|
- :attr:`reward_range` - A tuple corresponding to the minimum and maximum possible rewards
|
||||||
- :attr:`spec` - An environment spec that contains the information used to initialise the environment from `gym.make`
|
- :attr:`spec` - An environment spec that contains the information used to initialise the environment from `gymnasium.make`
|
||||||
- :attr:`metadata` - The metadata of the environment, i.e. render modes
|
- :attr:`metadata` - The metadata of the environment, i.e. render modes
|
||||||
- :attr:`np_random` - The random number generator for the environment
|
- :attr:`np_random` - The random number generator for the environment
|
||||||
|
|
||||||
@@ -188,7 +188,7 @@ class Env(Generic[ObsType, ActType]):
|
|||||||
"""Returns the base non-wrapped environment.
|
"""Returns the base non-wrapped environment.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
Env: The base non-wrapped gym.Env instance
|
Env: The base non-wrapped gymnasium.Env instance
|
||||||
"""
|
"""
|
||||||
return self
|
return self
|
||||||
|
|
||||||
@@ -362,7 +362,7 @@ class ObservationWrapper(Wrapper):
|
|||||||
``observation["target_position"] - observation["agent_position"]``. For this, you could implement an
|
``observation["target_position"] - observation["agent_position"]``. For this, you could implement an
|
||||||
observation wrapper like this::
|
observation wrapper like this::
|
||||||
|
|
||||||
class RelativePosition(gym.ObservationWrapper):
|
class RelativePosition(gymnasium.ObservationWrapper):
|
||||||
def __init__(self, env):
|
def __init__(self, env):
|
||||||
super().__init__(env)
|
super().__init__(env)
|
||||||
self.observation_space = Box(shape=(2,), low=-np.inf, high=np.inf)
|
self.observation_space = Box(shape=(2,), low=-np.inf, high=np.inf)
|
||||||
@@ -370,7 +370,7 @@ class ObservationWrapper(Wrapper):
|
|||||||
def observation(self, obs):
|
def observation(self, obs):
|
||||||
return obs["target"] - obs["agent"]
|
return obs["target"] - obs["agent"]
|
||||||
|
|
||||||
Among others, Gym provides the observation wrapper :class:`TimeAwareObservation`, which adds information about the
|
Among others, Gymnasium provides the observation wrapper :class:`TimeAwareObservation`, which adds information about the
|
||||||
index of the timestep to the observation.
|
index of the timestep to the observation.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@@ -402,7 +402,7 @@ class RewardWrapper(Wrapper):
|
|||||||
because it is intrinsic), we want to clip the reward to a range to gain some numerical stability.
|
because it is intrinsic), we want to clip the reward to a range to gain some numerical stability.
|
||||||
To do that, we could, for instance, implement the following wrapper::
|
To do that, we could, for instance, implement the following wrapper::
|
||||||
|
|
||||||
class ClipReward(gym.RewardWrapper):
|
class ClipReward(gymnasium.RewardWrapper):
|
||||||
def __init__(self, env, min_reward, max_reward):
|
def __init__(self, env, min_reward, max_reward):
|
||||||
super().__init__(env)
|
super().__init__(env)
|
||||||
self.min_reward = min_reward
|
self.min_reward = min_reward
|
||||||
@@ -433,10 +433,10 @@ class ActionWrapper(Wrapper):
|
|||||||
In that case, you need to specify the new action space of the wrapper by setting :attr:`self.action_space` in
|
In that case, you need to specify the new action space of the wrapper by setting :attr:`self.action_space` in
|
||||||
the :meth:`__init__` method of your wrapper.
|
the :meth:`__init__` method of your wrapper.
|
||||||
|
|
||||||
Let’s say you have an environment with action space of type :class:`gym.spaces.Box`, but you would only like
|
Let’s say you have an environment with action space of type :class:`gymnasium.spaces.Box`, but you would only like
|
||||||
to use a finite subset of actions. Then, you might want to implement the following wrapper::
|
to use a finite subset of actions. Then, you might want to implement the following wrapper::
|
||||||
|
|
||||||
class DiscreteActions(gym.ActionWrapper):
|
class DiscreteActions(gymnasium.ActionWrapper):
|
||||||
def __init__(self, env, disc_to_cont):
|
def __init__(self, env, disc_to_cont):
|
||||||
super().__init__(env)
|
super().__init__(env)
|
||||||
self.disc_to_cont = disc_to_cont
|
self.disc_to_cont = disc_to_cont
|
||||||
@@ -446,13 +446,13 @@ class ActionWrapper(Wrapper):
|
|||||||
return self.disc_to_cont[act]
|
return self.disc_to_cont[act]
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
env = gym.make("LunarLanderContinuous-v2")
|
env = gymnasium.make("LunarLanderContinuous-v2")
|
||||||
wrapped_env = DiscreteActions(env, [np.array([1,0]), np.array([-1,0]),
|
wrapped_env = DiscreteActions(env, [np.array([1,0]), np.array([-1,0]),
|
||||||
np.array([0,1]), np.array([0,-1])])
|
np.array([0,1]), np.array([0,-1])])
|
||||||
print(wrapped_env.action_space) #Discrete(4)
|
print(wrapped_env.action_space) #Discrete(4)
|
||||||
|
|
||||||
|
|
||||||
Among others, Gym provides the action wrappers :class:`ClipAction` and :class:`RescaleAction`.
|
Among others, Gymasnium provides the action wrappers :class:`ClipAction` and :class:`RescaleAction`.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def step(self, action):
|
def step(self, action):
|
@@ -1,5 +1,5 @@
|
|||||||
from gym.envs.registration import load_env_plugins as _load_env_plugins
|
from gymnasium.envs.registration import load_env_plugins as _load_env_plugins
|
||||||
from gym.envs.registration import make, register, registry, spec
|
from gymnasium.envs.registration import make, register, registry, spec
|
||||||
|
|
||||||
# Hook to load plugins from entry points
|
# Hook to load plugins from entry points
|
||||||
_load_env_plugins()
|
_load_env_plugins()
|
||||||
@@ -10,41 +10,41 @@ _load_env_plugins()
|
|||||||
|
|
||||||
register(
|
register(
|
||||||
id="CartPole-v0",
|
id="CartPole-v0",
|
||||||
entry_point="gym.envs.classic_control.cartpole:CartPoleEnv",
|
entry_point="gymnasium.envs.classic_control.cartpole:CartPoleEnv",
|
||||||
max_episode_steps=200,
|
max_episode_steps=200,
|
||||||
reward_threshold=195.0,
|
reward_threshold=195.0,
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="CartPole-v1",
|
id="CartPole-v1",
|
||||||
entry_point="gym.envs.classic_control.cartpole:CartPoleEnv",
|
entry_point="gymnasium.envs.classic_control.cartpole:CartPoleEnv",
|
||||||
max_episode_steps=500,
|
max_episode_steps=500,
|
||||||
reward_threshold=475.0,
|
reward_threshold=475.0,
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="MountainCar-v0",
|
id="MountainCar-v0",
|
||||||
entry_point="gym.envs.classic_control.mountain_car:MountainCarEnv",
|
entry_point="gymnasium.envs.classic_control.mountain_car:MountainCarEnv",
|
||||||
max_episode_steps=200,
|
max_episode_steps=200,
|
||||||
reward_threshold=-110.0,
|
reward_threshold=-110.0,
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="MountainCarContinuous-v0",
|
id="MountainCarContinuous-v0",
|
||||||
entry_point="gym.envs.classic_control.continuous_mountain_car:Continuous_MountainCarEnv",
|
entry_point="gymnasium.envs.classic_control.continuous_mountain_car:Continuous_MountainCarEnv",
|
||||||
max_episode_steps=999,
|
max_episode_steps=999,
|
||||||
reward_threshold=90.0,
|
reward_threshold=90.0,
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="Pendulum-v1",
|
id="Pendulum-v1",
|
||||||
entry_point="gym.envs.classic_control.pendulum:PendulumEnv",
|
entry_point="gymnasium.envs.classic_control.pendulum:PendulumEnv",
|
||||||
max_episode_steps=200,
|
max_episode_steps=200,
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="Acrobot-v1",
|
id="Acrobot-v1",
|
||||||
entry_point="gym.envs.classic_control.acrobot:AcrobotEnv",
|
entry_point="gymnasium.envs.classic_control.acrobot:AcrobotEnv",
|
||||||
reward_threshold=-100.0,
|
reward_threshold=-100.0,
|
||||||
max_episode_steps=500,
|
max_episode_steps=500,
|
||||||
)
|
)
|
||||||
@@ -54,14 +54,14 @@ register(
|
|||||||
|
|
||||||
register(
|
register(
|
||||||
id="LunarLander-v2",
|
id="LunarLander-v2",
|
||||||
entry_point="gym.envs.box2d.lunar_lander:LunarLander",
|
entry_point="gymnasium.envs.box2d.lunar_lander:LunarLander",
|
||||||
max_episode_steps=1000,
|
max_episode_steps=1000,
|
||||||
reward_threshold=200,
|
reward_threshold=200,
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="LunarLanderContinuous-v2",
|
id="LunarLanderContinuous-v2",
|
||||||
entry_point="gym.envs.box2d.lunar_lander:LunarLander",
|
entry_point="gymnasium.envs.box2d.lunar_lander:LunarLander",
|
||||||
kwargs={"continuous": True},
|
kwargs={"continuous": True},
|
||||||
max_episode_steps=1000,
|
max_episode_steps=1000,
|
||||||
reward_threshold=200,
|
reward_threshold=200,
|
||||||
@@ -69,14 +69,14 @@ register(
|
|||||||
|
|
||||||
register(
|
register(
|
||||||
id="BipedalWalker-v3",
|
id="BipedalWalker-v3",
|
||||||
entry_point="gym.envs.box2d.bipedal_walker:BipedalWalker",
|
entry_point="gymnasium.envs.box2d.bipedal_walker:BipedalWalker",
|
||||||
max_episode_steps=1600,
|
max_episode_steps=1600,
|
||||||
reward_threshold=300,
|
reward_threshold=300,
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="BipedalWalkerHardcore-v3",
|
id="BipedalWalkerHardcore-v3",
|
||||||
entry_point="gym.envs.box2d.bipedal_walker:BipedalWalker",
|
entry_point="gymnasium.envs.box2d.bipedal_walker:BipedalWalker",
|
||||||
kwargs={"hardcore": True},
|
kwargs={"hardcore": True},
|
||||||
max_episode_steps=2000,
|
max_episode_steps=2000,
|
||||||
reward_threshold=300,
|
reward_threshold=300,
|
||||||
@@ -84,7 +84,7 @@ register(
|
|||||||
|
|
||||||
register(
|
register(
|
||||||
id="CarRacing-v2",
|
id="CarRacing-v2",
|
||||||
entry_point="gym.envs.box2d.car_racing:CarRacing",
|
entry_point="gymnasium.envs.box2d.car_racing:CarRacing",
|
||||||
max_episode_steps=1000,
|
max_episode_steps=1000,
|
||||||
reward_threshold=900,
|
reward_threshold=900,
|
||||||
)
|
)
|
||||||
@@ -94,13 +94,13 @@ register(
|
|||||||
|
|
||||||
register(
|
register(
|
||||||
id="Blackjack-v1",
|
id="Blackjack-v1",
|
||||||
entry_point="gym.envs.toy_text.blackjack:BlackjackEnv",
|
entry_point="gymnasium.envs.toy_text.blackjack:BlackjackEnv",
|
||||||
kwargs={"sab": True, "natural": False},
|
kwargs={"sab": True, "natural": False},
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="FrozenLake-v1",
|
id="FrozenLake-v1",
|
||||||
entry_point="gym.envs.toy_text.frozen_lake:FrozenLakeEnv",
|
entry_point="gymnasium.envs.toy_text.frozen_lake:FrozenLakeEnv",
|
||||||
kwargs={"map_name": "4x4"},
|
kwargs={"map_name": "4x4"},
|
||||||
max_episode_steps=100,
|
max_episode_steps=100,
|
||||||
reward_threshold=0.70, # optimum = 0.74
|
reward_threshold=0.70, # optimum = 0.74
|
||||||
@@ -108,7 +108,7 @@ register(
|
|||||||
|
|
||||||
register(
|
register(
|
||||||
id="FrozenLake8x8-v1",
|
id="FrozenLake8x8-v1",
|
||||||
entry_point="gym.envs.toy_text.frozen_lake:FrozenLakeEnv",
|
entry_point="gymnasium.envs.toy_text.frozen_lake:FrozenLakeEnv",
|
||||||
kwargs={"map_name": "8x8"},
|
kwargs={"map_name": "8x8"},
|
||||||
max_episode_steps=200,
|
max_episode_steps=200,
|
||||||
reward_threshold=0.85, # optimum = 0.91
|
reward_threshold=0.85, # optimum = 0.91
|
||||||
@@ -116,12 +116,12 @@ register(
|
|||||||
|
|
||||||
register(
|
register(
|
||||||
id="CliffWalking-v0",
|
id="CliffWalking-v0",
|
||||||
entry_point="gym.envs.toy_text.cliffwalking:CliffWalkingEnv",
|
entry_point="gymnasium.envs.toy_text.cliffwalking:CliffWalkingEnv",
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="Taxi-v3",
|
id="Taxi-v3",
|
||||||
entry_point="gym.envs.toy_text.taxi:TaxiEnv",
|
entry_point="gymnasium.envs.toy_text.taxi:TaxiEnv",
|
||||||
reward_threshold=8, # optimum = 8.46
|
reward_threshold=8, # optimum = 8.46
|
||||||
max_episode_steps=200,
|
max_episode_steps=200,
|
||||||
)
|
)
|
||||||
@@ -133,119 +133,119 @@ register(
|
|||||||
|
|
||||||
register(
|
register(
|
||||||
id="Reacher-v2",
|
id="Reacher-v2",
|
||||||
entry_point="gym.envs.mujoco:ReacherEnv",
|
entry_point="gymnasium.envs.mujoco:ReacherEnv",
|
||||||
max_episode_steps=50,
|
max_episode_steps=50,
|
||||||
reward_threshold=-3.75,
|
reward_threshold=-3.75,
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="Reacher-v4",
|
id="Reacher-v4",
|
||||||
entry_point="gym.envs.mujoco.reacher_v4:ReacherEnv",
|
entry_point="gymnasium.envs.mujoco.reacher_v4:ReacherEnv",
|
||||||
max_episode_steps=50,
|
max_episode_steps=50,
|
||||||
reward_threshold=-3.75,
|
reward_threshold=-3.75,
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="Pusher-v2",
|
id="Pusher-v2",
|
||||||
entry_point="gym.envs.mujoco:PusherEnv",
|
entry_point="gymnasium.envs.mujoco:PusherEnv",
|
||||||
max_episode_steps=100,
|
max_episode_steps=100,
|
||||||
reward_threshold=0.0,
|
reward_threshold=0.0,
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="Pusher-v4",
|
id="Pusher-v4",
|
||||||
entry_point="gym.envs.mujoco.pusher_v4:PusherEnv",
|
entry_point="gymnasium.envs.mujoco.pusher_v4:PusherEnv",
|
||||||
max_episode_steps=100,
|
max_episode_steps=100,
|
||||||
reward_threshold=0.0,
|
reward_threshold=0.0,
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="InvertedPendulum-v2",
|
id="InvertedPendulum-v2",
|
||||||
entry_point="gym.envs.mujoco:InvertedPendulumEnv",
|
entry_point="gymnasium.envs.mujoco:InvertedPendulumEnv",
|
||||||
max_episode_steps=1000,
|
max_episode_steps=1000,
|
||||||
reward_threshold=950.0,
|
reward_threshold=950.0,
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="InvertedPendulum-v4",
|
id="InvertedPendulum-v4",
|
||||||
entry_point="gym.envs.mujoco.inverted_pendulum_v4:InvertedPendulumEnv",
|
entry_point="gymnasium.envs.mujoco.inverted_pendulum_v4:InvertedPendulumEnv",
|
||||||
max_episode_steps=1000,
|
max_episode_steps=1000,
|
||||||
reward_threshold=950.0,
|
reward_threshold=950.0,
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="InvertedDoublePendulum-v2",
|
id="InvertedDoublePendulum-v2",
|
||||||
entry_point="gym.envs.mujoco:InvertedDoublePendulumEnv",
|
entry_point="gymnasium.envs.mujoco:InvertedDoublePendulumEnv",
|
||||||
max_episode_steps=1000,
|
max_episode_steps=1000,
|
||||||
reward_threshold=9100.0,
|
reward_threshold=9100.0,
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="InvertedDoublePendulum-v4",
|
id="InvertedDoublePendulum-v4",
|
||||||
entry_point="gym.envs.mujoco.inverted_double_pendulum_v4:InvertedDoublePendulumEnv",
|
entry_point="gymnasium.envs.mujoco.inverted_double_pendulum_v4:InvertedDoublePendulumEnv",
|
||||||
max_episode_steps=1000,
|
max_episode_steps=1000,
|
||||||
reward_threshold=9100.0,
|
reward_threshold=9100.0,
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="HalfCheetah-v2",
|
id="HalfCheetah-v2",
|
||||||
entry_point="gym.envs.mujoco:HalfCheetahEnv",
|
entry_point="gymnasium.envs.mujoco:HalfCheetahEnv",
|
||||||
max_episode_steps=1000,
|
max_episode_steps=1000,
|
||||||
reward_threshold=4800.0,
|
reward_threshold=4800.0,
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="HalfCheetah-v3",
|
id="HalfCheetah-v3",
|
||||||
entry_point="gym.envs.mujoco.half_cheetah_v3:HalfCheetahEnv",
|
entry_point="gymnasium.envs.mujoco.half_cheetah_v3:HalfCheetahEnv",
|
||||||
max_episode_steps=1000,
|
max_episode_steps=1000,
|
||||||
reward_threshold=4800.0,
|
reward_threshold=4800.0,
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="HalfCheetah-v4",
|
id="HalfCheetah-v4",
|
||||||
entry_point="gym.envs.mujoco.half_cheetah_v4:HalfCheetahEnv",
|
entry_point="gymnasium.envs.mujoco.half_cheetah_v4:HalfCheetahEnv",
|
||||||
max_episode_steps=1000,
|
max_episode_steps=1000,
|
||||||
reward_threshold=4800.0,
|
reward_threshold=4800.0,
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="Hopper-v2",
|
id="Hopper-v2",
|
||||||
entry_point="gym.envs.mujoco:HopperEnv",
|
entry_point="gymnasium.envs.mujoco:HopperEnv",
|
||||||
max_episode_steps=1000,
|
max_episode_steps=1000,
|
||||||
reward_threshold=3800.0,
|
reward_threshold=3800.0,
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="Hopper-v3",
|
id="Hopper-v3",
|
||||||
entry_point="gym.envs.mujoco.hopper_v3:HopperEnv",
|
entry_point="gymnasium.envs.mujoco.hopper_v3:HopperEnv",
|
||||||
max_episode_steps=1000,
|
max_episode_steps=1000,
|
||||||
reward_threshold=3800.0,
|
reward_threshold=3800.0,
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="Hopper-v4",
|
id="Hopper-v4",
|
||||||
entry_point="gym.envs.mujoco.hopper_v4:HopperEnv",
|
entry_point="gymnasium.envs.mujoco.hopper_v4:HopperEnv",
|
||||||
max_episode_steps=1000,
|
max_episode_steps=1000,
|
||||||
reward_threshold=3800.0,
|
reward_threshold=3800.0,
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="Swimmer-v2",
|
id="Swimmer-v2",
|
||||||
entry_point="gym.envs.mujoco:SwimmerEnv",
|
entry_point="gymnasium.envs.mujoco:SwimmerEnv",
|
||||||
max_episode_steps=1000,
|
max_episode_steps=1000,
|
||||||
reward_threshold=360.0,
|
reward_threshold=360.0,
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="Swimmer-v3",
|
id="Swimmer-v3",
|
||||||
entry_point="gym.envs.mujoco.swimmer_v3:SwimmerEnv",
|
entry_point="gymnasium.envs.mujoco.swimmer_v3:SwimmerEnv",
|
||||||
max_episode_steps=1000,
|
max_episode_steps=1000,
|
||||||
reward_threshold=360.0,
|
reward_threshold=360.0,
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="Swimmer-v4",
|
id="Swimmer-v4",
|
||||||
entry_point="gym.envs.mujoco.swimmer_v4:SwimmerEnv",
|
entry_point="gymnasium.envs.mujoco.swimmer_v4:SwimmerEnv",
|
||||||
max_episode_steps=1000,
|
max_episode_steps=1000,
|
||||||
reward_threshold=360.0,
|
reward_threshold=360.0,
|
||||||
)
|
)
|
||||||
@@ -253,68 +253,68 @@ register(
|
|||||||
register(
|
register(
|
||||||
id="Walker2d-v2",
|
id="Walker2d-v2",
|
||||||
max_episode_steps=1000,
|
max_episode_steps=1000,
|
||||||
entry_point="gym.envs.mujoco:Walker2dEnv",
|
entry_point="gymnasium.envs.mujoco:Walker2dEnv",
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="Walker2d-v3",
|
id="Walker2d-v3",
|
||||||
max_episode_steps=1000,
|
max_episode_steps=1000,
|
||||||
entry_point="gym.envs.mujoco.walker2d_v3:Walker2dEnv",
|
entry_point="gymnasium.envs.mujoco.walker2d_v3:Walker2dEnv",
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="Walker2d-v4",
|
id="Walker2d-v4",
|
||||||
max_episode_steps=1000,
|
max_episode_steps=1000,
|
||||||
entry_point="gym.envs.mujoco.walker2d_v4:Walker2dEnv",
|
entry_point="gymnasium.envs.mujoco.walker2d_v4:Walker2dEnv",
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="Ant-v2",
|
id="Ant-v2",
|
||||||
entry_point="gym.envs.mujoco:AntEnv",
|
entry_point="gymnasium.envs.mujoco:AntEnv",
|
||||||
max_episode_steps=1000,
|
max_episode_steps=1000,
|
||||||
reward_threshold=6000.0,
|
reward_threshold=6000.0,
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="Ant-v3",
|
id="Ant-v3",
|
||||||
entry_point="gym.envs.mujoco.ant_v3:AntEnv",
|
entry_point="gymnasium.envs.mujoco.ant_v3:AntEnv",
|
||||||
max_episode_steps=1000,
|
max_episode_steps=1000,
|
||||||
reward_threshold=6000.0,
|
reward_threshold=6000.0,
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="Ant-v4",
|
id="Ant-v4",
|
||||||
entry_point="gym.envs.mujoco.ant_v4:AntEnv",
|
entry_point="gymnasium.envs.mujoco.ant_v4:AntEnv",
|
||||||
max_episode_steps=1000,
|
max_episode_steps=1000,
|
||||||
reward_threshold=6000.0,
|
reward_threshold=6000.0,
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="Humanoid-v2",
|
id="Humanoid-v2",
|
||||||
entry_point="gym.envs.mujoco:HumanoidEnv",
|
entry_point="gymnasium.envs.mujoco:HumanoidEnv",
|
||||||
max_episode_steps=1000,
|
max_episode_steps=1000,
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="Humanoid-v3",
|
id="Humanoid-v3",
|
||||||
entry_point="gym.envs.mujoco.humanoid_v3:HumanoidEnv",
|
entry_point="gymnasium.envs.mujoco.humanoid_v3:HumanoidEnv",
|
||||||
max_episode_steps=1000,
|
max_episode_steps=1000,
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="Humanoid-v4",
|
id="Humanoid-v4",
|
||||||
entry_point="gym.envs.mujoco.humanoid_v4:HumanoidEnv",
|
entry_point="gymnasium.envs.mujoco.humanoid_v4:HumanoidEnv",
|
||||||
max_episode_steps=1000,
|
max_episode_steps=1000,
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="HumanoidStandup-v2",
|
id="HumanoidStandup-v2",
|
||||||
entry_point="gym.envs.mujoco:HumanoidStandupEnv",
|
entry_point="gymnasium.envs.mujoco:HumanoidStandupEnv",
|
||||||
max_episode_steps=1000,
|
max_episode_steps=1000,
|
||||||
)
|
)
|
||||||
|
|
||||||
register(
|
register(
|
||||||
id="HumanoidStandup-v4",
|
id="HumanoidStandup-v4",
|
||||||
entry_point="gym.envs.mujoco.humanoidstandup_v4:HumanoidStandupEnv",
|
entry_point="gymnasium.envs.mujoco.humanoidstandup_v4:HumanoidStandupEnv",
|
||||||
max_episode_steps=1000,
|
max_episode_steps=1000,
|
||||||
)
|
)
|
3
gymnasium/envs/box2d/__init__.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
from gymnasium.envs.box2d.bipedal_walker import BipedalWalker, BipedalWalkerHardcore
|
||||||
|
from gymnasium.envs.box2d.car_racing import CarRacing
|
||||||
|
from gymnasium.envs.box2d.lunar_lander import LunarLander, LunarLanderContinuous
|
@@ -5,10 +5,10 @@ from typing import TYPE_CHECKING, List, Optional
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
import gym
|
import gymnasium
|
||||||
from gym import error, spaces
|
from gymnasium import error, spaces
|
||||||
from gym.error import DependencyNotInstalled
|
from gymnasium.error import DependencyNotInstalled
|
||||||
from gym.utils import EzPickle
|
from gymnasium.utils import EzPickle
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import Box2D
|
import Box2D
|
||||||
@@ -21,7 +21,9 @@ try:
|
|||||||
revoluteJointDef,
|
revoluteJointDef,
|
||||||
)
|
)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise DependencyNotInstalled("box2D is not installed, run `pip install gym[box2d]`")
|
raise DependencyNotInstalled(
|
||||||
|
"box2D is not installed, run `pip install gymnasium[box2d]`"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@@ -98,7 +100,7 @@ class ContactDetector(contactListener):
|
|||||||
leg.ground_contact = False
|
leg.ground_contact = False
|
||||||
|
|
||||||
|
|
||||||
class BipedalWalker(gym.Env, EzPickle):
|
class BipedalWalker(gymnasium.Env, EzPickle):
|
||||||
"""
|
"""
|
||||||
### Description
|
### Description
|
||||||
This is a simple 4-joint walker robot environment.
|
This is a simple 4-joint walker robot environment.
|
||||||
@@ -112,7 +114,7 @@ class BipedalWalker(gym.Env, EzPickle):
|
|||||||
A heuristic is provided for testing. It's also useful to get demonstrations
|
A heuristic is provided for testing. It's also useful to get demonstrations
|
||||||
to learn from. To run the heuristic:
|
to learn from. To run the heuristic:
|
||||||
```
|
```
|
||||||
python gym/envs/box2d/bipedal_walker.py
|
python gymnasium/envs/box2d/bipedal_walker.py
|
||||||
```
|
```
|
||||||
|
|
||||||
### Action Space
|
### Action Space
|
||||||
@@ -142,8 +144,8 @@ class BipedalWalker(gym.Env, EzPickle):
|
|||||||
To use to the _hardcore_ environment, you need to specify the
|
To use to the _hardcore_ environment, you need to specify the
|
||||||
`hardcore=True` argument like below:
|
`hardcore=True` argument like below:
|
||||||
```python
|
```python
|
||||||
import gym
|
import gymnasium
|
||||||
env = gym.make("BipedalWalker-v3", hardcore=True)
|
env = gymnasium.make("BipedalWalker-v3", hardcore=True)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Version History
|
### Version History
|
||||||
@@ -611,7 +613,7 @@ class BipedalWalker(gym.Env, EzPickle):
|
|||||||
from pygame import gfxdraw
|
from pygame import gfxdraw
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise DependencyNotInstalled(
|
raise DependencyNotInstalled(
|
||||||
"pygame is not installed, run `pip install gym[box2d]`"
|
"pygame is not installed, run `pip install gymnasium[box2d]`"
|
||||||
)
|
)
|
||||||
|
|
||||||
if self.screen is None and self.render_mode == "human":
|
if self.screen is None and self.render_mode == "human":
|
||||||
@@ -758,8 +760,8 @@ class BipedalWalkerHardcore:
|
|||||||
raise error.Error(
|
raise error.Error(
|
||||||
"Error initializing BipedalWalkerHardcore Environment.\n"
|
"Error initializing BipedalWalkerHardcore Environment.\n"
|
||||||
"Currently, we do not support initializing this mode of environment by calling the class directly.\n"
|
"Currently, we do not support initializing this mode of environment by calling the class directly.\n"
|
||||||
"To use this environment, instead create it by specifying the hardcore keyword in gym.make, i.e.\n"
|
"To use this environment, instead create it by specifying the hardcore keyword in gymnasium.make, i.e.\n"
|
||||||
'gym.make("BipedalWalker-v3", hardcore=True)'
|
'gymnasium.make("BipedalWalker-v3", hardcore=True)'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
@@ -12,12 +12,14 @@ import math
|
|||||||
import Box2D
|
import Box2D
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym.error import DependencyNotInstalled
|
from gymnasium.error import DependencyNotInstalled
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from Box2D.b2 import fixtureDef, polygonShape, revoluteJointDef
|
from Box2D.b2 import fixtureDef, polygonShape, revoluteJointDef
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise DependencyNotInstalled("box2D is not installed, run `pip install gym[box2d]`")
|
raise DependencyNotInstalled(
|
||||||
|
"box2D is not installed, run `pip install gymnasium[box2d]`"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
SIZE = 0.02
|
SIZE = 0.02
|
@@ -5,17 +5,19 @@ from typing import Optional, Union
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
import gym
|
import gymnasium
|
||||||
from gym import spaces
|
from gymnasium import spaces
|
||||||
from gym.envs.box2d.car_dynamics import Car
|
from gymnasium.envs.box2d.car_dynamics import Car
|
||||||
from gym.error import DependencyNotInstalled, InvalidAction
|
from gymnasium.error import DependencyNotInstalled, InvalidAction
|
||||||
from gym.utils import EzPickle
|
from gymnasium.utils import EzPickle
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import Box2D
|
import Box2D
|
||||||
from Box2D.b2 import contactListener, fixtureDef, polygonShape
|
from Box2D.b2 import contactListener, fixtureDef, polygonShape
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise DependencyNotInstalled("box2D is not installed, run `pip install gym[box2d]`")
|
raise DependencyNotInstalled(
|
||||||
|
"box2D is not installed, run `pip install gymnasium[box2d]`"
|
||||||
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# As pygame is necessary for using the environment (reset and step) even without a render mode
|
# As pygame is necessary for using the environment (reset and step) even without a render mode
|
||||||
@@ -24,7 +26,7 @@ try:
|
|||||||
from pygame import gfxdraw
|
from pygame import gfxdraw
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise DependencyNotInstalled(
|
raise DependencyNotInstalled(
|
||||||
"pygame is not installed, run `pip install gym[box2d]`"
|
"pygame is not installed, run `pip install gymnasium[box2d]`"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@@ -102,7 +104,7 @@ class FrictionDetector(contactListener):
|
|||||||
obj.tiles.remove(tile)
|
obj.tiles.remove(tile)
|
||||||
|
|
||||||
|
|
||||||
class CarRacing(gym.Env, EzPickle):
|
class CarRacing(gymnasium.Env, EzPickle):
|
||||||
"""
|
"""
|
||||||
### Description
|
### Description
|
||||||
The easiest control task to learn from pixels - a top-down
|
The easiest control task to learn from pixels - a top-down
|
||||||
@@ -113,7 +115,7 @@ class CarRacing(gym.Env, EzPickle):
|
|||||||
steering wheel position, and gyroscope.
|
steering wheel position, and gyroscope.
|
||||||
To play yourself (it's rather fast for humans), type:
|
To play yourself (it's rather fast for humans), type:
|
||||||
```
|
```
|
||||||
python gym/envs/box2d/car_racing.py
|
python gymnasium/envs/box2d/car_racing.py
|
||||||
```
|
```
|
||||||
Remember: it's a powerful rear-wheel drive car - don't press the accelerator
|
Remember: it's a powerful rear-wheel drive car - don't press the accelerator
|
||||||
and turn at the same time.
|
and turn at the same time.
|
||||||
@@ -157,7 +159,7 @@ class CarRacing(gym.Env, EzPickle):
|
|||||||
`domain_randomize` must be `True` on init for this argument to work.
|
`domain_randomize` must be `True` on init for this argument to work.
|
||||||
Example usage:
|
Example usage:
|
||||||
```py
|
```py
|
||||||
env = gym.make("CarRacing-v1", domain_randomize=True)
|
env = gymnasium.make("CarRacing-v1", domain_randomize=True)
|
||||||
|
|
||||||
# normal reset, this changes the colour scheme by default
|
# normal reset, this changes the colour scheme by default
|
||||||
env.reset()
|
env.reset()
|
@@ -6,11 +6,11 @@ from typing import TYPE_CHECKING, Optional
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
import gym
|
import gymnasium
|
||||||
from gym import error, spaces
|
from gymnasium import error, spaces
|
||||||
from gym.error import DependencyNotInstalled
|
from gymnasium.error import DependencyNotInstalled
|
||||||
from gym.utils import EzPickle, colorize
|
from gymnasium.utils import EzPickle, colorize
|
||||||
from gym.utils.step_api_compatibility import step_api_compatibility
|
from gymnasium.utils.step_api_compatibility import step_api_compatibility
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import Box2D
|
import Box2D
|
||||||
@@ -23,7 +23,9 @@ try:
|
|||||||
revoluteJointDef,
|
revoluteJointDef,
|
||||||
)
|
)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise DependencyNotInstalled("box2d is not installed, run `pip install gym[box2d]`")
|
raise DependencyNotInstalled(
|
||||||
|
"box2d is not installed, run `pip install gymnasium[box2d]`"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
if TYPE_CHECKING:
|
if TYPE_CHECKING:
|
||||||
@@ -72,7 +74,7 @@ class ContactDetector(contactListener):
|
|||||||
self.env.legs[i].ground_contact = False
|
self.env.legs[i].ground_contact = False
|
||||||
|
|
||||||
|
|
||||||
class LunarLander(gym.Env, EzPickle):
|
class LunarLander(gymnasium.Env, EzPickle):
|
||||||
"""
|
"""
|
||||||
### Description
|
### Description
|
||||||
This environment is a classic rocket trajectory optimization problem.
|
This environment is a classic rocket trajectory optimization problem.
|
||||||
@@ -88,7 +90,7 @@ class LunarLander(gym.Env, EzPickle):
|
|||||||
|
|
||||||
To see a heuristic landing, run:
|
To see a heuristic landing, run:
|
||||||
```
|
```
|
||||||
python gym/envs/box2d/lunar_lander.py
|
python gymnasium/envs/box2d/lunar_lander.py
|
||||||
```
|
```
|
||||||
<!-- To play yourself, run: -->
|
<!-- To play yourself, run: -->
|
||||||
<!-- python examples/agents/keyboard_agent.py LunarLander-v2 -->
|
<!-- python examples/agents/keyboard_agent.py LunarLander-v2 -->
|
||||||
@@ -139,8 +141,8 @@ class LunarLander(gym.Env, EzPickle):
|
|||||||
To use to the _continuous_ environment, you need to specify the
|
To use to the _continuous_ environment, you need to specify the
|
||||||
`continuous=True` argument like below:
|
`continuous=True` argument like below:
|
||||||
```python
|
```python
|
||||||
import gym
|
import gymnasium
|
||||||
env = gym.make(
|
env = gymnasium.make(
|
||||||
"LunarLander-v2",
|
"LunarLander-v2",
|
||||||
continuous: bool = False,
|
continuous: bool = False,
|
||||||
gravity: float = -10.0,
|
gravity: float = -10.0,
|
||||||
@@ -605,7 +607,7 @@ class LunarLander(gym.Env, EzPickle):
|
|||||||
from pygame import gfxdraw
|
from pygame import gfxdraw
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise DependencyNotInstalled(
|
raise DependencyNotInstalled(
|
||||||
"pygame is not installed, run `pip install gym[box2d]`"
|
"pygame is not installed, run `pip install gymnasium[box2d]`"
|
||||||
)
|
)
|
||||||
|
|
||||||
if self.screen is None and self.render_mode == "human":
|
if self.screen is None and self.render_mode == "human":
|
||||||
@@ -800,8 +802,8 @@ class LunarLanderContinuous:
|
|||||||
raise error.Error(
|
raise error.Error(
|
||||||
"Error initializing LunarLanderContinuous Environment.\n"
|
"Error initializing LunarLanderContinuous Environment.\n"
|
||||||
"Currently, we do not support initializing this mode of environment by calling the class directly.\n"
|
"Currently, we do not support initializing this mode of environment by calling the class directly.\n"
|
||||||
"To use this environment, instead create it by specifying the continuous keyword in gym.make, i.e.\n"
|
"To use this environment, instead create it by specifying the continuous keyword in gymnasium.make, i.e.\n"
|
||||||
'gym.make("LunarLander-v2", continuous=True)'
|
'gymnasium.make("LunarLander-v2", continuous=True)'
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
7
gymnasium/envs/classic_control/__init__.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
from gymnasium.envs.classic_control.acrobot import AcrobotEnv
|
||||||
|
from gymnasium.envs.classic_control.cartpole import CartPoleEnv
|
||||||
|
from gymnasium.envs.classic_control.continuous_mountain_car import (
|
||||||
|
Continuous_MountainCarEnv,
|
||||||
|
)
|
||||||
|
from gymnasium.envs.classic_control.mountain_car import MountainCarEnv
|
||||||
|
from gymnasium.envs.classic_control.pendulum import PendulumEnv
|
@@ -4,8 +4,8 @@ from typing import Optional
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
from numpy import cos, pi, sin
|
from numpy import cos, pi, sin
|
||||||
|
|
||||||
from gym import core, spaces
|
from gymnasium import core, spaces
|
||||||
from gym.error import DependencyNotInstalled
|
from gymnasium.error import DependencyNotInstalled
|
||||||
|
|
||||||
__copyright__ = "Copyright 2013, RLPy http://acl.mit.edu/RLPy"
|
__copyright__ = "Copyright 2013, RLPy http://acl.mit.edu/RLPy"
|
||||||
__credits__ = [
|
__credits__ = [
|
||||||
@@ -20,7 +20,7 @@ __author__ = "Christoph Dann <cdann@cdann.de>"
|
|||||||
|
|
||||||
# SOURCE:
|
# SOURCE:
|
||||||
# https://github.com/rlpy/rlpy/blob/master/rlpy/Domains/Acrobot.py
|
# https://github.com/rlpy/rlpy/blob/master/rlpy/Domains/Acrobot.py
|
||||||
from gym.envs.classic_control import utils
|
from gymnasium.envs.classic_control import utils
|
||||||
|
|
||||||
|
|
||||||
class AcrobotEnv(core.Env):
|
class AcrobotEnv(core.Env):
|
||||||
@@ -97,7 +97,7 @@ class AcrobotEnv(core.Env):
|
|||||||
No additional arguments are currently supported.
|
No additional arguments are currently supported.
|
||||||
|
|
||||||
```
|
```
|
||||||
env = gym.make('Acrobot-v1')
|
env = gymnasium.make('Acrobot-v1')
|
||||||
```
|
```
|
||||||
|
|
||||||
By default, the dynamics of the acrobot follow those described in Sutton and Barto's book
|
By default, the dynamics of the acrobot follow those described in Sutton and Barto's book
|
||||||
@@ -126,7 +126,7 @@ class AcrobotEnv(core.Env):
|
|||||||
- v1: Maximum number of steps increased from 200 to 500. The observation space for v0 provided direct readings of
|
- v1: Maximum number of steps increased from 200 to 500. The observation space for v0 provided direct readings of
|
||||||
`theta1` and `theta2` in radians, having a range of `[-pi, pi]`. The v1 observation space as described here provides the
|
`theta1` and `theta2` in radians, having a range of `[-pi, pi]`. The v1 observation space as described here provides the
|
||||||
sine and cosine of each angle instead.
|
sine and cosine of each angle instead.
|
||||||
- v0: Initial versions release (1.0.0) (removed from gym for v1)
|
- v0: Initial versions release (1.0.0) (removed from gymnasium for v1)
|
||||||
|
|
||||||
### References
|
### References
|
||||||
- Sutton, R. S. (1996). Generalization in Reinforcement Learning: Successful Examples Using Sparse Coarse Coding.
|
- Sutton, R. S. (1996). Generalization in Reinforcement Learning: Successful Examples Using Sparse Coarse Coding.
|
||||||
@@ -282,7 +282,7 @@ class AcrobotEnv(core.Env):
|
|||||||
from pygame import gfxdraw
|
from pygame import gfxdraw
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise DependencyNotInstalled(
|
raise DependencyNotInstalled(
|
||||||
"pygame is not installed, run `pip install gym[classic_control]`"
|
"pygame is not installed, run `pip install gymnasium[classic_control]`"
|
||||||
)
|
)
|
||||||
|
|
||||||
if self.screen is None:
|
if self.screen is None:
|
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 6.8 KiB |
@@ -8,13 +8,13 @@ from typing import Optional, Union
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
import gym
|
import gymnasium
|
||||||
from gym import logger, spaces
|
from gymnasium import logger, spaces
|
||||||
from gym.envs.classic_control import utils
|
from gymnasium.envs.classic_control import utils
|
||||||
from gym.error import DependencyNotInstalled
|
from gymnasium.error import DependencyNotInstalled
|
||||||
|
|
||||||
|
|
||||||
class CartPoleEnv(gym.Env[np.ndarray, Union[int, np.ndarray]]):
|
class CartPoleEnv(gymnasium.Env[np.ndarray, Union[int, np.ndarray]]):
|
||||||
"""
|
"""
|
||||||
### Description
|
### Description
|
||||||
|
|
||||||
@@ -75,7 +75,7 @@ class CartPoleEnv(gym.Env[np.ndarray, Union[int, np.ndarray]]):
|
|||||||
### Arguments
|
### Arguments
|
||||||
|
|
||||||
```
|
```
|
||||||
gym.make('CartPole-v1')
|
gymnasium.make('CartPole-v1')
|
||||||
```
|
```
|
||||||
|
|
||||||
No additional arguments are currently supported.
|
No additional arguments are currently supported.
|
||||||
@@ -212,7 +212,7 @@ class CartPoleEnv(gym.Env[np.ndarray, Union[int, np.ndarray]]):
|
|||||||
from pygame import gfxdraw
|
from pygame import gfxdraw
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise DependencyNotInstalled(
|
raise DependencyNotInstalled(
|
||||||
"pygame is not installed, run `pip install gym[classic_control]`"
|
"pygame is not installed, run `pip install gymnasium[classic_control]`"
|
||||||
)
|
)
|
||||||
|
|
||||||
if self.screen is None:
|
if self.screen is None:
|
@@ -7,7 +7,7 @@ A merge between two sources:
|
|||||||
of Jose Antonio Martin H. (version 1.0), adapted by 'Tom Schaul, tom@idsia.ch'
|
of Jose Antonio Martin H. (version 1.0), adapted by 'Tom Schaul, tom@idsia.ch'
|
||||||
and then modified by Arnaud de Broissia
|
and then modified by Arnaud de Broissia
|
||||||
|
|
||||||
* the gym MountainCar environment
|
* the gymnasium MountainCar environment
|
||||||
itself from
|
itself from
|
||||||
http://incompleteideas.net/sutton/MountainCar/MountainCar1.cp
|
http://incompleteideas.net/sutton/MountainCar/MountainCar1.cp
|
||||||
permalink: https://perma.cc/6Z2N-PFWC
|
permalink: https://perma.cc/6Z2N-PFWC
|
||||||
@@ -18,13 +18,13 @@ from typing import Optional
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
import gym
|
import gymnasium
|
||||||
from gym import spaces
|
from gymnasium import spaces
|
||||||
from gym.envs.classic_control import utils
|
from gymnasium.envs.classic_control import utils
|
||||||
from gym.error import DependencyNotInstalled
|
from gymnasium.error import DependencyNotInstalled
|
||||||
|
|
||||||
|
|
||||||
class Continuous_MountainCarEnv(gym.Env):
|
class Continuous_MountainCarEnv(gymnasium.Env):
|
||||||
"""
|
"""
|
||||||
### Description
|
### Description
|
||||||
|
|
||||||
@@ -32,7 +32,7 @@ class Continuous_MountainCarEnv(gym.Env):
|
|||||||
at the bottom of a sinusoidal valley, with the only possible actions being the accelerations
|
at the bottom of a sinusoidal valley, with the only possible actions being the accelerations
|
||||||
that can be applied to the car in either direction. The goal of the MDP is to strategically
|
that can be applied to the car in either direction. The goal of the MDP is to strategically
|
||||||
accelerate the car to reach the goal state on top of the right hill. There are two versions
|
accelerate the car to reach the goal state on top of the right hill. There are two versions
|
||||||
of the mountain car domain in gym: one with discrete actions and one with continuous.
|
of the mountain car domain in gymnasium: one with discrete actions and one with continuous.
|
||||||
This version is the one with continuous actions.
|
This version is the one with continuous actions.
|
||||||
|
|
||||||
This MDP first appeared in [Andrew Moore's PhD Thesis (1990)](https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-209.pdf)
|
This MDP first appeared in [Andrew Moore's PhD Thesis (1990)](https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-209.pdf)
|
||||||
@@ -92,7 +92,7 @@ class Continuous_MountainCarEnv(gym.Env):
|
|||||||
### Arguments
|
### Arguments
|
||||||
|
|
||||||
```
|
```
|
||||||
gym.make('MountainCarContinuous-v0')
|
gymnasium.make('MountainCarContinuous-v0')
|
||||||
```
|
```
|
||||||
|
|
||||||
### Version History
|
### Version History
|
||||||
@@ -112,7 +112,7 @@ class Continuous_MountainCarEnv(gym.Env):
|
|||||||
self.max_position = 0.6
|
self.max_position = 0.6
|
||||||
self.max_speed = 0.07
|
self.max_speed = 0.07
|
||||||
self.goal_position = (
|
self.goal_position = (
|
||||||
0.45 # was 0.5 in gym, 0.45 in Arnaud de Broissia's version
|
0.45 # was 0.5 in gymnasium, 0.45 in Arnaud de Broissia's version
|
||||||
)
|
)
|
||||||
self.goal_velocity = goal_velocity
|
self.goal_velocity = goal_velocity
|
||||||
self.power = 0.0015
|
self.power = 0.0015
|
||||||
@@ -194,7 +194,7 @@ class Continuous_MountainCarEnv(gym.Env):
|
|||||||
from pygame import gfxdraw
|
from pygame import gfxdraw
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise DependencyNotInstalled(
|
raise DependencyNotInstalled(
|
||||||
"pygame is not installed, run `pip install gym[classic_control]`"
|
"pygame is not installed, run `pip install gymnasium[classic_control]`"
|
||||||
)
|
)
|
||||||
|
|
||||||
if self.screen is None:
|
if self.screen is None:
|
@@ -7,13 +7,13 @@ from typing import Optional
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
import gym
|
import gymnasium
|
||||||
from gym import spaces
|
from gymnasium import spaces
|
||||||
from gym.envs.classic_control import utils
|
from gymnasium.envs.classic_control import utils
|
||||||
from gym.error import DependencyNotInstalled
|
from gymnasium.error import DependencyNotInstalled
|
||||||
|
|
||||||
|
|
||||||
class MountainCarEnv(gym.Env):
|
class MountainCarEnv(gymnasium.Env):
|
||||||
"""
|
"""
|
||||||
### Description
|
### Description
|
||||||
|
|
||||||
@@ -21,7 +21,7 @@ class MountainCarEnv(gym.Env):
|
|||||||
at the bottom of a sinusoidal valley, with the only possible actions being the accelerations
|
at the bottom of a sinusoidal valley, with the only possible actions being the accelerations
|
||||||
that can be applied to the car in either direction. The goal of the MDP is to strategically
|
that can be applied to the car in either direction. The goal of the MDP is to strategically
|
||||||
accelerate the car to reach the goal state on top of the right hill. There are two versions
|
accelerate the car to reach the goal state on top of the right hill. There are two versions
|
||||||
of the mountain car domain in gym: one with discrete actions and one with continuous.
|
of the mountain car domain in gymnasium: one with discrete actions and one with continuous.
|
||||||
This version is the one with discrete actions.
|
This version is the one with discrete actions.
|
||||||
|
|
||||||
This MDP first appeared in [Andrew Moore's PhD Thesis (1990)](https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-209.pdf)
|
This MDP first appeared in [Andrew Moore's PhD Thesis (1990)](https://www.cl.cam.ac.uk/techreports/UCAM-CL-TR-209.pdf)
|
||||||
@@ -87,7 +87,7 @@ class MountainCarEnv(gym.Env):
|
|||||||
### Arguments
|
### Arguments
|
||||||
|
|
||||||
```
|
```
|
||||||
gym.make('MountainCar-v0')
|
gymnasium.make('MountainCar-v0')
|
||||||
```
|
```
|
||||||
|
|
||||||
### Version History
|
### Version History
|
||||||
@@ -172,7 +172,7 @@ class MountainCarEnv(gym.Env):
|
|||||||
from pygame import gfxdraw
|
from pygame import gfxdraw
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise DependencyNotInstalled(
|
raise DependencyNotInstalled(
|
||||||
"pygame is not installed, run `pip install gym[classic_control]`"
|
"pygame is not installed, run `pip install gymnasium[classic_control]`"
|
||||||
)
|
)
|
||||||
|
|
||||||
if self.screen is None:
|
if self.screen is None:
|
@@ -5,16 +5,16 @@ from typing import Optional
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
import gym
|
import gymnasium
|
||||||
from gym import spaces
|
from gymnasium import spaces
|
||||||
from gym.envs.classic_control import utils
|
from gymnasium.envs.classic_control import utils
|
||||||
from gym.error import DependencyNotInstalled
|
from gymnasium.error import DependencyNotInstalled
|
||||||
|
|
||||||
DEFAULT_X = np.pi
|
DEFAULT_X = np.pi
|
||||||
DEFAULT_Y = 1.0
|
DEFAULT_Y = 1.0
|
||||||
|
|
||||||
|
|
||||||
class PendulumEnv(gym.Env):
|
class PendulumEnv(gymnasium.Env):
|
||||||
"""
|
"""
|
||||||
### Description
|
### Description
|
||||||
|
|
||||||
@@ -77,7 +77,7 @@ class PendulumEnv(gym.Env):
|
|||||||
The default value is g = 10.0 .
|
The default value is g = 10.0 .
|
||||||
|
|
||||||
```
|
```
|
||||||
gym.make('Pendulum-v1', g=9.81)
|
gymnasium.make('Pendulum-v1', g=9.81)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Version History
|
### Version History
|
||||||
@@ -110,7 +110,7 @@ class PendulumEnv(gym.Env):
|
|||||||
high = np.array([1.0, 1.0, self.max_speed], dtype=np.float32)
|
high = np.array([1.0, 1.0, self.max_speed], dtype=np.float32)
|
||||||
# This will throw a warning in tests/envs/test_envs in utils/env_checker.py as the space is not symmetric
|
# This will throw a warning in tests/envs/test_envs in utils/env_checker.py as the space is not symmetric
|
||||||
# or normalised as max_torque == 2 by default. Ignoring the issue here as the default settings are too old
|
# or normalised as max_torque == 2 by default. Ignoring the issue here as the default settings are too old
|
||||||
# to update to follow the openai gym api
|
# to update to follow the openai gymnasium api
|
||||||
self.action_space = spaces.Box(
|
self.action_space = spaces.Box(
|
||||||
low=-self.max_torque, high=self.max_torque, shape=(1,), dtype=np.float32
|
low=-self.max_torque, high=self.max_torque, shape=(1,), dtype=np.float32
|
||||||
)
|
)
|
||||||
@@ -168,7 +168,7 @@ class PendulumEnv(gym.Env):
|
|||||||
from pygame import gfxdraw
|
from pygame import gfxdraw
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise DependencyNotInstalled(
|
raise DependencyNotInstalled(
|
||||||
"pygame is not installed, run `pip install gym[classic_control]`"
|
"pygame is not installed, run `pip install gymnasium[classic_control]`"
|
||||||
)
|
)
|
||||||
|
|
||||||
if self.screen is None:
|
if self.screen is None:
|
19
gymnasium/envs/mujoco/__init__.py
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
from gymnasium.envs.mujoco.mujoco_env import MujocoEnv, MuJocoPyEnv # isort:skip
|
||||||
|
from gymnasium.envs.mujoco.mujoco_rendering import ( # isort:skip
|
||||||
|
RenderContextOffscreen,
|
||||||
|
Viewer,
|
||||||
|
)
|
||||||
|
|
||||||
|
# ^^^^^ so that user gets the correct error
|
||||||
|
# message if mujoco is not installed correctly
|
||||||
|
from gymnasium.envs.mujoco.ant import AntEnv
|
||||||
|
from gymnasium.envs.mujoco.half_cheetah import HalfCheetahEnv
|
||||||
|
from gymnasium.envs.mujoco.hopper import HopperEnv
|
||||||
|
from gymnasium.envs.mujoco.humanoid import HumanoidEnv
|
||||||
|
from gymnasium.envs.mujoco.humanoidstandup import HumanoidStandupEnv
|
||||||
|
from gymnasium.envs.mujoco.inverted_double_pendulum import InvertedDoublePendulumEnv
|
||||||
|
from gymnasium.envs.mujoco.inverted_pendulum import InvertedPendulumEnv
|
||||||
|
from gymnasium.envs.mujoco.pusher import PusherEnv
|
||||||
|
from gymnasium.envs.mujoco.reacher import ReacherEnv
|
||||||
|
from gymnasium.envs.mujoco.swimmer import SwimmerEnv
|
||||||
|
from gymnasium.envs.mujoco.walker2d import Walker2dEnv
|
@@ -1,8 +1,8 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import utils
|
from gymnasium import utils
|
||||||
from gym.envs.mujoco import MuJocoPyEnv
|
from gymnasium.envs.mujoco import MuJocoPyEnv
|
||||||
from gym.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
|
||||||
|
|
||||||
class AntEnv(MuJocoPyEnv, utils.EzPickle):
|
class AntEnv(MuJocoPyEnv, utils.EzPickle):
|
@@ -1,8 +1,8 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import utils
|
from gymnasium import utils
|
||||||
from gym.envs.mujoco import MuJocoPyEnv
|
from gymnasium.envs.mujoco import MuJocoPyEnv
|
||||||
from gym.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
|
||||||
DEFAULT_CAMERA_CONFIG = {
|
DEFAULT_CAMERA_CONFIG = {
|
||||||
"distance": 4.0,
|
"distance": 4.0,
|
@@ -1,8 +1,8 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import utils
|
from gymnasium import utils
|
||||||
from gym.envs.mujoco import MujocoEnv
|
from gymnasium.envs.mujoco import MujocoEnv
|
||||||
from gym.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
|
||||||
DEFAULT_CAMERA_CONFIG = {
|
DEFAULT_CAMERA_CONFIG = {
|
||||||
"distance": 4.0,
|
"distance": 4.0,
|
||||||
@@ -143,13 +143,13 @@ class AntEnv(MujocoEnv, utils.EzPickle):
|
|||||||
No additional arguments are currently supported in v2 and lower.
|
No additional arguments are currently supported in v2 and lower.
|
||||||
|
|
||||||
```
|
```
|
||||||
env = gym.make('Ant-v2')
|
env = gymnasium.make('Ant-v2')
|
||||||
```
|
```
|
||||||
|
|
||||||
v3 and v4 take gym.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc.
|
v3 and v4 take gymnasium.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc.
|
||||||
|
|
||||||
```
|
```
|
||||||
env = gym.make('Ant-v4', ctrl_cost_weight=0.1, ...)
|
env = gymnasium.make('Ant-v4', ctrl_cost_weight=0.1, ...)
|
||||||
```
|
```
|
||||||
|
|
||||||
| Parameter | Type | Default |Description |
|
| Parameter | Type | Default |Description |
|
||||||
@@ -166,7 +166,7 @@ class AntEnv(MujocoEnv, utils.EzPickle):
|
|||||||
|
|
||||||
### Version History
|
### Version History
|
||||||
* v4: all mujoco environments now use the mujoco bindings in mujoco>=2.1.3
|
* v4: all mujoco environments now use the mujoco bindings in mujoco>=2.1.3
|
||||||
* v3: support for gym.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc. rgb rendering comes from tracking camera (so agent does not run away from screen)
|
* v3: support for gymnasium.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc. rgb rendering comes from tracking camera (so agent does not run away from screen)
|
||||||
* v2: All continuous control environments now use mujoco_py >= 1.50
|
* v2: All continuous control environments now use mujoco_py >= 1.50
|
||||||
* v1: max_time_steps raised to 1000 for robot based tasks. Added reward_threshold to environments.
|
* v1: max_time_steps raised to 1000 for robot based tasks. Added reward_threshold to environments.
|
||||||
* v0: Initial versions release (1.0.0)
|
* v0: Initial versions release (1.0.0)
|
@@ -1,121 +1,121 @@
|
|||||||
<mujoco model="humanoid">
|
<mujoco model="humanoid">
|
||||||
<compiler angle="degree" inertiafromgeom="true"/>
|
<compiler angle="degree" inertiafromgeom="true"/>
|
||||||
<default>
|
<default>
|
||||||
<joint armature="1" damping="1" limited="true"/>
|
<joint armature="1" damping="1" limited="true"/>
|
||||||
<geom conaffinity="1" condim="1" contype="1" margin="0.001" material="geom" rgba="0.8 0.6 .4 1"/>
|
<geom conaffinity="1" condim="1" contype="1" margin="0.001" material="geom" rgba="0.8 0.6 .4 1"/>
|
||||||
<motor ctrllimited="true" ctrlrange="-.4 .4"/>
|
<motor ctrllimited="true" ctrlrange="-.4 .4"/>
|
||||||
</default>
|
</default>
|
||||||
<option integrator="RK4" iterations="50" solver="PGS" timestep="0.003">
|
<option integrator="RK4" iterations="50" solver="PGS" timestep="0.003">
|
||||||
<!-- <flags solverstat="enable" energy="enable"/>-->
|
<!-- <flags solverstat="enable" energy="enable"/>-->
|
||||||
</option>
|
</option>
|
||||||
<size nkey="5" nuser_geom="1"/>
|
<size nkey="5" nuser_geom="1"/>
|
||||||
<visual>
|
<visual>
|
||||||
<map fogend="5" fogstart="3"/>
|
<map fogend="5" fogstart="3"/>
|
||||||
</visual>
|
</visual>
|
||||||
<asset>
|
<asset>
|
||||||
<texture builtin="gradient" height="100" rgb1=".4 .5 .6" rgb2="0 0 0" type="skybox" width="100"/>
|
<texture builtin="gradient" height="100" rgb1=".4 .5 .6" rgb2="0 0 0" type="skybox" width="100"/>
|
||||||
<!-- <texture builtin="gradient" height="100" rgb1="1 1 1" rgb2="0 0 0" type="skybox" width="100"/>-->
|
<!-- <texture builtin="gradient" height="100" rgb1="1 1 1" rgb2="0 0 0" type="skybox" width="100"/>-->
|
||||||
<texture builtin="flat" height="1278" mark="cross" markrgb="1 1 1" name="texgeom" random="0.01" rgb1="0.8 0.6 0.4" rgb2="0.8 0.6 0.4" type="cube" width="127"/>
|
<texture builtin="flat" height="1278" mark="cross" markrgb="1 1 1" name="texgeom" random="0.01" rgb1="0.8 0.6 0.4" rgb2="0.8 0.6 0.4" type="cube" width="127"/>
|
||||||
<texture builtin="checker" height="100" name="texplane" rgb1="0 0 0" rgb2="0.8 0.8 0.8" type="2d" width="100"/>
|
<texture builtin="checker" height="100" name="texplane" rgb1="0 0 0" rgb2="0.8 0.8 0.8" type="2d" width="100"/>
|
||||||
<material name="MatPlane" reflectance="0.5" shininess="1" specular="1" texrepeat="60 60" texture="texplane"/>
|
<material name="MatPlane" reflectance="0.5" shininess="1" specular="1" texrepeat="60 60" texture="texplane"/>
|
||||||
<material name="geom" texture="texgeom" texuniform="true"/>
|
<material name="geom" texture="texgeom" texuniform="true"/>
|
||||||
</asset>
|
</asset>
|
||||||
<worldbody>
|
<worldbody>
|
||||||
<light cutoff="100" diffuse="1 1 1" dir="-0 0 -1.3" directional="true" exponent="1" pos="0 0 1.3" specular=".1 .1 .1"/>
|
<light cutoff="100" diffuse="1 1 1" dir="-0 0 -1.3" directional="true" exponent="1" pos="0 0 1.3" specular=".1 .1 .1"/>
|
||||||
<geom condim="3" friction="1 .1 .1" material="MatPlane" name="floor" pos="0 0 0" rgba="0.8 0.9 0.8 1" size="20 20 0.125" type="plane"/>
|
<geom condim="3" friction="1 .1 .1" material="MatPlane" name="floor" pos="0 0 0" rgba="0.8 0.9 0.8 1" size="20 20 0.125" type="plane"/>
|
||||||
<!-- <geom condim="3" material="MatPlane" name="floor" pos="0 0 0" size="10 10 0.125" type="plane"/>-->
|
<!-- <geom condim="3" material="MatPlane" name="floor" pos="0 0 0" size="10 10 0.125" type="plane"/>-->
|
||||||
<body name="torso" pos="0 0 1.4">
|
<body name="torso" pos="0 0 1.4">
|
||||||
<camera name="track" mode="trackcom" pos="0 -4 0" xyaxes="1 0 0 0 0 1"/>
|
<camera name="track" mode="trackcom" pos="0 -4 0" xyaxes="1 0 0 0 0 1"/>
|
||||||
<joint armature="0" damping="0" limited="false" name="root" pos="0 0 0" stiffness="0" type="free"/>
|
<joint armature="0" damping="0" limited="false" name="root" pos="0 0 0" stiffness="0" type="free"/>
|
||||||
<geom fromto="0 -.07 0 0 .07 0" name="torso1" size="0.07" type="capsule"/>
|
<geom fromto="0 -.07 0 0 .07 0" name="torso1" size="0.07" type="capsule"/>
|
||||||
<geom name="head" pos="0 0 .19" size=".09" type="sphere" user="258"/>
|
<geom name="head" pos="0 0 .19" size=".09" type="sphere" user="258"/>
|
||||||
<geom fromto="-.01 -.06 -.12 -.01 .06 -.12" name="uwaist" size="0.06" type="capsule"/>
|
<geom fromto="-.01 -.06 -.12 -.01 .06 -.12" name="uwaist" size="0.06" type="capsule"/>
|
||||||
<body name="lwaist" pos="-.01 0 -0.260" quat="1.000 0 -0.002 0">
|
<body name="lwaist" pos="-.01 0 -0.260" quat="1.000 0 -0.002 0">
|
||||||
<geom fromto="0 -.06 0 0 .06 0" name="lwaist" size="0.06" type="capsule"/>
|
<geom fromto="0 -.06 0 0 .06 0" name="lwaist" size="0.06" type="capsule"/>
|
||||||
<joint armature="0.02" axis="0 0 1" damping="5" name="abdomen_z" pos="0 0 0.065" range="-45 45" stiffness="20" type="hinge"/>
|
<joint armature="0.02" axis="0 0 1" damping="5" name="abdomen_z" pos="0 0 0.065" range="-45 45" stiffness="20" type="hinge"/>
|
||||||
<joint armature="0.02" axis="0 1 0" damping="5" name="abdomen_y" pos="0 0 0.065" range="-75 30" stiffness="10" type="hinge"/>
|
<joint armature="0.02" axis="0 1 0" damping="5" name="abdomen_y" pos="0 0 0.065" range="-75 30" stiffness="10" type="hinge"/>
|
||||||
<body name="pelvis" pos="0 0 -0.165" quat="1.000 0 -0.002 0">
|
<body name="pelvis" pos="0 0 -0.165" quat="1.000 0 -0.002 0">
|
||||||
<joint armature="0.02" axis="1 0 0" damping="5" name="abdomen_x" pos="0 0 0.1" range="-35 35" stiffness="10" type="hinge"/>
|
<joint armature="0.02" axis="1 0 0" damping="5" name="abdomen_x" pos="0 0 0.1" range="-35 35" stiffness="10" type="hinge"/>
|
||||||
<geom fromto="-.02 -.07 0 -.02 .07 0" name="butt" size="0.09" type="capsule"/>
|
<geom fromto="-.02 -.07 0 -.02 .07 0" name="butt" size="0.09" type="capsule"/>
|
||||||
<body name="right_thigh" pos="0 -0.1 -0.04">
|
<body name="right_thigh" pos="0 -0.1 -0.04">
|
||||||
<joint armature="0.01" axis="1 0 0" damping="5" name="right_hip_x" pos="0 0 0" range="-25 5" stiffness="10" type="hinge"/>
|
<joint armature="0.01" axis="1 0 0" damping="5" name="right_hip_x" pos="0 0 0" range="-25 5" stiffness="10" type="hinge"/>
|
||||||
<joint armature="0.01" axis="0 0 1" damping="5" name="right_hip_z" pos="0 0 0" range="-60 35" stiffness="10" type="hinge"/>
|
<joint armature="0.01" axis="0 0 1" damping="5" name="right_hip_z" pos="0 0 0" range="-60 35" stiffness="10" type="hinge"/>
|
||||||
<joint armature="0.0080" axis="0 1 0" damping="5" name="right_hip_y" pos="0 0 0" range="-110 20" stiffness="20" type="hinge"/>
|
<joint armature="0.0080" axis="0 1 0" damping="5" name="right_hip_y" pos="0 0 0" range="-110 20" stiffness="20" type="hinge"/>
|
||||||
<geom fromto="0 0 0 0 0.01 -.34" name="right_thigh1" size="0.06" type="capsule"/>
|
<geom fromto="0 0 0 0 0.01 -.34" name="right_thigh1" size="0.06" type="capsule"/>
|
||||||
<body name="right_shin" pos="0 0.01 -0.403">
|
<body name="right_shin" pos="0 0.01 -0.403">
|
||||||
<joint armature="0.0060" axis="0 -1 0" name="right_knee" pos="0 0 .02" range="-160 -2" type="hinge"/>
|
<joint armature="0.0060" axis="0 -1 0" name="right_knee" pos="0 0 .02" range="-160 -2" type="hinge"/>
|
||||||
<geom fromto="0 0 0 0 0 -.3" name="right_shin1" size="0.049" type="capsule"/>
|
<geom fromto="0 0 0 0 0 -.3" name="right_shin1" size="0.049" type="capsule"/>
|
||||||
<body name="right_foot" pos="0 0 -0.45">
|
<body name="right_foot" pos="0 0 -0.45">
|
||||||
<geom name="right_foot" pos="0 0 0.1" size="0.075" type="sphere" user="0"/>
|
<geom name="right_foot" pos="0 0 0.1" size="0.075" type="sphere" user="0"/>
|
||||||
</body>
|
</body>
|
||||||
</body>
|
</body>
|
||||||
</body>
|
</body>
|
||||||
<body name="left_thigh" pos="0 0.1 -0.04">
|
<body name="left_thigh" pos="0 0.1 -0.04">
|
||||||
<joint armature="0.01" axis="-1 0 0" damping="5" name="left_hip_x" pos="0 0 0" range="-25 5" stiffness="10" type="hinge"/>
|
<joint armature="0.01" axis="-1 0 0" damping="5" name="left_hip_x" pos="0 0 0" range="-25 5" stiffness="10" type="hinge"/>
|
||||||
<joint armature="0.01" axis="0 0 -1" damping="5" name="left_hip_z" pos="0 0 0" range="-60 35" stiffness="10" type="hinge"/>
|
<joint armature="0.01" axis="0 0 -1" damping="5" name="left_hip_z" pos="0 0 0" range="-60 35" stiffness="10" type="hinge"/>
|
||||||
<joint armature="0.01" axis="0 1 0" damping="5" name="left_hip_y" pos="0 0 0" range="-110 20" stiffness="20" type="hinge"/>
|
<joint armature="0.01" axis="0 1 0" damping="5" name="left_hip_y" pos="0 0 0" range="-110 20" stiffness="20" type="hinge"/>
|
||||||
<geom fromto="0 0 0 0 -0.01 -.34" name="left_thigh1" size="0.06" type="capsule"/>
|
<geom fromto="0 0 0 0 -0.01 -.34" name="left_thigh1" size="0.06" type="capsule"/>
|
||||||
<body name="left_shin" pos="0 -0.01 -0.403">
|
<body name="left_shin" pos="0 -0.01 -0.403">
|
||||||
<joint armature="0.0060" axis="0 -1 0" name="left_knee" pos="0 0 .02" range="-160 -2" stiffness="1" type="hinge"/>
|
<joint armature="0.0060" axis="0 -1 0" name="left_knee" pos="0 0 .02" range="-160 -2" stiffness="1" type="hinge"/>
|
||||||
<geom fromto="0 0 0 0 0 -.3" name="left_shin1" size="0.049" type="capsule"/>
|
<geom fromto="0 0 0 0 0 -.3" name="left_shin1" size="0.049" type="capsule"/>
|
||||||
<body name="left_foot" pos="0 0 -0.45">
|
<body name="left_foot" pos="0 0 -0.45">
|
||||||
<geom name="left_foot" type="sphere" size="0.075" pos="0 0 0.1" user="0" />
|
<geom name="left_foot" type="sphere" size="0.075" pos="0 0 0.1" user="0" />
|
||||||
</body>
|
</body>
|
||||||
</body>
|
</body>
|
||||||
</body>
|
</body>
|
||||||
</body>
|
</body>
|
||||||
</body>
|
</body>
|
||||||
<body name="right_upper_arm" pos="0 -0.17 0.06">
|
<body name="right_upper_arm" pos="0 -0.17 0.06">
|
||||||
<joint armature="0.0068" axis="2 1 1" name="right_shoulder1" pos="0 0 0" range="-85 60" stiffness="1" type="hinge"/>
|
<joint armature="0.0068" axis="2 1 1" name="right_shoulder1" pos="0 0 0" range="-85 60" stiffness="1" type="hinge"/>
|
||||||
<joint armature="0.0051" axis="0 -1 1" name="right_shoulder2" pos="0 0 0" range="-85 60" stiffness="1" type="hinge"/>
|
<joint armature="0.0051" axis="0 -1 1" name="right_shoulder2" pos="0 0 0" range="-85 60" stiffness="1" type="hinge"/>
|
||||||
<geom fromto="0 0 0 .16 -.16 -.16" name="right_uarm1" size="0.04 0.16" type="capsule"/>
|
<geom fromto="0 0 0 .16 -.16 -.16" name="right_uarm1" size="0.04 0.16" type="capsule"/>
|
||||||
<body name="right_lower_arm" pos=".18 -.18 -.18">
|
<body name="right_lower_arm" pos=".18 -.18 -.18">
|
||||||
<joint armature="0.0028" axis="0 -1 1" name="right_elbow" pos="0 0 0" range="-90 50" stiffness="0" type="hinge"/>
|
<joint armature="0.0028" axis="0 -1 1" name="right_elbow" pos="0 0 0" range="-90 50" stiffness="0" type="hinge"/>
|
||||||
<geom fromto="0.01 0.01 0.01 .17 .17 .17" name="right_larm" size="0.031" type="capsule"/>
|
<geom fromto="0.01 0.01 0.01 .17 .17 .17" name="right_larm" size="0.031" type="capsule"/>
|
||||||
<geom name="right_hand" pos=".18 .18 .18" size="0.04" type="sphere"/>
|
<geom name="right_hand" pos=".18 .18 .18" size="0.04" type="sphere"/>
|
||||||
<camera pos="0 0 0"/>
|
<camera pos="0 0 0"/>
|
||||||
</body>
|
</body>
|
||||||
</body>
|
</body>
|
||||||
<body name="left_upper_arm" pos="0 0.17 0.06">
|
<body name="left_upper_arm" pos="0 0.17 0.06">
|
||||||
<joint armature="0.0068" axis="2 -1 1" name="left_shoulder1" pos="0 0 0" range="-60 85" stiffness="1" type="hinge"/>
|
<joint armature="0.0068" axis="2 -1 1" name="left_shoulder1" pos="0 0 0" range="-60 85" stiffness="1" type="hinge"/>
|
||||||
<joint armature="0.0051" axis="0 1 1" name="left_shoulder2" pos="0 0 0" range="-60 85" stiffness="1" type="hinge"/>
|
<joint armature="0.0051" axis="0 1 1" name="left_shoulder2" pos="0 0 0" range="-60 85" stiffness="1" type="hinge"/>
|
||||||
<geom fromto="0 0 0 .16 .16 -.16" name="left_uarm1" size="0.04 0.16" type="capsule"/>
|
<geom fromto="0 0 0 .16 .16 -.16" name="left_uarm1" size="0.04 0.16" type="capsule"/>
|
||||||
<body name="left_lower_arm" pos=".18 .18 -.18">
|
<body name="left_lower_arm" pos=".18 .18 -.18">
|
||||||
<joint armature="0.0028" axis="0 -1 -1" name="left_elbow" pos="0 0 0" range="-90 50" stiffness="0" type="hinge"/>
|
<joint armature="0.0028" axis="0 -1 -1" name="left_elbow" pos="0 0 0" range="-90 50" stiffness="0" type="hinge"/>
|
||||||
<geom fromto="0.01 -0.01 0.01 .17 -.17 .17" name="left_larm" size="0.031" type="capsule"/>
|
<geom fromto="0.01 -0.01 0.01 .17 -.17 .17" name="left_larm" size="0.031" type="capsule"/>
|
||||||
<geom name="left_hand" pos=".18 -.18 .18" size="0.04" type="sphere"/>
|
<geom name="left_hand" pos=".18 -.18 .18" size="0.04" type="sphere"/>
|
||||||
</body>
|
</body>
|
||||||
</body>
|
</body>
|
||||||
</body>
|
</body>
|
||||||
</worldbody>
|
</worldbody>
|
||||||
<tendon>
|
<tendon>
|
||||||
<fixed name="left_hipknee">
|
<fixed name="left_hipknee">
|
||||||
<joint coef="-1" joint="left_hip_y"/>
|
<joint coef="-1" joint="left_hip_y"/>
|
||||||
<joint coef="1" joint="left_knee"/>
|
<joint coef="1" joint="left_knee"/>
|
||||||
</fixed>
|
</fixed>
|
||||||
<fixed name="right_hipknee">
|
<fixed name="right_hipknee">
|
||||||
<joint coef="-1" joint="right_hip_y"/>
|
<joint coef="-1" joint="right_hip_y"/>
|
||||||
<joint coef="1" joint="right_knee"/>
|
<joint coef="1" joint="right_knee"/>
|
||||||
</fixed>
|
</fixed>
|
||||||
</tendon>
|
</tendon>
|
||||||
|
|
||||||
<actuator>
|
<actuator>
|
||||||
<motor gear="100" joint="abdomen_y" name="abdomen_y"/>
|
<motor gear="100" joint="abdomen_y" name="abdomen_y"/>
|
||||||
<motor gear="100" joint="abdomen_z" name="abdomen_z"/>
|
<motor gear="100" joint="abdomen_z" name="abdomen_z"/>
|
||||||
<motor gear="100" joint="abdomen_x" name="abdomen_x"/>
|
<motor gear="100" joint="abdomen_x" name="abdomen_x"/>
|
||||||
<motor gear="100" joint="right_hip_x" name="right_hip_x"/>
|
<motor gear="100" joint="right_hip_x" name="right_hip_x"/>
|
||||||
<motor gear="100" joint="right_hip_z" name="right_hip_z"/>
|
<motor gear="100" joint="right_hip_z" name="right_hip_z"/>
|
||||||
<motor gear="300" joint="right_hip_y" name="right_hip_y"/>
|
<motor gear="300" joint="right_hip_y" name="right_hip_y"/>
|
||||||
<motor gear="200" joint="right_knee" name="right_knee"/>
|
<motor gear="200" joint="right_knee" name="right_knee"/>
|
||||||
<motor gear="100" joint="left_hip_x" name="left_hip_x"/>
|
<motor gear="100" joint="left_hip_x" name="left_hip_x"/>
|
||||||
<motor gear="100" joint="left_hip_z" name="left_hip_z"/>
|
<motor gear="100" joint="left_hip_z" name="left_hip_z"/>
|
||||||
<motor gear="300" joint="left_hip_y" name="left_hip_y"/>
|
<motor gear="300" joint="left_hip_y" name="left_hip_y"/>
|
||||||
<motor gear="200" joint="left_knee" name="left_knee"/>
|
<motor gear="200" joint="left_knee" name="left_knee"/>
|
||||||
<motor gear="25" joint="right_shoulder1" name="right_shoulder1"/>
|
<motor gear="25" joint="right_shoulder1" name="right_shoulder1"/>
|
||||||
<motor gear="25" joint="right_shoulder2" name="right_shoulder2"/>
|
<motor gear="25" joint="right_shoulder2" name="right_shoulder2"/>
|
||||||
<motor gear="25" joint="right_elbow" name="right_elbow"/>
|
<motor gear="25" joint="right_elbow" name="right_elbow"/>
|
||||||
<motor gear="25" joint="left_shoulder1" name="left_shoulder1"/>
|
<motor gear="25" joint="left_shoulder1" name="left_shoulder1"/>
|
||||||
<motor gear="25" joint="left_shoulder2" name="left_shoulder2"/>
|
<motor gear="25" joint="left_shoulder2" name="left_shoulder2"/>
|
||||||
<motor gear="25" joint="left_elbow" name="left_elbow"/>
|
<motor gear="25" joint="left_elbow" name="left_elbow"/>
|
||||||
</actuator>
|
</actuator>
|
||||||
</mujoco>
|
</mujoco>
|
@@ -1,121 +1,121 @@
|
|||||||
<mujoco model="humanoidstandup">
|
<mujoco model="humanoidstandup">
|
||||||
<compiler angle="degree" inertiafromgeom="true"/>
|
<compiler angle="degree" inertiafromgeom="true"/>
|
||||||
<default>
|
<default>
|
||||||
<joint armature="1" damping="1" limited="true"/>
|
<joint armature="1" damping="1" limited="true"/>
|
||||||
<geom conaffinity="1" condim="1" contype="1" margin="0.001" material="geom" rgba="0.8 0.6 .4 1"/>
|
<geom conaffinity="1" condim="1" contype="1" margin="0.001" material="geom" rgba="0.8 0.6 .4 1"/>
|
||||||
<motor ctrllimited="true" ctrlrange="-.4 .4"/>
|
<motor ctrllimited="true" ctrlrange="-.4 .4"/>
|
||||||
</default>
|
</default>
|
||||||
<option integrator="RK4" iterations="50" solver="PGS" timestep="0.003">
|
<option integrator="RK4" iterations="50" solver="PGS" timestep="0.003">
|
||||||
<!-- <flags solverstat="enable" energy="enable"/>-->
|
<!-- <flags solverstat="enable" energy="enable"/>-->
|
||||||
</option>
|
</option>
|
||||||
<size nkey="5" nuser_geom="1"/>
|
<size nkey="5" nuser_geom="1"/>
|
||||||
<visual>
|
<visual>
|
||||||
<map fogend="5" fogstart="3"/>
|
<map fogend="5" fogstart="3"/>
|
||||||
</visual>
|
</visual>
|
||||||
<asset>
|
<asset>
|
||||||
<texture builtin="gradient" height="100" rgb1=".4 .5 .6" rgb2="0 0 0" type="skybox" width="100"/>
|
<texture builtin="gradient" height="100" rgb1=".4 .5 .6" rgb2="0 0 0" type="skybox" width="100"/>
|
||||||
<!-- <texture builtin="gradient" height="100" rgb1="1 1 1" rgb2="0 0 0" type="skybox" width="100"/>-->
|
<!-- <texture builtin="gradient" height="100" rgb1="1 1 1" rgb2="0 0 0" type="skybox" width="100"/>-->
|
||||||
<texture builtin="flat" height="1278" mark="cross" markrgb="1 1 1" name="texgeom" random="0.01" rgb1="0.8 0.6 0.4" rgb2="0.8 0.6 0.4" type="cube" width="127"/>
|
<texture builtin="flat" height="1278" mark="cross" markrgb="1 1 1" name="texgeom" random="0.01" rgb1="0.8 0.6 0.4" rgb2="0.8 0.6 0.4" type="cube" width="127"/>
|
||||||
<texture builtin="checker" height="100" name="texplane" rgb1="0 0 0" rgb2="0.8 0.8 0.8" type="2d" width="100"/>
|
<texture builtin="checker" height="100" name="texplane" rgb1="0 0 0" rgb2="0.8 0.8 0.8" type="2d" width="100"/>
|
||||||
<material name="MatPlane" reflectance="0.5" shininess="1" specular="1" texrepeat="60 60" texture="texplane"/>
|
<material name="MatPlane" reflectance="0.5" shininess="1" specular="1" texrepeat="60 60" texture="texplane"/>
|
||||||
<material name="geom" texture="texgeom" texuniform="true"/>
|
<material name="geom" texture="texgeom" texuniform="true"/>
|
||||||
</asset>
|
</asset>
|
||||||
<worldbody>
|
<worldbody>
|
||||||
<light cutoff="100" diffuse="1 1 1" dir="-0 0 -1.3" directional="true" exponent="1" pos="0 0 1.3" specular=".1 .1 .1"/>
|
<light cutoff="100" diffuse="1 1 1" dir="-0 0 -1.3" directional="true" exponent="1" pos="0 0 1.3" specular=".1 .1 .1"/>
|
||||||
<geom condim="3" friction="1 .1 .1" material="MatPlane" name="floor" pos="0 0 0" rgba="0.8 0.9 0.8 1" size="20 20 0.125" type="plane"/>
|
<geom condim="3" friction="1 .1 .1" material="MatPlane" name="floor" pos="0 0 0" rgba="0.8 0.9 0.8 1" size="20 20 0.125" type="plane"/>
|
||||||
<!-- <geom condim="3" material="MatPlane" name="floor" pos="0 0 0" size="10 10 0.125" type="plane"/>-->
|
<!-- <geom condim="3" material="MatPlane" name="floor" pos="0 0 0" size="10 10 0.125" type="plane"/>-->
|
||||||
<body name="torso" pos="0 0 .105">
|
<body name="torso" pos="0 0 .105">
|
||||||
<camera name="track" mode="trackcom" pos="0 -3 .5" xyaxes="1 0 0 0 0 1"/>
|
<camera name="track" mode="trackcom" pos="0 -3 .5" xyaxes="1 0 0 0 0 1"/>
|
||||||
<joint armature="0" damping="0" limited="false" name="root" pos="0 0 0" stiffness="0" type="free"/>
|
<joint armature="0" damping="0" limited="false" name="root" pos="0 0 0" stiffness="0" type="free"/>
|
||||||
<geom fromto="0 -.07 0 0 .07 0" name="torso1" size="0.07" type="capsule"/>
|
<geom fromto="0 -.07 0 0 .07 0" name="torso1" size="0.07" type="capsule"/>
|
||||||
<geom name="head" pos="-.15 0 0" size=".09" type="sphere" user="258"/>
|
<geom name="head" pos="-.15 0 0" size=".09" type="sphere" user="258"/>
|
||||||
<geom fromto=".11 -.06 0 .11 .06 0" name="uwaist" size="0.06" type="capsule"/>
|
<geom fromto=".11 -.06 0 .11 .06 0" name="uwaist" size="0.06" type="capsule"/>
|
||||||
<body name="lwaist" pos=".21 0 0" quat="1.000 0 -0.002 0">
|
<body name="lwaist" pos=".21 0 0" quat="1.000 0 -0.002 0">
|
||||||
<geom fromto="0 -.06 0 0 .06 0" name="lwaist" size="0.06" type="capsule"/>
|
<geom fromto="0 -.06 0 0 .06 0" name="lwaist" size="0.06" type="capsule"/>
|
||||||
<joint armature="0.02" axis="0 0 1" damping="5" name="abdomen_z" pos="0 0 0.065" range="-45 45" stiffness="20" type="hinge"/>
|
<joint armature="0.02" axis="0 0 1" damping="5" name="abdomen_z" pos="0 0 0.065" range="-45 45" stiffness="20" type="hinge"/>
|
||||||
<joint armature="0.02" axis="0 1 0" damping="5" name="abdomen_y" pos="0 0 0.065" range="-75 30" stiffness="10" type="hinge"/>
|
<joint armature="0.02" axis="0 1 0" damping="5" name="abdomen_y" pos="0 0 0.065" range="-75 30" stiffness="10" type="hinge"/>
|
||||||
<body name="pelvis" pos="0.165 0 0" quat="1.000 0 -0.002 0">
|
<body name="pelvis" pos="0.165 0 0" quat="1.000 0 -0.002 0">
|
||||||
<joint armature="0.02" axis="1 0 0" damping="5" name="abdomen_x" pos="0 0 0.1" range="-35 35" stiffness="10" type="hinge"/>
|
<joint armature="0.02" axis="1 0 0" damping="5" name="abdomen_x" pos="0 0 0.1" range="-35 35" stiffness="10" type="hinge"/>
|
||||||
<geom fromto="-.02 -.07 0 -.02 .07 0" name="butt" size="0.09" type="capsule"/>
|
<geom fromto="-.02 -.07 0 -.02 .07 0" name="butt" size="0.09" type="capsule"/>
|
||||||
<body name="right_thigh" pos="0 -0.1 0">
|
<body name="right_thigh" pos="0 -0.1 0">
|
||||||
<joint armature="0.01" axis="1 0 0" damping="5" name="right_hip_x" pos="0 0 0" range="-25 5" stiffness="10" type="hinge"/>
|
<joint armature="0.01" axis="1 0 0" damping="5" name="right_hip_x" pos="0 0 0" range="-25 5" stiffness="10" type="hinge"/>
|
||||||
<joint armature="0.01" axis="0 0 1" damping="5" name="right_hip_z" pos="0 0 0" range="-60 35" stiffness="10" type="hinge"/>
|
<joint armature="0.01" axis="0 0 1" damping="5" name="right_hip_z" pos="0 0 0" range="-60 35" stiffness="10" type="hinge"/>
|
||||||
<joint armature="0.0080" axis="0 1 0" damping="5" name="right_hip_y" pos="0 0 0" range="-110 20" stiffness="20" type="hinge"/>
|
<joint armature="0.0080" axis="0 1 0" damping="5" name="right_hip_y" pos="0 0 0" range="-110 20" stiffness="20" type="hinge"/>
|
||||||
<geom fromto="0 0 0 0.34 0.01 0" name="right_thigh1" size="0.06" type="capsule"/>
|
<geom fromto="0 0 0 0.34 0.01 0" name="right_thigh1" size="0.06" type="capsule"/>
|
||||||
<body name="right_shin" pos="0.403 0.01 0">
|
<body name="right_shin" pos="0.403 0.01 0">
|
||||||
<joint armature="0.0060" axis="0 -1 0" name="right_knee" pos="0 0 .02" range="-160 -2" type="hinge"/>
|
<joint armature="0.0060" axis="0 -1 0" name="right_knee" pos="0 0 .02" range="-160 -2" type="hinge"/>
|
||||||
<geom fromto="0 0 0 0.3 0 0" name="right_shin1" size="0.049" type="capsule"/>
|
<geom fromto="0 0 0 0.3 0 0" name="right_shin1" size="0.049" type="capsule"/>
|
||||||
<body name="right_foot" pos="0.35 0 -.10">
|
<body name="right_foot" pos="0.35 0 -.10">
|
||||||
<geom name="right_foot" pos="0 0 0.1" size="0.075" type="sphere" user="0"/>
|
<geom name="right_foot" pos="0 0 0.1" size="0.075" type="sphere" user="0"/>
|
||||||
</body>
|
</body>
|
||||||
</body>
|
</body>
|
||||||
</body>
|
</body>
|
||||||
<body name="left_thigh" pos="0 0.1 0">
|
<body name="left_thigh" pos="0 0.1 0">
|
||||||
<joint armature="0.01" axis="-1 0 0" damping="5" name="left_hip_x" pos="0 0 0" range="-25 5" stiffness="10" type="hinge"/>
|
<joint armature="0.01" axis="-1 0 0" damping="5" name="left_hip_x" pos="0 0 0" range="-25 5" stiffness="10" type="hinge"/>
|
||||||
<joint armature="0.01" axis="0 0 -1" damping="5" name="left_hip_z" pos="0 0 0" range="-60 35" stiffness="10" type="hinge"/>
|
<joint armature="0.01" axis="0 0 -1" damping="5" name="left_hip_z" pos="0 0 0" range="-60 35" stiffness="10" type="hinge"/>
|
||||||
<joint armature="0.01" axis="0 1 0" damping="5" name="left_hip_y" pos="0 0 0" range="-120 20" stiffness="20" type="hinge"/>
|
<joint armature="0.01" axis="0 1 0" damping="5" name="left_hip_y" pos="0 0 0" range="-120 20" stiffness="20" type="hinge"/>
|
||||||
<geom fromto="0 0 0 0.34 -0.01 0" name="left_thigh1" size="0.06" type="capsule"/>
|
<geom fromto="0 0 0 0.34 -0.01 0" name="left_thigh1" size="0.06" type="capsule"/>
|
||||||
<body name="left_shin" pos="0.403 -0.01 0">
|
<body name="left_shin" pos="0.403 -0.01 0">
|
||||||
<joint armature="0.0060" axis="0 -1 0" name="left_knee" pos="0 0 .02" range="-160 -2" stiffness="1" type="hinge"/>
|
<joint armature="0.0060" axis="0 -1 0" name="left_knee" pos="0 0 .02" range="-160 -2" stiffness="1" type="hinge"/>
|
||||||
<geom fromto="0 0 0 0.3 0 0" name="left_shin1" size="0.049" type="capsule"/>
|
<geom fromto="0 0 0 0.3 0 0" name="left_shin1" size="0.049" type="capsule"/>
|
||||||
<body name="left_foot" pos="0.35 0 -.1">
|
<body name="left_foot" pos="0.35 0 -.1">
|
||||||
<geom name="left_foot" type="sphere" size="0.075" pos="0 0 0.1" user="0" />
|
<geom name="left_foot" type="sphere" size="0.075" pos="0 0 0.1" user="0" />
|
||||||
</body>
|
</body>
|
||||||
</body>
|
</body>
|
||||||
</body>
|
</body>
|
||||||
</body>
|
</body>
|
||||||
</body>
|
</body>
|
||||||
<body name="right_upper_arm" pos="0 -0.17 0.06">
|
<body name="right_upper_arm" pos="0 -0.17 0.06">
|
||||||
<joint armature="0.0068" axis="2 1 1" name="right_shoulder1" pos="0 0 0" range="-85 60" stiffness="1" type="hinge"/>
|
<joint armature="0.0068" axis="2 1 1" name="right_shoulder1" pos="0 0 0" range="-85 60" stiffness="1" type="hinge"/>
|
||||||
<joint armature="0.0051" axis="0 -1 1" name="right_shoulder2" pos="0 0 0" range="-85 60" stiffness="1" type="hinge"/>
|
<joint armature="0.0051" axis="0 -1 1" name="right_shoulder2" pos="0 0 0" range="-85 60" stiffness="1" type="hinge"/>
|
||||||
<geom fromto="0 0 0 .16 -.16 -.16" name="right_uarm1" size="0.04 0.16" type="capsule"/>
|
<geom fromto="0 0 0 .16 -.16 -.16" name="right_uarm1" size="0.04 0.16" type="capsule"/>
|
||||||
<body name="right_lower_arm" pos=".18 -.18 -.18">
|
<body name="right_lower_arm" pos=".18 -.18 -.18">
|
||||||
<joint armature="0.0028" axis="0 -1 1" name="right_elbow" pos="0 0 0" range="-90 50" stiffness="0" type="hinge"/>
|
<joint armature="0.0028" axis="0 -1 1" name="right_elbow" pos="0 0 0" range="-90 50" stiffness="0" type="hinge"/>
|
||||||
<geom fromto="0.01 0.01 0.01 .17 .17 .17" name="right_larm" size="0.031" type="capsule"/>
|
<geom fromto="0.01 0.01 0.01 .17 .17 .17" name="right_larm" size="0.031" type="capsule"/>
|
||||||
<geom name="right_hand" pos=".18 .18 .18" size="0.04" type="sphere"/>
|
<geom name="right_hand" pos=".18 .18 .18" size="0.04" type="sphere"/>
|
||||||
<camera pos="0 0 0"/>
|
<camera pos="0 0 0"/>
|
||||||
</body>
|
</body>
|
||||||
</body>
|
</body>
|
||||||
<body name="left_upper_arm" pos="0 0.17 0.06">
|
<body name="left_upper_arm" pos="0 0.17 0.06">
|
||||||
<joint armature="0.0068" axis="2 -1 1" name="left_shoulder1" pos="0 0 0" range="-60 85" stiffness="1" type="hinge"/>
|
<joint armature="0.0068" axis="2 -1 1" name="left_shoulder1" pos="0 0 0" range="-60 85" stiffness="1" type="hinge"/>
|
||||||
<joint armature="0.0051" axis="0 1 1" name="left_shoulder2" pos="0 0 0" range="-60 85" stiffness="1" type="hinge"/>
|
<joint armature="0.0051" axis="0 1 1" name="left_shoulder2" pos="0 0 0" range="-60 85" stiffness="1" type="hinge"/>
|
||||||
<geom fromto="0 0 0 .16 .16 -.16" name="left_uarm1" size="0.04 0.16" type="capsule"/>
|
<geom fromto="0 0 0 .16 .16 -.16" name="left_uarm1" size="0.04 0.16" type="capsule"/>
|
||||||
<body name="left_lower_arm" pos=".18 .18 -.18">
|
<body name="left_lower_arm" pos=".18 .18 -.18">
|
||||||
<joint armature="0.0028" axis="0 -1 -1" name="left_elbow" pos="0 0 0" range="-90 50" stiffness="0" type="hinge"/>
|
<joint armature="0.0028" axis="0 -1 -1" name="left_elbow" pos="0 0 0" range="-90 50" stiffness="0" type="hinge"/>
|
||||||
<geom fromto="0.01 -0.01 0.01 .17 -.17 .17" name="left_larm" size="0.031" type="capsule"/>
|
<geom fromto="0.01 -0.01 0.01 .17 -.17 .17" name="left_larm" size="0.031" type="capsule"/>
|
||||||
<geom name="left_hand" pos=".18 -.18 .18" size="0.04" type="sphere"/>
|
<geom name="left_hand" pos=".18 -.18 .18" size="0.04" type="sphere"/>
|
||||||
</body>
|
</body>
|
||||||
</body>
|
</body>
|
||||||
</body>
|
</body>
|
||||||
</worldbody>
|
</worldbody>
|
||||||
<tendon>
|
<tendon>
|
||||||
<fixed name="left_hipknee">
|
<fixed name="left_hipknee">
|
||||||
<joint coef="-1" joint="left_hip_y"/>
|
<joint coef="-1" joint="left_hip_y"/>
|
||||||
<joint coef="1" joint="left_knee"/>
|
<joint coef="1" joint="left_knee"/>
|
||||||
</fixed>
|
</fixed>
|
||||||
<fixed name="right_hipknee">
|
<fixed name="right_hipknee">
|
||||||
<joint coef="-1" joint="right_hip_y"/>
|
<joint coef="-1" joint="right_hip_y"/>
|
||||||
<joint coef="1" joint="right_knee"/>
|
<joint coef="1" joint="right_knee"/>
|
||||||
</fixed>
|
</fixed>
|
||||||
</tendon>
|
</tendon>
|
||||||
|
|
||||||
<actuator>
|
<actuator>
|
||||||
<motor gear="100" joint="abdomen_y" name="abdomen_y"/>
|
<motor gear="100" joint="abdomen_y" name="abdomen_y"/>
|
||||||
<motor gear="100" joint="abdomen_z" name="abdomen_z"/>
|
<motor gear="100" joint="abdomen_z" name="abdomen_z"/>
|
||||||
<motor gear="100" joint="abdomen_x" name="abdomen_x"/>
|
<motor gear="100" joint="abdomen_x" name="abdomen_x"/>
|
||||||
<motor gear="100" joint="right_hip_x" name="right_hip_x"/>
|
<motor gear="100" joint="right_hip_x" name="right_hip_x"/>
|
||||||
<motor gear="100" joint="right_hip_z" name="right_hip_z"/>
|
<motor gear="100" joint="right_hip_z" name="right_hip_z"/>
|
||||||
<motor gear="300" joint="right_hip_y" name="right_hip_y"/>
|
<motor gear="300" joint="right_hip_y" name="right_hip_y"/>
|
||||||
<motor gear="200" joint="right_knee" name="right_knee"/>
|
<motor gear="200" joint="right_knee" name="right_knee"/>
|
||||||
<motor gear="100" joint="left_hip_x" name="left_hip_x"/>
|
<motor gear="100" joint="left_hip_x" name="left_hip_x"/>
|
||||||
<motor gear="100" joint="left_hip_z" name="left_hip_z"/>
|
<motor gear="100" joint="left_hip_z" name="left_hip_z"/>
|
||||||
<motor gear="300" joint="left_hip_y" name="left_hip_y"/>
|
<motor gear="300" joint="left_hip_y" name="left_hip_y"/>
|
||||||
<motor gear="200" joint="left_knee" name="left_knee"/>
|
<motor gear="200" joint="left_knee" name="left_knee"/>
|
||||||
<motor gear="25" joint="right_shoulder1" name="right_shoulder1"/>
|
<motor gear="25" joint="right_shoulder1" name="right_shoulder1"/>
|
||||||
<motor gear="25" joint="right_shoulder2" name="right_shoulder2"/>
|
<motor gear="25" joint="right_shoulder2" name="right_shoulder2"/>
|
||||||
<motor gear="25" joint="right_elbow" name="right_elbow"/>
|
<motor gear="25" joint="right_elbow" name="right_elbow"/>
|
||||||
<motor gear="25" joint="left_shoulder1" name="left_shoulder1"/>
|
<motor gear="25" joint="left_shoulder1" name="left_shoulder1"/>
|
||||||
<motor gear="25" joint="left_shoulder2" name="left_shoulder2"/>
|
<motor gear="25" joint="left_shoulder2" name="left_shoulder2"/>
|
||||||
<motor gear="25" joint="left_elbow" name="left_elbow"/>
|
<motor gear="25" joint="left_elbow" name="left_elbow"/>
|
||||||
</actuator>
|
</actuator>
|
||||||
</mujoco>
|
</mujoco>
|
@@ -1,27 +1,27 @@
|
|||||||
<mujoco model="inverted pendulum">
|
<mujoco model="inverted pendulum">
|
||||||
<compiler inertiafromgeom="true"/>
|
<compiler inertiafromgeom="true"/>
|
||||||
<default>
|
<default>
|
||||||
<joint armature="0" damping="1" limited="true"/>
|
<joint armature="0" damping="1" limited="true"/>
|
||||||
<geom contype="0" friction="1 0.1 0.1" rgba="0.7 0.7 0 1"/>
|
<geom contype="0" friction="1 0.1 0.1" rgba="0.7 0.7 0 1"/>
|
||||||
<tendon/>
|
<tendon/>
|
||||||
<motor ctrlrange="-3 3"/>
|
<motor ctrlrange="-3 3"/>
|
||||||
</default>
|
</default>
|
||||||
<option gravity="0 0 -9.81" integrator="RK4" timestep="0.02"/>
|
<option gravity="0 0 -9.81" integrator="RK4" timestep="0.02"/>
|
||||||
<size nstack="3000"/>
|
<size nstack="3000"/>
|
||||||
<worldbody>
|
<worldbody>
|
||||||
<!--geom name="ground" type="plane" pos="0 0 0" /-->
|
<!--geom name="ground" type="plane" pos="0 0 0" /-->
|
||||||
<geom name="rail" pos="0 0 0" quat="0.707 0 0.707 0" rgba="0.3 0.3 0.7 1" size="0.02 1" type="capsule"/>
|
<geom name="rail" pos="0 0 0" quat="0.707 0 0.707 0" rgba="0.3 0.3 0.7 1" size="0.02 1" type="capsule"/>
|
||||||
<body name="cart" pos="0 0 0">
|
<body name="cart" pos="0 0 0">
|
||||||
<joint axis="1 0 0" limited="true" name="slider" pos="0 0 0" range="-1 1" type="slide"/>
|
<joint axis="1 0 0" limited="true" name="slider" pos="0 0 0" range="-1 1" type="slide"/>
|
||||||
<geom name="cart" pos="0 0 0" quat="0.707 0 0.707 0" size="0.1 0.1" type="capsule"/>
|
<geom name="cart" pos="0 0 0" quat="0.707 0 0.707 0" size="0.1 0.1" type="capsule"/>
|
||||||
<body name="pole" pos="0 0 0">
|
<body name="pole" pos="0 0 0">
|
||||||
<joint axis="0 1 0" name="hinge" pos="0 0 0" range="-90 90" type="hinge"/>
|
<joint axis="0 1 0" name="hinge" pos="0 0 0" range="-90 90" type="hinge"/>
|
||||||
<geom fromto="0 0 0 0.001 0 0.6" name="cpole" rgba="0 0.7 0.7 1" size="0.049 0.3" type="capsule"/>
|
<geom fromto="0 0 0 0.001 0 0.6" name="cpole" rgba="0 0.7 0.7 1" size="0.049 0.3" type="capsule"/>
|
||||||
<!-- <body name="pole2" pos="0.001 0 0.6"><joint name="hinge2" type="hinge" pos="0 0 0" axis="0 1 0"/><geom name="cpole2" type="capsule" fromto="0 0 0 0 0 0.6" size="0.05 0.3" rgba="0.7 0 0.7 1"/><site name="tip2" pos="0 0 .6"/></body>-->
|
<!-- <body name="pole2" pos="0.001 0 0.6"><joint name="hinge2" type="hinge" pos="0 0 0" axis="0 1 0"/><geom name="cpole2" type="capsule" fromto="0 0 0 0 0 0.6" size="0.05 0.3" rgba="0.7 0 0.7 1"/><site name="tip2" pos="0 0 .6"/></body>-->
|
||||||
</body>
|
</body>
|
||||||
</body>
|
</body>
|
||||||
</worldbody>
|
</worldbody>
|
||||||
<actuator>
|
<actuator>
|
||||||
<motor ctrllimited="true" ctrlrange="-3 3" gear="100" joint="slider" name="slide"/>
|
<motor ctrllimited="true" ctrlrange="-3 3" gear="100" joint="slider" name="slide"/>
|
||||||
</actuator>
|
</actuator>
|
||||||
</mujoco>
|
</mujoco>
|
@@ -1,39 +1,39 @@
|
|||||||
<mujoco model="reacher">
|
<mujoco model="reacher">
|
||||||
<compiler angle="radian" inertiafromgeom="true"/>
|
<compiler angle="radian" inertiafromgeom="true"/>
|
||||||
<default>
|
<default>
|
||||||
<joint armature="1" damping="1" limited="true"/>
|
<joint armature="1" damping="1" limited="true"/>
|
||||||
<geom contype="0" friction="1 0.1 0.1" rgba="0.7 0.7 0 1"/>
|
<geom contype="0" friction="1 0.1 0.1" rgba="0.7 0.7 0 1"/>
|
||||||
</default>
|
</default>
|
||||||
<option gravity="0 0 -9.81" integrator="RK4" timestep="0.01"/>
|
<option gravity="0 0 -9.81" integrator="RK4" timestep="0.01"/>
|
||||||
<worldbody>
|
<worldbody>
|
||||||
<!-- Arena -->
|
<!-- Arena -->
|
||||||
<geom conaffinity="0" contype="0" name="ground" pos="0 0 0" rgba="0.9 0.9 0.9 1" size="1 1 10" type="plane"/>
|
<geom conaffinity="0" contype="0" name="ground" pos="0 0 0" rgba="0.9 0.9 0.9 1" size="1 1 10" type="plane"/>
|
||||||
<geom conaffinity="0" fromto="-.3 -.3 .01 .3 -.3 .01" name="sideS" rgba="0.9 0.4 0.6 1" size=".02" type="capsule"/>
|
<geom conaffinity="0" fromto="-.3 -.3 .01 .3 -.3 .01" name="sideS" rgba="0.9 0.4 0.6 1" size=".02" type="capsule"/>
|
||||||
<geom conaffinity="0" fromto=" .3 -.3 .01 .3 .3 .01" name="sideE" rgba="0.9 0.4 0.6 1" size=".02" type="capsule"/>
|
<geom conaffinity="0" fromto=" .3 -.3 .01 .3 .3 .01" name="sideE" rgba="0.9 0.4 0.6 1" size=".02" type="capsule"/>
|
||||||
<geom conaffinity="0" fromto="-.3 .3 .01 .3 .3 .01" name="sideN" rgba="0.9 0.4 0.6 1" size=".02" type="capsule"/>
|
<geom conaffinity="0" fromto="-.3 .3 .01 .3 .3 .01" name="sideN" rgba="0.9 0.4 0.6 1" size=".02" type="capsule"/>
|
||||||
<geom conaffinity="0" fromto="-.3 -.3 .01 -.3 .3 .01" name="sideW" rgba="0.9 0.4 0.6 1" size=".02" type="capsule"/>
|
<geom conaffinity="0" fromto="-.3 -.3 .01 -.3 .3 .01" name="sideW" rgba="0.9 0.4 0.6 1" size=".02" type="capsule"/>
|
||||||
<!-- Arm -->
|
<!-- Arm -->
|
||||||
<geom conaffinity="0" contype="0" fromto="0 0 0 0 0 0.02" name="root" rgba="0.9 0.4 0.6 1" size=".011" type="cylinder"/>
|
<geom conaffinity="0" contype="0" fromto="0 0 0 0 0 0.02" name="root" rgba="0.9 0.4 0.6 1" size=".011" type="cylinder"/>
|
||||||
<body name="body0" pos="0 0 .01">
|
<body name="body0" pos="0 0 .01">
|
||||||
<geom fromto="0 0 0 0.1 0 0" name="link0" rgba="0.0 0.4 0.6 1" size=".01" type="capsule"/>
|
<geom fromto="0 0 0 0.1 0 0" name="link0" rgba="0.0 0.4 0.6 1" size=".01" type="capsule"/>
|
||||||
<joint axis="0 0 1" limited="false" name="joint0" pos="0 0 0" type="hinge"/>
|
<joint axis="0 0 1" limited="false" name="joint0" pos="0 0 0" type="hinge"/>
|
||||||
<body name="body1" pos="0.1 0 0">
|
<body name="body1" pos="0.1 0 0">
|
||||||
<joint axis="0 0 1" limited="true" name="joint1" pos="0 0 0" range="-3.0 3.0" type="hinge"/>
|
<joint axis="0 0 1" limited="true" name="joint1" pos="0 0 0" range="-3.0 3.0" type="hinge"/>
|
||||||
<geom fromto="0 0 0 0.1 0 0" name="link1" rgba="0.0 0.4 0.6 1" size=".01" type="capsule"/>
|
<geom fromto="0 0 0 0.1 0 0" name="link1" rgba="0.0 0.4 0.6 1" size=".01" type="capsule"/>
|
||||||
<body name="fingertip" pos="0.11 0 0">
|
<body name="fingertip" pos="0.11 0 0">
|
||||||
<geom contype="0" name="fingertip" pos="0 0 0" rgba="0.0 0.8 0.6 1" size=".01" type="sphere"/>
|
<geom contype="0" name="fingertip" pos="0 0 0" rgba="0.0 0.8 0.6 1" size=".01" type="sphere"/>
|
||||||
</body>
|
</body>
|
||||||
</body>
|
</body>
|
||||||
</body>
|
</body>
|
||||||
<!-- Target -->
|
<!-- Target -->
|
||||||
<body name="target" pos=".1 -.1 .01">
|
<body name="target" pos=".1 -.1 .01">
|
||||||
<joint armature="0" axis="1 0 0" damping="0" limited="true" name="target_x" pos="0 0 0" range="-.27 .27" ref=".1" stiffness="0" type="slide"/>
|
<joint armature="0" axis="1 0 0" damping="0" limited="true" name="target_x" pos="0 0 0" range="-.27 .27" ref=".1" stiffness="0" type="slide"/>
|
||||||
<joint armature="0" axis="0 1 0" damping="0" limited="true" name="target_y" pos="0 0 0" range="-.27 .27" ref="-.1" stiffness="0" type="slide"/>
|
<joint armature="0" axis="0 1 0" damping="0" limited="true" name="target_y" pos="0 0 0" range="-.27 .27" ref="-.1" stiffness="0" type="slide"/>
|
||||||
<geom conaffinity="0" contype="0" name="target" pos="0 0 0" rgba="0.9 0.2 0.2 1" size=".009" type="sphere"/>
|
<geom conaffinity="0" contype="0" name="target" pos="0 0 0" rgba="0.9 0.2 0.2 1" size=".009" type="sphere"/>
|
||||||
</body>
|
</body>
|
||||||
</worldbody>
|
</worldbody>
|
||||||
<actuator>
|
<actuator>
|
||||||
<motor ctrllimited="true" ctrlrange="-1.0 1.0" gear="200.0" joint="joint0"/>
|
<motor ctrllimited="true" ctrlrange="-1.0 1.0" gear="200.0" joint="joint0"/>
|
||||||
<motor ctrllimited="true" ctrlrange="-1.0 1.0" gear="200.0" joint="joint1"/>
|
<motor ctrllimited="true" ctrlrange="-1.0 1.0" gear="200.0" joint="joint1"/>
|
||||||
</actuator>
|
</actuator>
|
||||||
</mujoco>
|
</mujoco>
|
@@ -1,8 +1,8 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import utils
|
from gymnasium import utils
|
||||||
from gym.envs.mujoco import MuJocoPyEnv
|
from gymnasium.envs.mujoco import MuJocoPyEnv
|
||||||
from gym.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
|
||||||
|
|
||||||
class HalfCheetahEnv(MuJocoPyEnv, utils.EzPickle):
|
class HalfCheetahEnv(MuJocoPyEnv, utils.EzPickle):
|
@@ -2,9 +2,9 @@ __credits__ = ["Rushiv Arora"]
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import utils
|
from gymnasium import utils
|
||||||
from gym.envs.mujoco import MuJocoPyEnv
|
from gymnasium.envs.mujoco import MuJocoPyEnv
|
||||||
from gym.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
|
||||||
DEFAULT_CAMERA_CONFIG = {
|
DEFAULT_CAMERA_CONFIG = {
|
||||||
"distance": 4.0,
|
"distance": 4.0,
|
@@ -2,9 +2,9 @@ __credits__ = ["Rushiv Arora"]
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import utils
|
from gymnasium import utils
|
||||||
from gym.envs.mujoco import MujocoEnv
|
from gymnasium.envs.mujoco import MujocoEnv
|
||||||
from gym.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
|
||||||
DEFAULT_CAMERA_CONFIG = {
|
DEFAULT_CAMERA_CONFIG = {
|
||||||
"distance": 4.0,
|
"distance": 4.0,
|
||||||
@@ -106,13 +106,13 @@ class HalfCheetahEnv(MujocoEnv, utils.EzPickle):
|
|||||||
No additional arguments are currently supported in v2 and lower.
|
No additional arguments are currently supported in v2 and lower.
|
||||||
|
|
||||||
```
|
```
|
||||||
env = gym.make('HalfCheetah-v2')
|
env = gymnasium.make('HalfCheetah-v2')
|
||||||
```
|
```
|
||||||
|
|
||||||
v3 and v4 take gym.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc.
|
v3 and v4 take gymnasium.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc.
|
||||||
|
|
||||||
```
|
```
|
||||||
env = gym.make('HalfCheetah-v4', ctrl_cost_weight=0.1, ....)
|
env = gymnasium.make('HalfCheetah-v4', ctrl_cost_weight=0.1, ....)
|
||||||
```
|
```
|
||||||
|
|
||||||
| Parameter | Type | Default | Description |
|
| Parameter | Type | Default | Description |
|
||||||
@@ -126,7 +126,7 @@ class HalfCheetahEnv(MujocoEnv, utils.EzPickle):
|
|||||||
### Version History
|
### Version History
|
||||||
|
|
||||||
* v4: all mujoco environments now use the mujoco bindings in mujoco>=2.1.3
|
* v4: all mujoco environments now use the mujoco bindings in mujoco>=2.1.3
|
||||||
* v3: support for gym.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc. rgb rendering comes from tracking camera (so agent does not run away from screen)
|
* v3: support for gymnasium.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc. rgb rendering comes from tracking camera (so agent does not run away from screen)
|
||||||
* v2: All continuous control environments now use mujoco_py >= 1.50
|
* v2: All continuous control environments now use mujoco_py >= 1.50
|
||||||
* v1: max_time_steps raised to 1000 for robot based tasks. Added reward_threshold to environments.
|
* v1: max_time_steps raised to 1000 for robot based tasks. Added reward_threshold to environments.
|
||||||
* v0: Initial versions release (1.0.0)
|
* v0: Initial versions release (1.0.0)
|
@@ -1,8 +1,8 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import utils
|
from gymnasium import utils
|
||||||
from gym.envs.mujoco import MuJocoPyEnv
|
from gymnasium.envs.mujoco import MuJocoPyEnv
|
||||||
from gym.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
|
||||||
|
|
||||||
class HopperEnv(MuJocoPyEnv, utils.EzPickle):
|
class HopperEnv(MuJocoPyEnv, utils.EzPickle):
|
@@ -2,9 +2,9 @@ __credits__ = ["Rushiv Arora"]
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import utils
|
from gymnasium import utils
|
||||||
from gym.envs.mujoco import MuJocoPyEnv
|
from gymnasium.envs.mujoco import MuJocoPyEnv
|
||||||
from gym.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
|
||||||
DEFAULT_CAMERA_CONFIG = {
|
DEFAULT_CAMERA_CONFIG = {
|
||||||
"trackbodyid": 2,
|
"trackbodyid": 2,
|
@@ -1,8 +1,8 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import utils
|
from gymnasium import utils
|
||||||
from gym.envs.mujoco import MujocoEnv
|
from gymnasium.envs.mujoco import MujocoEnv
|
||||||
from gym.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
|
||||||
DEFAULT_CAMERA_CONFIG = {
|
DEFAULT_CAMERA_CONFIG = {
|
||||||
"trackbodyid": 2,
|
"trackbodyid": 2,
|
||||||
@@ -107,13 +107,13 @@ class HopperEnv(MujocoEnv, utils.EzPickle):
|
|||||||
No additional arguments are currently supported in v2 and lower.
|
No additional arguments are currently supported in v2 and lower.
|
||||||
|
|
||||||
```
|
```
|
||||||
env = gym.make('Hopper-v2')
|
env = gymnasium.make('Hopper-v2')
|
||||||
```
|
```
|
||||||
|
|
||||||
v3 and v4 take gym.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc.
|
v3 and v4 take gymnasium.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc.
|
||||||
|
|
||||||
```
|
```
|
||||||
env = gym.make('Hopper-v4', ctrl_cost_weight=0.1, ....)
|
env = gymnasium.make('Hopper-v4', ctrl_cost_weight=0.1, ....)
|
||||||
```
|
```
|
||||||
|
|
||||||
| Parameter | Type | Default | Description |
|
| Parameter | Type | Default | Description |
|
||||||
@@ -132,7 +132,7 @@ class HopperEnv(MujocoEnv, utils.EzPickle):
|
|||||||
### Version History
|
### Version History
|
||||||
|
|
||||||
* v4: all mujoco environments now use the mujoco bindings in mujoco>=2.1.3
|
* v4: all mujoco environments now use the mujoco bindings in mujoco>=2.1.3
|
||||||
* v3: support for gym.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc. rgb rendering comes from tracking camera (so agent does not run away from screen)
|
* v3: support for gymnasium.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc. rgb rendering comes from tracking camera (so agent does not run away from screen)
|
||||||
* v2: All continuous control environments now use mujoco_py >= 1.50
|
* v2: All continuous control environments now use mujoco_py >= 1.50
|
||||||
* v1: max_time_steps raised to 1000 for robot based tasks. Added reward_threshold to environments.
|
* v1: max_time_steps raised to 1000 for robot based tasks. Added reward_threshold to environments.
|
||||||
* v0: Initial versions release (1.0.0)
|
* v0: Initial versions release (1.0.0)
|
@@ -1,8 +1,8 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import utils
|
from gymnasium import utils
|
||||||
from gym.envs.mujoco import MuJocoPyEnv
|
from gymnasium.envs.mujoco import MuJocoPyEnv
|
||||||
from gym.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
|
||||||
|
|
||||||
def mass_center(model, sim):
|
def mass_center(model, sim):
|
@@ -1,8 +1,8 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import utils
|
from gymnasium import utils
|
||||||
from gym.envs.mujoco import MuJocoPyEnv
|
from gymnasium.envs.mujoco import MuJocoPyEnv
|
||||||
from gym.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
|
||||||
DEFAULT_CAMERA_CONFIG = {
|
DEFAULT_CAMERA_CONFIG = {
|
||||||
"trackbodyid": 1,
|
"trackbodyid": 1,
|
@@ -1,8 +1,8 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import utils
|
from gymnasium import utils
|
||||||
from gym.envs.mujoco import MujocoEnv
|
from gymnasium.envs.mujoco import MujocoEnv
|
||||||
from gym.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
|
||||||
DEFAULT_CAMERA_CONFIG = {
|
DEFAULT_CAMERA_CONFIG = {
|
||||||
"trackbodyid": 1,
|
"trackbodyid": 1,
|
||||||
@@ -182,13 +182,13 @@ class HumanoidEnv(MujocoEnv, utils.EzPickle):
|
|||||||
No additional arguments are currently supported in v2 and lower.
|
No additional arguments are currently supported in v2 and lower.
|
||||||
|
|
||||||
```
|
```
|
||||||
env = gym.make('Humanoid-v4')
|
env = gymnasium.make('Humanoid-v4')
|
||||||
```
|
```
|
||||||
|
|
||||||
v3 and v4 take gym.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc.
|
v3 and v4 take gymnasium.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc.
|
||||||
|
|
||||||
```
|
```
|
||||||
env = gym.make('Humanoid-v4', ctrl_cost_weight=0.1, ....)
|
env = gymnasium.make('Humanoid-v4', ctrl_cost_weight=0.1, ....)
|
||||||
```
|
```
|
||||||
|
|
||||||
| Parameter | Type | Default | Description |
|
| Parameter | Type | Default | Description |
|
||||||
@@ -206,7 +206,7 @@ class HumanoidEnv(MujocoEnv, utils.EzPickle):
|
|||||||
### Version History
|
### Version History
|
||||||
|
|
||||||
* v4: all mujoco environments now use the mujoco bindings in mujoco>=2.1.3
|
* v4: all mujoco environments now use the mujoco bindings in mujoco>=2.1.3
|
||||||
* v3: support for gym.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc. rgb rendering comes from tracking camera (so agent does not run away from screen)
|
* v3: support for gymnasium.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc. rgb rendering comes from tracking camera (so agent does not run away from screen)
|
||||||
* v2: All continuous control environments now use mujoco_py >= 1.50
|
* v2: All continuous control environments now use mujoco_py >= 1.50
|
||||||
* v1: max_time_steps raised to 1000 for robot based tasks. Added reward_threshold to environments.
|
* v1: max_time_steps raised to 1000 for robot based tasks. Added reward_threshold to environments.
|
||||||
* v0: Initial versions release (1.0.0)
|
* v0: Initial versions release (1.0.0)
|
@@ -1,8 +1,8 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import utils
|
from gymnasium import utils
|
||||||
from gym.envs.mujoco import MuJocoPyEnv
|
from gymnasium.envs.mujoco import MuJocoPyEnv
|
||||||
from gym.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
|
||||||
|
|
||||||
class HumanoidStandupEnv(MuJocoPyEnv, utils.EzPickle):
|
class HumanoidStandupEnv(MuJocoPyEnv, utils.EzPickle):
|
@@ -1,8 +1,8 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import utils
|
from gymnasium import utils
|
||||||
from gym.envs.mujoco import MujocoEnv
|
from gymnasium.envs.mujoco import MujocoEnv
|
||||||
from gym.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
|
||||||
|
|
||||||
class HumanoidStandupEnv(MujocoEnv, utils.EzPickle):
|
class HumanoidStandupEnv(MujocoEnv, utils.EzPickle):
|
||||||
@@ -162,17 +162,17 @@ class HumanoidStandupEnv(MujocoEnv, utils.EzPickle):
|
|||||||
No additional arguments are currently supported.
|
No additional arguments are currently supported.
|
||||||
|
|
||||||
```
|
```
|
||||||
env = gym.make('HumanoidStandup-v4')
|
env = gymnasium.make('HumanoidStandup-v4')
|
||||||
```
|
```
|
||||||
|
|
||||||
There is no v3 for HumanoidStandup, unlike the robot environments where a v3 and
|
There is no v3 for HumanoidStandup, unlike the robot environments where a v3 and
|
||||||
beyond take gym.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc.
|
beyond take gymnasium.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc.
|
||||||
|
|
||||||
|
|
||||||
### Version History
|
### Version History
|
||||||
|
|
||||||
* v4: all mujoco environments now use the mujoco bindings in mujoco>=2.1.3
|
* v4: all mujoco environments now use the mujoco bindings in mujoco>=2.1.3
|
||||||
* v3: support for gym.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc. rgb rendering comes from tracking camera (so agent does not run away from screen)
|
* v3: support for gymnasium.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc. rgb rendering comes from tracking camera (so agent does not run away from screen)
|
||||||
* v2: All continuous control environments now use mujoco_py >= 1.50
|
* v2: All continuous control environments now use mujoco_py >= 1.50
|
||||||
* v1: max_time_steps raised to 1000 for robot based tasks. Added reward_threshold to environments.
|
* v1: max_time_steps raised to 1000 for robot based tasks. Added reward_threshold to environments.
|
||||||
* v0: Initial versions release (1.0.0)
|
* v0: Initial versions release (1.0.0)
|
@@ -1,8 +1,8 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import utils
|
from gymnasium import utils
|
||||||
from gym.envs.mujoco import MuJocoPyEnv
|
from gymnasium.envs.mujoco import MuJocoPyEnv
|
||||||
from gym.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
|
||||||
|
|
||||||
class InvertedDoublePendulumEnv(MuJocoPyEnv, utils.EzPickle):
|
class InvertedDoublePendulumEnv(MuJocoPyEnv, utils.EzPickle):
|
@@ -1,8 +1,8 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import utils
|
from gymnasium import utils
|
||||||
from gym.envs.mujoco import MujocoEnv
|
from gymnasium.envs.mujoco import MujocoEnv
|
||||||
from gym.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
|
||||||
|
|
||||||
class InvertedDoublePendulumEnv(MujocoEnv, utils.EzPickle):
|
class InvertedDoublePendulumEnv(MujocoEnv, utils.EzPickle):
|
||||||
@@ -97,16 +97,16 @@ class InvertedDoublePendulumEnv(MujocoEnv, utils.EzPickle):
|
|||||||
No additional arguments are currently supported.
|
No additional arguments are currently supported.
|
||||||
|
|
||||||
```
|
```
|
||||||
env = gym.make('InvertedDoublePendulum-v4')
|
env = gymnasium.make('InvertedDoublePendulum-v4')
|
||||||
```
|
```
|
||||||
There is no v3 for InvertedPendulum, unlike the robot environments where a v3 and
|
There is no v3 for InvertedPendulum, unlike the robot environments where a v3 and
|
||||||
beyond take gym.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc.
|
beyond take gymnasium.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc.
|
||||||
|
|
||||||
|
|
||||||
### Version History
|
### Version History
|
||||||
|
|
||||||
* v4: all mujoco environments now use the mujoco bindings in mujoco>=2.1.3
|
* v4: all mujoco environments now use the mujoco bindings in mujoco>=2.1.3
|
||||||
* v3: support for gym.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc. rgb rendering comes from tracking camera (so agent does not run away from screen)
|
* v3: support for gymnasium.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc. rgb rendering comes from tracking camera (so agent does not run away from screen)
|
||||||
* v2: All continuous control environments now use mujoco_py >= 1.50
|
* v2: All continuous control environments now use mujoco_py >= 1.50
|
||||||
* v1: max_time_steps raised to 1000 for robot based tasks (including inverted pendulum)
|
* v1: max_time_steps raised to 1000 for robot based tasks (including inverted pendulum)
|
||||||
* v0: Initial versions release (1.0.0)
|
* v0: Initial versions release (1.0.0)
|
@@ -1,8 +1,8 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import utils
|
from gymnasium import utils
|
||||||
from gym.envs.mujoco import MuJocoPyEnv
|
from gymnasium.envs.mujoco import MuJocoPyEnv
|
||||||
from gym.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
|
||||||
|
|
||||||
class InvertedPendulumEnv(MuJocoPyEnv, utils.EzPickle):
|
class InvertedPendulumEnv(MuJocoPyEnv, utils.EzPickle):
|
@@ -1,8 +1,8 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import utils
|
from gymnasium import utils
|
||||||
from gym.envs.mujoco import MujocoEnv
|
from gymnasium.envs.mujoco import MujocoEnv
|
||||||
from gym.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
|
||||||
|
|
||||||
class InvertedPendulumEnv(MujocoEnv, utils.EzPickle):
|
class InvertedPendulumEnv(MujocoEnv, utils.EzPickle):
|
||||||
@@ -68,16 +68,16 @@ class InvertedPendulumEnv(MujocoEnv, utils.EzPickle):
|
|||||||
No additional arguments are currently supported.
|
No additional arguments are currently supported.
|
||||||
|
|
||||||
```
|
```
|
||||||
env = gym.make('InvertedPendulum-v4')
|
env = gymnasium.make('InvertedPendulum-v4')
|
||||||
```
|
```
|
||||||
There is no v3 for InvertedPendulum, unlike the robot environments where a
|
There is no v3 for InvertedPendulum, unlike the robot environments where a
|
||||||
v3 and beyond take gym.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc.
|
v3 and beyond take gymnasium.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc.
|
||||||
|
|
||||||
|
|
||||||
### Version History
|
### Version History
|
||||||
|
|
||||||
* v4: all mujoco environments now use the mujoco bindings in mujoco>=2.1.3
|
* v4: all mujoco environments now use the mujoco bindings in mujoco>=2.1.3
|
||||||
* v3: support for gym.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc. rgb rendering comes from tracking camera (so agent does not run away from screen)
|
* v3: support for gymnasium.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc. rgb rendering comes from tracking camera (so agent does not run away from screen)
|
||||||
* v2: All continuous control environments now use mujoco_py >= 1.50
|
* v2: All continuous control environments now use mujoco_py >= 1.50
|
||||||
* v1: max_time_steps raised to 1000 for robot based tasks (including inverted pendulum)
|
* v1: max_time_steps raised to 1000 for robot based tasks (including inverted pendulum)
|
||||||
* v0: Initial versions release (1.0.0)
|
* v0: Initial versions release (1.0.0)
|
@@ -3,9 +3,9 @@ from typing import Optional, Union
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
import gym
|
import gymnasium
|
||||||
from gym import error, logger, spaces
|
from gymnasium import error, logger, spaces
|
||||||
from gym.spaces import Space
|
from gymnasium.spaces import Space
|
||||||
|
|
||||||
MUJOCO_PY_NOT_INSTALLED = False
|
MUJOCO_PY_NOT_INSTALLED = False
|
||||||
MUJOCO_NOT_INSTALLED = False
|
MUJOCO_NOT_INSTALLED = False
|
||||||
@@ -26,7 +26,7 @@ except ImportError as e:
|
|||||||
DEFAULT_SIZE = 480
|
DEFAULT_SIZE = 480
|
||||||
|
|
||||||
|
|
||||||
class BaseMujocoEnv(gym.Env):
|
class BaseMujocoEnv(gymnasium.Env):
|
||||||
"""Superclass for all MuJoCo environments."""
|
"""Superclass for all MuJoCo environments."""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
@@ -395,15 +395,17 @@ class MujocoEnv(BaseMujocoEnv):
|
|||||||
|
|
||||||
def _get_viewer(
|
def _get_viewer(
|
||||||
self, mode
|
self, mode
|
||||||
) -> Union["gym.envs.mujoco.Viewer", "gym.envs.mujoco.RenderContextOffscreen"]:
|
) -> Union[
|
||||||
|
"gymnasium.envs.mujoco.Viewer", "gymnasium.envs.mujoco.RenderContextOffscreen"
|
||||||
|
]:
|
||||||
self.viewer = self._viewers.get(mode)
|
self.viewer = self._viewers.get(mode)
|
||||||
if self.viewer is None:
|
if self.viewer is None:
|
||||||
if mode == "human":
|
if mode == "human":
|
||||||
from gym.envs.mujoco import Viewer
|
from gymnasium.envs.mujoco import Viewer
|
||||||
|
|
||||||
self.viewer = Viewer(self.model, self.data)
|
self.viewer = Viewer(self.model, self.data)
|
||||||
elif mode in {"rgb_array", "depth_array"}:
|
elif mode in {"rgb_array", "depth_array"}:
|
||||||
from gym.envs.mujoco import RenderContextOffscreen
|
from gymnasium.envs.mujoco import RenderContextOffscreen
|
||||||
|
|
||||||
self.viewer = RenderContextOffscreen(self.model, self.data)
|
self.viewer = RenderContextOffscreen(self.model, self.data)
|
||||||
else:
|
else:
|
@@ -1,8 +1,8 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import utils
|
from gymnasium import utils
|
||||||
from gym.envs.mujoco import MuJocoPyEnv
|
from gymnasium.envs.mujoco import MuJocoPyEnv
|
||||||
from gym.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
|
||||||
|
|
||||||
class PusherEnv(MuJocoPyEnv, utils.EzPickle):
|
class PusherEnv(MuJocoPyEnv, utils.EzPickle):
|
@@ -1,8 +1,8 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import utils
|
from gymnasium import utils
|
||||||
from gym.envs.mujoco import MujocoEnv
|
from gymnasium.envs.mujoco import MujocoEnv
|
||||||
from gym.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
|
||||||
|
|
||||||
class PusherEnv(MujocoEnv, utils.EzPickle):
|
class PusherEnv(MujocoEnv, utils.EzPickle):
|
||||||
@@ -113,11 +113,11 @@ class PusherEnv(MujocoEnv, utils.EzPickle):
|
|||||||
(or by changing the path to a modified XML file in another folder)..
|
(or by changing the path to a modified XML file in another folder)..
|
||||||
|
|
||||||
```
|
```
|
||||||
env = gym.make('Pusher-v4')
|
env = gymnasium.make('Pusher-v4')
|
||||||
```
|
```
|
||||||
|
|
||||||
There is no v3 for Pusher, unlike the robot environments where a v3 and
|
There is no v3 for Pusher, unlike the robot environments where a v3 and
|
||||||
beyond take gym.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc.
|
beyond take gymnasium.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc.
|
||||||
|
|
||||||
|
|
||||||
### Version History
|
### Version History
|
@@ -1,8 +1,8 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import utils
|
from gymnasium import utils
|
||||||
from gym.envs.mujoco import MuJocoPyEnv
|
from gymnasium.envs.mujoco import MuJocoPyEnv
|
||||||
from gym.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
|
||||||
|
|
||||||
class ReacherEnv(MuJocoPyEnv, utils.EzPickle):
|
class ReacherEnv(MuJocoPyEnv, utils.EzPickle):
|
@@ -1,8 +1,8 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import utils
|
from gymnasium import utils
|
||||||
from gym.envs.mujoco import MujocoEnv
|
from gymnasium.envs.mujoco import MujocoEnv
|
||||||
from gym.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
|
||||||
|
|
||||||
class ReacherEnv(MujocoEnv, utils.EzPickle):
|
class ReacherEnv(MujocoEnv, utils.EzPickle):
|
||||||
@@ -103,11 +103,11 @@ class ReacherEnv(MujocoEnv, utils.EzPickle):
|
|||||||
(or by changing the path to a modified XML file in another folder)..
|
(or by changing the path to a modified XML file in another folder)..
|
||||||
|
|
||||||
```
|
```
|
||||||
env = gym.make('Reacher-v4')
|
env = gymnasium.make('Reacher-v4')
|
||||||
```
|
```
|
||||||
|
|
||||||
There is no v3 for Reacher, unlike the robot environments where a v3 and
|
There is no v3 for Reacher, unlike the robot environments where a v3 and
|
||||||
beyond take gym.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc.
|
beyond take gymnasium.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc.
|
||||||
|
|
||||||
|
|
||||||
### Version History
|
### Version History
|
@@ -1,8 +1,8 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import utils
|
from gymnasium import utils
|
||||||
from gym.envs.mujoco import MuJocoPyEnv
|
from gymnasium.envs.mujoco import MuJocoPyEnv
|
||||||
from gym.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
|
||||||
|
|
||||||
class SwimmerEnv(MuJocoPyEnv, utils.EzPickle):
|
class SwimmerEnv(MuJocoPyEnv, utils.EzPickle):
|
@@ -2,9 +2,9 @@ __credits__ = ["Rushiv Arora"]
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import utils
|
from gymnasium import utils
|
||||||
from gym.envs.mujoco import MuJocoPyEnv
|
from gymnasium.envs.mujoco import MuJocoPyEnv
|
||||||
from gym.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
|
||||||
DEFAULT_CAMERA_CONFIG = {}
|
DEFAULT_CAMERA_CONFIG = {}
|
||||||
|
|
@@ -2,9 +2,9 @@ __credits__ = ["Rushiv Arora"]
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import utils
|
from gymnasium import utils
|
||||||
from gym.envs.mujoco import MujocoEnv
|
from gymnasium.envs.mujoco import MujocoEnv
|
||||||
from gym.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
|
||||||
DEFAULT_CAMERA_CONFIG = {}
|
DEFAULT_CAMERA_CONFIG = {}
|
||||||
|
|
||||||
@@ -97,13 +97,13 @@ class SwimmerEnv(MujocoEnv, utils.EzPickle):
|
|||||||
No additional arguments are currently supported in v2 and lower.
|
No additional arguments are currently supported in v2 and lower.
|
||||||
|
|
||||||
```
|
```
|
||||||
gym.make('Swimmer-v4')
|
gymnasium.make('Swimmer-v4')
|
||||||
```
|
```
|
||||||
|
|
||||||
v3 and v4 take gym.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc.
|
v3 and v4 take gymnasium.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc.
|
||||||
|
|
||||||
```
|
```
|
||||||
env = gym.make('Swimmer-v4', ctrl_cost_weight=0.1, ....)
|
env = gymnasium.make('Swimmer-v4', ctrl_cost_weight=0.1, ....)
|
||||||
```
|
```
|
||||||
|
|
||||||
| Parameter | Type | Default | Description |
|
| Parameter | Type | Default | Description |
|
||||||
@@ -118,7 +118,7 @@ class SwimmerEnv(MujocoEnv, utils.EzPickle):
|
|||||||
### Version History
|
### Version History
|
||||||
|
|
||||||
* v4: all mujoco environments now use the mujoco bindings in mujoco>=2.1.3
|
* v4: all mujoco environments now use the mujoco bindings in mujoco>=2.1.3
|
||||||
* v3: support for gym.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc. rgb rendering comes from tracking camera (so agent does not run away from screen)
|
* v3: support for gymnasium.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc. rgb rendering comes from tracking camera (so agent does not run away from screen)
|
||||||
* v2: All continuous control environments now use mujoco_py >= 1.50
|
* v2: All continuous control environments now use mujoco_py >= 1.50
|
||||||
* v1: max_time_steps raised to 1000 for robot based tasks. Added reward_threshold to environments.
|
* v1: max_time_steps raised to 1000 for robot based tasks. Added reward_threshold to environments.
|
||||||
* v0: Initial versions release (1.0.0)
|
* v0: Initial versions release (1.0.0)
|
@@ -1,8 +1,8 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import utils
|
from gymnasium import utils
|
||||||
from gym.envs.mujoco import MuJocoPyEnv
|
from gymnasium.envs.mujoco import MuJocoPyEnv
|
||||||
from gym.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
|
||||||
|
|
||||||
class Walker2dEnv(MuJocoPyEnv, utils.EzPickle):
|
class Walker2dEnv(MuJocoPyEnv, utils.EzPickle):
|
@@ -1,8 +1,8 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import utils
|
from gymnasium import utils
|
||||||
from gym.envs.mujoco import MuJocoPyEnv
|
from gymnasium.envs.mujoco import MuJocoPyEnv
|
||||||
from gym.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
|
||||||
DEFAULT_CAMERA_CONFIG = {
|
DEFAULT_CAMERA_CONFIG = {
|
||||||
"trackbodyid": 2,
|
"trackbodyid": 2,
|
@@ -1,8 +1,8 @@
|
|||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import utils
|
from gymnasium import utils
|
||||||
from gym.envs.mujoco import MujocoEnv
|
from gymnasium.envs.mujoco import MujocoEnv
|
||||||
from gym.spaces import Box
|
from gymnasium.spaces import Box
|
||||||
|
|
||||||
DEFAULT_CAMERA_CONFIG = {
|
DEFAULT_CAMERA_CONFIG = {
|
||||||
"trackbodyid": 2,
|
"trackbodyid": 2,
|
||||||
@@ -112,13 +112,13 @@ class Walker2dEnv(MujocoEnv, utils.EzPickle):
|
|||||||
No additional arguments are currently supported in v2 and lower.
|
No additional arguments are currently supported in v2 and lower.
|
||||||
|
|
||||||
```
|
```
|
||||||
env = gym.make('Walker2d-v4')
|
env = gymnasium.make('Walker2d-v4')
|
||||||
```
|
```
|
||||||
|
|
||||||
v3 and beyond take gym.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc.
|
v3 and beyond take gymnasium.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc.
|
||||||
|
|
||||||
```
|
```
|
||||||
env = gym.make('Walker2d-v4', ctrl_cost_weight=0.1, ....)
|
env = gymnasium.make('Walker2d-v4', ctrl_cost_weight=0.1, ....)
|
||||||
```
|
```
|
||||||
|
|
||||||
| Parameter | Type | Default | Description |
|
| Parameter | Type | Default | Description |
|
||||||
@@ -137,7 +137,7 @@ class Walker2dEnv(MujocoEnv, utils.EzPickle):
|
|||||||
### Version History
|
### Version History
|
||||||
|
|
||||||
* v4: all mujoco environments now use the mujoco bindings in mujoco>=2.1.3
|
* v4: all mujoco environments now use the mujoco bindings in mujoco>=2.1.3
|
||||||
* v3: support for gym.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc. rgb rendering comes from tracking camera (so agent does not run away from screen)
|
* v3: support for gymnasium.make kwargs such as xml_file, ctrl_cost_weight, reset_noise_scale etc. rgb rendering comes from tracking camera (so agent does not run away from screen)
|
||||||
* v2: All continuous control environments now use mujoco_py >= 1.50
|
* v2: All continuous control environments now use mujoco_py >= 1.50
|
||||||
* v1: max_time_steps raised to 1000 for robot based tasks. Added reward_threshold to environments.
|
* v1: max_time_steps raised to 1000 for robot based tasks. Added reward_threshold to environments.
|
||||||
* v0: Initial versions release (1.0.0)
|
* v0: Initial versions release (1.0.0)
|
@@ -21,15 +21,15 @@ from typing import (
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym.wrappers import (
|
from gymnasium.wrappers import (
|
||||||
AutoResetWrapper,
|
AutoResetWrapper,
|
||||||
HumanRendering,
|
HumanRendering,
|
||||||
OrderEnforcing,
|
OrderEnforcing,
|
||||||
RenderCollection,
|
RenderCollection,
|
||||||
TimeLimit,
|
TimeLimit,
|
||||||
)
|
)
|
||||||
from gym.wrappers.compatibility import EnvCompatibility
|
from gymnasium.wrappers.compatibility import EnvCompatibility
|
||||||
from gym.wrappers.env_checker import PassiveEnvChecker
|
from gymnasium.wrappers.env_checker import PassiveEnvChecker
|
||||||
|
|
||||||
if sys.version_info < (3, 10):
|
if sys.version_info < (3, 10):
|
||||||
import importlib_metadata as metadata # type: ignore
|
import importlib_metadata as metadata # type: ignore
|
||||||
@@ -41,7 +41,7 @@ if sys.version_info >= (3, 8):
|
|||||||
else:
|
else:
|
||||||
from typing_extensions import Literal
|
from typing_extensions import Literal
|
||||||
|
|
||||||
from gym import Env, error, logger
|
from gymnasium import Env, error, logger
|
||||||
|
|
||||||
ENV_ID_RE = re.compile(
|
ENV_ID_RE = re.compile(
|
||||||
r"^(?:(?P<namespace>[\w:-]+)\/)?(?:(?P<name>[\w:.-]+?))(?:-v(?P<version>\d+))?$"
|
r"^(?:(?P<namespace>[\w:-]+)\/)?(?:(?P<name>[\w:.-]+?))(?:-v(?P<version>\d+))?$"
|
||||||
@@ -116,17 +116,17 @@ def get_env_id(ns: Optional[str], name: str, version: Optional[int]) -> str:
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class EnvSpec:
|
class EnvSpec:
|
||||||
"""A specification for creating environments with `gym.make`.
|
"""A specification for creating environments with `gymnasium.make`.
|
||||||
|
|
||||||
* id: The string used to create the environment with `gym.make`
|
* id: The string used to create the environment with `gymnasium.make`
|
||||||
* entry_point: The location of the environment to create from
|
* entry_point: The location of the environment to create from
|
||||||
* reward_threshold: The reward threshold for completing the environment.
|
* reward_threshold: The reward threshold for completing the environment.
|
||||||
* nondeterministic: If the observation of an environment cannot be repeated with the same initial state, random number generator state and actions.
|
* nondeterministic: If the observation of an environment cannot be repeated with the same initial state, random number generator state and actions.
|
||||||
* max_episode_steps: The max number of steps that the environment can take before truncation
|
* max_episode_steps: The max number of steps that the environment can take before truncation
|
||||||
* order_enforce: If to enforce the order of `reset` before `step` and `render` functions
|
* order_enforce: If to enforce the order of `reset` before `step` and `render` functions
|
||||||
* autoreset: If to automatically reset the environment on episode end
|
* autoreset: If to automatically reset the environment on episode end
|
||||||
* disable_env_checker: If to disable the environment checker wrapper in `gym.make`, by default False (runs the environment checker)
|
* disable_env_checker: If to disable the environment checker wrapper in `gymnasium.make`, by default False (runs the environment checker)
|
||||||
* kwargs: Additional keyword arguments passed to the environments through `gym.make`
|
* kwargs: Additional keyword arguments passed to the environments through `gymnasium.make`
|
||||||
"""
|
"""
|
||||||
|
|
||||||
id: str
|
id: str
|
||||||
@@ -263,7 +263,7 @@ def find_highest_version(ns: Optional[str], name: str) -> Optional[int]:
|
|||||||
return max(version, default=None)
|
return max(version, default=None)
|
||||||
|
|
||||||
|
|
||||||
def load_env_plugins(entry_point: str = "gym.envs") -> None:
|
def load_env_plugins(entry_point: str = "gymnasium.envs") -> None:
|
||||||
# Load third-party environments
|
# Load third-party environments
|
||||||
for plugin in metadata.entry_points(group=entry_point):
|
for plugin in metadata.entry_points(group=entry_point):
|
||||||
# Python 3.8 doesn't support plugin.module, plugin.attr
|
# Python 3.8 doesn't support plugin.module, plugin.attr
|
||||||
@@ -284,7 +284,7 @@ def load_env_plugins(entry_point: str = "gym.envs") -> None:
|
|||||||
finally:
|
finally:
|
||||||
if attr is None:
|
if attr is None:
|
||||||
raise error.Error(
|
raise error.Error(
|
||||||
f"Gym environment plugin `{module}` must specify a function to execute, not a root module"
|
f"Gymnasium environment plugin `{module}` must specify a function to execute, not a root module"
|
||||||
)
|
)
|
||||||
|
|
||||||
context = namespace(plugin.name)
|
context = namespace(plugin.name)
|
||||||
@@ -414,7 +414,7 @@ def _check_spec_register(spec: EnvSpec):
|
|||||||
f"`{spec.id}` when the versioned environment "
|
f"`{spec.id}` when the versioned environment "
|
||||||
f"`{latest_versioned_spec.id}` of the same name "
|
f"`{latest_versioned_spec.id}` of the same name "
|
||||||
f"already exists. Note: the default behavior is "
|
f"already exists. Note: the default behavior is "
|
||||||
f"that `gym.make` with the unversioned environment "
|
f"that `gymnasium.make` with the unversioned environment "
|
||||||
f"will return the latest versioned environment"
|
f"will return the latest versioned environment"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -443,7 +443,7 @@ def register(
|
|||||||
apply_api_compatibility: bool = False,
|
apply_api_compatibility: bool = False,
|
||||||
**kwargs,
|
**kwargs,
|
||||||
):
|
):
|
||||||
"""Register an environment with gym.
|
"""Register an environment with gymnasium.
|
||||||
|
|
||||||
The `id` parameter corresponds to the name of the environment, with the syntax as follows:
|
The `id` parameter corresponds to the name of the environment, with the syntax as follows:
|
||||||
`(namespace)/(env_name)-v(version)` where `namespace` is optional.
|
`(namespace)/(env_name)-v(version)` where `namespace` is optional.
|
||||||
@@ -509,7 +509,7 @@ def make(
|
|||||||
) -> Env:
|
) -> Env:
|
||||||
"""Create an environment according to the given ID.
|
"""Create an environment according to the given ID.
|
||||||
|
|
||||||
To find all available environments use `gym.envs.registry.keys()` for all valid ids.
|
To find all available environments use `gymnasium.envs.registry.keys()` for all valid ids.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
id: Name of the environment. Optionally, a module to import can be included, eg. 'module:Env-v0'
|
id: Name of the environment. Optionally, a module to import can be included, eg. 'module:Env-v0'
|
4
gymnasium/envs/toy_text/__init__.py
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
from gymnasium.envs.toy_text.blackjack import BlackjackEnv
|
||||||
|
from gymnasium.envs.toy_text.cliffwalking import CliffWalkingEnv
|
||||||
|
from gymnasium.envs.toy_text.frozen_lake import FrozenLakeEnv
|
||||||
|
from gymnasium.envs.toy_text.taxi import TaxiEnv
|
@@ -3,9 +3,9 @@ from typing import Optional
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
import gym
|
import gymnasium
|
||||||
from gym import spaces
|
from gymnasium import spaces
|
||||||
from gym.error import DependencyNotInstalled
|
from gymnasium.error import DependencyNotInstalled
|
||||||
|
|
||||||
|
|
||||||
def cmp(a, b):
|
def cmp(a, b):
|
||||||
@@ -46,7 +46,7 @@ def is_natural(hand): # Is this hand a natural blackjack?
|
|||||||
return sorted(hand) == [1, 10]
|
return sorted(hand) == [1, 10]
|
||||||
|
|
||||||
|
|
||||||
class BlackjackEnv(gym.Env):
|
class BlackjackEnv(gymnasium.Env):
|
||||||
"""
|
"""
|
||||||
Blackjack is a card game where the goal is to beat the dealer by obtaining cards
|
Blackjack is a card game where the goal is to beat the dealer by obtaining cards
|
||||||
that sum to closer to 21 (without going over 21) than the dealers cards.
|
that sum to closer to 21 (without going over 21) than the dealers cards.
|
||||||
@@ -94,7 +94,7 @@ class BlackjackEnv(gym.Env):
|
|||||||
### Arguments
|
### Arguments
|
||||||
|
|
||||||
```
|
```
|
||||||
gym.make('Blackjack-v1', natural=False, sab=False)
|
gymnasium.make('Blackjack-v1', natural=False, sab=False)
|
||||||
```
|
```
|
||||||
|
|
||||||
<a id="nat">`natural=False`</a>: Whether to give an additional reward for
|
<a id="nat">`natural=False`</a>: Whether to give an additional reward for
|
||||||
@@ -194,7 +194,7 @@ class BlackjackEnv(gym.Env):
|
|||||||
import pygame
|
import pygame
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise DependencyNotInstalled(
|
raise DependencyNotInstalled(
|
||||||
"pygame is not installed, run `pip install gym[toy_text]`"
|
"pygame is not installed, run `pip install gymnasium[toy_text]`"
|
||||||
)
|
)
|
||||||
|
|
||||||
player_sum, dealer_card_value, usable_ace = self._get_obs()
|
player_sum, dealer_card_value, usable_ace = self._get_obs()
|
@@ -5,9 +5,9 @@ from typing import Optional
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import Env, spaces
|
from gymnasium import Env, spaces
|
||||||
from gym.envs.toy_text.utils import categorical_sample
|
from gymnasium.envs.toy_text.utils import categorical_sample
|
||||||
from gym.error import DependencyNotInstalled
|
from gymnasium.error import DependencyNotInstalled
|
||||||
|
|
||||||
UP = 0
|
UP = 0
|
||||||
RIGHT = 1
|
RIGHT = 1
|
||||||
@@ -55,7 +55,7 @@ class CliffWalkingEnv(Env):
|
|||||||
### Arguments
|
### Arguments
|
||||||
|
|
||||||
```
|
```
|
||||||
gym.make('CliffWalking-v0')
|
gymnasium.make('CliffWalking-v0')
|
||||||
```
|
```
|
||||||
|
|
||||||
### Version History
|
### Version History
|
||||||
@@ -173,7 +173,7 @@ class CliffWalkingEnv(Env):
|
|||||||
import pygame
|
import pygame
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise DependencyNotInstalled(
|
raise DependencyNotInstalled(
|
||||||
"pygame is not installed, run `pip install gym[toy_text]`"
|
"pygame is not installed, run `pip install gymnasium[toy_text]`"
|
||||||
)
|
)
|
||||||
if self.window_surface is None:
|
if self.window_surface is None:
|
||||||
pygame.init()
|
pygame.init()
|
@@ -5,9 +5,9 @@ from typing import List, Optional
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from gym import Env, spaces, utils
|
from gymnasium import Env, spaces, utils
|
||||||
from gym.envs.toy_text.utils import categorical_sample
|
from gymnasium.envs.toy_text.utils import categorical_sample
|
||||||
from gym.error import DependencyNotInstalled
|
from gymnasium.error import DependencyNotInstalled
|
||||||
|
|
||||||
LEFT = 0
|
LEFT = 0
|
||||||
DOWN = 1
|
DOWN = 1
|
||||||
@@ -105,7 +105,7 @@ class FrozenLakeEnv(Env):
|
|||||||
### Arguments
|
### Arguments
|
||||||
|
|
||||||
```
|
```
|
||||||
gym.make('FrozenLake-v1', desc=None, map_name="4x4", is_slippery=True)
|
gymnasium.make('FrozenLake-v1', desc=None, map_name="4x4", is_slippery=True)
|
||||||
```
|
```
|
||||||
|
|
||||||
`desc`: Used to specify custom map for frozen lake. For example,
|
`desc`: Used to specify custom map for frozen lake. For example,
|
||||||
@@ -115,9 +115,9 @@ class FrozenLakeEnv(Env):
|
|||||||
A random generated map can be specified by calling the function `generate_random_map`. For example,
|
A random generated map can be specified by calling the function `generate_random_map`. For example,
|
||||||
|
|
||||||
```
|
```
|
||||||
from gym.envs.toy_text.frozen_lake import generate_random_map
|
from gymnasium.envs.toy_text.frozen_lake import generate_random_map
|
||||||
|
|
||||||
gym.make('FrozenLake-v1', desc=generate_random_map(size=8))
|
gymnasium.make('FrozenLake-v1', desc=generate_random_map(size=8))
|
||||||
```
|
```
|
||||||
|
|
||||||
`map_name`: ID to use any of the preloaded maps.
|
`map_name`: ID to use any of the preloaded maps.
|
||||||
@@ -277,7 +277,7 @@ class FrozenLakeEnv(Env):
|
|||||||
import pygame
|
import pygame
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise DependencyNotInstalled(
|
raise DependencyNotInstalled(
|
||||||
"pygame is not installed, run `pip install gym[toy_text]`"
|
"pygame is not installed, run `pip install gymnasium[toy_text]`"
|
||||||
)
|
)
|
||||||
|
|
||||||
if self.window_surface is None:
|
if self.window_surface is None:
|
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 6.8 KiB After Width: | Height: | Size: 6.8 KiB |
Before Width: | Height: | Size: 6.9 KiB After Width: | Height: | Size: 6.9 KiB |
Before Width: | Height: | Size: 7.8 KiB After Width: | Height: | Size: 7.8 KiB |
Before Width: | Height: | Size: 8.3 KiB After Width: | Height: | Size: 8.3 KiB |
Before Width: | Height: | Size: 8.5 KiB After Width: | Height: | Size: 8.5 KiB |
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 9.6 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.5 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 43 KiB |
Before Width: | Height: | Size: 5.8 KiB After Width: | Height: | Size: 5.8 KiB |
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 6.3 KiB |
Before Width: | Height: | Size: 6.5 KiB After Width: | Height: | Size: 6.5 KiB |
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 7.7 KiB |
Before Width: | Height: | Size: 7.9 KiB After Width: | Height: | Size: 7.9 KiB |
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.8 KiB |
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 9.3 KiB |
Before Width: | Height: | Size: 6.1 KiB After Width: | Height: | Size: 6.1 KiB |
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |