From 3713a3a87b4d9ba3c09c11e847a0331ffd12013c Mon Sep 17 00:00:00 2001 From: Simon Alibert Date: Fri, 29 Mar 2024 13:59:09 +0100 Subject: [PATCH] Package xarm --- envs/sim_xarm/README.md | 1 + envs/sim_xarm/poetry.lock | 448 ++++++++++++++++++ envs/sim_xarm/pyproject.toml | 34 ++ envs/sim_xarm/xarm/__init__.py | 166 +++++++ envs/sim_xarm/xarm/tasks/__init__.py | 0 envs/sim_xarm/xarm/tasks/assets/lift.xml | 53 +++ .../xarm/tasks/assets/mesh/base_link.stl | 3 + .../xarm/tasks/assets/mesh/block_inner.stl | 3 + .../xarm/tasks/assets/mesh/block_inner2.stl | 3 + .../xarm/tasks/assets/mesh/block_outer.stl | 3 + .../xarm/tasks/assets/mesh/left_finger.stl | 3 + .../tasks/assets/mesh/left_inner_knuckle.stl | 3 + .../tasks/assets/mesh/left_outer_knuckle.stl | 3 + .../sim_xarm/xarm/tasks/assets/mesh/link1.stl | 3 + .../sim_xarm/xarm/tasks/assets/mesh/link2.stl | 3 + .../sim_xarm/xarm/tasks/assets/mesh/link3.stl | 3 + .../sim_xarm/xarm/tasks/assets/mesh/link4.stl | 3 + .../sim_xarm/xarm/tasks/assets/mesh/link5.stl | 3 + .../sim_xarm/xarm/tasks/assets/mesh/link6.stl | 3 + .../sim_xarm/xarm/tasks/assets/mesh/link7.stl | 3 + .../xarm/tasks/assets/mesh/link_base.stl | 3 + .../xarm/tasks/assets/mesh/right_finger.stl | 3 + .../tasks/assets/mesh/right_inner_knuckle.stl | 3 + .../tasks/assets/mesh/right_outer_knuckle.stl | 3 + .../sim_xarm/xarm/tasks/assets/peg_in_box.xml | 74 +++ envs/sim_xarm/xarm/tasks/assets/push.xml | 54 +++ envs/sim_xarm/xarm/tasks/assets/reach.xml | 48 ++ envs/sim_xarm/xarm/tasks/assets/shared.xml | 51 ++ envs/sim_xarm/xarm/tasks/assets/xarm.xml | 88 ++++ envs/sim_xarm/xarm/tasks/base.py | 145 ++++++ envs/sim_xarm/xarm/tasks/lift.py | 100 ++++ envs/sim_xarm/xarm/tasks/mocap.py | 67 +++ envs/sim_xarm/xarm/tasks/peg_in_box.py | 86 ++++ envs/sim_xarm/xarm/tasks/push.py | 78 +++ envs/sim_xarm/xarm/tasks/reach.py | 44 ++ 35 files changed, 1591 insertions(+) create mode 100644 envs/sim_xarm/README.md create mode 100644 envs/sim_xarm/poetry.lock create mode 100644 envs/sim_xarm/pyproject.toml create mode 100644 envs/sim_xarm/xarm/__init__.py create mode 100644 envs/sim_xarm/xarm/tasks/__init__.py create mode 100644 envs/sim_xarm/xarm/tasks/assets/lift.xml create mode 100644 envs/sim_xarm/xarm/tasks/assets/mesh/base_link.stl create mode 100644 envs/sim_xarm/xarm/tasks/assets/mesh/block_inner.stl create mode 100644 envs/sim_xarm/xarm/tasks/assets/mesh/block_inner2.stl create mode 100644 envs/sim_xarm/xarm/tasks/assets/mesh/block_outer.stl create mode 100644 envs/sim_xarm/xarm/tasks/assets/mesh/left_finger.stl create mode 100644 envs/sim_xarm/xarm/tasks/assets/mesh/left_inner_knuckle.stl create mode 100644 envs/sim_xarm/xarm/tasks/assets/mesh/left_outer_knuckle.stl create mode 100644 envs/sim_xarm/xarm/tasks/assets/mesh/link1.stl create mode 100644 envs/sim_xarm/xarm/tasks/assets/mesh/link2.stl create mode 100644 envs/sim_xarm/xarm/tasks/assets/mesh/link3.stl create mode 100644 envs/sim_xarm/xarm/tasks/assets/mesh/link4.stl create mode 100644 envs/sim_xarm/xarm/tasks/assets/mesh/link5.stl create mode 100644 envs/sim_xarm/xarm/tasks/assets/mesh/link6.stl create mode 100644 envs/sim_xarm/xarm/tasks/assets/mesh/link7.stl create mode 100644 envs/sim_xarm/xarm/tasks/assets/mesh/link_base.stl create mode 100644 envs/sim_xarm/xarm/tasks/assets/mesh/right_finger.stl create mode 100644 envs/sim_xarm/xarm/tasks/assets/mesh/right_inner_knuckle.stl create mode 100644 envs/sim_xarm/xarm/tasks/assets/mesh/right_outer_knuckle.stl create mode 100644 envs/sim_xarm/xarm/tasks/assets/peg_in_box.xml create mode 100644 envs/sim_xarm/xarm/tasks/assets/push.xml create mode 100644 envs/sim_xarm/xarm/tasks/assets/reach.xml create mode 100644 envs/sim_xarm/xarm/tasks/assets/shared.xml create mode 100644 envs/sim_xarm/xarm/tasks/assets/xarm.xml create mode 100644 envs/sim_xarm/xarm/tasks/base.py create mode 100644 envs/sim_xarm/xarm/tasks/lift.py create mode 100644 envs/sim_xarm/xarm/tasks/mocap.py create mode 100644 envs/sim_xarm/xarm/tasks/peg_in_box.py create mode 100644 envs/sim_xarm/xarm/tasks/push.py create mode 100644 envs/sim_xarm/xarm/tasks/reach.py diff --git a/envs/sim_xarm/README.md b/envs/sim_xarm/README.md new file mode 100644 index 00000000..5bb630ac --- /dev/null +++ b/envs/sim_xarm/README.md @@ -0,0 +1 @@ +# xArm environment for LeRobot diff --git a/envs/sim_xarm/poetry.lock b/envs/sim_xarm/poetry.lock new file mode 100644 index 00000000..af9b9326 --- /dev/null +++ b/envs/sim_xarm/poetry.lock @@ -0,0 +1,448 @@ +# This file is automatically @generated by Poetry 1.8.2 and should not be changed by hand. + +[[package]] +name = "absl-py" +version = "2.1.0" +description = "Abseil Python Common Libraries, see https://github.com/abseil/abseil-py." +optional = false +python-versions = ">=3.7" +files = [ + {file = "absl-py-2.1.0.tar.gz", hash = "sha256:7820790efbb316739cde8b4e19357243fc3608a152024288513dd968d7d959ff"}, + {file = "absl_py-2.1.0-py3-none-any.whl", hash = "sha256:526a04eadab8b4ee719ce68f204172ead1027549089702d99b9059f129ff1308"}, +] + +[[package]] +name = "cloudpickle" +version = "3.0.0" +description = "Pickler class to extend the standard pickle.Pickler functionality" +optional = false +python-versions = ">=3.8" +files = [ + {file = "cloudpickle-3.0.0-py3-none-any.whl", hash = "sha256:246ee7d0c295602a036e86369c77fecda4ab17b506496730f2f576d9016fd9c7"}, + {file = "cloudpickle-3.0.0.tar.gz", hash = "sha256:996d9a482c6fb4f33c1a35335cf8afd065d2a56e973270364840712d9131a882"}, +] + +[[package]] +name = "farama-notifications" +version = "0.0.4" +description = "Notifications for all Farama Foundation maintained libraries." +optional = false +python-versions = "*" +files = [ + {file = "Farama-Notifications-0.0.4.tar.gz", hash = "sha256:13fceff2d14314cf80703c8266462ebf3733c7d165336eee998fc58e545efd18"}, + {file = "Farama_Notifications-0.0.4-py3-none-any.whl", hash = "sha256:14de931035a41961f7c056361dc7f980762a143d05791ef5794a751a2caf05ae"}, +] + +[[package]] +name = "glfw" +version = "2.7.0" +description = "A ctypes-based wrapper for GLFW3." +optional = false +python-versions = "*" +files = [ + {file = "glfw-2.7.0-py2.py27.py3.py30.py31.py32.py33.py34.py35.py36.py37.py38-none-macosx_10_6_intel.whl", hash = "sha256:bd82849edcceda4e262bd1227afaa74b94f9f0731c1197863cd25c15bfc613fc"}, + {file = "glfw-2.7.0-py2.py27.py3.py30.py31.py32.py33.py34.py35.py36.py37.py38-none-macosx_11_0_arm64.whl", hash = "sha256:56ea163c964bb0bc336def2d6a6a1bd42f9db4b870ef834ac77d7b7ee68b8dfc"}, + {file = "glfw-2.7.0-py2.py27.py3.py30.py31.py32.py33.py34.py35.py36.py37.py38-none-manylinux2010_i686.whl", hash = "sha256:463aab9e5567c83d8120556b3a845807c60950ed0218fc1283368f46f5ece331"}, + {file = "glfw-2.7.0-py2.py27.py3.py30.py31.py32.py33.py34.py35.py36.py37.py38-none-manylinux2010_x86_64.whl", hash = "sha256:a6f54188dfc349e5426b0ada84843f6eb35a3811d8dbf57ae49c448e7d683bb4"}, + {file = "glfw-2.7.0-py2.py27.py3.py30.py31.py32.py33.py34.py35.py36.py37.py38-none-manylinux2014_aarch64.whl", hash = "sha256:e33568b0aba2045a3d7555f22fcf83fafcacc7c2fc4cb995741894ea51e43ab6"}, + {file = "glfw-2.7.0-py2.py27.py3.py30.py31.py32.py33.py34.py35.py36.py37.py38-none-manylinux2014_x86_64.whl", hash = "sha256:d8630dd9673860c427abde5b79bbc348e02eccde8a3f2a802c5a2a4fb5d79fb8"}, + {file = "glfw-2.7.0-py2.py27.py3.py30.py31.py32.py33.py34.py35.py36.py37.py38-none-win32.whl", hash = "sha256:ff92d14ac1c7afa9c5deb495c335b485868709880e6e080e99ace7026d74c756"}, + {file = "glfw-2.7.0-py2.py27.py3.py30.py31.py32.py33.py34.py35.py36.py37.py38-none-win_amd64.whl", hash = "sha256:20d4b31a5a6a61fb787b25f8408204e0e248313cc500953071d13d30a2e5cc9d"}, + {file = "glfw-2.7.0.tar.gz", hash = "sha256:0e209ad38fa8c5be67ca590d7b17533d95ad1eb57d0a3f07b98131db69b79000"}, +] + +[package.extras] +preview = ["glfw-preview"] + +[[package]] +name = "gymnasium" +version = "0.29.1" +description = "A standard API for reinforcement learning and a diverse set of reference environments (formerly Gym)." +optional = false +python-versions = ">=3.8" +files = [ + {file = "gymnasium-0.29.1-py3-none-any.whl", hash = "sha256:61c3384b5575985bb7f85e43213bcb40f36fcdff388cae6bc229304c71f2843e"}, + {file = "gymnasium-0.29.1.tar.gz", hash = "sha256:1a532752efcb7590478b1cc7aa04f608eb7a2fdad5570cd217b66b6a35274bb1"}, +] + +[package.dependencies] +cloudpickle = ">=1.2.0" +farama-notifications = ">=0.0.1" +numpy = ">=1.21.0" +typing-extensions = ">=4.3.0" + +[package.extras] +accept-rom-license = ["autorom[accept-rom-license] (>=0.4.2,<0.5.0)"] +all = ["box2d-py (==2.3.5)", "cython (<3)", "imageio (>=2.14.1)", "jax (>=0.4.0)", "jaxlib (>=0.4.0)", "lz4 (>=3.1.0)", "matplotlib (>=3.0)", "moviepy (>=1.0.0)", "mujoco (>=2.3.3)", "mujoco-py (>=2.1,<2.2)", "opencv-python (>=3.0)", "pygame (>=2.1.3)", "shimmy[atari] (>=0.1.0,<1.0)", "swig (==4.*)", "torch (>=1.0.0)"] +atari = ["shimmy[atari] (>=0.1.0,<1.0)"] +box2d = ["box2d-py (==2.3.5)", "pygame (>=2.1.3)", "swig (==4.*)"] +classic-control = ["pygame (>=2.1.3)", "pygame (>=2.1.3)"] +jax = ["jax (>=0.4.0)", "jaxlib (>=0.4.0)"] +mujoco = ["imageio (>=2.14.1)", "mujoco (>=2.3.3)"] +mujoco-py = ["cython (<3)", "cython (<3)", "mujoco-py (>=2.1,<2.2)", "mujoco-py (>=2.1,<2.2)"] +other = ["lz4 (>=3.1.0)", "matplotlib (>=3.0)", "moviepy (>=1.0.0)", "opencv-python (>=3.0)", "torch (>=1.0.0)"] +testing = ["pytest (==7.1.3)", "scipy (>=1.7.3)"] +toy-text = ["pygame (>=2.1.3)", "pygame (>=2.1.3)"] + +[[package]] +name = "gymnasium-robotics" +version = "1.2.4" +description = "Robotics environments for the Gymnasium repo." +optional = false +python-versions = ">=3.8" +files = [ + {file = "gymnasium-robotics-1.2.4.tar.gz", hash = "sha256:d304192b066f8b800599dfbe3d9d90bba9b761ee884472bdc4d05968a8bc61cb"}, + {file = "gymnasium_robotics-1.2.4-py3-none-any.whl", hash = "sha256:c2cb23e087ca0280ae6802837eb7b3a6d14e5bd24c00803ab09f015fcff3eef5"}, +] + +[package.dependencies] +gymnasium = ">=0.26" +imageio = "*" +Jinja2 = ">=3.0.3" +mujoco = ">=2.3.3,<3.0" +numpy = ">=1.21.0" +PettingZoo = ">=1.23.0" + +[package.extras] +mujoco-py = ["cython (<3)", "mujoco-py (>=2.1,<2.2)"] +testing = ["Jinja2 (>=3.0.3)", "PettingZoo (>=1.23.0)", "cython (<3)", "mujoco-py (>=2.1,<2.2)", "pytest (==7.0.1)"] + +[[package]] +name = "imageio" +version = "2.34.0" +description = "Library for reading and writing a wide range of image, video, scientific, and volumetric data formats." +optional = false +python-versions = ">=3.8" +files = [ + {file = "imageio-2.34.0-py3-none-any.whl", hash = "sha256:08082bf47ccb54843d9c73fe9fc8f3a88c72452ab676b58aca74f36167e8ccba"}, + {file = "imageio-2.34.0.tar.gz", hash = "sha256:ae9732e10acf807a22c389aef193f42215718e16bd06eed0c5bb57e1034a4d53"}, +] + +[package.dependencies] +numpy = "*" +pillow = ">=8.3.2" + +[package.extras] +all-plugins = ["astropy", "av", "imageio-ffmpeg", "pillow-heif", "psutil", "tifffile"] +all-plugins-pypy = ["av", "imageio-ffmpeg", "pillow-heif", "psutil", "tifffile"] +build = ["wheel"] +dev = ["black", "flake8", "fsspec[github]", "pytest", "pytest-cov"] +docs = ["numpydoc", "pydata-sphinx-theme", "sphinx (<6)"] +ffmpeg = ["imageio-ffmpeg", "psutil"] +fits = ["astropy"] +full = ["astropy", "av", "black", "flake8", "fsspec[github]", "gdal", "imageio-ffmpeg", "itk", "numpydoc", "pillow-heif", "psutil", "pydata-sphinx-theme", "pytest", "pytest-cov", "sphinx (<6)", "tifffile", "wheel"] +gdal = ["gdal"] +itk = ["itk"] +linting = ["black", "flake8"] +pillow-heif = ["pillow-heif"] +pyav = ["av"] +test = ["fsspec[github]", "pytest", "pytest-cov"] +tifffile = ["tifffile"] + +[[package]] +name = "jinja2" +version = "3.1.3" +description = "A very fast and expressive template engine." +optional = false +python-versions = ">=3.7" +files = [ + {file = "Jinja2-3.1.3-py3-none-any.whl", hash = "sha256:7d6d50dd97d52cbc355597bd845fabfbac3f551e1f99619e39a35ce8c370b5fa"}, + {file = "Jinja2-3.1.3.tar.gz", hash = "sha256:ac8bd6544d4bb2c9792bf3a159e80bba8fda7f07e81bc3aed565432d5925ba90"}, +] + +[package.dependencies] +MarkupSafe = ">=2.0" + +[package.extras] +i18n = ["Babel (>=2.7)"] + +[[package]] +name = "markupsafe" +version = "2.1.5" +description = "Safely add untrusted strings to HTML/XML markup." +optional = false +python-versions = ">=3.7" +files = [ + {file = "MarkupSafe-2.1.5-cp310-cp310-macosx_10_9_universal2.whl", hash = "sha256:a17a92de5231666cfbe003f0e4b9b3a7ae3afb1ec2845aadc2bacc93ff85febc"}, + {file = "MarkupSafe-2.1.5-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:72b6be590cc35924b02c78ef34b467da4ba07e4e0f0454a2c5907f473fc50ce5"}, + {file = "MarkupSafe-2.1.5-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:e61659ba32cf2cf1481e575d0462554625196a1f2fc06a1c777d3f48e8865d46"}, + {file = "MarkupSafe-2.1.5-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:2174c595a0d73a3080ca3257b40096db99799265e1c27cc5a610743acd86d62f"}, + {file = "MarkupSafe-2.1.5-cp310-cp310-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ae2ad8ae6ebee9d2d94b17fb62763125f3f374c25618198f40cbb8b525411900"}, + {file = "MarkupSafe-2.1.5-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:075202fa5b72c86ad32dc7d0b56024ebdbcf2048c0ba09f1cde31bfdd57bcfff"}, + {file = "MarkupSafe-2.1.5-cp310-cp310-musllinux_1_1_i686.whl", hash = "sha256:598e3276b64aff0e7b3451b72e94fa3c238d452e7ddcd893c3ab324717456bad"}, + {file = "MarkupSafe-2.1.5-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:fce659a462a1be54d2ffcacea5e3ba2d74daa74f30f5f143fe0c58636e355fdd"}, + {file = "MarkupSafe-2.1.5-cp310-cp310-win32.whl", hash = "sha256:d9fad5155d72433c921b782e58892377c44bd6252b5af2f67f16b194987338a4"}, + {file = "MarkupSafe-2.1.5-cp310-cp310-win_amd64.whl", hash = "sha256:bf50cd79a75d181c9181df03572cdce0fbb75cc353bc350712073108cba98de5"}, + {file = "MarkupSafe-2.1.5-cp311-cp311-macosx_10_9_universal2.whl", hash = "sha256:629ddd2ca402ae6dbedfceeba9c46d5f7b2a61d9749597d4307f943ef198fc1f"}, + {file = "MarkupSafe-2.1.5-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:5b7b716f97b52c5a14bffdf688f971b2d5ef4029127f1ad7a513973cfd818df2"}, + {file = "MarkupSafe-2.1.5-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6ec585f69cec0aa07d945b20805be741395e28ac1627333b1c5b0105962ffced"}, + {file = "MarkupSafe-2.1.5-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:b91c037585eba9095565a3556f611e3cbfaa42ca1e865f7b8015fe5c7336d5a5"}, + {file = "MarkupSafe-2.1.5-cp311-cp311-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:7502934a33b54030eaf1194c21c692a534196063db72176b0c4028e140f8f32c"}, + {file = "MarkupSafe-2.1.5-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:0e397ac966fdf721b2c528cf028494e86172b4feba51d65f81ffd65c63798f3f"}, + {file = "MarkupSafe-2.1.5-cp311-cp311-musllinux_1_1_i686.whl", hash = "sha256:c061bb86a71b42465156a3ee7bd58c8c2ceacdbeb95d05a99893e08b8467359a"}, + {file = "MarkupSafe-2.1.5-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:3a57fdd7ce31c7ff06cdfbf31dafa96cc533c21e443d57f5b1ecc6cdc668ec7f"}, + {file = "MarkupSafe-2.1.5-cp311-cp311-win32.whl", hash = "sha256:397081c1a0bfb5124355710fe79478cdbeb39626492b15d399526ae53422b906"}, + {file = "MarkupSafe-2.1.5-cp311-cp311-win_amd64.whl", hash = "sha256:2b7c57a4dfc4f16f7142221afe5ba4e093e09e728ca65c51f5620c9aaeb9a617"}, + {file = "MarkupSafe-2.1.5-cp312-cp312-macosx_10_9_universal2.whl", hash = "sha256:8dec4936e9c3100156f8a2dc89c4b88d5c435175ff03413b443469c7c8c5f4d1"}, + {file = "MarkupSafe-2.1.5-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:3c6b973f22eb18a789b1460b4b91bf04ae3f0c4234a0a6aa6b0a92f6f7b951d4"}, + {file = "MarkupSafe-2.1.5-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ac07bad82163452a6884fe8fa0963fb98c2346ba78d779ec06bd7a6262132aee"}, + {file = "MarkupSafe-2.1.5-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f5dfb42c4604dddc8e4305050aa6deb084540643ed5804d7455b5df8fe16f5e5"}, + {file = "MarkupSafe-2.1.5-cp312-cp312-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ea3d8a3d18833cf4304cd2fc9cbb1efe188ca9b5efef2bdac7adc20594a0e46b"}, + {file = "MarkupSafe-2.1.5-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:d050b3361367a06d752db6ead6e7edeb0009be66bc3bae0ee9d97fb326badc2a"}, + {file = "MarkupSafe-2.1.5-cp312-cp312-musllinux_1_1_i686.whl", hash = "sha256:bec0a414d016ac1a18862a519e54b2fd0fc8bbfd6890376898a6c0891dd82e9f"}, + {file = "MarkupSafe-2.1.5-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:58c98fee265677f63a4385256a6d7683ab1832f3ddd1e66fe948d5880c21a169"}, + {file = "MarkupSafe-2.1.5-cp312-cp312-win32.whl", hash = "sha256:8590b4ae07a35970728874632fed7bd57b26b0102df2d2b233b6d9d82f6c62ad"}, + {file = "MarkupSafe-2.1.5-cp312-cp312-win_amd64.whl", hash = "sha256:823b65d8706e32ad2df51ed89496147a42a2a6e01c13cfb6ffb8b1e92bc910bb"}, + {file = "MarkupSafe-2.1.5-cp37-cp37m-macosx_10_9_x86_64.whl", hash = "sha256:c8b29db45f8fe46ad280a7294f5c3ec36dbac9491f2d1c17345be8e69cc5928f"}, + {file = "MarkupSafe-2.1.5-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:ec6a563cff360b50eed26f13adc43e61bc0c04d94b8be985e6fb24b81f6dcfdf"}, + {file = "MarkupSafe-2.1.5-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:a549b9c31bec33820e885335b451286e2969a2d9e24879f83fe904a5ce59d70a"}, + {file = "MarkupSafe-2.1.5-cp37-cp37m-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4f11aa001c540f62c6166c7726f71f7573b52c68c31f014c25cc7901deea0b52"}, + {file = "MarkupSafe-2.1.5-cp37-cp37m-musllinux_1_1_aarch64.whl", hash = "sha256:7b2e5a267c855eea6b4283940daa6e88a285f5f2a67f2220203786dfa59b37e9"}, + {file = "MarkupSafe-2.1.5-cp37-cp37m-musllinux_1_1_i686.whl", hash = "sha256:2d2d793e36e230fd32babe143b04cec8a8b3eb8a3122d2aceb4a371e6b09b8df"}, + {file = "MarkupSafe-2.1.5-cp37-cp37m-musllinux_1_1_x86_64.whl", hash = "sha256:ce409136744f6521e39fd8e2a24c53fa18ad67aa5bc7c2cf83645cce5b5c4e50"}, + {file = "MarkupSafe-2.1.5-cp37-cp37m-win32.whl", hash = "sha256:4096e9de5c6fdf43fb4f04c26fb114f61ef0bf2e5604b6ee3019d51b69e8c371"}, + {file = "MarkupSafe-2.1.5-cp37-cp37m-win_amd64.whl", hash = "sha256:4275d846e41ecefa46e2015117a9f491e57a71ddd59bbead77e904dc02b1bed2"}, + {file = "MarkupSafe-2.1.5-cp38-cp38-macosx_10_9_universal2.whl", hash = "sha256:656f7526c69fac7f600bd1f400991cc282b417d17539a1b228617081106feb4a"}, + {file = "MarkupSafe-2.1.5-cp38-cp38-macosx_10_9_x86_64.whl", hash = "sha256:97cafb1f3cbcd3fd2b6fbfb99ae11cdb14deea0736fc2b0952ee177f2b813a46"}, + {file = "MarkupSafe-2.1.5-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:1f3fbcb7ef1f16e48246f704ab79d79da8a46891e2da03f8783a5b6fa41a9532"}, + {file = "MarkupSafe-2.1.5-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:fa9db3f79de01457b03d4f01b34cf91bc0048eb2c3846ff26f66687c2f6d16ab"}, + {file = "MarkupSafe-2.1.5-cp38-cp38-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:ffee1f21e5ef0d712f9033568f8344d5da8cc2869dbd08d87c84656e6a2d2f68"}, + {file = "MarkupSafe-2.1.5-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:5dedb4db619ba5a2787a94d877bc8ffc0566f92a01c0ef214865e54ecc9ee5e0"}, + {file = "MarkupSafe-2.1.5-cp38-cp38-musllinux_1_1_i686.whl", hash = "sha256:30b600cf0a7ac9234b2638fbc0fb6158ba5bdcdf46aeb631ead21248b9affbc4"}, + {file = "MarkupSafe-2.1.5-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:8dd717634f5a044f860435c1d8c16a270ddf0ef8588d4887037c5028b859b0c3"}, + {file = "MarkupSafe-2.1.5-cp38-cp38-win32.whl", hash = "sha256:daa4ee5a243f0f20d528d939d06670a298dd39b1ad5f8a72a4275124a7819eff"}, + {file = "MarkupSafe-2.1.5-cp38-cp38-win_amd64.whl", hash = "sha256:619bc166c4f2de5caa5a633b8b7326fbe98e0ccbfacabd87268a2b15ff73a029"}, + {file = "MarkupSafe-2.1.5-cp39-cp39-macosx_10_9_universal2.whl", hash = "sha256:7a68b554d356a91cce1236aa7682dc01df0edba8d043fd1ce607c49dd3c1edcf"}, + {file = "MarkupSafe-2.1.5-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:db0b55e0f3cc0be60c1f19efdde9a637c32740486004f20d1cff53c3c0ece4d2"}, + {file = "MarkupSafe-2.1.5-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3e53af139f8579a6d5f7b76549125f0d94d7e630761a2111bc431fd820e163b8"}, + {file = "MarkupSafe-2.1.5-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:17b950fccb810b3293638215058e432159d2b71005c74371d784862b7e4683f3"}, + {file = "MarkupSafe-2.1.5-cp39-cp39-manylinux_2_5_i686.manylinux1_i686.manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:4c31f53cdae6ecfa91a77820e8b151dba54ab528ba65dfd235c80b086d68a465"}, + {file = "MarkupSafe-2.1.5-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:bff1b4290a66b490a2f4719358c0cdcd9bafb6b8f061e45c7a2460866bf50c2e"}, + {file = "MarkupSafe-2.1.5-cp39-cp39-musllinux_1_1_i686.whl", hash = "sha256:bc1667f8b83f48511b94671e0e441401371dfd0f0a795c7daa4a3cd1dde55bea"}, + {file = "MarkupSafe-2.1.5-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:5049256f536511ee3f7e1b3f87d1d1209d327e818e6ae1365e8653d7e3abb6a6"}, + {file = "MarkupSafe-2.1.5-cp39-cp39-win32.whl", hash = "sha256:00e046b6dd71aa03a41079792f8473dc494d564611a8f89bbbd7cb93295ebdcf"}, + {file = "MarkupSafe-2.1.5-cp39-cp39-win_amd64.whl", hash = "sha256:fa173ec60341d6bb97a89f5ea19c85c5643c1e7dedebc22f5181eb73573142c5"}, + {file = "MarkupSafe-2.1.5.tar.gz", hash = "sha256:d283d37a890ba4c1ae73ffadf8046435c76e7bc2247bbb63c00bd1a709c6544b"}, +] + +[[package]] +name = "mujoco" +version = "2.3.7" +description = "MuJoCo Physics Simulator" +optional = false +python-versions = ">=3.8" +files = [ + {file = "mujoco-2.3.7-cp310-cp310-macosx_10_16_x86_64.whl", hash = "sha256:e8714a5ff6a1561b364b7b4648d4c0c8d13e751874cf7401c309b9d23fa9598b"}, + {file = "mujoco-2.3.7-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:a934315f858a4e0c4b90a682fde519471cfdd7baa64435179da8cd20d4ae3f99"}, + {file = "mujoco-2.3.7-cp310-cp310-macosx_11_0_x86_64.whl", hash = "sha256:36513024330f88b5f9a43558efef5692b33599bffd5141029b690a27918ffcbe"}, + {file = "mujoco-2.3.7-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6d4eede8ba8210fbd3d3cd1dbf69e24dd1541aa74c5af5b8adbbbf65504b6dba"}, + {file = "mujoco-2.3.7-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ab85fafc9d5a091c712947573b7e694512d283876bf7f33ae3f8daad3a20c0db"}, + {file = "mujoco-2.3.7-cp310-cp310-win_amd64.whl", hash = "sha256:f8b7e13fef8c813d91b78f975ed0815157692777907ffa4b4be53a4edb75019b"}, + {file = "mujoco-2.3.7-cp311-cp311-macosx_10_16_x86_64.whl", hash = "sha256:779520216f72a8e370e3f0cdd71b45c3b7384c63331a3189194c930a3e7cff5c"}, + {file = "mujoco-2.3.7-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:9d4018053879016282d27ab7a91e292c72d44efb5a88553feacfe5b843dde103"}, + {file = "mujoco-2.3.7-cp311-cp311-macosx_11_0_x86_64.whl", hash = "sha256:3149b16b8122ee62642474bfd2871064e8edc40235471cf5d84be3569afc0312"}, + {file = "mujoco-2.3.7-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c08660a8d52ef3efde76095f0991e807703a950c1e882d2bcd984b9a846626f7"}, + {file = "mujoco-2.3.7-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:426af8965f8636d94a0f75740c3024a62b3e585020ee817ef5208ec844a1ad94"}, + {file = "mujoco-2.3.7-cp311-cp311-win_amd64.whl", hash = "sha256:215415a8e98a4b50625beae859079d5e0810b2039e50420f0ba81763c34abb59"}, + {file = "mujoco-2.3.7-cp38-cp38-macosx_10_16_x86_64.whl", hash = "sha256:8b78d14f4c60cea3c58e046bd4de453fb5b9b33aca6a25fc91d39a53f3a5342a"}, + {file = "mujoco-2.3.7-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:5c6f5a51d6f537a4bf294cf73816f3a6384573f8f10a5452b044df2771412a96"}, + {file = "mujoco-2.3.7-cp38-cp38-macosx_11_0_x86_64.whl", hash = "sha256:ea8911e6047f92d7d775701f37e4c093971b6def3160f01d0b6926e29a7e962e"}, + {file = "mujoco-2.3.7-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7473a3de4dd1a8762d569ffb139196b4c5e7eca27d256df97b6cd4c66d2a09b2"}, + {file = "mujoco-2.3.7-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:40e7e2d8f93d2495ec74efec84e5118ecc6e1d85157a844789c73c9ac9a4e28e"}, + {file = "mujoco-2.3.7-cp38-cp38-win_amd64.whl", hash = "sha256:720bc228a2023b3b0ed6af78f5b0f8ea36867be321d473321555c57dbf6e4e5b"}, + {file = "mujoco-2.3.7-cp39-cp39-macosx_10_16_x86_64.whl", hash = "sha256:855e79686366442aa410246043b44f7d842d3900d68fe7e37feb42147db9d707"}, + {file = "mujoco-2.3.7-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:98947f4a742d34d36f3c3f83e9167025bb0414bbaa4bd859b0673bdab9959963"}, + {file = "mujoco-2.3.7-cp39-cp39-macosx_11_0_x86_64.whl", hash = "sha256:d42818f2ee5d1632dbce31d136ed5ff868db54b04e4e9aca0c5a3ac329f8a90f"}, + {file = "mujoco-2.3.7-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9237e1ba14bced9449c31199e6d5be49547f3a4c99bc83b196af7ca45fd73b83"}, + {file = "mujoco-2.3.7-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:39b728ea638245b150e2650c5433e6952e0ed3798c63e47e264574270caea2a3"}, + {file = "mujoco-2.3.7-cp39-cp39-win_amd64.whl", hash = "sha256:9c721a5042b99d948d5f0296a534bcce3f142c777c4d7642f503a539513f3912"}, + {file = "mujoco-2.3.7.tar.gz", hash = "sha256:422041f1ce37c6d151fbced1048df626837e94fe3cd9f813585907046336a7d0"}, +] + +[package.dependencies] +absl-py = "*" +glfw = "*" +numpy = "*" +pyopengl = "*" + +[[package]] +name = "numpy" +version = "1.26.4" +description = "Fundamental package for array computing in Python" +optional = false +python-versions = ">=3.9" +files = [ + {file = "numpy-1.26.4-cp310-cp310-macosx_10_9_x86_64.whl", hash = "sha256:9ff0f4f29c51e2803569d7a51c2304de5554655a60c5d776e35b4a41413830d0"}, + {file = "numpy-1.26.4-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:2e4ee3380d6de9c9ec04745830fd9e2eccb3e6cf790d39d7b98ffd19b0dd754a"}, + {file = "numpy-1.26.4-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d209d8969599b27ad20994c8e41936ee0964e6da07478d6c35016bc386b66ad4"}, + {file = "numpy-1.26.4-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:ffa75af20b44f8dba823498024771d5ac50620e6915abac414251bd971b4529f"}, + {file = "numpy-1.26.4-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:62b8e4b1e28009ef2846b4c7852046736bab361f7aeadeb6a5b89ebec3c7055a"}, + {file = "numpy-1.26.4-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:a4abb4f9001ad2858e7ac189089c42178fcce737e4169dc61321660f1a96c7d2"}, + {file = "numpy-1.26.4-cp310-cp310-win32.whl", hash = "sha256:bfe25acf8b437eb2a8b2d49d443800a5f18508cd811fea3181723922a8a82b07"}, + {file = "numpy-1.26.4-cp310-cp310-win_amd64.whl", hash = "sha256:b97fe8060236edf3662adfc2c633f56a08ae30560c56310562cb4f95500022d5"}, + {file = "numpy-1.26.4-cp311-cp311-macosx_10_9_x86_64.whl", hash = "sha256:4c66707fabe114439db9068ee468c26bbdf909cac0fb58686a42a24de1760c71"}, + {file = "numpy-1.26.4-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:edd8b5fe47dab091176d21bb6de568acdd906d1887a4584a15a9a96a1dca06ef"}, + {file = "numpy-1.26.4-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:7ab55401287bfec946ced39700c053796e7cc0e3acbef09993a9ad2adba6ca6e"}, + {file = "numpy-1.26.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:666dbfb6ec68962c033a450943ded891bed2d54e6755e35e5835d63f4f6931d5"}, + {file = "numpy-1.26.4-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:96ff0b2ad353d8f990b63294c8986f1ec3cb19d749234014f4e7eb0112ceba5a"}, + {file = "numpy-1.26.4-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:60dedbb91afcbfdc9bc0b1f3f402804070deed7392c23eb7a7f07fa857868e8a"}, + {file = "numpy-1.26.4-cp311-cp311-win32.whl", hash = "sha256:1af303d6b2210eb850fcf03064d364652b7120803a0b872f5211f5234b399f20"}, + {file = "numpy-1.26.4-cp311-cp311-win_amd64.whl", hash = "sha256:cd25bcecc4974d09257ffcd1f098ee778f7834c3ad767fe5db785be9a4aa9cb2"}, + {file = "numpy-1.26.4-cp312-cp312-macosx_10_9_x86_64.whl", hash = "sha256:b3ce300f3644fb06443ee2222c2201dd3a89ea6040541412b8fa189341847218"}, + {file = "numpy-1.26.4-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:03a8c78d01d9781b28a6989f6fa1bb2c4f2d51201cf99d3dd875df6fbd96b23b"}, + {file = "numpy-1.26.4-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:9fad7dcb1aac3c7f0584a5a8133e3a43eeb2fe127f47e3632d43d677c66c102b"}, + {file = "numpy-1.26.4-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:675d61ffbfa78604709862923189bad94014bef562cc35cf61d3a07bba02a7ed"}, + {file = "numpy-1.26.4-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:ab47dbe5cc8210f55aa58e4805fe224dac469cde56b9f731a4c098b91917159a"}, + {file = "numpy-1.26.4-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:1dda2e7b4ec9dd512f84935c5f126c8bd8b9f2fc001e9f54af255e8c5f16b0e0"}, + {file = "numpy-1.26.4-cp312-cp312-win32.whl", hash = "sha256:50193e430acfc1346175fcbdaa28ffec49947a06918b7b92130744e81e640110"}, + {file = "numpy-1.26.4-cp312-cp312-win_amd64.whl", hash = "sha256:08beddf13648eb95f8d867350f6a018a4be2e5ad54c8d8caed89ebca558b2818"}, + {file = "numpy-1.26.4-cp39-cp39-macosx_10_9_x86_64.whl", hash = "sha256:7349ab0fa0c429c82442a27a9673fc802ffdb7c7775fad780226cb234965e53c"}, + {file = "numpy-1.26.4-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:52b8b60467cd7dd1e9ed082188b4e6bb35aa5cdd01777621a1658910745b90be"}, + {file = "numpy-1.26.4-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d5241e0a80d808d70546c697135da2c613f30e28251ff8307eb72ba696945764"}, + {file = "numpy-1.26.4-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:f870204a840a60da0b12273ef34f7051e98c3b5961b61b0c2c1be6dfd64fbcd3"}, + {file = "numpy-1.26.4-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:679b0076f67ecc0138fd2ede3a8fd196dddc2ad3254069bcb9faf9a79b1cebcd"}, + {file = "numpy-1.26.4-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:47711010ad8555514b434df65f7d7b076bb8261df1ca9bb78f53d3b2db02e95c"}, + {file = "numpy-1.26.4-cp39-cp39-win32.whl", hash = "sha256:a354325ee03388678242a4d7ebcd08b5c727033fcff3b2f536aea978e15ee9e6"}, + {file = "numpy-1.26.4-cp39-cp39-win_amd64.whl", hash = "sha256:3373d5d70a5fe74a2c1bb6d2cfd9609ecf686d47a2d7b1d37a8f3b6bf6003aea"}, + {file = "numpy-1.26.4-pp39-pypy39_pp73-macosx_10_9_x86_64.whl", hash = "sha256:afedb719a9dcfc7eaf2287b839d8198e06dcd4cb5d276a3df279231138e83d30"}, + {file = "numpy-1.26.4-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:95a7476c59002f2f6c590b9b7b998306fba6a5aa646b1e22ddfeaf8f78c3a29c"}, + {file = "numpy-1.26.4-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:7e50d0a0cc3189f9cb0aeb3a6a6af18c16f59f004b866cd2be1c14b36134a4a0"}, + {file = "numpy-1.26.4.tar.gz", hash = "sha256:2a02aba9ed12e4ac4eb3ea9421c420301a0c6460d9830d74a9df87efa4912010"}, +] + +[[package]] +name = "pettingzoo" +version = "1.24.3" +description = "Gymnasium for multi-agent reinforcement learning." +optional = false +python-versions = ">=3.8" +files = [ + {file = "pettingzoo-1.24.3-py3-none-any.whl", hash = "sha256:23ed90517d2e8a7098bdaf5e31234b3a7f7b73ca578d70d1ca7b9d0cb0e37982"}, + {file = "pettingzoo-1.24.3.tar.gz", hash = "sha256:91f9094f18e06fb74b98f4099cd22e8ae4396125e51719d50b30c9f1c7ab07e6"}, +] + +[package.dependencies] +gymnasium = ">=0.28.0" +numpy = ">=1.21.0" + +[package.extras] +all = ["box2d-py (==2.3.5)", "chess (==1.9.4)", "multi-agent-ale-py (==0.1.11)", "pillow (>=8.0.1)", "pygame (==2.3.0)", "pymunk (==6.2.0)", "rlcard (==1.0.5)", "scipy (>=1.4.1)", "shimmy[openspiel] (>=1.2.0)"] +atari = ["multi-agent-ale-py (==0.1.11)", "pygame (==2.3.0)"] +butterfly = ["pygame (==2.3.0)", "pymunk (==6.2.0)"] +classic = ["chess (==1.9.4)", "pygame (==2.3.0)", "rlcard (==1.0.5)", "shimmy[openspiel] (>=1.2.0)"] +mpe = ["pygame (==2.3.0)"] +other = ["pillow (>=8.0.1)"] +sisl = ["box2d-py (==2.3.5)", "pygame (==2.3.0)", "pymunk (==6.2.0)", "scipy (>=1.4.1)"] +testing = ["AutoROM", "pre-commit", "pynput", "pytest", "pytest-cov", "pytest-markdown-docs", "pytest-xdist"] + +[[package]] +name = "pillow" +version = "10.2.0" +description = "Python Imaging Library (Fork)" +optional = false +python-versions = ">=3.8" +files = [ + {file = "pillow-10.2.0-cp310-cp310-macosx_10_10_x86_64.whl", hash = "sha256:7823bdd049099efa16e4246bdf15e5a13dbb18a51b68fa06d6c1d4d8b99a796e"}, + {file = "pillow-10.2.0-cp310-cp310-macosx_11_0_arm64.whl", hash = "sha256:83b2021f2ade7d1ed556bc50a399127d7fb245e725aa0113ebd05cfe88aaf588"}, + {file = "pillow-10.2.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:6fad5ff2f13d69b7e74ce5b4ecd12cc0ec530fcee76356cac6742785ff71c452"}, + {file = "pillow-10.2.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:da2b52b37dad6d9ec64e653637a096905b258d2fc2b984c41ae7d08b938a67e4"}, + {file = "pillow-10.2.0-cp310-cp310-manylinux_2_28_aarch64.whl", hash = "sha256:47c0995fc4e7f79b5cfcab1fc437ff2890b770440f7696a3ba065ee0fd496563"}, + {file = "pillow-10.2.0-cp310-cp310-manylinux_2_28_x86_64.whl", hash = "sha256:322bdf3c9b556e9ffb18f93462e5f749d3444ce081290352c6070d014c93feb2"}, + {file = "pillow-10.2.0-cp310-cp310-musllinux_1_1_aarch64.whl", hash = "sha256:51f1a1bffc50e2e9492e87d8e09a17c5eea8409cda8d3f277eb6edc82813c17c"}, + {file = "pillow-10.2.0-cp310-cp310-musllinux_1_1_x86_64.whl", hash = "sha256:69ffdd6120a4737710a9eee73e1d2e37db89b620f702754b8f6e62594471dee0"}, + {file = "pillow-10.2.0-cp310-cp310-win32.whl", hash = "sha256:c6dafac9e0f2b3c78df97e79af707cdc5ef8e88208d686a4847bab8266870023"}, + {file = "pillow-10.2.0-cp310-cp310-win_amd64.whl", hash = "sha256:aebb6044806f2e16ecc07b2a2637ee1ef67a11840a66752751714a0d924adf72"}, + {file = "pillow-10.2.0-cp310-cp310-win_arm64.whl", hash = "sha256:7049e301399273a0136ff39b84c3678e314f2158f50f517bc50285fb5ec847ad"}, + {file = "pillow-10.2.0-cp311-cp311-macosx_10_10_x86_64.whl", hash = "sha256:35bb52c37f256f662abdfa49d2dfa6ce5d93281d323a9af377a120e89a9eafb5"}, + {file = "pillow-10.2.0-cp311-cp311-macosx_11_0_arm64.whl", hash = "sha256:9c23f307202661071d94b5e384e1e1dc7dfb972a28a2310e4ee16103e66ddb67"}, + {file = "pillow-10.2.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:773efe0603db30c281521a7c0214cad7836c03b8ccff897beae9b47c0b657d61"}, + {file = "pillow-10.2.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:11fa2e5984b949b0dd6d7a94d967743d87c577ff0b83392f17cb3990d0d2fd6e"}, + {file = "pillow-10.2.0-cp311-cp311-manylinux_2_28_aarch64.whl", hash = "sha256:716d30ed977be8b37d3ef185fecb9e5a1d62d110dfbdcd1e2a122ab46fddb03f"}, + {file = "pillow-10.2.0-cp311-cp311-manylinux_2_28_x86_64.whl", hash = "sha256:a086c2af425c5f62a65e12fbf385f7c9fcb8f107d0849dba5839461a129cf311"}, + {file = "pillow-10.2.0-cp311-cp311-musllinux_1_1_aarch64.whl", hash = "sha256:c8de2789052ed501dd829e9cae8d3dcce7acb4777ea4a479c14521c942d395b1"}, + {file = "pillow-10.2.0-cp311-cp311-musllinux_1_1_x86_64.whl", hash = "sha256:609448742444d9290fd687940ac0b57fb35e6fd92bdb65386e08e99af60bf757"}, + {file = "pillow-10.2.0-cp311-cp311-win32.whl", hash = "sha256:823ef7a27cf86df6597fa0671066c1b596f69eba53efa3d1e1cb8b30f3533068"}, + {file = "pillow-10.2.0-cp311-cp311-win_amd64.whl", hash = "sha256:1da3b2703afd040cf65ec97efea81cfba59cdbed9c11d8efc5ab09df9509fc56"}, + {file = "pillow-10.2.0-cp311-cp311-win_arm64.whl", hash = "sha256:edca80cbfb2b68d7b56930b84a0e45ae1694aeba0541f798e908a49d66b837f1"}, + {file = "pillow-10.2.0-cp312-cp312-macosx_10_10_x86_64.whl", hash = "sha256:1b5e1b74d1bd1b78bc3477528919414874748dd363e6272efd5abf7654e68bef"}, + {file = "pillow-10.2.0-cp312-cp312-macosx_11_0_arm64.whl", hash = "sha256:0eae2073305f451d8ecacb5474997c08569fb4eb4ac231ffa4ad7d342fdc25ac"}, + {file = "pillow-10.2.0-cp312-cp312-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b7c2286c23cd350b80d2fc9d424fc797575fb16f854b831d16fd47ceec078f2c"}, + {file = "pillow-10.2.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:1e23412b5c41e58cec602f1135c57dfcf15482013ce6e5f093a86db69646a5aa"}, + {file = "pillow-10.2.0-cp312-cp312-manylinux_2_28_aarch64.whl", hash = "sha256:52a50aa3fb3acb9cf7213573ef55d31d6eca37f5709c69e6858fe3bc04a5c2a2"}, + {file = "pillow-10.2.0-cp312-cp312-manylinux_2_28_x86_64.whl", hash = "sha256:127cee571038f252a552760076407f9cff79761c3d436a12af6000cd182a9d04"}, + {file = "pillow-10.2.0-cp312-cp312-musllinux_1_1_aarch64.whl", hash = "sha256:8d12251f02d69d8310b046e82572ed486685c38f02176bd08baf216746eb947f"}, + {file = "pillow-10.2.0-cp312-cp312-musllinux_1_1_x86_64.whl", hash = "sha256:54f1852cd531aa981bc0965b7d609f5f6cc8ce8c41b1139f6ed6b3c54ab82bfb"}, + {file = "pillow-10.2.0-cp312-cp312-win32.whl", hash = "sha256:257d8788df5ca62c980314053197f4d46eefedf4e6175bc9412f14412ec4ea2f"}, + {file = "pillow-10.2.0-cp312-cp312-win_amd64.whl", hash = "sha256:154e939c5f0053a383de4fd3d3da48d9427a7e985f58af8e94d0b3c9fcfcf4f9"}, + {file = "pillow-10.2.0-cp312-cp312-win_arm64.whl", hash = "sha256:f379abd2f1e3dddb2b61bc67977a6b5a0a3f7485538bcc6f39ec76163891ee48"}, + {file = "pillow-10.2.0-cp38-cp38-macosx_10_10_x86_64.whl", hash = "sha256:8373c6c251f7ef8bda6675dd6d2b3a0fcc31edf1201266b5cf608b62a37407f9"}, + {file = "pillow-10.2.0-cp38-cp38-macosx_11_0_arm64.whl", hash = "sha256:870ea1ada0899fd0b79643990809323b389d4d1d46c192f97342eeb6ee0b8483"}, + {file = "pillow-10.2.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:b4b6b1e20608493548b1f32bce8cca185bf0480983890403d3b8753e44077129"}, + {file = "pillow-10.2.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:3031709084b6e7852d00479fd1d310b07d0ba82765f973b543c8af5061cf990e"}, + {file = "pillow-10.2.0-cp38-cp38-manylinux_2_28_aarch64.whl", hash = "sha256:3ff074fc97dd4e80543a3e91f69d58889baf2002b6be64347ea8cf5533188213"}, + {file = "pillow-10.2.0-cp38-cp38-manylinux_2_28_x86_64.whl", hash = "sha256:cb4c38abeef13c61d6916f264d4845fab99d7b711be96c326b84df9e3e0ff62d"}, + {file = "pillow-10.2.0-cp38-cp38-musllinux_1_1_aarch64.whl", hash = "sha256:b1b3020d90c2d8e1dae29cf3ce54f8094f7938460fb5ce8bc5c01450b01fbaf6"}, + {file = "pillow-10.2.0-cp38-cp38-musllinux_1_1_x86_64.whl", hash = "sha256:170aeb00224ab3dc54230c797f8404507240dd868cf52066f66a41b33169bdbe"}, + {file = "pillow-10.2.0-cp38-cp38-win32.whl", hash = "sha256:c4225f5220f46b2fde568c74fca27ae9771536c2e29d7c04f4fb62c83275ac4e"}, + {file = "pillow-10.2.0-cp38-cp38-win_amd64.whl", hash = "sha256:0689b5a8c5288bc0504d9fcee48f61a6a586b9b98514d7d29b840143d6734f39"}, + {file = "pillow-10.2.0-cp39-cp39-macosx_10_10_x86_64.whl", hash = "sha256:b792a349405fbc0163190fde0dc7b3fef3c9268292586cf5645598b48e63dc67"}, + {file = "pillow-10.2.0-cp39-cp39-macosx_11_0_arm64.whl", hash = "sha256:c570f24be1e468e3f0ce7ef56a89a60f0e05b30a3669a459e419c6eac2c35364"}, + {file = "pillow-10.2.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d8ecd059fdaf60c1963c58ceb8997b32e9dc1b911f5da5307aab614f1ce5c2fb"}, + {file = "pillow-10.2.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:c365fd1703040de1ec284b176d6af5abe21b427cb3a5ff68e0759e1e313a5e7e"}, + {file = "pillow-10.2.0-cp39-cp39-manylinux_2_28_aarch64.whl", hash = "sha256:70c61d4c475835a19b3a5aa42492409878bbca7438554a1f89d20d58a7c75c01"}, + {file = "pillow-10.2.0-cp39-cp39-manylinux_2_28_x86_64.whl", hash = "sha256:b6f491cdf80ae540738859d9766783e3b3c8e5bd37f5dfa0b76abdecc5081f13"}, + {file = "pillow-10.2.0-cp39-cp39-musllinux_1_1_aarch64.whl", hash = "sha256:9d189550615b4948f45252d7f005e53c2040cea1af5b60d6f79491a6e147eef7"}, + {file = "pillow-10.2.0-cp39-cp39-musllinux_1_1_x86_64.whl", hash = "sha256:49d9ba1ed0ef3e061088cd1e7538a0759aab559e2e0a80a36f9fd9d8c0c21591"}, + {file = "pillow-10.2.0-cp39-cp39-win32.whl", hash = "sha256:babf5acfede515f176833ed6028754cbcd0d206f7f614ea3447d67c33be12516"}, + {file = "pillow-10.2.0-cp39-cp39-win_amd64.whl", hash = "sha256:0304004f8067386b477d20a518b50f3fa658a28d44e4116970abfcd94fac34a8"}, + {file = "pillow-10.2.0-cp39-cp39-win_arm64.whl", hash = "sha256:0fb3e7fc88a14eacd303e90481ad983fd5b69c761e9e6ef94c983f91025da869"}, + {file = "pillow-10.2.0-pp310-pypy310_pp73-macosx_10_10_x86_64.whl", hash = "sha256:322209c642aabdd6207517e9739c704dc9f9db943015535783239022002f054a"}, + {file = "pillow-10.2.0-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:3eedd52442c0a5ff4f887fab0c1c0bb164d8635b32c894bc1faf4c618dd89df2"}, + {file = "pillow-10.2.0-pp310-pypy310_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:cb28c753fd5eb3dd859b4ee95de66cc62af91bcff5db5f2571d32a520baf1f04"}, + {file = "pillow-10.2.0-pp310-pypy310_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:33870dc4653c5017bf4c8873e5488d8f8d5f8935e2f1fb9a2208c47cdd66efd2"}, + {file = "pillow-10.2.0-pp310-pypy310_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:3c31822339516fb3c82d03f30e22b1d038da87ef27b6a78c9549888f8ceda39a"}, + {file = "pillow-10.2.0-pp310-pypy310_pp73-win_amd64.whl", hash = "sha256:a2b56ba36e05f973d450582fb015594aaa78834fefe8dfb8fcd79b93e64ba4c6"}, + {file = "pillow-10.2.0-pp38-pypy38_pp73-win_amd64.whl", hash = "sha256:d8e6aeb9201e655354b3ad049cb77d19813ad4ece0df1249d3c793de3774f8c7"}, + {file = "pillow-10.2.0-pp39-pypy39_pp73-macosx_10_10_x86_64.whl", hash = "sha256:2247178effb34a77c11c0e8ac355c7a741ceca0a732b27bf11e747bbc950722f"}, + {file = "pillow-10.2.0-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:15587643b9e5eb26c48e49a7b33659790d28f190fc514a322d55da2fb5c2950e"}, + {file = "pillow-10.2.0-pp39-pypy39_pp73-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:753cd8f2086b2b80180d9b3010dd4ed147efc167c90d3bf593fe2af21265e5a5"}, + {file = "pillow-10.2.0-pp39-pypy39_pp73-manylinux_2_28_aarch64.whl", hash = "sha256:7c8f97e8e7a9009bcacbe3766a36175056c12f9a44e6e6f2d5caad06dcfbf03b"}, + {file = "pillow-10.2.0-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl", hash = "sha256:d1b35bcd6c5543b9cb547dee3150c93008f8dd0f1fef78fc0cd2b141c5baf58a"}, + {file = "pillow-10.2.0-pp39-pypy39_pp73-win_amd64.whl", hash = "sha256:fe4c15f6c9285dc54ce6553a3ce908ed37c8f3825b5a51a15c91442bb955b868"}, + {file = "pillow-10.2.0.tar.gz", hash = "sha256:e87f0b2c78157e12d7686b27d63c070fd65d994e8ddae6f328e0dcf4a0cd007e"}, +] + +[package.extras] +docs = ["furo", "olefile", "sphinx (>=2.4)", "sphinx-copybutton", "sphinx-inline-tabs", "sphinx-removed-in", "sphinxext-opengraph"] +fpx = ["olefile"] +mic = ["olefile"] +tests = ["check-manifest", "coverage", "defusedxml", "markdown2", "olefile", "packaging", "pyroma", "pytest", "pytest-cov", "pytest-timeout"] +typing = ["typing-extensions"] +xmp = ["defusedxml"] + +[[package]] +name = "pyopengl" +version = "3.1.7" +description = "Standard OpenGL bindings for Python" +optional = false +python-versions = "*" +files = [ + {file = "PyOpenGL-3.1.7-py3-none-any.whl", hash = "sha256:a6ab19cf290df6101aaf7470843a9c46207789855746399d0af92521a0a92b7a"}, + {file = "PyOpenGL-3.1.7.tar.gz", hash = "sha256:eef31a3888e6984fd4d8e6c9961b184c9813ca82604d37fe3da80eb000a76c86"}, +] + +[[package]] +name = "typing-extensions" +version = "4.10.0" +description = "Backported and Experimental Type Hints for Python 3.8+" +optional = false +python-versions = ">=3.8" +files = [ + {file = "typing_extensions-4.10.0-py3-none-any.whl", hash = "sha256:69b1a937c3a517342112fb4c6df7e72fc39a38e7891a5730ed4985b5214b5475"}, + {file = "typing_extensions-4.10.0.tar.gz", hash = "sha256:b0abd7c89e8fb96f98db18d86106ff1d90ab692004eb746cf6eda2682f91b3cb"}, +] + +[metadata] +lock-version = "2.0" +python-versions = "^3.10" +content-hash = "165d82035aade2abad497b32e156ec18d8ebc6c57a36376c3351b593c6889f22" diff --git a/envs/sim_xarm/pyproject.toml b/envs/sim_xarm/pyproject.toml new file mode 100644 index 00000000..8aa24679 --- /dev/null +++ b/envs/sim_xarm/pyproject.toml @@ -0,0 +1,34 @@ +[tool.poetry] +name = "sim_xarm" +version = "0.1.0" +description = "xArm environment for LeRobot" +authors = [ + "Rémi Cadène ", +] +maintainers = [ + "Alexander Soare ", + "Quentin Gallouédec ", + "Simon Alibert ", +] +readme = "README.md" +license = "Apache-2.0" +classifiers=[ + "Development Status :: 3 - Alpha", + "Intended Audience :: Developers", + "Topic :: Software Development :: Build Tools", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python :: 3.10", +] +packages = [{include = "xarm"}] + + +[tool.poetry.dependencies] +python = "^3.10" +mujoco = "^2.3.7" +gymnasium = "^0.29.1" +gymnasium-robotics = "^1.2.4" + + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" diff --git a/envs/sim_xarm/xarm/__init__.py b/envs/sim_xarm/xarm/__init__.py new file mode 100644 index 00000000..a4dcb92d --- /dev/null +++ b/envs/sim_xarm/xarm/__init__.py @@ -0,0 +1,166 @@ +from collections import OrderedDict, deque + +import gymnasium as gym +import numpy as np +from gymnasium.wrappers import TimeLimit + +from xarm.tasks.base import Base as Base +from xarm.tasks.lift import Lift +from xarm.tasks.peg_in_box import PegInBox +from xarm.tasks.push import Push +from xarm.tasks.reach import Reach + +TASKS = OrderedDict( + ( + ( + "reach", + { + "env": Reach, + "action_space": "xyz", + "episode_length": 50, + "description": "Reach a target location with the end effector", + }, + ), + ( + "push", + { + "env": Push, + "action_space": "xyz", + "episode_length": 50, + "description": "Push a cube to a target location", + }, + ), + ( + "peg_in_box", + { + "env": PegInBox, + "action_space": "xyz", + "episode_length": 50, + "description": "Insert a peg into a box", + }, + ), + ( + "lift", + { + "env": Lift, + "action_space": "xyzw", + "episode_length": 50, + "description": "Lift a cube above a height threshold", + }, + ), + ) +) + + +class SimXarmWrapper(gym.Wrapper): + """ + A wrapper for the SimXarm environments. This wrapper is used to + convert the action and observation spaces to the correct format. + """ + + def __init__(self, env, task, obs_mode, image_size, action_repeat, frame_stack=1, channel_last=False): + super().__init__(env) + self._env = env + self.obs_mode = obs_mode + self.image_size = image_size + self.action_repeat = action_repeat + self.frame_stack = frame_stack + self._frames = deque([], maxlen=frame_stack) + self.channel_last = channel_last + self._max_episode_steps = task["episode_length"] // action_repeat + + image_shape = ( + (image_size, image_size, 3 * frame_stack) + if channel_last + else (3 * frame_stack, image_size, image_size) + ) + if obs_mode == "state": + self.observation_space = env.observation_space["observation"] + elif obs_mode == "rgb": + self.observation_space = gym.spaces.Box(low=0, high=255, shape=image_shape, dtype=np.uint8) + elif obs_mode == "all": + self.observation_space = gym.spaces.Dict( + state=gym.spaces.Box(low=-np.inf, high=np.inf, shape=(4,), dtype=np.float32), + rgb=gym.spaces.Box(low=0, high=255, shape=image_shape, dtype=np.uint8), + ) + else: + raise ValueError(f"Unknown obs_mode {obs_mode}. Must be one of [rgb, all, state]") + self.action_space = gym.spaces.Box(low=-1.0, high=1.0, shape=(len(task["action_space"]),)) + self.action_padding = np.zeros(4 - len(task["action_space"]), dtype=np.float32) + if "w" not in task["action_space"]: + self.action_padding[-1] = 1.0 + + def _render_obs(self): + obs = self.render(mode="rgb_array", width=self.image_size, height=self.image_size) + if not self.channel_last: + obs = obs.transpose(2, 0, 1) + return obs.copy() + + def _update_frames(self, reset=False): + pixels = self._render_obs() + self._frames.append(pixels) + if reset: + for _ in range(1, self.frame_stack): + self._frames.append(pixels) + assert len(self._frames) == self.frame_stack + + def transform_obs(self, obs, reset=False): + if self.obs_mode == "state": + return obs["observation"] + elif self.obs_mode == "rgb": + self._update_frames(reset=reset) + rgb_obs = np.concatenate(list(self._frames), axis=-1 if self.channel_last else 0) + return rgb_obs + elif self.obs_mode == "all": + self._update_frames(reset=reset) + rgb_obs = np.concatenate(list(self._frames), axis=-1 if self.channel_last else 0) + return OrderedDict((("rgb", rgb_obs), ("state", self.robot_state))) + else: + raise ValueError(f"Unknown obs_mode {self.obs_mode}. Must be one of [rgb, all, state]") + + def reset(self): + return self.transform_obs(self._env.reset(), reset=True) + + def step(self, action): + action = np.concatenate([action, self.action_padding]) + reward = 0.0 + for _ in range(self.action_repeat): + obs, r, done, info = self._env.step(action) + reward += r + return self.transform_obs(obs), reward, done, info + + def render(self, mode="rgb_array", width=384, height=384, **kwargs): + return self._env.render(mode, width=width, height=height) + + @property + def state(self): + return self._env.robot_state + + +def make(task, obs_mode="state", image_size=84, action_repeat=1, frame_stack=1, channel_last=False, seed=0): + """ + Create a new environment. + Args: + task (str): The task to create an environment for. Must be one of: + - 'reach' + - 'push' + - 'peg-in-box' + - 'lift' + obs_mode (str): The observation mode to use. Must be one of: + - 'state': Only state observations + - 'rgb': RGB images + - 'all': RGB images and state observations + image_size (int): The size of the image observations + action_repeat (int): The number of times to repeat the action + seed (int): The random seed to use + Returns: + gym.Env: The environment + """ + if task not in TASKS: + raise ValueError(f"Unknown task {task}. Must be one of {list(TASKS.keys())}") + env = TASKS[task]["env"]() + env = TimeLimit(env, TASKS[task]["episode_length"]) + env = SimXarmWrapper(env, TASKS[task], obs_mode, image_size, action_repeat, frame_stack, channel_last) + env.seed(seed) + + return env diff --git a/envs/sim_xarm/xarm/tasks/__init__.py b/envs/sim_xarm/xarm/tasks/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/envs/sim_xarm/xarm/tasks/assets/lift.xml b/envs/sim_xarm/xarm/tasks/assets/lift.xml new file mode 100644 index 00000000..92231f92 --- /dev/null +++ b/envs/sim_xarm/xarm/tasks/assets/lift.xml @@ -0,0 +1,53 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/envs/sim_xarm/xarm/tasks/assets/mesh/base_link.stl b/envs/sim_xarm/xarm/tasks/assets/mesh/base_link.stl new file mode 100644 index 00000000..f1f52955 --- /dev/null +++ b/envs/sim_xarm/xarm/tasks/assets/mesh/base_link.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:21fb81ae7fba19e3c6b2d2ca60c8051712ba273357287eb5a397d92d61c7a736 +size 1211434 diff --git a/envs/sim_xarm/xarm/tasks/assets/mesh/block_inner.stl b/envs/sim_xarm/xarm/tasks/assets/mesh/block_inner.stl new file mode 100644 index 00000000..6cb88945 --- /dev/null +++ b/envs/sim_xarm/xarm/tasks/assets/mesh/block_inner.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:be68ce180d11630a667a5f37f4dffcc3feebe4217d4bb3912c813b6d9ca3ec66 +size 3284 diff --git a/envs/sim_xarm/xarm/tasks/assets/mesh/block_inner2.stl b/envs/sim_xarm/xarm/tasks/assets/mesh/block_inner2.stl new file mode 100644 index 00000000..dab55ef5 --- /dev/null +++ b/envs/sim_xarm/xarm/tasks/assets/mesh/block_inner2.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:2c6448552bf6b1c4f17334d686a5320ce051bcdfe31431edf69303d8a570d1de +size 3284 diff --git a/envs/sim_xarm/xarm/tasks/assets/mesh/block_outer.stl b/envs/sim_xarm/xarm/tasks/assets/mesh/block_outer.stl new file mode 100644 index 00000000..21cf11fa --- /dev/null +++ b/envs/sim_xarm/xarm/tasks/assets/mesh/block_outer.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:748b9e197e6521914f18d1f6383a36f211136b3f33f2ad2a8c11b9f921c2cf86 +size 6284 diff --git a/envs/sim_xarm/xarm/tasks/assets/mesh/left_finger.stl b/envs/sim_xarm/xarm/tasks/assets/mesh/left_finger.stl new file mode 100644 index 00000000..6bf4e502 --- /dev/null +++ b/envs/sim_xarm/xarm/tasks/assets/mesh/left_finger.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a44756eb72f9c214cb37e61dc209cd7073fdff3e4271a7423476ef6fd090d2d4 +size 242684 diff --git a/envs/sim_xarm/xarm/tasks/assets/mesh/left_inner_knuckle.stl b/envs/sim_xarm/xarm/tasks/assets/mesh/left_inner_knuckle.stl new file mode 100644 index 00000000..817c7e1d --- /dev/null +++ b/envs/sim_xarm/xarm/tasks/assets/mesh/left_inner_knuckle.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:e8e48692ad26837bb3d6a97582c89784d09948fc09bfe4e5a59017859ff04dac +size 366284 diff --git a/envs/sim_xarm/xarm/tasks/assets/mesh/left_outer_knuckle.stl b/envs/sim_xarm/xarm/tasks/assets/mesh/left_outer_knuckle.stl new file mode 100644 index 00000000..010c0f3b --- /dev/null +++ b/envs/sim_xarm/xarm/tasks/assets/mesh/left_outer_knuckle.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:501665812b08d67e764390db781e839adc6896a9540301d60adf606f57648921 +size 22284 diff --git a/envs/sim_xarm/xarm/tasks/assets/mesh/link1.stl b/envs/sim_xarm/xarm/tasks/assets/mesh/link1.stl new file mode 100644 index 00000000..f2b676f2 --- /dev/null +++ b/envs/sim_xarm/xarm/tasks/assets/mesh/link1.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:34b541122df84d2ef5fcb91b715eb19659dc15ad8d44a191dde481f780265636 +size 184184 diff --git a/envs/sim_xarm/xarm/tasks/assets/mesh/link2.stl b/envs/sim_xarm/xarm/tasks/assets/mesh/link2.stl new file mode 100644 index 00000000..bf93580c --- /dev/null +++ b/envs/sim_xarm/xarm/tasks/assets/mesh/link2.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:61e641cd47c169ecef779683332e00e4914db729bf02dfb61bfbe69351827455 +size 225584 diff --git a/envs/sim_xarm/xarm/tasks/assets/mesh/link3.stl b/envs/sim_xarm/xarm/tasks/assets/mesh/link3.stl new file mode 100644 index 00000000..d316d233 --- /dev/null +++ b/envs/sim_xarm/xarm/tasks/assets/mesh/link3.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:9e2798e7946dd70046c95455d5ba96392d0b54a6069caba91dc4ca66e1379b42 +size 237084 diff --git a/envs/sim_xarm/xarm/tasks/assets/mesh/link4.stl b/envs/sim_xarm/xarm/tasks/assets/mesh/link4.stl new file mode 100644 index 00000000..f6d5fe94 --- /dev/null +++ b/envs/sim_xarm/xarm/tasks/assets/mesh/link4.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c757fee95f873191a0633c355c07a360032960771cabbd7593a6cdb0f1ffb089 +size 243684 diff --git a/envs/sim_xarm/xarm/tasks/assets/mesh/link5.stl b/envs/sim_xarm/xarm/tasks/assets/mesh/link5.stl new file mode 100644 index 00000000..e037b8b9 --- /dev/null +++ b/envs/sim_xarm/xarm/tasks/assets/mesh/link5.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:715ad5787c5dab57589937fd47289882707b5e1eb997e340d567785b02f4ec90 +size 229084 diff --git a/envs/sim_xarm/xarm/tasks/assets/mesh/link6.stl b/envs/sim_xarm/xarm/tasks/assets/mesh/link6.stl new file mode 100644 index 00000000..198c5300 --- /dev/null +++ b/envs/sim_xarm/xarm/tasks/assets/mesh/link6.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:85b320aa420497827223d16d492bba8de091173374e361396fc7a5dad7bdb0cb +size 399384 diff --git a/envs/sim_xarm/xarm/tasks/assets/mesh/link7.stl b/envs/sim_xarm/xarm/tasks/assets/mesh/link7.stl new file mode 100644 index 00000000..ce9a39ac --- /dev/null +++ b/envs/sim_xarm/xarm/tasks/assets/mesh/link7.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:97115d848fbf802cb770cd9be639ae2af993103b9d9bbb0c50c943c738a36f18 +size 231684 diff --git a/envs/sim_xarm/xarm/tasks/assets/mesh/link_base.stl b/envs/sim_xarm/xarm/tasks/assets/mesh/link_base.stl new file mode 100644 index 00000000..110b9531 --- /dev/null +++ b/envs/sim_xarm/xarm/tasks/assets/mesh/link_base.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f6fcbc18258090eb56c21cfb17baa5ae43abc98b1958cd366f3a73b9898fc7f0 +size 2106184 diff --git a/envs/sim_xarm/xarm/tasks/assets/mesh/right_finger.stl b/envs/sim_xarm/xarm/tasks/assets/mesh/right_finger.stl new file mode 100644 index 00000000..03f26e9a --- /dev/null +++ b/envs/sim_xarm/xarm/tasks/assets/mesh/right_finger.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:c5dee87c7f37baf554b8456ebfe0b3e8ed0b22b8938bd1add6505c2ad6d32c7d +size 242684 diff --git a/envs/sim_xarm/xarm/tasks/assets/mesh/right_inner_knuckle.stl b/envs/sim_xarm/xarm/tasks/assets/mesh/right_inner_knuckle.stl new file mode 100644 index 00000000..8586f344 --- /dev/null +++ b/envs/sim_xarm/xarm/tasks/assets/mesh/right_inner_knuckle.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:b41dd2c2c550281bf78d7cc6fa117b14786700e5c453560a0cb5fd6dfa0ffb3e +size 366284 diff --git a/envs/sim_xarm/xarm/tasks/assets/mesh/right_outer_knuckle.stl b/envs/sim_xarm/xarm/tasks/assets/mesh/right_outer_knuckle.stl new file mode 100644 index 00000000..ae7afc25 --- /dev/null +++ b/envs/sim_xarm/xarm/tasks/assets/mesh/right_outer_knuckle.stl @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:75ca1107d0a42a0f03802a9a49cab48419b31851ee8935f8f1ca06be1c1c91e8 +size 22284 diff --git a/envs/sim_xarm/xarm/tasks/assets/peg_in_box.xml b/envs/sim_xarm/xarm/tasks/assets/peg_in_box.xml new file mode 100644 index 00000000..0f85459f --- /dev/null +++ b/envs/sim_xarm/xarm/tasks/assets/peg_in_box.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/envs/sim_xarm/xarm/tasks/assets/push.xml b/envs/sim_xarm/xarm/tasks/assets/push.xml new file mode 100644 index 00000000..42a78c8a --- /dev/null +++ b/envs/sim_xarm/xarm/tasks/assets/push.xml @@ -0,0 +1,54 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/envs/sim_xarm/xarm/tasks/assets/reach.xml b/envs/sim_xarm/xarm/tasks/assets/reach.xml new file mode 100644 index 00000000..ded6d209 --- /dev/null +++ b/envs/sim_xarm/xarm/tasks/assets/reach.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/envs/sim_xarm/xarm/tasks/assets/shared.xml b/envs/sim_xarm/xarm/tasks/assets/shared.xml new file mode 100644 index 00000000..ee56f8f0 --- /dev/null +++ b/envs/sim_xarm/xarm/tasks/assets/shared.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/envs/sim_xarm/xarm/tasks/assets/xarm.xml b/envs/sim_xarm/xarm/tasks/assets/xarm.xml new file mode 100644 index 00000000..023474d6 --- /dev/null +++ b/envs/sim_xarm/xarm/tasks/assets/xarm.xml @@ -0,0 +1,88 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/envs/sim_xarm/xarm/tasks/base.py b/envs/sim_xarm/xarm/tasks/base.py new file mode 100644 index 00000000..72c251f9 --- /dev/null +++ b/envs/sim_xarm/xarm/tasks/base.py @@ -0,0 +1,145 @@ +import os + +import mujoco +import numpy as np +from gymnasium_robotics.envs import robot_env + +from xarm.tasks import mocap + + +class Base(robot_env.MujocoRobotEnv): + """ + Superclass for all simxarm environments. + Args: + xml_name (str): name of the xml environment file + gripper_rotation (list): initial rotation of the gripper (given as a quaternion) + """ + + def __init__(self, xml_name, gripper_rotation=None): + if gripper_rotation is None: + gripper_rotation = [0, 1, 0, 0] + self.gripper_rotation = np.array(gripper_rotation, dtype=np.float32) + self.center_of_table = np.array([1.655, 0.3, 0.63625]) + self.max_z = 1.2 + self.min_z = 0.2 + super().__init__( + model_path=os.path.join(os.path.dirname(__file__), "assets", xml_name + ".xml"), + n_substeps=20, + n_actions=4, + initial_qpos={}, + ) + + @property + def dt(self): + return self.n_substeps * self.model.opt.timestep + + @property + def eef(self): + return self._utils.get_site_xpos(self.model, self.data, "grasp") + + @property + def obj(self): + return self._utils.get_site_xpos(self.model, self.data, "object_site") + + @property + def robot_state(self): + gripper_angle = self._utils.get_joint_qpos(self.model, self.data, "right_outer_knuckle_joint") + return np.concatenate([self.eef, gripper_angle]) + + def is_success(self): + return NotImplementedError() + + def get_reward(self): + raise NotImplementedError() + + def _sample_goal(self): + raise NotImplementedError() + + def get_obs(self): + return self._get_obs() + + def _step_callback(self): + self._mujoco.mj_forward(self.model, self.data) + + def _limit_gripper(self, gripper_pos, pos_ctrl): + if gripper_pos[0] > self.center_of_table[0] - 0.105 + 0.15: + pos_ctrl[0] = min(pos_ctrl[0], 0) + if gripper_pos[0] < self.center_of_table[0] - 0.105 - 0.3: + pos_ctrl[0] = max(pos_ctrl[0], 0) + if gripper_pos[1] > self.center_of_table[1] + 0.3: + pos_ctrl[1] = min(pos_ctrl[1], 0) + if gripper_pos[1] < self.center_of_table[1] - 0.3: + pos_ctrl[1] = max(pos_ctrl[1], 0) + if gripper_pos[2] > self.max_z: + pos_ctrl[2] = min(pos_ctrl[2], 0) + if gripper_pos[2] < self.min_z: + pos_ctrl[2] = max(pos_ctrl[2], 0) + return pos_ctrl + + def _apply_action(self, action): + assert action.shape == (4,) + action = action.copy() + pos_ctrl, gripper_ctrl = action[:3], action[3] + pos_ctrl = self._limit_gripper( + self._utils.get_site_xpos(self.model, self.data, "grasp"), pos_ctrl + ) * (1 / self.n_substeps) + gripper_ctrl = np.array([gripper_ctrl, gripper_ctrl]) + mocap.apply_action( + self.model, + self._model_names, + self.data, + np.concatenate([pos_ctrl, self.gripper_rotation, gripper_ctrl]), + ) + + def _render_callback(self): + self._mujoco.mj_forward(self.model, self.data) + + def _reset_sim(self): + self.data.time = self.initial_time + self.data.qpos[:] = np.copy(self.initial_qpos) + self.data.qvel[:] = np.copy(self.initial_qvel) + self._sample_goal() + self._mujoco.mj_step(self.model, self.data, nstep=10) + return True + + def _set_gripper(self, gripper_pos, gripper_rotation): + self._utils.set_mocap_pos(self.model, self.data, "robot0:mocap", gripper_pos) + self._utils.set_mocap_quat(self.model, self.data, "robot0:mocap", gripper_rotation) + self._utils.set_joint_qpos(self.model, self.data, "right_outer_knuckle_joint", 0) + self.data.qpos[10] = 0.0 + self.data.qpos[12] = 0.0 + + def _env_setup(self, initial_qpos): + for name, value in initial_qpos.items(): + self.data.set_joint_qpos(name, value) + mocap.reset(self.model, self.data) + mujoco.mj_forward(self.model, self.data) + self._sample_goal() + mujoco.mj_forward(self.model, self.data) + + def reset(self): + self._reset_sim() + return self._get_obs() + + def step(self, action): + assert action.shape == (4,) + assert self.action_space.contains(action), "{!r} ({}) invalid".format(action, type(action)) + self._apply_action(action) + self._mujoco.mj_step(self.model, self.data, nstep=2) + self._step_callback() + obs = self._get_obs() + reward = self.get_reward() + done = False + info = {"is_success": self.is_success(), "success": self.is_success()} + return obs, reward, done, info + + def render(self, mode="rgb_array", width=384, height=384): + self._render_callback() + # HACK + self.model.vis.global_.offwidth = width + self.model.vis.global_.offheight = height + return self.mujoco_renderer.render(mode) + + def close(self): + if self.mujoco_renderer is not None: + self.mujoco_renderer.close() diff --git a/envs/sim_xarm/xarm/tasks/lift.py b/envs/sim_xarm/xarm/tasks/lift.py new file mode 100644 index 00000000..5e9e85e0 --- /dev/null +++ b/envs/sim_xarm/xarm/tasks/lift.py @@ -0,0 +1,100 @@ +import numpy as np + +from xarm import Base + + +class Lift(Base): + def __init__(self): + self._z_threshold = 0.15 + super().__init__("lift") + + @property + def z_target(self): + return self._init_z + self._z_threshold + + def is_success(self): + return self.obj[2] >= self.z_target + + def get_reward(self): + reach_dist = np.linalg.norm(self.obj - self.eef) + reach_dist_xy = np.linalg.norm(self.obj[:-1] - self.eef[:-1]) + pick_completed = self.obj[2] >= (self.z_target - 0.01) + obj_dropped = (self.obj[2] < (self._init_z + 0.005)) and (reach_dist > 0.02) + + # Reach + if reach_dist < 0.05: + reach_reward = -reach_dist + max(self._action[-1], 0) / 50 + elif reach_dist_xy < 0.05: + reach_reward = -reach_dist + else: + z_bonus = np.linalg.norm(np.linalg.norm(self.obj[-1] - self.eef[-1])) + reach_reward = -reach_dist - 2 * z_bonus + + # Pick + if pick_completed and not obj_dropped: + pick_reward = self.z_target + elif (reach_dist < 0.1) and (self.obj[2] > (self._init_z + 0.005)): + pick_reward = min(self.z_target, self.obj[2]) + else: + pick_reward = 0 + + return reach_reward / 100 + pick_reward + + def _get_obs(self): + eef_velp = self._utils.get_site_xvelp(self.model, self.data, "grasp") * self.dt + gripper_angle = self._utils.get_joint_qpos(self.model, self.data, "right_outer_knuckle_joint") + eef = self.eef - self.center_of_table + + obj = self.obj - self.center_of_table + obj_rot = self._utils.get_joint_qpos(self.model, self.data, "object_joint0")[-4:] + obj_velp = self._utils.get_site_xvelp(self.model, self.data, "object_site") * self.dt + obj_velr = self._utils.get_site_xvelr(self.model, self.data, "object_site") * self.dt + + obs = np.concatenate( + [ + eef, + eef_velp, + obj, + obj_rot, + obj_velp, + obj_velr, + eef - obj, + np.array( + [ + np.linalg.norm(eef - obj), + np.linalg.norm(eef[:-1] - obj[:-1]), + self.z_target, + self.z_target - obj[-1], + self.z_target - eef[-1], + ] + ), + gripper_angle, + ], + axis=0, + ) + return {"observation": obs, "state": eef, "achieved_goal": eef, "desired_goal": eef} + + def _sample_goal(self): + # Gripper + gripper_pos = np.array([1.280, 0.295, 0.735]) + self.np_random.uniform(-0.05, 0.05, size=3) + super()._set_gripper(gripper_pos, self.gripper_rotation) + + # Object + object_pos = self.center_of_table - np.array([0.15, 0.10, 0.07]) + object_pos[0] += self.np_random.uniform(-0.05, 0.05, size=1) + object_pos[1] += self.np_random.uniform(-0.05, 0.05, size=1) + object_qpos = self._utils.get_joint_qpos(self.model, self.data, "object_joint0") + object_qpos[:3] = object_pos + self._utils.set_joint_qpos(self.model, self.data, "object_joint0", object_qpos) + self._init_z = object_pos[2] + + # Goal + return object_pos + np.array([0, 0, self._z_threshold]) + + def reset(self): + self._action = np.zeros(4) + return super().reset() + + def step(self, action): + self._action = action.copy() + return super().step(action) diff --git a/envs/sim_xarm/xarm/tasks/mocap.py b/envs/sim_xarm/xarm/tasks/mocap.py new file mode 100644 index 00000000..4295bf19 --- /dev/null +++ b/envs/sim_xarm/xarm/tasks/mocap.py @@ -0,0 +1,67 @@ +# import mujoco_py +import mujoco +import numpy as np + + +def apply_action(model, model_names, data, action): + if model.nmocap > 0: + pos_action, gripper_action = np.split(action, (model.nmocap * 7,)) + if data.ctrl is not None: + for i in range(gripper_action.shape[0]): + data.ctrl[i] = gripper_action[i] + pos_action = pos_action.reshape(model.nmocap, 7) + pos_delta, quat_delta = pos_action[:, :3], pos_action[:, 3:] + reset_mocap2body_xpos(model, model_names, data) + data.mocap_pos[:] = data.mocap_pos + pos_delta + data.mocap_quat[:] = data.mocap_quat + quat_delta + + +def reset(model, data): + if model.nmocap > 0 and model.eq_data is not None: + for i in range(model.eq_data.shape[0]): + # if sim.model.eq_type[i] == mujoco_py.const.EQ_WELD: + if model.eq_type[i] == mujoco.mjtEq.mjEQ_WELD: + # model.eq_data[i, :] = np.array([0., 0., 0., 1., 0., 0., 0.]) + model.eq_data[i, :] = np.array( + [ + 0.0, + 0.0, + 0.0, + 1.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + 0.0, + ] + ) + # sim.forward() + mujoco.mj_forward(model, data) + + +def reset_mocap2body_xpos(model, model_names, data): + if model.eq_type is None or model.eq_obj1id is None or model.eq_obj2id is None: + return + + # For all weld constraints + for eq_type, obj1_id, obj2_id in zip(model.eq_type, model.eq_obj1id, model.eq_obj2id, strict=False): + # if eq_type != mujoco_py.const.EQ_WELD: + if eq_type != mujoco.mjtEq.mjEQ_WELD: + continue + # body2 = model.body_id2name(obj2_id) + body2 = model_names.body_id2name[obj2_id] + if body2 == "B0" or body2 == "B9" or body2 == "B1": + continue + mocap_id = model.body_mocapid[obj1_id] + if mocap_id != -1: + # obj1 is the mocap, obj2 is the welded body + body_idx = obj2_id + else: + # obj2 is the mocap, obj1 is the welded body + mocap_id = model.body_mocapid[obj2_id] + body_idx = obj1_id + assert mocap_id != -1 + data.mocap_pos[mocap_id][:] = data.xpos[body_idx] + data.mocap_quat[mocap_id][:] = data.xquat[body_idx] diff --git a/envs/sim_xarm/xarm/tasks/peg_in_box.py b/envs/sim_xarm/xarm/tasks/peg_in_box.py new file mode 100644 index 00000000..0af6f54b --- /dev/null +++ b/envs/sim_xarm/xarm/tasks/peg_in_box.py @@ -0,0 +1,86 @@ +import numpy as np + +from xarm import Base + + +class PegInBox(Base): + def __init__(self): + super().__init__("peg_in_box") + + def _reset_sim(self): + self._act_magnitude = 0 + super()._reset_sim() + for _ in range(10): + self._apply_action(np.array([0, 0, 0, 1], dtype=np.float32)) + self.sim.step() + + @property + def box(self): + return self.sim.data.get_site_xpos("box_site") + + def is_success(self): + return np.linalg.norm(self.obj - self.box) <= 0.05 + + def get_reward(self): + dist_xy = np.linalg.norm(self.obj[:2] - self.box[:2]) + dist_xyz = np.linalg.norm(self.obj - self.box) + return float(dist_xy <= 0.045) * (2 - 6 * dist_xyz) - 0.2 * np.square(self._act_magnitude) - dist_xy + + def _get_obs(self): + eef_velp = self.sim.data.get_site_xvelp("grasp") * self.dt + gripper_angle = self.sim.data.get_joint_qpos("right_outer_knuckle_joint") + eef, box = self.eef - self.center_of_table, self.box - self.center_of_table + + obj = self.obj - self.center_of_table + obj_rot = self.sim.data.get_joint_qpos("object_joint0")[-4:] + obj_velp = self.sim.data.get_site_xvelp("object_site") * self.dt + obj_velr = self.sim.data.get_site_xvelr("object_site") * self.dt + + obs = np.concatenate( + [ + eef, + eef_velp, + box, + obj, + obj_rot, + obj_velp, + obj_velr, + eef - box, + eef - obj, + obj - box, + np.array( + [ + np.linalg.norm(eef - box), + np.linalg.norm(eef - obj), + np.linalg.norm(obj - box), + gripper_angle, + ] + ), + ], + axis=0, + ) + return {"observation": obs, "state": eef, "achieved_goal": eef, "desired_goal": box} + + def _sample_goal(self): + # Gripper + gripper_pos = np.array([1.280, 0.295, 0.9]) + self.np_random.uniform(-0.05, 0.05, size=3) + super()._set_gripper(gripper_pos, self.gripper_rotation) + + # Object + object_pos = gripper_pos - np.array([0, 0, 0.06]) + self.np_random.uniform(-0.005, 0.005, size=3) + object_qpos = self.sim.data.get_joint_qpos("object_joint0") + object_qpos[:3] = object_pos + self.sim.data.set_joint_qpos("object_joint0", object_qpos) + + # Box + box_pos = np.array([1.61, 0.18, 0.58]) + box_pos[:2] += self.np_random.uniform(-0.11, 0.11, size=2) + box_qpos = self.sim.data.get_joint_qpos("box_joint0") + box_qpos[:3] = box_pos + self.sim.data.set_joint_qpos("box_joint0", box_qpos) + + return self.box + + def step(self, action): + self._act_magnitude = np.linalg.norm(action[:3]) + return super().step(action) diff --git a/envs/sim_xarm/xarm/tasks/push.py b/envs/sim_xarm/xarm/tasks/push.py new file mode 100644 index 00000000..929674ef --- /dev/null +++ b/envs/sim_xarm/xarm/tasks/push.py @@ -0,0 +1,78 @@ +import numpy as np + +from xarm import Base + + +class Push(Base): + def __init__(self): + super().__init__("push") + + def _reset_sim(self): + self._act_magnitude = 0 + super()._reset_sim() + + def is_success(self): + return np.linalg.norm(self.obj - self.goal) <= 0.05 + + def get_reward(self): + dist = np.linalg.norm(self.obj - self.goal) + penalty = self._act_magnitude**2 + return -(dist + 0.15 * penalty) + + def _get_obs(self): + eef_velp = self.sim.data.get_site_xvelp("grasp") * self.dt + gripper_angle = self.sim.data.get_joint_qpos("right_outer_knuckle_joint") + eef, goal = self.eef - self.center_of_table, self.goal - self.center_of_table + + obj = self.obj - self.center_of_table + obj_rot = self.sim.data.get_joint_qpos("object_joint0")[-4:] + obj_velp = self.sim.data.get_site_xvelp("object_site") * self.dt + obj_velr = self.sim.data.get_site_xvelr("object_site") * self.dt + + obs = np.concatenate( + [ + eef, + eef_velp, + goal, + obj, + obj_rot, + obj_velp, + obj_velr, + eef - goal, + eef - obj, + obj - goal, + np.array( + [ + np.linalg.norm(eef - goal), + np.linalg.norm(eef - obj), + np.linalg.norm(obj - goal), + gripper_angle, + ] + ), + ], + axis=0, + ) + return {"observation": obs, "state": eef, "achieved_goal": eef, "desired_goal": goal} + + def _sample_goal(self): + # Gripper + gripper_pos = np.array([1.280, 0.295, 0.735]) + self.np_random.uniform(-0.05, 0.05, size=3) + super()._set_gripper(gripper_pos, self.gripper_rotation) + + # Object + object_pos = self.center_of_table - np.array([0.25, 0, 0.07]) + object_pos[0] += self.np_random.uniform(-0.08, 0.08, size=1) + object_pos[1] += self.np_random.uniform(-0.08, 0.08, size=1) + object_qpos = self.sim.data.get_joint_qpos("object_joint0") + object_qpos[:3] = object_pos + self.sim.data.set_joint_qpos("object_joint0", object_qpos) + + # Goal + self.goal = np.array([1.600, 0.200, 0.545]) + self.goal[:2] += self.np_random.uniform(-0.1, 0.1, size=2) + self.sim.model.site_pos[self.sim.model.site_name2id("target0")] = self.goal + return self.goal + + def step(self, action): + self._act_magnitude = np.linalg.norm(action[:3]) + return super().step(action) diff --git a/envs/sim_xarm/xarm/tasks/reach.py b/envs/sim_xarm/xarm/tasks/reach.py new file mode 100644 index 00000000..db430491 --- /dev/null +++ b/envs/sim_xarm/xarm/tasks/reach.py @@ -0,0 +1,44 @@ +import numpy as np + +from xarm import Base + + +class Reach(Base): + def __init__(self): + super().__init__("reach") + + def _reset_sim(self): + self._act_magnitude = 0 + super()._reset_sim() + + def is_success(self): + return np.linalg.norm(self.eef - self.goal) <= 0.05 + + def get_reward(self): + dist = np.linalg.norm(self.eef - self.goal) + penalty = self._act_magnitude**2 + return -(dist + 0.15 * penalty) + + def _get_obs(self): + eef_velp = self.sim.data.get_site_xvelp("grasp") * self.dt + gripper_angle = self.sim.data.get_joint_qpos("right_outer_knuckle_joint") + eef, goal = self.eef - self.center_of_table, self.goal - self.center_of_table + obs = np.concatenate( + [eef, eef_velp, goal, eef - goal, np.array([np.linalg.norm(eef - goal), gripper_angle])], axis=0 + ) + return {"observation": obs, "state": eef, "achieved_goal": eef, "desired_goal": goal} + + def _sample_goal(self): + # Gripper + gripper_pos = np.array([1.280, 0.295, 0.735]) + self.np_random.uniform(-0.05, 0.05, size=3) + super()._set_gripper(gripper_pos, self.gripper_rotation) + + # Goal + self.goal = np.array([1.550, 0.287, 0.580]) + self.goal[:2] += self.np_random.uniform(-0.125, 0.125, size=2) + self.sim.model.site_pos[self.sim.model.site_name2id("target0")] = self.goal + return self.goal + + def step(self, action): + self._act_magnitude = np.linalg.norm(action[:3]) + return super().step(action)