Files
Gymnasium/docs/environments/mujoco.md

61 lines
3.6 KiB
Markdown
Raw Normal View History

2022-09-13 20:27:34 +01:00
---
firstpage:
lastpage:
---
# MuJoCo
2022-09-13 20:27:34 +01:00
```{toctree}
:hidden:
mujoco/ant
mujoco/half_cheetah
mujoco/hopper
mujoco/humanoid
mujoco/humanoid_standup
mujoco/inverted_double_pendulum
mujoco/inverted_pendulum
mujoco/pusher
mujoco/reacher
mujoco/swimmer
mujoco/walker2d
2022-09-13 20:27:34 +01:00
```
```{raw} html
2022-10-03 19:01:14 +01:00
:file: mujoco/list.html
2022-09-13 20:27:34 +01:00
```
2022-10-10 17:23:40 +02:00
MuJoCo stands for Multi-Joint dynamics with Contact. It is a physics engine for facilitating research and development in robotics, biomechanics, graphics and animation, and other areas where fast and accurate simulation is needed.
2022-09-13 20:27:34 +01:00
The unique dependencies for this set of environments can be installed via:
````bash
pip install gymnasium[mujoco]
````
These environments also require that the MuJoCo engine be installed. As of October 2021 DeepMind has acquired MuJoCo and is open-sourcing it in 2022, making it free for everyone. Instructions on installing the MuJoCo engine can be found on their [website](https://mujoco.org) and [GitHub repository](https://github.com/deepmind/mujoco). Using MuJoCo with Gymnasium also requires that the framework `mujoco` be installed (this dependency is installed with the above command).
For MuJoCo V3 environments and older the `mujoco-py` framework is required (`pip install mujoco-py`) which can be found in the [GitHub repository](https://github.com/openai/mujoco-py/tree/master/mujoco_py)
2022-09-13 20:27:34 +01:00
2023-03-14 16:53:31 +01:00
There are eleven Mujoco environments: Ant, HalfCheetah, Hopper, Humanoid, HumanoidStandup, InvertedDoublePendulum, InvertedPendulum, Pusher, Reacher, Swimmer, and Walker2d. All of these environments are stochastic in terms of their initial state, with a Gaussian noise added to a fixed initial state in order to add stochasticity. The state spaces for MuJoCo environments in Gymnasium consist of two parts that are flattened and concatenated together: a position of a body part ('*mujoco-py.mjsim.qpos*') or joint and its corresponding velocity ('*mujoco-py.mjsim.qvel*'). Often, some of the first positional elements are omitted from the state space since the reward is calculated based on their values, leaving it up to the algorithm to infer those hidden values indirectly.
2022-09-13 20:27:34 +01:00
Among Gymnasium environments, this set of environments can be considered as more difficult ones to solve by a policy.
2022-10-14 12:01:30 +01:00
Environments can be configured by changing the XML files or by tweaking the parameters of their classes.
## Rendering Arguments
The all MuJoCo Environments besides the general Gymnasium arguments and environment specific arguments they also take the following arguments for configuring the renderer:
```python
env = gymnasium.make("Ant-v5", render_mode="rgb_array", width=1280, height=720)
```
| Parameter | Type | Default |Description |
|--------------------------------------------|------------|--------------|-------------------------------|
|`width` | **int** | `480` | The width of the render window. |
|`height` | **int** | `480` | The width of the render window. |
|`camera_id` |**int \| None**| `None` | The camera ID used for the render window. |
|`camera_name` |**str \| None**| `None` | The name of the camera used (mutally exclusive option with `camera_id`). |
|`default_camera_config` |**Dict[str, Union[float, int]] \| None** | `None` | The [mjvcamera](https://mujoco.readthedocs.io/en/stable/APIreference/APItypes.html?highlight=camera#mjvcamera) properties. |
|`max_geom` | **int** | `1000` | Max number of geometrical objects to render (useful for 3rd-party environments).|