Giter Site home page Giter Site logo

danieltakeshi / gym-cloth Goto Github PK

View Code? Open in Web Editor NEW
25.0 25.0 11.0 4.95 MB

Code for IROS 2020 paper: https://arxiv.org/abs/1910.04854

Python 3.76% CMake 2.36% C++ 65.10% Shell 0.36% Dockerfile 0.01% Makefile 0.33% M4 0.77% C 17.23% Batchfile 0.05% Fortran 8.96% JavaScript 0.05% CSS 0.03% HTML 0.01% Objective-C 0.73% Lua 0.04% Objective-C++ 0.01% GLSL 0.01% Less 0.05% Cython 0.14%

gym-cloth's People

Contributors

danieltakeshi avatar dependabot[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

gym-cloth's Issues

Data Generation for RGBD

How to Generate Data for RGBD Training, w/Domain Randomization

After 9ad4ba4 I ran:

python examples/analytic.py oracle --max_episodes=5 --seed=1337 --tier=2

to get episodes in

logs/demos-2020-02-09-15-59-pol-oracle-seed-1337-obs-blender-depth-False-rgbd-True-tier2_epis_5.pkl

The images in /tmp/blender will be 224x224. To see what the neural net would get, we can resize.

Then I ran:

python analysis/check_demo_data.py

to get these episodes, these are correctly 100x100 and have noise injected, etc:

First ep:

img_resized_ep_000_t_00_rew_-0 0_act_-0 11_0 17_0 50_0 37_c img_resized_ep_000_t_01_rew_0 1_act_0 08_0 99_-0 48_0 00_c img_resized_ep_000_t_02_rew_0 1_act_-0 37_-0 15_-0 28_-0 38_c img_resized_ep_000_t_03_rew_0 1_act_0 24_-0 82_0 34_-0 08_c img_resized_ep_000_t_04_rew_5 1_act_-0 72_-0 43_-0 13_-0 26_c img_resized_ep_000_t_05_lastobs_c

img_resized_ep_000_t_00_rew_-0 0_act_-0 11_0 17_0 50_0 37_d img_resized_ep_000_t_01_rew_0 1_act_0 08_0 99_-0 48_0 00_d img_resized_ep_000_t_02_rew_0 1_act_-0 37_-0 15_-0 28_-0 38_d img_resized_ep_000_t_03_rew_0 1_act_0 24_-0 82_0 34_-0 08_d img_resized_ep_000_t_04_rew_5 1_act_-0 72_-0 43_-0 13_-0 26_d img_resized_ep_000_t_05_lastobs_d

Second:

img_resized_ep_001_t_00_rew_0 3_act_0 00_-0 29_-0 45_-0 32_c img_resized_ep_001_t_01_rew_5 1_act_-0 30_0 66_-0 32_0 15_c img_resized_ep_001_t_02_lastobs_c

img_resized_ep_001_t_00_rew_0 3_act_0 00_-0 29_-0 45_-0 32_d img_resized_ep_001_t_01_rew_5 1_act_-0 30_0 66_-0 32_0 15_d img_resized_ep_001_t_02_lastobs_d

Third:

img_resized_ep_002_t_00_rew_0 0_act_0 10_-0 35_-0 50_-0 29_c img_resized_ep_002_t_01_rew_0 1_act_0 39_-1 05_0 27_0 02_c img_resized_ep_002_t_02_rew_0 1_act_-0 51_0 72_-0 22_0 13_c img_resized_ep_002_t_03_rew_5 1_act_0 62_0 61_0 17_0 18_c img_resized_ep_002_t_04_lastobs_c

img_resized_ep_002_t_00_rew_0 0_act_0 10_-0 35_-0 50_-0 29_d img_resized_ep_002_t_01_rew_0 1_act_0 39_-1 05_0 27_0 02_d img_resized_ep_002_t_02_rew_0 1_act_-0 51_0 72_-0 22_0 13_d img_resized_ep_002_t_03_rew_5 1_act_0 62_0 61_0 17_0 18_d img_resized_ep_002_t_04_lastobs_d

Fourth:

img_resized_ep_003_t_00_rew_0 2_act_-0 00_0 38_0 45_0 28_c img_resized_ep_003_t_01_rew_5 1_act_0 39_-0 55_0 27_-0 20_c img_resized_ep_003_t_02_lastobs_c

img_resized_ep_003_t_00_rew_0 2_act_-0 00_0 38_0 45_0 28_d img_resized_ep_003_t_01_rew_5 1_act_0 39_-0 55_0 27_-0 20_d img_resized_ep_003_t_02_lastobs_d

Fifth:

img_resized_ep_004_t_00_rew_-0 2_act_-0 05_0 56_0 47_0 20_c img_resized_ep_004_t_01_rew_0 1_act_-0 14_1 13_-0 39_-0 06_c img_resized_ep_004_t_02_rew_0 2_act_-0 60_-0 34_-0 18_-0 30_c img_resized_ep_004_t_03_rew_-0 0_act_0 75_-0 46_0 11_-0 25_c img_resized_ep_004_t_04_rew_0 0_act_0 66_0 46_0 15_0 24_c img_resized_ep_004_t_05_rew_0 1_act_-0 49_0 88_-0 23_0 05_c img_resized_ep_004_t_06_rew_5 1_act_-0 68_-0 79_-0 14_-0 09_c img_resized_ep_004_t_07_lastobs_c

img_resized_ep_004_t_00_rew_-0 2_act_-0 05_0 56_0 47_0 20_d img_resized_ep_004_t_01_rew_0 1_act_-0 14_1 13_-0 39_-0 06_d img_resized_ep_004_t_02_rew_0 2_act_-0 60_-0 34_-0 18_-0 30_d img_resized_ep_004_t_03_rew_-0 0_act_0 75_-0 46_0 11_-0 25_d img_resized_ep_004_t_04_rew_0 0_act_0 66_0 46_0 15_0 24_d img_resized_ep_004_t_05_rew_0 1_act_-0 49_0 88_-0 23_0 05_d img_resized_ep_004_t_06_rew_5 1_act_-0 68_-0 79_-0 14_-0 09_d img_resized_ep_004_t_07_lastobs_d

All right seems reasonable. Now let's scale this up. DON'T FORGET TO python setup.py install BEFOREHAND!!

python examples/analytic.py oracle --max_episodes=400 --seed=1336 --tier=1
python examples/analytic.py oracle --max_episodes=400 --seed=1337 --tier=1
python examples/analytic.py oracle --max_episodes=400 --seed=1338 --tier=1
python examples/analytic.py oracle --max_episodes=400 --seed=1339 --tier=1
python examples/analytic.py oracle --max_episodes=400 --seed=1340 --tier=1

python examples/analytic.py oracle --max_episodes=400 --seed=1336 --tier=2
python examples/analytic.py oracle --max_episodes=400 --seed=1337 --tier=2
python examples/analytic.py oracle --max_episodes=400 --seed=1338 --tier=2
python examples/analytic.py oracle --max_episodes=400 --seed=1339 --tier=2
python examples/analytic.py oracle --max_episodes=400 --seed=1340 --tier=2

python examples/analytic.py oracle --max_episodes=400 --seed=1336 --tier=3
python examples/analytic.py oracle --max_episodes=400 --seed=1337 --tier=3
python examples/analytic.py oracle --max_episodes=400 --seed=1338 --tier=3
python examples/analytic.py oracle --max_episodes=400 --seed=1339 --tier=3
python examples/analytic.py oracle --max_episodes=400 --seed=1340 --tier=3
  • Ran Tier1 on hermes1, Feb 09. [Note: copied over to takeshi, should start training Feb 11]
  • Ran Tier2 + Tier3 on triton4, Feb 10.

[I copied the data all to be on Triton4 and Mason ... and should do another machine soon just in case.]

Update: all the datasets are available on Triton4:

(py3-iros-2020) seita@triton4:~/gym-cloth (master) $ python analysis/combine_demo_data.py
  just loaded demos-2020-02-09-16-31-pol-oracle-seed-1336-obs-blender-depth-False-rgbd-True-tier1_epis_400.pkl, len 400
  just loaded demos-2020-02-09-16-31-pol-oracle-seed-1337-obs-blender-depth-False-rgbd-True-tier1_epis_400.pkl, len 400
  just loaded demos-2020-02-09-16-31-pol-oracle-seed-1338-obs-blender-depth-False-rgbd-True-tier1_epis_400.pkl, len 400
  just loaded demos-2020-02-09-16-31-pol-oracle-seed-1339-obs-blender-depth-False-rgbd-True-tier1_epis_400.pkl, len 400
  just loaded demos-2020-02-09-16-31-pol-oracle-seed-1340-obs-blender-depth-False-rgbd-True-tier1_epis_400.pkl, len 400
saving at logs/demos-2020-02-09-16-31-pol-oracle-seed-1336_to_1340-obs-blender-depth-False-rgbd-True-tier1_epis_2000_COMBO.pkl, len 2000
(py3-iros-2020) seita@triton4:~/gym-cloth (master) $ python analysis/combine_demo_data.py
  just loaded demos-2020-02-10-15-00-pol-oracle-seed-1336-obs-blender-depth-False-rgbd-True-tier2_epis_400.pkl, len 400
  just loaded demos-2020-02-10-15-01-pol-oracle-seed-1337-obs-blender-depth-False-rgbd-True-tier2_epis_400.pkl, len 400
  just loaded demos-2020-02-10-15-01-pol-oracle-seed-1338-obs-blender-depth-False-rgbd-True-tier2_epis_400.pkl, len 400
  just loaded demos-2020-02-10-15-02-pol-oracle-seed-1339-obs-blender-depth-False-rgbd-True-tier2_epis_400.pkl, len 400
  just loaded demos-2020-02-10-15-02-pol-oracle-seed-1340-obs-blender-depth-False-rgbd-True-tier2_epis_400.pkl, len 400
saving at logs/demos-2020-02-10-15-02-pol-oracle-seed-1336_to_1340-obs-blender-depth-False-rgbd-True-tier2_epis_2000_COMBO.pkl, len 2000
(py3-iros-2020) seita@triton4:~/gym-cloth (master) $ python analysis/combine_demo_data.py
  just loaded demos-2020-02-10-15-04-pol-oracle-seed-1336-obs-blender-depth-False-rgbd-True-tier3_epis_400.pkl, len 400
  just loaded demos-2020-02-10-15-04-pol-oracle-seed-1337-obs-blender-depth-False-rgbd-True-tier3_epis_400.pkl, len 400
  just loaded demos-2020-02-10-15-04-pol-oracle-seed-1338-obs-blender-depth-False-rgbd-True-tier3_epis_400.pkl, len 400
  just loaded demos-2020-02-10-15-04-pol-oracle-seed-1339-obs-blender-depth-False-rgbd-True-tier3_epis_400.pkl, len 400
  just loaded demos-2020-02-10-15-05-pol-oracle-seed-1340-obs-blender-depth-False-rgbd-True-tier3_epis_400.pkl, len 400
saving at logs/demos-2020-02-10-15-05-pol-oracle-seed-1336_to_1340-obs-blender-depth-False-rgbd-True-tier3_epis_2000_COMBO.pkl, len 2000
(py3-iros-2020) seita@triton4:~/gym-cloth (master) $

Data Statistics

Currently these are 1.1G, 1.9G, and 2.2G, respectively, for the three tiers:

demos-2020-02-09-16-31-pol-oracle-seed-1336_to_1340-obs-blender-depth-False-rgbd-True-tier1_epis_2000_COMBO.pkl
demos-2020-02-10-15-02-pol-oracle-seed-1336_to_1340-obs-blender-depth-False-rgbd-True-tier2_epis_2000_COMBO.pkl
demos-2020-02-10-15-05-pol-oracle-seed-1336_to_1340-obs-blender-depth-False-rgbd-True-tier3_epis_2000_COMBO.pkl

And then running the analysis script analysis/check_demo_data.py I am getting this for T1:

loaded data, length (i.e., episodes) 2000
episode lengths (wrt t): max / min / mean: 6.0 / 1.0 / 1.80 +/- 0.8
num_oob: 0
num_tear: 0
num coverage below 0.9: 0
total transitions: 3599
coverage at start: 78.0 +/- 7.1
coverage at end:   95.6 +/- 2.1
inv-var at start:  0.962 +/- 0.5
inv-var at end:    11.582 +/- 41.6
actions, len 14396, max 1.423, min -1.316, mean -0.008

average values across three channels
  chan. 1: 157.9 +/- 69.0
  chan. 2: 107.7 +/- 32.0
  chan. 3: 78.7 +/- 14.2

and this for T2:

loaded data, length (i.e., episodes) 2000
episode lengths (wrt t): max / min / mean: 10.0 / 1.0 / 3.94 +/- 2.0
num_oob: 6
num_tear: 0
num coverage below 0.9: 51
total transitions: 7878
coverage at start: 57.5 +/- 6.1
coverage at end:   94.5 +/- 5.1
inv-var at start:  0.745 +/- 0.1
inv-var at end:    10.177 +/- 14.0
actions, len 31512, max 1.312, min -1.333, mean 0.001

average values across three channels
  chan. 1: 155.5 +/- 66.6
  chan. 2: 110.5 +/- 34.6
  chan. 3: 85.0 +/- 19.6

and this for T3:

loaded data, length (i.e., episodes) 2000
episode lengths (wrt t): max / min / mean: 10.0 / 1.0 / 4.64 +/- 1.1
num_oob: 3
num_tear: 0
num coverage below 0.9: 7
total transitions: 9276
coverage at start: 41.2 +/- 3.4
coverage at end:   95.0 +/- 2.7
inv-var at start:  0.231 +/- 0.1
inv-var at end:    9.329 +/- 15.4
actions, len 37104, max 1.247, min -1.263, mean -0.001

average values across three channels
  chan. 1: 151.9 +/- 65.5
  chan. 2: 113.1 +/- 37.0
  chan. 3: 90.5 +/- 24.5

Makes sense! Similar to results that I was getting before.

Now the next step is to start training ...

Diagonal folding graspped points mismatch actions

Hi, first thanks for this great repo!

I have created a new environment following the given ClothEnv to perform diagonal folding.
The changes can be found in my fork gym-cloth in the file DiagonalClothEnv.

I modified the original code and works as:

  1. Get an action
  2. Keep grasping the top corner until done, perform self.gripper.adjust(x=delta_x, y=delta_y, z=delta_z) instead of self._pull()
  3. After adjusting the corner position, update the cloth for i in range(cloth_updates): self.cloth.update()

However, the grasped points pt.pinned = True don't behave as expected.
In the first iteration t=0, I take an action in the z coordinate and pull the cloth by 0.007. This works as expected and the grasped points are then at z=0.007.
At t=1, I apply the same action on the z coordinate, self.gripper.adjust(x=0., y=0., z=0.007). This should move the grasped points to z=0.014.
However, after performing the first self.cloth.update() the grasped points are at z=0.021.

Why do the graspped points pt.pinned=True move to a different position after the update?

Blender does not exist crashes the simulation

I run the example line and the simulation window pops up as expected. However after a few seconds.

Traceback (most recent call last):
  File "examples/analytic.py", line 788, in <module>
    run(args, policy)
  File "examples/analytic.py", line 708, in run
    obs = env.reset()
  File "/home/dhananjay/miniconda3/envs/py3-cloth/lib/python3.6/site-packages/gym_cloth-0.0.1-py3.6-linux-x86_64.egg/gym_cloth/envs/cloth_env.py", line 795, in reset
    obs = self.state
  File "/home/dhananjay/miniconda3/envs/py3-cloth/lib/python3.6/site-packages/gym_cloth-0.0.1-py3.6-linux-x86_64.egg/gym_cloth/envs/cloth_env.py", line 204, in state
    img_rgb = self.get_blender_rep('False')
  File "/home/dhananjay/miniconda3/envs/py3-cloth/lib/python3.6/site-packages/gym_cloth-0.0.1-py3.6-linux-x86_64.egg/gym_cloth/envs/cloth_env.py", line 281, in get_blender_rep
    str(self.dom_rand_params['specular_max'])
  File "/home/dhananjay/miniconda3/envs/py3-cloth/lib/python3.6/subprocess.py", line 287, in call
    with Popen(*popenargs, **kwargs) as p:
  File "/home/dhananjay/miniconda3/envs/py3-cloth/lib/python3.6/subprocess.py", line 729, in __init__
    restore_signals, start_new_session)
  File "/home/dhananjay/miniconda3/envs/py3-cloth/lib/python3.6/subprocess.py", line 1364, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'blender': 'blender'

