Skip to content

Commit

Permalink
Merge branch 'Farama-Foundation:main' into mmjc-v1
Browse files Browse the repository at this point in the history
  • Loading branch information
Kallinteris-Andreas authored Feb 14, 2024
2 parents 5112fbb + acad2a0 commit a086668
Show file tree
Hide file tree
Showing 13 changed files with 35 additions and 22 deletions.
2 changes: 2 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,14 @@ Fixes # (issue)

Please delete options that are not relevant.

- [ ] Documentation only change (no code changed)
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
- [ ] This change requires a documentation update

### Screenshots

Please attach before and after screenshots of the change if applicable.

<!--
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ repos:
language: node
pass_filenames: false
types: [python]
additional_dependencies: ["pyright"]
additional_dependencies: ["pyright@1.1.347"]
args:
- --project=pyproject.toml
- repo: https://github.com/pycqa/pydocstyle
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ The different tasks involve hammering a nail, opening a door, twirling a pen, or

## Multi-goal API

The robotic environments use an extension of the core Gymansium API by inheriting from [GoalEnv](https://robotics.farama.org/envs/#) class. The new API forces the environments to have a dictionary observation space that contains 3 keys:
The robotic environments use an extension of the core Gymansium API by inheriting from [GoalEnv](https://robotics.farama.org/content/multi-goal_api/) class. The new API forces the environments to have a dictionary observation space that contains 3 keys:

* `observation` - The actual observation of the environment
* `desired_goal` - The goal that the agent has to achieved
Expand Down Expand Up @@ -83,7 +83,7 @@ If you use this in your research, please cite:
author = {Rodrigo de Lazcano and Kallinteris Andreas and Jun Jet Tai and Seungjae Ryan Lee and Jordan Terry},
title = {Gymnasium Robotics},
url = {http://github.com/Farama-Foundation/Gymnasium-Robotics},
version = {1.2.3},
version = {1.2.4},
year = {2023},
}
```
2 changes: 1 addition & 1 deletion docs/content/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ These environments also require the MuJoCo engine from Deepmind to be installed.

Note that the latest environment versions use the latest mujoco python bindings maintained by the MuJoCo team. If you wish to use the old versions of the environments that depend on [mujoco-py](https://github.com/openai/mujoco-py), please install this library with `pip install gymnasium-robotics[mujoco-py]`

We support and test for Python 3.7, 3.8, 3.9, 3.10 and 3.11 on Linux and macOS. We will accept PRs related to Windows, but do not officially support it.
We support and test for Python 3.8, 3.9, 3.10 and 3.11 on Linux and macOS. We will accept PRs related to Windows, but do not officially support it.
14 changes: 13 additions & 1 deletion gymnasium_robotics/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1111,6 +1111,18 @@ def _merge(a, b):
max_episode_steps=300,
)

register(
id=f"PointMaze_Open_Diverse_GR{suffix}-v3",
entry_point="gymnasium_robotics.envs.maze.point_maze:PointMazeEnv",
kwargs=_merge(
{
"maze_map": maps.OPEN_DIVERSE_GR,
},
kwargs,
),
max_episode_steps=300,
)

register(
id=f"PointMaze_Medium{suffix}-v3",
entry_point="gymnasium_robotics.envs.maze.point_maze:PointMazeEnv",
Expand Down Expand Up @@ -1225,7 +1237,7 @@ def _merge(a, b):
)


__version__ = "1.2.3"
__version__ = "1.2.4"


try:
Expand Down
2 changes: 1 addition & 1 deletion gymnasium_robotics/envs/adroit_hand/adroit_door.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def step(self, a):

# compute the sparse reward variant first
goal_distance = self.data.qpos[self.door_hinge_addrs]
goal_achieved = True if goal_distance >= 1.35 else False
goal_achieved = goal_distance >= 1.35
reward = 10.0 if goal_achieved else -0.1

# override reward if not sparse reward
Expand Down
2 changes: 1 addition & 1 deletion gymnasium_robotics/envs/adroit_hand/adroit_hammer.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def step(self, a):

# compute the sparse reward variant first
goal_distance = np.linalg.norm(nail_pos - goal_pos)
goal_achieved = True if goal_distance < 0.01 else False
goal_achieved = goal_distance < 0.01
reward = 10.0 if goal_achieved else -0.1

# override reward if not sparse reward
Expand Down
4 changes: 1 addition & 3 deletions gymnasium_robotics/envs/adroit_hand/adroit_pen.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,9 +301,7 @@ def step(self, a):
# compute the sparse reward variant first
goal_distance = np.linalg.norm(obj_pos - desired_loc)
orien_similarity = np.dot(obj_orien, desired_orien)
goal_achieved = (
True if (goal_distance < 0.075 and orien_similarity > 0.95) else False
)
goal_achieved = goal_distance < 0.075 and orien_similarity > 0.95
reward = 10.0 if goal_achieved else -0.1

# goal_failed = obj_pos[2] < 0.075
Expand Down
2 changes: 1 addition & 1 deletion gymnasium_robotics/envs/adroit_hand/adroit_relocate.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ def step(self, a):

# compute the sparse reward variant first
goal_distance = float(np.linalg.norm(obj_pos - target_pos))
goal_achieved = True if goal_distance < 0.1 else False
goal_achieved = goal_distance < 0.1
reward = 10.0 if goal_achieved else -0.1

# override reward if not sparse reward
Expand Down
6 changes: 3 additions & 3 deletions gymnasium_robotics/envs/fetch/pick_and_place.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ class MujocoFetchPickAndPlaceEnv(MujocoFetchEnv, EzPickle):
| 3 | Block x position in global coordinates | -Inf | Inf | object0 |- |- | position (m) |
| 4 | Block y position in global coordinates | -Inf | Inf | object0 |- |- | position (m) |
| 5 | Block z position in global coordinates | -Inf | Inf | object0 |- |- | position (m) |
| 6 | Relative block x position with respect to gripper x position in globla coordinates. Equals to x<sub>gripper</sub> - x<sub>block</sub> | -Inf | Inf | object0 |- |- | position (m) |
| 7 | Relative block y position with respect to gripper y position in globla coordinates. Equals to y<sub>gripper</sub> - y<sub>block</sub> | -Inf | Inf | object0 |- |- | position (m) |
| 8 | Relative block z position with respect to gripper z position in globla coordinates. Equals to z<sub>gripper</sub> - z<sub>block</sub> | -Inf | Inf | object0 |- |- | position (m) |
| 6 | Relative block x position with respect to gripper x position in global coordinates. Equals to x<sub>block</sub> - x<sub>gripper</sub> | -Inf | Inf | object0 |- |- | position (m) |
| 7 | Relative block y position with respect to gripper y position in global coordinates. Equals to y<sub>block</sub> - y<sub>gripper</sub> | -Inf | Inf | object0 |- |- | position (m) |
| 8 | Relative block z position with respect to gripper z position in global coordinates. Equals to z<sub>block</sub> - z<sub>gripper</sub> | -Inf | Inf | object0 |- |- | position (m) |
| 9 | Joint displacement of the right gripper finger | -Inf | Inf |- | robot0:r_gripper_finger_joint | hinge | position (m) |
| 10 | Joint displacement of the left gripper finger | -Inf | Inf |- | robot0:l_gripper_finger_joint | hinge | position (m) |
| 11 | Global x rotation of the block in a XYZ Euler frame rotation | -Inf | Inf | object0 |- |- | angle (rad) |
Expand Down
6 changes: 3 additions & 3 deletions gymnasium_robotics/envs/fetch/push.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@ class MujocoFetchPushEnv(MujocoFetchEnv, EzPickle):
| 3 | Block x position in global coordinates | -Inf | Inf | object0 |- |- | position (m) |
| 4 | Block y position in global coordinates | -Inf | Inf | object0 |- |- | position (m) |
| 5 | Block z position in global coordinates | -Inf | Inf | object0 |- |- | position (m) |
| 6 | Relative block x position with respect to gripper x position in globla coordinates. Equals to x<sub>gripper</sub> - x<sub>block</sub> | -Inf | Inf | object0 |- |- | position (m) |
| 7 | Relative block y position with respect to gripper y position in globla coordinates. Equals to y<sub>gripper</sub> - y<sub>block</sub> | -Inf | Inf | object0 |- |- | position (m) |
| 8 | Relative block z position with respect to gripper z position in globla coordinates. Equals to z<sub>gripper</sub> - z<sub>block</sub> | -Inf | Inf | object0 |- |- | position (m) |
| 6 | Relative block x position with respect to gripper x position in global coordinates. Equals to x<sub>block</sub> - x<sub>gripper</sub> | -Inf | Inf | object0 |- |- | position (m) |
| 7 | Relative block y position with respect to gripper y position in global coordinates. Equals to y<sub>block</sub> - y<sub>gripper</sub> | -Inf | Inf | object0 |- |- | position (m) |
| 8 | Relative block z position with respect to gripper z position in global coordinates. Equals to z<sub>block</sub> - z<sub>gripper</sub> | -Inf | Inf | object0 |- |- | position (m) |
| 9 | Joint displacement of the right gripper finger | -Inf | Inf |- | robot0:r_gripper_finger_joint | hinge | position (m) |
| 10 | Joint displacement of the left gripper finger | -Inf | Inf |- | robot0:l_gripper_finger_joint | hinge | position (m) |
| 11 | Global x rotation of the block in a XYZ Euler frame rotation | -Inf | Inf | object0 |- |- | angle (rad) |
Expand Down
6 changes: 3 additions & 3 deletions gymnasium_robotics/envs/fetch/slide.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@ class MujocoFetchSlideEnv(MujocoFetchEnv, EzPickle):
| 3 | Puck x position in global coordinates | -Inf | Inf | object0 |- |- | position (m) |
| 4 | Puck y position in global coordinates | -Inf | Inf | object0 |- |- | position (m) |
| 5 | Puck z position in global coordinates | -Inf | Inf | object0 |- |- | position (m) |
| 6 | Relative puck x position with respect to gripper x position in globla coordinates. Equals to x<sub>gripper</sub> - x<sub>puck</sub> | -Inf | Inf | object0 |- |- | position (m) |
| 7 | Relative puck y position with respect to gripper y position in globla coordinates. Equals to y<sub>gripper</sub> - y<sub>puck</sub> | -Inf | Inf | object0 |- |- | position (m) |
| 8 | Relative puck z position with respect to gripper z position in globla coordinates. Equals to z<sub>gripper</sub> - z<sub>puck</sub> | -Inf | Inf | object0 |- |- | position (m) |
| 6 | Relative puck x position with respect to gripper x position in global coordinates. Equals to x<sub>puck</sub> - x<sub>gripper</sub> | -Inf | Inf | object0 |- |- | position (m) |
| 7 | Relative puck y position with respect to gripper y position in global coordinates. Equals to y<sub>puck</sub> - y<sub>gripper</sub> | -Inf | Inf | object0 |- |- | position (m) |
| 8 | Relative puck z position with respect to gripper z position in global coordinates. Equals to z<sub>puck</sub> - z<sub>gripper</sub> | -Inf | Inf | object0 |- |- | position (m) |
| 9 | Joint displacement of the right gripper finger | -Inf | Inf |- | robot0:r_gripper_finger_joint | hinge | position (m) |
| 10 | Joint displacement of the left gripper finger | -Inf | Inf |- | robot0:l_gripper_finger_joint | hinge | position (m) |
| 11 | Global x rotation of the puck in a XYZ Euler frame rotation | -Inf | Inf | object0 |- |- | angle (rad) |
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,14 @@ exclude = [
strict = []

typeCheckingMode = "basic"
pythonVersion = "3.7"
pythonVersion = "3.8"
pythonPlatform = "All"
typeshedPath = "typeshed"
enableTypeIgnoreComments = true

# This is required as the CI pre-commit does not download the module (i.e. numpy)
# Therefore, we have to ignore missing imports

reportMissingImports = "none"
reportUnboundVariable = "warning"

reportGeneralTypeIssues = "none" # -> commented out raises 489 errors

0 comments on commit a086668

Please sign in to comment.