Giter Site home page Giter Site logo

danieltakeshi / gym-cloth Goto Github PK

View Code? Open in Web Editor NEW
26.0 5.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 Introduction

Gym Cloth

Quick logistics overview: this is one of the code bases used in our paper "Deep Imitation Learning of Sequential Fabric Smoothing From an Algorithmic Supervisor" with arXiv here and project website here. The arXiv version will have the most up-to-date version of the paper.


This creates a gym environment based on our cloth simulator. The path directory is structured following standard gym conventions, and we also include our .pyx files here for Cython compilation.

Platforms tested:

  • Mac OS X (renderer working)
  • Ubuntu 16.04 (renderer not working, unfortunately)
  • Ubuntu 18.04 (renderer working)

Please use Python 3.6.

Installation and Code Usage

  1. Make a new virtualenv or conda env. For example, if you're using conda envs, run this to make and then activate the environment:

    conda create -n py3-cloth python=3.6
    conda activate py3-cloth
    
  2. Run pip install -r requirements.txt to install dependencies.

  3. Run python setup.py install. This should automatically "cythonize" the Python .pyx files. An alternative is to do python setup.py develop in development mode. This has the advantage in that code changes in package-dependent files will automatically be updated when you run code, and you avoid having to "re-install" the package. However, since we use Cython code in files that end with .pyx, those have to be re-compiled each time we run the code. Thus, they automatically require another python setup.py call anyway, so it seems like the distinction between install mode and develop mode doesn't matter here. For example, if running a script, I usually do this each time I run code:

    python setup.py install ; python examples/<script_name>.py
    

    So far this setup is working fine for us.

For quick testing, try running the policies using the provided examples/analytic.py script. This is the main script that we use to generate demonstration data for experiments. For example, this should work right away:

python examples/analytic.py oracle --max_episodes=400 --seed=1336 --tier=1

To actually visualize the renderer, you need to install it, and change the appropriate config file in cfg/ so that the render_opengl setting is True.

Renderer Installation

These instructions have been tested on Mac OS X and Ubuntu 18.04. For some reason, we have not been able to get this working for Ubuntu 16.04. For Ubuntu 18.04, you might need sudo access for make -j4 install. Currently the simulation is rendered in an independent C++ program. To set up the renderer,

  1. Navigate to render/ext/libzmq. Run
mkdir build; cd build
cmake ..
make -j4 install
  1. Navigate to render/ext/cppzmq. Again run
mkdir build; cd build
cmake ..
make -j4 install

(Edit: this step seems to not be necessary, see December 2020 comment below.)

  1. Navigate to render. Run
mkdir build; cd build
cmake ..
make

Finally you should have an executable clothsim in render/build. To test that it is working, go to render/build and run ./clothsim on the command line. You should see an empty window appear. There should be no segmentation faults. Occasionally I have seen it fail on installed machines, but normally rebooting fixes it.

Notes:

  • If you make changes to width, height, or render_port in cfg/env_config.yaml, please also update num_width_points, num_height_points, and render_port respectively in render/scene/pinned2.json.

  • It's easier to change the viewing angle by directly adjusting values in clothSimulator.cpp, rather than with the mouse and GUI. When you adjust the camera angles, be sure to re-compile the renderer using the instructions above. You only need to re-compile render, not the other two.

  • Note (Updated December 2020): with Ubuntu 18.04 and a conda environment, running ./clothsim seems to result in a frozen screen. Also, the second step of the installation above seems to fail (though this fix may help), but nonetheless, running it with cloth in it will seem to work normally.

Citation

If you find the code or other related resources useful, please consider citing the paper:

@inproceedings{seita_fabrics_2020,
    author = {Daniel Seita and Aditya Ganapathi and Ryan Hoque and Minho Hwang and Edward Cen and Ajay Kumar Tanwani and Ashwin Balakrishna and Brijen Thananjeyan and Jeffrey Ichnowski and Nawid Jamali and Katsu Yamane and Soshi Iba and John Canny and Ken Goldberg},
    title = {{Deep Imitation Learning of Sequential Fabric Smoothing From an Algorithmic Supervisor}},
    booktitle = {IEEE/RSJ International Conference on Intelligent Robots and Systems (IROS)},
    Year = {2020}
}

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.