diff --git a/gymnasium/envs/mujoco/inverted_double_pendulum_v5.py b/gymnasium/envs/mujoco/inverted_double_pendulum_v5.py index bf2835577..2c1716fa4 100644 --- a/gymnasium/envs/mujoco/inverted_double_pendulum_v5.py +++ b/gymnasium/envs/mujoco/inverted_double_pendulum_v5.py @@ -1,5 +1,7 @@ __credits__ = ["Kallinteris-Andreas"] +from typing import Dict, Union + import numpy as np from gymnasium import utils @@ -136,6 +138,7 @@ class InvertedDoublePendulumEnv(MujocoEnv, utils.EzPickle): ## Version History * v5: - Minimum `mujoco` version is now 2.3.3. + - Added `default_camera_config` argument, a dictionary for setting the `mj_camera` properties, mainly useful for custom environments. - Added `frame_skip` argument, used to configure the `dt` (duration of `step()`), default varies by environment check environment documentation pages. - Fixed bug: `healthy_reward` was given on every step (even if the Pendulum is unhealthy), now it is only given if the DoublePendulum is healthy (not terminated)(related [Github issue](https://github.com/Farama-Foundation/Gymnasium/issues/500)). - Excluded the `qfrc_constraint` ("constraint force") of the hinges from the observation space (as it was always 0, thus providing no useful information to the agent, resulting is slightly faster training) (related [Github issue](https://github.com/Farama-Foundation/Gymnasium/issues/228)). @@ -162,6 +165,7 @@ def __init__( self, xml_file: str = "inverted_double_pendulum.xml", frame_skip: int = 5, + default_camera_config: Dict[str, Union[float, int]] = {}, healthy_reward: float = 10.0, reset_noise_scale: float = 0.1, **kwargs, @@ -178,7 +182,7 @@ def __init__( xml_file, frame_skip, observation_space=observation_space, - default_camera_config=DEFAULT_CAMERA_CONFIG, + default_camera_config=default_camera_config, **kwargs, ) diff --git a/gymnasium/envs/mujoco/inverted_pendulum_v5.py b/gymnasium/envs/mujoco/inverted_pendulum_v5.py index 20d11d483..73122e349 100644 --- a/gymnasium/envs/mujoco/inverted_pendulum_v5.py +++ b/gymnasium/envs/mujoco/inverted_pendulum_v5.py @@ -1,5 +1,7 @@ __credits__ = ["Kallinteris-Andreas"] +from typing import Dict, Union + import numpy as np from gymnasium import utils @@ -115,6 +117,7 @@ class InvertedPendulumEnv(MujocoEnv, utils.EzPickle): * v5: - Minimum `mujoco` version is now 2.3.3. - Added support for fully custom/third party `mujoco` models using the `xml_file` argument (previously only a few changes could be made to the existing models). + - Added `default_camera_config` argument, a dictionary for setting the `mj_camera` properties, mainly useful for custom environments. - Added `env.observation_structure`, a dictionary for specifying the observation space compose (e.g. `qpos`, `qvel`), useful for building tooling and wrappers for the MuJoCo environments. - Added `frame_skip` argument, used to configure the `dt` (duration of `step()`), default varies by environment check environment documentation pages. - Fixed bug: `healthy_reward` was given on every step (even if the Pendulum is unhealthy), now it is only given if the Pendulum is healthy (not terminated) (related [Github issue](https://github.com/Farama-Foundation/Gymnasium/issues/500)). @@ -140,6 +143,7 @@ def __init__( self, xml_file: str = "inverted_pendulum.xml", frame_skip: int = 2, + default_camera_config: Dict[str, Union[float, int]] = DEFAULT_CAMERA_CONFIG, reset_noise_scale: float = 0.01, **kwargs, ): @@ -153,7 +157,7 @@ def __init__( xml_file, frame_skip, observation_space=observation_space, - default_camera_config=DEFAULT_CAMERA_CONFIG, + default_camera_config=default_camera_config, **kwargs, ) diff --git a/gymnasium/envs/mujoco/swimmer_v5.py b/gymnasium/envs/mujoco/swimmer_v5.py index a231cc627..f2f3ec103 100644 --- a/gymnasium/envs/mujoco/swimmer_v5.py +++ b/gymnasium/envs/mujoco/swimmer_v5.py @@ -1,5 +1,7 @@ __credits__ = ["Kallinteris-Andreas", "Rushiv Arora"] +from typing import Dict, Union + import numpy as np from gymnasium import utils @@ -169,6 +171,7 @@ def __init__( self, xml_file: str = "swimmer.xml", frame_skip: int = 4, + default_camera_config: Dict[str, Union[float, int]] = {}, forward_reward_weight: float = 1.0, ctrl_cost_weight: float = 1e-4, reset_noise_scale: float = 0.1, @@ -179,6 +182,7 @@ def __init__( self, xml_file, frame_skip, + default_camera_config, forward_reward_weight, ctrl_cost_weight, reset_noise_scale, @@ -195,7 +199,14 @@ def __init__( exclude_current_positions_from_observation ) - MujocoEnv.__init__(self, xml_file, frame_skip, observation_space=None, **kwargs) + MujocoEnv.__init__( + self, + xml_file, + frame_skip, + observation_space=None, + default_camera_config=default_camera_config, + **kwargs, + ) self.metadata = { "render_modes": [