No build directory

I follow the installations instructions on an Ubuntu 18.04 system until the example it works fine. but then I get.

(py3-cloth) dhananjay@dhananjay-G7-7700:~/Desktop/gym-cloth$ python examples/analytic.py oracle --max_episodes=400 --seed=1336 --tier=1
Yes, cython compiled.

Our result_path:
	/home/dhananjay/Desktop/gym-cloth/examples/../logs/demos-2021-06-25-11-59-pol-oracle-seed-1336-obs-blender-depth-False-rgbd-True-tier1_epis_400.pkl
06-25 11:59:36 cloth_env   : DEBUG    Just re-seeded env to: 8952872158261658479
06-25 11:59:36 cloth_env   : DEBUG    Just re-seeded env to: 1336
Traceback (most recent call last):
  File "examples/analytic.py", line 788, in <module>
    run(args, policy)
  File "examples/analytic.py", line 697, in run
    env.render(filepath=args.render_path)
  File "/home/dhananjay/miniconda3/envs/py3-cloth/lib/python3.6/site-packages/gym_cloth-0.0.1-py3.6-linux-x86_64.egg/gym_cloth/envs/cloth_env.py", line 1066, in render
    os.chdir(filepath)
FileNotFoundError: [Errno 2] No such file or directory: '/home/dhananjay/Desktop/gym-cloth/examples/../render/build'

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.