Skip to content

Commit f112f61

Browse files
authored
Merge pull request #61 from xkiixkii/development
Full MuJoCo Grasping Environment
2 parents 144ff0f + 65f2a02 commit f112f61

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+2811
-1501
lines changed

README.md

+37-36
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
[![Tests](https://github.com/dfki-ric/deformable_gym/actions/workflows/test.yaml/badge.svg)](https://github.com/dfki-ric/deformable_gym/actions/workflows/test.yaml)
22
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
33
[![pre-commit](https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit)](https://github.com/pre-commit/pre-commit)
4+
45
# DeformableGym
56

6-
This repository contains a collection of [gymnasium](https://github.com/Farama-Foundation/Gymnasium) environments built with [PyBullet](https://pybullet.org/) and [MuJoCo](https://github.com/google-deepmind/mujoco).
7+
This repository contains a collection of [gymnasium](https://github.com/Farama-Foundation/Gymnasium) environments built with [PyBullet](https://pybullet.org/) and [MuJoCo](https://github.com/google-deepmind/mujoco).
78
In these environments, the agent needs to learn to grasp deformable 3D objects such as shoe insoles or pillows from sparse reward signals.
89

910
<p align="center">
1011
<img src="doc/source/_static/defgym.svg"/>
1112
</p>
1213

13-
14-
## Installation
14+
## Installation
1515

1616
```bash
1717
git clone [email protected]:dfki-ric/deformable_gym.git
@@ -25,19 +25,16 @@ pip install -e .
2525

2626
## Available environments
2727

28-
| Environment Name | PyBullet | MuJoCo |
29-
|---------------------------|:-------------------:|:------------------:|
30-
| FloatingMiaGraspInsole | :heavy_check_mark: | :heavy_check_mark: |
31-
| FloatingShadowGraspInsole | :heavy_check_mark: | :heavy_check_mark: |
32-
| FloatingMiaGraspPillow | :heavy_check_mark: | :x: |
33-
| FloatingShadowGraspPillow | :heavy_check_mark: | :x: |
34-
| URMiaGraspInsole | :heavy_check_mark: | :x: |
35-
| URShadowGraspInsole | :heavy_check_mark: | :x: |
36-
| URMiaGraspPillow | :heavy_check_mark: | :x: |
37-
| URShadowGraspPillow | :heavy_check_mark: | :x: |
38-
39-
40-
28+
| Environment Name | PyBullet | MuJoCo |
29+
| ------------------------- | :----------------: | :----------------: |
30+
| FloatingMiaGraspInsole | :heavy_check_mark: | :heavy_check_mark: |
31+
| FloatingShadowGraspInsole | :heavy_check_mark: | :heavy_check_mark: |
32+
| FloatingMiaGraspPillow | :heavy_check_mark: | :heavy_check_mark: |
33+
| FloatingShadowGraspPillow | :heavy_check_mark: | :heavy_check_mark: |
34+
| URMiaGraspInsole | :heavy_check_mark: | :heavy_check_mark: |
35+
| URShadowGraspInsole | :heavy_check_mark: | :heavy_check_mark: |
36+
| URMiaGraspPillow | :heavy_check_mark: | :heavy_check_mark: |
37+
| URShadowGraspPillow | :heavy_check_mark: | :heavy_check_mark: |
4138

4239
### Known Issues
4340

@@ -49,7 +46,17 @@ libGL error: failed to load driver: iris
4946
libGL error: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
5047
libGL error: failed to load driver: swrast
5148
```
52-
49+
```
50+
libGL error: MESA-LOADER: failed to open iris: /usr/lib/dri/iris_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
51+
libGL error: failed to load driver: iris
52+
libGL error: MESA-LOADER: failed to open iris: /usr/lib/dri/iris_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
53+
libGL error: failed to load driver: iris
54+
libGL error: MESA-LOADER: failed to open swrast: /usr/lib/dri/swrast_dri.so: cannot open shared object file: No such file or directory (search paths /usr/lib/x86_64-linux-gnu/dri:\$${ORIGIN}/dri:/usr/lib/dri, suffix _dri)
55+
libGL error: failed to load driver: swrast
56+
/home/kaixing/miniconda3/envs/test/lib/python3.10/site-packages/glfw/__init__.py:914: GLFWError: (65543) b'GLX: Failed to create context: BadValue (integer parameter out of range for operation)'
57+
warnings.warn(message, GLFWError)
58+
ERROR: could not create window
59+
```
5360
In this case, install the following dependency via conda-forge:
5461

5562
```bash
@@ -72,8 +79,8 @@ import gymnasium
7279
Floating Mia Example
7380
=========
7481
75-
This is an example of how to use the FloatingMiaGraspEnv. A random policy is then
76-
used to generate ten episodes.
82+
This is an example of how to use the FloatingMiaGraspEnv. A random policy is then
83+
used to generate ten episodes.
7784
7885
"""
7986

@@ -93,19 +100,20 @@ while num_episodes <= 10:
93100
if terminated or truncated:
94101
print(f"Episode finished with return {episode_return}!")
95102
num_episodes += 1
96-
103+
97104
env.reset()
98105

99106
```
100107

101-
102108
## Documentation
109+
103110
The documentation can be found in the directory doc. To build the documentation, run e.g. (on linux):
104111

105112
```bash
106113
cd doc
107114
make html
108115
```
116+
109117
The HTML documentation is now located at doc/build/html/index.html. You need the following packages to build the documentation:
110118

111119
```bash
@@ -114,14 +122,15 @@ pip install numpydoc sphinx sphinx-gallery sphinx-bootstrap-theme
114122

115123
## Contributing
116124

117-
If you wish to report bugs, please use the [issue tracker](https://github.com/dfki-ric/deformable_gym/issues). If you would like to contribute to DeformableGym, just open an issue or a
118-
[pull request](https://github.com/dfki-ric/deformable_gym/pulls). The target branch for
119-
merge requests is the development branch. The development branch will be merged to main for new releases. If you have
125+
If you wish to report bugs, please use the [issue tracker](https://github.com/dfki-ric/deformable_gym/issues). If you would like to contribute to DeformableGym, just open an issue or a
126+
[pull request](https://github.com/dfki-ric/deformable_gym/pulls). The target branch for
127+
merge requests is the development branch. The development branch will be merged to main for new releases. If you have
120128
questions about the software, you should ask them in the discussion section.
121129

122130
The recommended workflow to add a new feature, add documentation, or fix a bug is the following:
131+
123132
- Push your changes to a branch (e.g. feature/x, doc/y, or fix/z) of your fork of the deformable_gym repository.
124-
- Open a pull request to the latest development branch. There is usually an open merge request from the latest development branch to the main branch.
133+
- Open a pull request to the latest development branch. There is usually an open merge request from the latest development branch to the main branch.
125134
- When the latest development branch is merged to the main branch, a new release will be made.
126135

127136
Note that there is a checklist for new features.
@@ -143,8 +152,6 @@ url = {https://deformable-workshop.github.io/icra2023/},
143152
}
144153
```
145154

146-
147-
148155
## Releases
149156

150157
### Semantic Versioning
@@ -155,22 +162,16 @@ version will be incremented when new functionality is added in a backwards
155162
compatible manner, and the patch version is incremented for bugfixes,
156163
documentation, etc.
157164

158-
159165
## Funding
160166

161167
This library has been developed initially at the
162-
[Robotics Innovation Center](http://robotik.dfki-bremen.de/en/startpage.html) of the
163-
[German Research Center for Artificial Intelligence (DFKI)](http://www.dfki.de) in Bremen together with the
164-
[Robotics Group](https://robotik.dfki-bremen.de/en/about-us/university-of-bremen-robotics-group.html) of the
168+
[Robotics Innovation Center](http://robotik.dfki-bremen.de/en/startpage.html) of the
169+
[German Research Center for Artificial Intelligence (DFKI)](http://www.dfki.de) in Bremen together with the
170+
[Robotics Group](https://robotik.dfki-bremen.de/en/about-us/university-of-bremen-robotics-group.html) of the
165171
[University of Bremen](http://www.uni-bremen.de/en.html). At this phase, the work was supported through a grant from the European
166172
Commission (870142).
167173

168174
<p float="left">
169175
<img src="doc/source/_static/DFKI_Logo.png" height="100px" />
170176
<img src="doc/source/_static/Uni_Logo.png" height="100px" />
171177
</p>
172-
173-
174-
175-
176-

assets/objects/mjcf/floor.xml renamed to assets/mj_scene_base.xml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
<mujoco>
2-
<!-- <option timestep="0.005"/> -->
2+
<option timestep="0.005" />
33
<visual>
44
<rgba haze="0.15 0.25 0.35 1" />
55
<quality shadowsize="8192" />
6-
<global azimuth="220" elevation="-30" />
76
</visual>
87
<asset>
98
<texture type="skybox" builtin="gradient" rgb1="0.3 0.5 0.7" rgb2="0 0 0" width="512" height="3072" />

assets/objects/mjcf/insole_fixed.xml

+9-9
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<plugin plugin="mujoco.elasticity.solid" />
66
</extension>
77
<worldbody>
8-
<body name="insole_fixed" pos=".12 -.05 .456">
8+
<body name="insole_fixed">
99
<flexcomp name="insole" mass=".5" dim="3" type="gmsh" file="insole.msh" rgba=".1 .9 .1 1" radius="0.001">
1010
<edge equality="true" />
1111
<plugin plugin="mujoco.elasticity.solid">
@@ -17,13 +17,13 @@
1717
</body>
1818
</worldbody>
1919
<equality>
20-
<weld name="fix_1" body1="insole_27" body2="world" />
21-
<weld name="fix_2" body1="insole_44" body2="world" />
22-
<weld name="fix_3" body1="insole_37" body2="world" />
23-
<weld name="fix_4" body1="insole_35" body2="world" />
24-
<weld name="fix_5" body1="insole_43" body2="world" />
25-
<weld name="fix_6" body1="insole_1" body2="world" />
26-
<weld name="fix_7" body1="insole_32" body2="world" />
27-
<weld name="fix_8" body1="insole_69" body2="world" />
20+
<weld name="fix_1" body1="insole_27" body2="insole_fixed" />
21+
<weld name="fix_2" body1="insole_44" body2="insole_fixed" />
22+
<weld name="fix_3" body1="insole_37" body2="insole_fixed" />
23+
<weld name="fix_4" body1="insole_35" body2="insole_fixed" />
24+
<weld name="fix_5" body1="insole_43" body2="insole_fixed" />
25+
<weld name="fix_6" body1="insole_1" body2="insole_fixed" />
26+
<weld name="fix_7" body1="insole_32" body2="insole_fixed" />
27+
<weld name="fix_8" body1="insole_69" body2="insole_fixed" />
2828
</equality>
2929
</mujoco>

assets/objects/mjcf/pillow_fixed.xml

+12-12
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
<mujoco>
2-
<!-- <include file="floor.xml"/> -->
2+
<!-- <include file="floor.xml" /> -->
33
<compiler meshdir="../../meshes/" />
44
<extension>
55
<plugin plugin="mujoco.elasticity.solid" />
66
</extension>
77
<worldbody>
8-
<body name="pillow_fixed" pos=".12 -.05 .456">
9-
<flexcomp name="pillow" mass=".5" dim="3" type="gmsh" scale=".7 .7 .7" file="pillow_small.msh" rgba=".1 .9 .1 1" radius="0.001">
8+
<body name="pillow_fixed" pos="0 0 1" quat="1 0 0 1">
9+
<flexcomp name="pillow" mass="1" dim="3" type="gmsh" scale=".7 .7 .7" file="pillow_small.msh" rgba=".1 .9 .1 1" radius="0.001">
1010
<edge equality="true" />
1111
<plugin plugin="mujoco.elasticity.solid">
12-
<config key="young" value="1e4" />
12+
<config key="young" value="2000" />
1313
<config key="poisson" value="0.1" />
1414
<config key="damping" value="1e-4" />
1515
</plugin>
1616
</flexcomp>
1717
</body>
1818
</worldbody>
1919
<equality>
20-
<weld name="fix_1" body1="pillow_94" body2="world" />
21-
<weld name="fix_2" body1="pillow_8" body2="world" />
22-
<weld name="fix_3" body1="pillow_9" body2="world" />
23-
<weld name="fix_4" body1="pillow_2" body2="world" />
24-
<weld name="fix_5" body1="pillow_58" body2="world" />
25-
<weld name="fix_6" body1="pillow_69" body2="world" />
26-
<weld name="fix_7" body1="pillow_116" body2="world" />
27-
<weld name="fix_8" body1="pillow_47" body2="world" />
20+
<weld name="fix_1" body1="pillow_94" body2="pillow_fixed" />
21+
<weld name="fix_2" body1="pillow_8" body2="pillow_fixed" />
22+
<weld name="fix_3" body1="pillow_9" body2="pillow_fixed" />
23+
<weld name="fix_4" body1="pillow_2" body2="pillow_fixed" />
24+
<weld name="fix_5" body1="pillow_58" body2="pillow_fixed" />
25+
<weld name="fix_6" body1="pillow_69" body2="pillow_fixed" />
26+
<weld name="fix_7" body1="pillow_116" body2="pillow_fixed" />
27+
<weld name="fix_8" body1="pillow_47" body2="pillow_fixed" />
2828
</equality>
2929
</mujoco>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<mujoco>
2+
<asset>
3+
<mesh name="index_finger" file="stl/index_finger.stl" scale="0.000999987 0.000999987 0.000999987" />
4+
<mesh name="index_tip" file="stl/index_tip.stl" scale="0.000999987 0.000999987 0.000999987" />
5+
<mesh name="little_finger" file="stl/little_finger.stl" scale="0.000999987 0.000999987 0.000999987" />
6+
<mesh name="little_tip" file="stl/little_tip.stl" scale="0.000999987 0.000999987 0.000999987" />
7+
<mesh name="middle_finger" file="stl/middle_finger.stl" scale="0.000999987 0.000999987 0.000999987" />
8+
<mesh name="middle_tip" file="stl/middle_tip.stl" scale="0.000999987 0.000999987 0.000999987" />
9+
<mesh name="dorsum_simple" file="stl/dorsum_simple.stl" scale="0.0766738 0.104275 0.0766738" />
10+
<mesh name="palm_simple" file="stl/palm_simple.stl" scale="0.122027 0.122027 0.122027" />
11+
<mesh name="wrist" file="stl/wrist.stl" scale="0.000999999 0.000999999 0.000999999" />
12+
<mesh name="ring_finger" file="stl/ring_finger.stl" scale="0.000999987 0.000999987 0.000999987" />
13+
<mesh name="ring_tip" file="stl/ring_tip.stl" scale="0.000999987 0.000999987 0.000999987" />
14+
<mesh name="thumb_cover" file="stl/thumb_cover.stl" scale="0.000999988 0.000999987 0.000999987" />
15+
<mesh name="thumb_frame" file="stl/thumb_frame.stl" scale="0.000999988 0.000999987 0.000999987" />
16+
<mesh name="thumb_metacarpus" file="stl/thumb_metacarpus.stl" scale="0.000999987 0.000999987 0.000999987" />
17+
<mesh name="UR_flange" file="stl/UR_flange.stl" scale="0.000999999 0.000999999 0.000999999" />
18+
</asset>
19+
</mujoco>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<mujoco>
2+
<asset>
3+
<material name="black" specular="0.5" shininess="0.25" rgba="0.16355 0.16355 0.16355 1" />
4+
<material name="gray" specular="0.0" shininess="0.25" rgba="0.80848 0.80848 0.80848 1" />
5+
<material name="metallic" specular="0" shininess="0.25" rgba="0.9 0.9 0.9 1" />
6+
<mesh name="shadow_rh_forearm_0" scale="0.001 0.001 0.001" file="shadow_hand/forearm_0.obj" />
7+
<mesh name="shadow_rh_forearm_1" scale="0.001 0.001 0.001" file="shadow_hand/forearm_1.obj" />
8+
<mesh name="shadow_rh_forearm_collision" scale="0.001 0.001 0.001" file="shadow_hand/forearm_collision.obj" />
9+
<mesh name="shadow_rh_wrist" scale="0.001 0.001 0.001" file="shadow_hand/wrist.obj" />
10+
<mesh name="shadow_rh_palm" scale="0.001 0.001 0.001" file="shadow_hand/palm.obj" />
11+
<mesh name="shadow_rh_f_knuckle" scale="0.001 0.001 0.001" file="shadow_hand/f_knuckle.obj" />
12+
<mesh name="shadow_rh_f_proximal" scale="0.001 0.001 0.001" file="shadow_hand/f_proximal.obj" />
13+
<mesh name="shadow_rh_f_middle" scale="0.001 0.001 0.001" file="shadow_hand/f_middle.obj" />
14+
<mesh name="shadow_rh_f_distal_pst" scale="0.001 0.001 0.001" file="shadow_hand/f_distal_pst.obj" />
15+
<mesh name="shadow_rh_lf_metacarpal" scale="0.001 0.001 0.001" file="shadow_hand/lf_metacarpal.obj" />
16+
<mesh name="shadow_rh_th_proximal" scale="0.001 0.001 0.001" file="shadow_hand/th_proximal.obj" />
17+
<mesh name="shadow_rh_th_middle" scale="0.001 0.001 0.001" file="shadow_hand/th_middle.obj" />
18+
<mesh name="shadow_rh_th_distal_pst" scale="0.001 0.001 0.001" file="shadow_hand/th_distal_pst.obj" />
19+
</asset>
20+
</mujoco>
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<mujoco>
2+
<asset>
3+
<mesh name="base" file="ur10/collision/base.stl" />
4+
<mesh name="shoulder" file="ur10/collision/shoulder.stl" />
5+
<mesh name="upperarm" file="ur10/collision/upperarm.stl" />
6+
<mesh name="forearm" file="ur10/collision/forearm.stl" />
7+
<mesh name="wrist1" file="ur10/collision/wrist1.stl" />
8+
<mesh name="wrist2" file="ur10/collision/wrist2.stl" />
9+
<mesh name="wrist3" file="ur10/collision/wrist3.stl" />
10+
</asset>
11+
</mujoco>
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<mujoco>
2+
<asset>
3+
<mesh name="base" file="ur10e/collision/base.stl" />
4+
<mesh name="shoulder" file="ur10e/collision/shoulder.stl" />
5+
<mesh name="upperarm" file="ur10e/collision/upperarm.stl" />
6+
<mesh name="forearm" file="ur10e/collision/forearm.stl" />
7+
<mesh name="wrist1" file="ur10e/collision/wrist1.stl" />
8+
<mesh name="wrist2" file="ur10e/collision/wrist2.stl" />
9+
<mesh name="wrist3" file="ur10e/collision/wrist3.stl" />
10+
</asset>
11+
</mujoco>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<mujoco>
2+
<asset>
3+
<mesh name="base" file="ur10/collision/base.stl" />
4+
<mesh name="shoulder" file="ur10/collision/shoulder.stl" />
5+
<mesh name="upperarm" file="ur10/collision/upperarm.stl" />
6+
<mesh name="forearm" file="ur10/collision/forearm.stl" />
7+
<mesh name="wrist1" file="ur10/collision/wrist1.stl" />
8+
<mesh name="wrist2" file="ur10/collision/wrist2.stl" />
9+
<mesh name="wrist3" file="ur10/collision/wrist3.stl" />
10+
<mesh name="robotiq_ft300" file="collision/robotiq/robotiq_ft300.STL" />
11+
<mesh name="robotiq_ft300-G-062-COUPLING_G-50-4M6-1D6_20181119" file="collision/robotiq/mountings/robotiq_ft300-G-062-COUPLING_G-50-4M6-1D6_20181119.STL" />
12+
</asset>
13+
</mujoco>
+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<mujoco>
2+
<asset>
3+
<mesh name="base" file="ur5/collision/base.stl" />
4+
<mesh name="shoulder" file="ur5/collision/shoulder.stl" />
5+
<mesh name="upperarm" file="ur5/collision/upperarm.stl" />
6+
<mesh name="forearm" file="ur5/collision/forearm.stl" />
7+
<mesh name="wrist1" file="ur5/collision/wrist1.stl" />
8+
<mesh name="wrist2" file="ur5/collision/wrist2.stl" />
9+
<mesh name="wrist3" file="ur5/collision/wrist3.stl" />
10+
</asset>
11+
</mujoco>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<mujoco>
2+
<default>
3+
<default class="mia_hand_finger">
4+
<position forcerange="-1.75 1.75" />
5+
<default class="mia_thumb">
6+
<position ctrlrange="0 1.1345" forcerange="-3.5 3.5" />
7+
</default>
8+
<default class="mia_index">
9+
<position ctrlrange="-1.4 1.4" />
10+
</default>
11+
<default class="mia_mrl">
12+
<position ctrlrange="0 1.39626" />
13+
</default>
14+
</default>
15+
</default>
16+
</mujoco>

0 commit comments

Comments
 (0)