├── .gitignore ├── .gitmodules ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE.md ├── README.md ├── environment.yml ├── experiments ├── agent │ ├── ppo.yaml │ └── sac.yaml ├── config.yaml ├── env │ ├── pgdm.yaml │ └── pregrasp.yaml └── hydra │ └── launcher │ ├── ray_cluster.yaml │ └── slurm.yaml ├── requirements.txt ├── rollout.py ├── setup.py ├── tcdm ├── __init__.py ├── envs │ ├── __init__.py │ ├── assets │ │ ├── common.xml │ │ ├── environments │ │ │ ├── empty.xml │ │ │ └── table.xml │ │ ├── meshes │ │ │ ├── adroit │ │ │ │ ├── F1.stl │ │ │ │ ├── F2.stl │ │ │ │ ├── F3.stl │ │ │ │ ├── TH1_z.stl │ │ │ │ ├── TH2_z.stl │ │ │ │ ├── TH3_z.stl │ │ │ │ ├── forearm_simple.stl │ │ │ │ ├── knuckle.stl │ │ │ │ ├── lfmetacarpal.stl │ │ │ │ ├── palm.stl │ │ │ │ └── wrist.stl │ │ │ └── scene │ │ │ │ ├── skyline.stl │ │ │ │ └── wall.stl │ │ ├── objects │ │ │ ├── airplane.xml │ │ │ ├── alarmclock.xml │ │ │ ├── apple.xml │ │ │ ├── banana.xml │ │ │ ├── binoculars.xml │ │ │ ├── body.xml │ │ │ ├── bowl.xml │ │ │ ├── camera.xml │ │ │ ├── coffeecan.xml │ │ │ ├── coffeemug.xml │ │ │ ├── crackerbox.xml │ │ │ ├── cubelarge.xml │ │ │ ├── cubemedium.xml │ │ │ ├── cubemiddle.xml │ │ │ ├── cubesmall.xml │ │ │ ├── cup.xml │ │ │ ├── cylinderlarge.xml │ │ │ ├── cylindermedium.xml │ │ │ ├── cylindersmall.xml │ │ │ ├── dapg_hammer.xml │ │ │ ├── door.xml │ │ │ ├── doorknob.xml │ │ │ ├── duck.xml │ │ │ ├── elephant.xml │ │ │ ├── eyeglasses.xml │ │ │ ├── flashlight.xml │ │ │ ├── flute.xml │ │ │ ├── fryingpan.xml │ │ │ ├── gamecontroller.xml │ │ │ ├── hammer.xml │ │ │ ├── hand.xml │ │ │ ├── headphones.xml │ │ │ ├── knife.xml │ │ │ ├── lightbulb.xml │ │ │ ├── mouse.xml │ │ │ ├── mug.xml │ │ │ ├── nail.xml │ │ │ ├── phone.xml │ │ │ ├── piggybank.xml │ │ │ ├── pyramidlarge.xml │ │ │ ├── pyramidmedium.xml │ │ │ ├── pyramidsmall.xml │ │ │ ├── rubberduck.xml │ │ │ ├── scissors.xml │ │ │ ├── spherelarge.xml │ │ │ ├── spheremedium.xml │ │ │ ├── spheresmall.xml │ │ │ ├── stamp.xml │ │ │ ├── stanfordbunny.xml │ │ │ ├── stapler.xml │ │ │ ├── table.xml │ │ │ ├── teapot.xml │ │ │ ├── toothbrush.xml │ │ │ ├── toothpaste.xml │ │ │ ├── toruslarge.xml │ │ │ ├── torusmedium.xml │ │ │ ├── torussmall.xml │ │ │ ├── train.xml │ │ │ ├── watch.xml │ │ │ ├── waterbottle.xml │ │ │ ├── wineglass.xml │ │ │ └── wristwatch.xml │ │ ├── robot_config.yaml │ │ ├── robots │ │ │ ├── adroit │ │ │ │ ├── actuators.xml │ │ │ │ ├── base.xml │ │ │ │ └── mocaps.txt │ │ │ ├── dhand │ │ │ │ ├── actuators.xml │ │ │ │ ├── base.xml │ │ │ │ └── mocaps.txt │ │ │ ├── dmanus │ │ │ │ ├── actuators.xml │ │ │ │ ├── base.xml │ │ │ │ └── mocaps.txt │ │ │ └── franka │ │ │ │ ├── actuators.xml │ │ │ │ ├── base.xml │ │ │ │ └── mocaps.txt │ │ ├── task_trajs.yaml │ │ └── textures │ │ │ ├── granite.png │ │ │ ├── high_contrast_brick.png │ │ │ ├── marble.png │ │ │ ├── silverRaw.png │ │ │ ├── white_marble_tile2.png │ │ │ └── wood.png │ ├── control.py │ ├── mujoco │ │ ├── __init__.py │ │ ├── mj_models │ │ │ ├── __init__.py │ │ │ ├── base.py │ │ │ ├── environments.py │ │ │ ├── objects.py │ │ │ └── robots.py │ │ └── physics.py │ ├── reference.py │ ├── rewards.py │ ├── suite │ │ ├── __init__.py │ │ └── tcdm.py │ └── wrappers.py ├── motion_util.py └── rl │ ├── __init__.py │ ├── models │ ├── __init__.py │ ├── distributions.py │ └── policies.py │ └── trainers │ ├── __init__.py │ ├── eval.py │ ├── ppo.py │ ├── sac.py │ └── util.py ├── train.py └── trajectories ├── TASKS.md ├── airplane_fly1.npz ├── airplane_pass1.npz ├── alarmclock_lift.npz ├── alarmclock_see1.npz ├── banana_pass1.npz ├── binoculars_pass1.npz ├── cup_drink1.npz ├── cup_pour1.npz ├── dhand_alarmclock.npz ├── dhand_binoculars.npz ├── dhand_cup.npz ├── dhand_elephant.npz ├── dhand_waterbottle.npz ├── dmanus_coffeecan.npz ├── dmanus_crackerbox.npz ├── dmanus_sim2real.npz ├── door_open.npz ├── duck_inspect1.npz ├── duck_lift.npz ├── elephant_pass1.npz ├── eyeglasses_pass1.npz ├── flashlight_lift.npz ├── flashlight_on2.npz ├── flute_pass1.npz ├── fryingpan_cook2.npz ├── goal_renders ├── airplane_fly1.mp4 ├── airplane_pass1.mp4 ├── alarmclock_lift.mp4 ├── alarmclock_see1.mp4 ├── banana_pass1.mp4 ├── binoculars_pass1.mp4 ├── cup_drink1.mp4 ├── cup_pour1.mp4 ├── dhand_alarmclock.mp4 ├── dhand_binoculars.mp4 ├── dhand_cup.mp4 ├── dhand_elephant.mp4 ├── dhand_waterbottle.mp4 ├── dmanus_coffeecan.mp4 ├── dmanus_crackerbox.mp4 ├── dmanus_sim2real.mp4 ├── door_open.mp4 ├── duck_inspect1.mp4 ├── duck_lift.mp4 ├── elephant_pass1.mp4 ├── eyeglasses_pass1.mp4 ├── flashlight_lift.mp4 ├── flashlight_on2.mp4 ├── flute_pass1.mp4 ├── fryingpan_cook2.mp4 ├── hammer_strike.mp4 ├── hammer_use1.mp4 ├── hand_inspect1.mp4 ├── headphones_pass1.mp4 ├── knife_chop1.mp4 ├── lightbulb_pass1.mp4 ├── mouse_lift.mp4 ├── mouse_use1.mp4 ├── mug_drink3.mp4 ├── piggybank_use1.mp4 ├── scissors_use1.mp4 ├── spheremedium_lift.mp4 ├── spheremedium_relocate.mp4 ├── stamp_stamp1.mp4 ├── stanfordbunny_inspect1.mp4 ├── stapler_lift.mp4 ├── toothbrush_lift.mp4 ├── toothpaste_lift.mp4 ├── toruslarge_inspect1.mp4 ├── train_play1.mp4 ├── watch_lift.mp4 ├── waterbottle_lift.mp4 ├── waterbottle_shake1.mp4 ├── wineglass_drink1.mp4 ├── wineglass_drink2.mp4 └── wineglass_toast1.mp4 ├── hammer_strike.npz ├── hammer_use1.npz ├── hand_inspect1.npz ├── headphones_pass1.npz ├── knife_chop1.npz ├── lightbulb_pass1.npz ├── mouse_lift.npz ├── mouse_use1.npz ├── mug_drink3.npz ├── piggybank_use1.npz ├── scissors_use1.npz ├── spheremedium_lift.npz ├── spheremedium_relocate.npz ├── stamp_stamp1.npz ├── stanfordbunny_inspect1.npz ├── stapler_lift.npz ├── toothbrush_lift.npz ├── toothpaste_lift.npz ├── toruslarge_inspect1.npz ├── train_play1.npz ├── watch_lift.npz ├── waterbottle_lift.npz ├── waterbottle_shake1.npz ├── wineglass_drink1.npz ├── wineglass_drink2.npz └── wineglass_toast1.npz /.gitignore: -------------------------------------------------------------------------------- 1 | MUJOCO_LOG.TXT 2 | *.egg-info/ 3 | __pycache__ 4 | log_* 5 | slurm-* 6 | *.mp4 7 | *.gif 8 | .DS_Store 9 | *.vscode 10 | *.pyc 11 | data/* 12 | outputs/* 13 | multirun/* 14 | *.swp 15 | wandb/* 16 | scratch/* 17 | pretrained_agents/* -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "tcdm/envs/assets/meshes/objects"] 2 | path = tcdm/envs/assets/meshes/objects 3 | url = https://github.com/vikashplus/object_sim.git 4 | [submodule "tcdm/envs/assets/meshes/robel"] 5 | path = tcdm/envs/assets/meshes/robel 6 | url = https://github.com/vikashplus/robel_sim.git 7 | branch = experimental-hand 8 | [submodule "tcdm/envs/assets/meshes/franka_sim"] 9 | path = tcdm/envs/assets/meshes/franka_sim 10 | url = https://github.com/vikashplus/franka_sim.git 11 | [submodule "tcdm/envs/assets/meshes/dmanus_sim"] 12 | path = tcdm/envs/assets/meshes/dmanus_sim 13 | url = https://github.com/vikashplus/dmanus_sim.git 14 | branch = dmanus_extra_THjoint 15 | [submodule "tcdm/envs/assets/meshes/YCB_sim"] 16 | path = tcdm/envs/assets/meshes/YCB_sim 17 | url = https://github.com/vikashplus/YCB_sim.git 18 | -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # Code of Conduct 2 | 3 | ## Our Pledge 4 | 5 | In the interest of fostering an open and welcoming environment, we as 6 | contributors and maintainers pledge to make participation in our project and 7 | our community a harassment-free experience for everyone, regardless of age, body 8 | size, disability, ethnicity, sex characteristics, gender identity and expression, 9 | level of experience, education, socio-economic status, nationality, personal 10 | appearance, race, religion, or sexual identity and orientation. 11 | 12 | ## Our Standards 13 | 14 | Examples of behavior that contributes to creating a positive environment 15 | include: 16 | 17 | * Using welcoming and inclusive language 18 | * Being respectful of differing viewpoints and experiences 19 | * Gracefully accepting constructive criticism 20 | * Focusing on what is best for the community 21 | * Showing empathy towards other community members 22 | 23 | Examples of unacceptable behavior by participants include: 24 | 25 | * The use of sexualized language or imagery and unwelcome sexual attention or 26 | advances 27 | * Trolling, insulting/derogatory comments, and personal or political attacks 28 | * Public or private harassment 29 | * Publishing others' private information, such as a physical or electronic 30 | address, without explicit permission 31 | * Other conduct which could reasonably be considered inappropriate in a 32 | professional setting 33 | 34 | ## Our Responsibilities 35 | 36 | Project maintainers are responsible for clarifying the standards of acceptable 37 | behavior and are expected to take appropriate and fair corrective action in 38 | response to any instances of unacceptable behavior. 39 | 40 | Project maintainers have the right and responsibility to remove, edit, or 41 | reject comments, commits, code, wiki edits, issues, and other contributions 42 | that are not aligned to this Code of Conduct, or to ban temporarily or 43 | permanently any contributor for other behaviors that they deem inappropriate, 44 | threatening, offensive, or harmful. 45 | 46 | ## Scope 47 | 48 | This Code of Conduct applies within all project spaces, and it also applies when 49 | an individual is representing the project or its community in public spaces. 50 | Examples of representing a project or community include using an official 51 | project e-mail address, posting via an official social media account, or acting 52 | as an appointed representative at an online or offline event. Representation of 53 | a project may be further defined and clarified by project maintainers. 54 | 55 | ## Enforcement 56 | 57 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 58 | reported by contacting the project team at . All 59 | complaints will be reviewed and investigated and will result in a response that 60 | is deemed necessary and appropriate to the circumstances. The project team is 61 | obligated to maintain confidentiality with regard to the reporter of an incident. 62 | Further details of specific enforcement policies may be posted separately. 63 | 64 | Project maintainers who do not follow or enforce the Code of Conduct in good 65 | faith may face temporary or permanent repercussions as determined by other 66 | members of the project's leadership. 67 | 68 | ## Attribution 69 | 70 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, 71 | available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html 72 | 73 | [homepage]: https://www.contributor-covenant.org 74 | 75 | For answers to common questions about this code of conduct, see 76 | https://www.contributor-covenant.org/faq -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to 2 | We want to make contributing to this project as easy and transparent as 3 | possible. 4 | 5 | ## Pull Requests 6 | We actively welcome your pull requests. 7 | 8 | 1. Fork the repo and create your branch from `main`. 9 | 2. If you've added code that should be tested, add tests. 10 | 3. If you've changed APIs, update the documentation. 11 | 4. Ensure the test suite passes. 12 | 5. Make sure your code lints. 13 | 6. If you haven't already, complete the Contributor License Agreement ("CLA"). 14 | 15 | ## Contributor License Agreement ("CLA") 16 | In order to accept your pull request, we need you to submit a CLA. You only need 17 | to do this once to work on any of Facebook's open source projects. 18 | 19 | Complete your CLA here: 20 | 21 | ## Issues 22 | We use GitHub issues to track public bugs. Please ensure your description is 23 | clear and has sufficient instructions to be able to reproduce the issue. 24 | 25 | Facebook has a [bounty program](https://www.facebook.com/whitehat/) for the safe 26 | disclosure of security bugs. In those cases, please go through the process 27 | outlined on that page and do not file a public issue. 28 | 29 | ## License 30 | By contributing to this project, you agree that your contributions will be licensed 31 | under the LICENSE file in the root directory of this source tree. 32 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | 2 | MIT License 3 | 4 | Copyright (c) Meta Platforms, Inc. and affiliates. 5 | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy 7 | of this software and associated documentation files (the "Software"), to deal 8 | in the Software without restriction, including without limitation the rights 9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 10 | copies of the Software, and to permit persons to whom the Software is 11 | furnished to do so, subject to the following conditions: 12 | 13 | The above copyright notice and this permission notice shall be included in all 14 | copies or substantial portions of the Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 22 | SOFTWARE. -------------------------------------------------------------------------------- /environment.yml: -------------------------------------------------------------------------------- 1 | name: tcdm 2 | channels: 3 | - nvidia 4 | - pytorch 5 | - conda-forge 6 | - defaults 7 | dependencies: 8 | - _libgcc_mutex=0.1=conda_forge 9 | - _openmp_mutex=4.5=1_gnu 10 | - bzip2=1.0.8=h7f98852_4 11 | - ca-certificates=2021.5.30=ha878542_0 12 | - ffmpeg=4.3.2=hca11adc_0 13 | - freetype=2.10.4=h0708190_1 14 | - glew=2.1.0=h9c3ff4c_2 15 | - gmp=6.2.1=h58526e2_0 16 | - gnutls=3.6.13=h85f3911_1 17 | - lame=3.100=h7f98852_1001 18 | - ld_impl_linux-64=2.36.1=hea4e1c9_2 19 | - libffi=3.3=h58526e2_2 20 | - libgcc-ng=11.1.0=hc902ee8_8 21 | - libglu=9.0.0=he1b5a44_1001 22 | - libgomp=11.1.0=hc902ee8_8 23 | - libiconv=1.16=h516909a_0 24 | - libpng=1.6.37=h21135ba_2 25 | - libstdcxx-ng=11.1.0=h56837e0_8 26 | - libuv=1.42.0=h7f98852_0 27 | - libwebp-base=1.2.1=h7f98852_0 28 | - libxcb=1.13=h7f98852_1003 29 | - lz4-c=1.9.3=h9c3ff4c_1 30 | - mkl-service=2.3.0=py38h1e0a361_2 31 | - mkl_fft=1.2.0=py38hab2c0dc_1 32 | - mkl_random=1.2.0=py38hc5bc63f_1 33 | - ncurses=6.2=h58526e2_4 34 | - nettle=3.6=he412f7d_0 35 | - ninja=1.10.2=h4bd325d_0 36 | - olefile=0.46=pyh9f0ad1d_1 37 | - openh264=2.1.1=h780b84a_0 38 | - openssl=1.1.1l=h7f98852_0 39 | - pip=21.2.4=pyhd8ed1ab_0 40 | - pthread-stubs=0.4=h36c2ea0_1001 41 | - python=3.8.10=h49503c6_1_cpython 42 | - python_abi=3.8=2_cp38 43 | - readline=8.1=h46c0cb4_0 44 | - setuptools=57.4.0=py38h578d9bd_0 45 | - six=1.16.0=pyh6c4a22f_0 46 | - sqlite=3.36.0=h9cd32fc_0 47 | - tk=8.6.11=h21135ba_0 48 | - typing_extensions=3.10.0.0=pyha770c72_0 49 | - wheel=0.37.0=pyhd8ed1ab_1 50 | - x264=1!161.3030=h7f98852_1 51 | - xorg-kbproto=1.0.7=h7f98852_1002 52 | - xorg-libx11=1.7.2=h7f98852_0 53 | - xorg-libxau=1.0.9=h7f98852_0 54 | - xorg-libxdmcp=1.1.3=h7f98852_0 55 | - xorg-libxext=1.3.4=h7f98852_1 56 | - xorg-xextproto=7.3.0=h7f98852_1002 57 | - xorg-xproto=7.0.31=h7f98852_1007 58 | - xz=5.2.5=h516909a_1 59 | - zlib=1.2.11=h516909a_1010 60 | - zstd=1.4.9=ha95c52a_0 61 | - blas=1.0=mkl 62 | - intel-openmp=2021.3.0=h06a4308_3350 63 | - jpeg=9b=h024ee3a_2 64 | - libtiff=4.2.0=h85742a9_0 65 | - mkl=2020.2=256 66 | - numpy=1.19.2=py38h54aff64_0 67 | - numpy-base=1.19.2=py38hfa32c7d_0 68 | - pillow=7.1.2=py38hb39fc2d_0 69 | - cudatoolkit=11.1.74=h6bb024c_0 70 | - pytorch=1.9.0=py3.8_cuda11.1_cudnn8.0.5_0 71 | - torchaudio=0.9.0=py38 72 | - torchvision=0.10.0=py38_cu111 73 | prefix: /private/home/sudeepdasari/.conda/envs/tcdm 74 | 75 | -------------------------------------------------------------------------------- /experiments/agent/ppo.yaml: -------------------------------------------------------------------------------- 1 | name: PPO # algorithm name 2 | multi_proc: True # whether to use multi_processing or not 3 | params: 4 | gamma: 0.95 # discount factor 5 | gae_lambda: 0.95 # GAE parameter 6 | learning_rate: 1e-5 # learning rate for optimizer 7 | ent_coef: 0.001 # PPO Entropy coefficient 8 | vf_coef: 0.5 # Added multiplier on Value Function Loss 9 | clip_range: 0.2 # PPO Clip parameter 10 | n_steps: 4096 # Number of timesteps to collect per iteration (e.g. global batch) 11 | batch_size: 256 # Minibatch size for each ADAM step during PPO opt 12 | n_epochs: 5 # Number of epochs on collected global batch per iteration 13 | warm_start_mean: True # Warm start mean to explore around initial position 14 | policy_kwargs: # Policy parameters (initial STD and architecture) 15 | net_arch: 16 | - pi: [256, 128] 17 | vf: [256, 128] 18 | log_std_init: -1.60 19 | -------------------------------------------------------------------------------- /experiments/agent/sac.yaml: -------------------------------------------------------------------------------- 1 | name: SAC # algorithm name 2 | multi_proc: True # whether to use multi_processing or not 3 | params: 4 | learning_rate: 0.0003 # learning rate for adam optimizer 5 | buffer_size: 1000000 # size of replay buffer 6 | learning_starts: 100 # how many model steps to collect transition before learning 7 | batch_size: 256 # gradient batch size 8 | tau: 0.005 # soft update co-efficient (e.g. Polyak update) 9 | gamma: 0.95 # discount factor 10 | train_freq: 1 # how frequently to update model (see SB3 docs for advanced options) 11 | gradient_steps: 1 # how many gradient steps to do after each rollout 12 | ent_coef: auto # entropy regularization co-efficient 13 | target_entropy: auto # target entropy when using auto mode 14 | target_update_interval: 1 # how frequently to update the target network 15 | warm_start_mean: True # Warm start mean to explore around initial position 16 | policy_kwargs: # Policy parameters (initial STD and architecture) 17 | net_arch: 18 | pi: [256, 128] 19 | qf: [256, 128] 20 | log_std_init: -1.60 21 | -------------------------------------------------------------------------------- /experiments/config.yaml: -------------------------------------------------------------------------------- 1 | defaults: 2 | - agent: ppo 3 | - env: pgdm 4 | - override hydra/launcher: slurm 5 | - _self_ 6 | 7 | hydra: 8 | sweep: 9 | dir: ${env:HOME}/checkpoints/${exp_name}/${now:%Y-%m-%d}/${now:%H-%M-%S} 10 | subdir: ${wandb.sweep_name_prefix}-${hydra.job.num} 11 | 12 | exp_name: MimicTrainer 13 | id: ${hydra.job.id} 14 | resume_model: null 15 | total_timesteps: 50000000 16 | n_envs: 32 17 | n_eval_envs: 5 18 | eval_freq: 1000000 19 | vid_freq: null 20 | save_freq: 10000000 21 | restore_checkpoint_freq: 500000 22 | seed: 0 23 | 24 | checkpoints: 25 | save_freq: 4000000 26 | save_path: './models/' 27 | name_prefix: 'rl_model' 28 | 29 | wandb: 30 | project: dummy_proj 31 | group: ${exp_name} 32 | sweep_name_prefix: run 33 | -------------------------------------------------------------------------------- /experiments/env/pgdm.yaml: -------------------------------------------------------------------------------- 1 | name: hammer-use1 # environment name formatted as 'domain-task' 2 | task_kwargs: # task keywords 3 | append_time: True # append time phase variables to state 4 | pregrasp: motion_planned # PGDM uses planned initialization 5 | reward_kwargs: # parameters for object mimic reward 6 | obj_err_scale: 50 7 | object_reward_scale: 10.0 8 | lift_bonus_thresh: 0.02 9 | lift_bonus_mag: 2.5 10 | obj_com_term: 0.25 11 | n_envs: ${n_envs} 12 | obj_reward_ramp: 0 13 | obj_reward_start: 0 14 | env_kwargs: {} # environment keyworks 15 | info_keywords: ['obj_err', 'obj_success', 16 | 'step_obj_err', 'time_frac', 17 | 'obj_err_scale'] 18 | state_keyword: state 19 | n_envs: ${n_envs} 20 | vid_freq: ${vid_freq} 21 | vid_length: 100 22 | -------------------------------------------------------------------------------- /experiments/env/pregrasp.yaml: -------------------------------------------------------------------------------- 1 | name: hammer-use1 # environment name formatted as 'domain-task' 2 | task_kwargs: # task keywords 3 | append_time: True # append time phase variables to state 4 | pregrasp: initialized # initialization method for PreGrasp (e.g. state, planner, etc.) 5 | reward_kwargs: # parameters for object mimic reward 6 | obj_err_scale: 50 7 | object_reward_scale: 10.0 8 | lift_bonus_thresh: 0.02 9 | lift_bonus_mag: 2.5 10 | obj_com_term: 0.25 11 | n_envs: ${n_envs} 12 | obj_reward_ramp: 0 13 | obj_reward_start: 0 14 | env_kwargs: {} # environment keyworks 15 | info_keywords: ['obj_err', 'obj_success', 16 | 'step_obj_err', 'time_frac', 17 | 'obj_err_scale'] 18 | state_keyword: state 19 | n_envs: ${n_envs} 20 | vid_freq: ${vid_freq} 21 | vid_length: 100 22 | -------------------------------------------------------------------------------- /experiments/hydra/launcher/ray_cluster.yaml: -------------------------------------------------------------------------------- 1 | defaults: 2 | - ray 3 | 4 | ray: 5 | init: 6 | address: localhost:6379 7 | _redis_password: local 8 | remote: 9 | num_cpus: 24 10 | num_gpus: 0.5 11 | -------------------------------------------------------------------------------- /experiments/hydra/launcher/slurm.yaml: -------------------------------------------------------------------------------- 1 | defaults: 2 | - submitit_slurm 3 | 4 | timeout_min: 1440 5 | partition: learnlab 6 | gpus_per_node: 1 7 | cpus_per_task: 40 8 | mem_gb: 60 9 | nodes: 1 10 | constraint: pascal|volta 11 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | hydra-core==1.1 2 | hydra-ray-launcher==0.1.3 3 | hydra-submitit-launcher 4 | pyquaternion 5 | dm-control==1.0.1 6 | mujoco==2.1.5 7 | tqdm 8 | gym==0.18.3 9 | opencv-python 10 | seaborn 11 | stable-baselines3==1.1.0 12 | wandb 13 | imageio 14 | imageio-ffmpeg 15 | tensorboard 16 | -------------------------------------------------------------------------------- /rollout.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | 7 | import matplotlib.pyplot as plt 8 | import pickle as pkl 9 | import numpy as np 10 | import glob, yaml, os, imageio, cv2, shutil 11 | from tcdm import suite 12 | from stable_baselines3 import PPO 13 | from argparse import ArgumentParser 14 | 15 | 16 | """ 17 | PLEASE DOWNLOAD AND UNZIP THE PRE-TRAINED AGENTS BEFORE RUNNING THIS 18 | SEE: https://github.com/facebookresearch/DexMan#pre-trained-policies 19 | """ 20 | 21 | parser = ArgumentParser(description="Example code for loading pre-trained policies") 22 | parser.add_argument('--save_folder', default='pretrained_agents/hammer_use1/', 23 | help="Save folder containing agent checkpoint/config") 24 | parser.add_argument('--render', action="store_true", help="Supply flag to render mp4") 25 | 26 | 27 | def render(writer, physics, AA=2, height=256, width=256): 28 | if writer is None: 29 | return 30 | img = physics.render(camera_id=0, height=height * AA, width=width * AA) 31 | writer.append_data(cv2.resize(img, (width, height), interpolation=cv2.INTER_AREA)) 32 | 33 | 34 | def rollout(save_folder, writer): 35 | # get experiment config 36 | config = yaml.safe_load(open(os.path.join(save_folder, 'exp_config.yaml'), 'r')) 37 | 38 | # build environment and load policy 39 | o, t = config['env']['name'].split('-') 40 | env = suite.load(o, t, config['env']['task_kwargs'], gym_wrap=True) 41 | policy = PPO.load(os.path.join(save_folder, 'checkpoint.zip')) 42 | 43 | # rollout the policy and print total reward 44 | s, done, total_reward = env.reset(), False, 0 45 | render(writer, env.wrapped.physics) 46 | while not done: 47 | action, _ = policy.predict(s['state'], deterministic=True) 48 | s, r, done, __ = env.step(action) 49 | render(writer, env.wrapped.physics) 50 | total_reward += r 51 | print('Total reward:', total_reward) 52 | 53 | 54 | if __name__ == "__main__": 55 | args = parser.parse_args() 56 | 57 | # configure writer 58 | if args.render: 59 | writer = imageio.get_writer('rollout.mp4', fps=25) 60 | rollout(args.save_folder, writer) 61 | writer.close() 62 | else: 63 | rollout(args.save_folder, None) 64 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | 7 | from setuptools import setup 8 | 9 | setup( 10 | name='tcdm', 11 | version='0.1', 12 | packages=['tcdm'], 13 | ) 14 | -------------------------------------------------------------------------------- /tcdm/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | 7 | try: 8 | from tcdm.envs import suite 9 | except: 10 | pass -------------------------------------------------------------------------------- /tcdm/envs/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | 7 | import os, tcdm 8 | 9 | 10 | # logic for retrieving assets 11 | def asset_abspath(resource_path): 12 | envs_path = os.path.dirname(__file__) 13 | asset_folder_path = os.path.join(envs_path, 'assets') 14 | return os.path.join(asset_folder_path, resource_path) 15 | 16 | 17 | # logic for retreiving trajectories 18 | def traj_abspath(resource_path): 19 | base_path = os.path.dirname(os.path.dirname(tcdm.__file__)) 20 | data_folder_path = os.path.join(base_path, 'trajectories') 21 | return os.path.join(data_folder_path, resource_path) 22 | 23 | 24 | # mj_models relies on asset_abspath hence import at end 25 | from tcdm.envs.mujoco import mj_models 26 | -------------------------------------------------------------------------------- /tcdm/envs/assets/common.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /tcdm/envs/assets/environments/empty.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 33 | -------------------------------------------------------------------------------- /tcdm/envs/assets/environments/table.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 71 | -------------------------------------------------------------------------------- /tcdm/envs/assets/meshes/adroit/F1.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/tcdm/envs/assets/meshes/adroit/F1.stl -------------------------------------------------------------------------------- /tcdm/envs/assets/meshes/adroit/F2.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/tcdm/envs/assets/meshes/adroit/F2.stl -------------------------------------------------------------------------------- /tcdm/envs/assets/meshes/adroit/F3.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/tcdm/envs/assets/meshes/adroit/F3.stl -------------------------------------------------------------------------------- /tcdm/envs/assets/meshes/adroit/TH1_z.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/tcdm/envs/assets/meshes/adroit/TH1_z.stl -------------------------------------------------------------------------------- /tcdm/envs/assets/meshes/adroit/TH2_z.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/tcdm/envs/assets/meshes/adroit/TH2_z.stl -------------------------------------------------------------------------------- /tcdm/envs/assets/meshes/adroit/TH3_z.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/tcdm/envs/assets/meshes/adroit/TH3_z.stl -------------------------------------------------------------------------------- /tcdm/envs/assets/meshes/adroit/forearm_simple.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/tcdm/envs/assets/meshes/adroit/forearm_simple.stl -------------------------------------------------------------------------------- /tcdm/envs/assets/meshes/adroit/knuckle.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/tcdm/envs/assets/meshes/adroit/knuckle.stl -------------------------------------------------------------------------------- /tcdm/envs/assets/meshes/adroit/lfmetacarpal.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/tcdm/envs/assets/meshes/adroit/lfmetacarpal.stl -------------------------------------------------------------------------------- /tcdm/envs/assets/meshes/adroit/palm.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/tcdm/envs/assets/meshes/adroit/palm.stl -------------------------------------------------------------------------------- /tcdm/envs/assets/meshes/adroit/wrist.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/tcdm/envs/assets/meshes/adroit/wrist.stl -------------------------------------------------------------------------------- /tcdm/envs/assets/meshes/scene/skyline.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/tcdm/envs/assets/meshes/scene/skyline.stl -------------------------------------------------------------------------------- /tcdm/envs/assets/meshes/scene/wall.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/tcdm/envs/assets/meshes/scene/wall.stl -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/airplane.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/alarmclock.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/apple.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/banana.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/binoculars.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/body.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/bowl.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/camera.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/coffeecan.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/coffeemug.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/crackerbox.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/cubelarge.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/cubemedium.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/cubemiddle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/cubesmall.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/cup.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/cylinderlarge.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/cylindermedium.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/cylindersmall.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/dapg_hammer.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/door.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/doorknob.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/duck.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/elephant.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/flashlight.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/flute.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/gamecontroller.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/hammer.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/hand.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/headphones.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/knife.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/lightbulb.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/mouse.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/mug.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/nail.xml: -------------------------------------------------------------------------------- 1 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/phone.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/piggybank.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/pyramidlarge.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/pyramidmedium.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/pyramidsmall.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/rubberduck.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/scissors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/spherelarge.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/spheremedium.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/spheresmall.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/stamp.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/stanfordbunny.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/stapler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/table.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/toothbrush.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/toothpaste.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/toruslarge.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/torusmedium.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/torussmall.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/train.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/watch.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/waterbottle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /tcdm/envs/assets/objects/wristwatch.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /tcdm/envs/assets/robot_config.yaml: -------------------------------------------------------------------------------- 1 | adroit: 2 | BODIES: ['wrist_point', 'ffknuckle_point', 'ffmiddle_point', 'ffdistal_point', 3 | 'mfknuckle_point', 'mfmiddle_point', 'mfdistal_point', 'lfknuckle_point', 4 | 'lfmiddle_point', 'lfdistal_point', 'rfknuckle_point', 'rfmiddle_point', 5 | 'rfdistal_point', 'thknuckle_point', 'thmiddle_point', 'thdistal_point'] 6 | FINGERTIP_INDICES: [3, 6, 9, 12, 15] 7 | dhand: 8 | BODIES: ['wrist_point', 'ffknuckle_point', 'ffmiddle_point', 'ffdistal_point', 9 | 'mfknuckle_point', 'mfmiddle_point', 'mfdistal_point', 'pfknuckle_point', 10 | 'pfmiddle_point', 'pfdistal_point', 'tfknuckle_point', 'tfmiddle_point', 11 | 'tfdistal_point'] 12 | FINGERTIP_INDICES: [3, 6, 9, 12] 13 | dmanus: 14 | BODIES: ['wrist_point', 'ffknuckle_point', 'ffmiddle_point', 'ffdistal_point', 15 | 'rfknuckle_point', 'rfmiddle_point', 'rfdistal_point','thknuckle_point', 16 | 'thmiddle_point', 'thdistal_point'] 17 | FINGERTIP_INDICES: [3,6,9] 18 | franka: 19 | BODIES: ['end_effector'] 20 | FINGERTIP_INDICES: [0] 21 | -------------------------------------------------------------------------------- /tcdm/envs/assets/robots/adroit/actuators.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /tcdm/envs/assets/robots/adroit/mocaps.txt: -------------------------------------------------------------------------------- 1 | 0 -0.304 0.2003 2 | -0.03299996 -0.17500012 0.20036551 3 | -0.03299996 -0.13000014 0.20040135 4 | -0.03299996 -0.09500015 0.20042922 5 | -0.01099999 -0.17100015 0.20040374 6 | -0.01099999 -0.12600017 0.20043957 7 | -0.01099999 -0.09100018 0.20046744 8 | 0.03399996 -0.18200021 0.20046665 9 | 0.03399996 -0.13700022 0.20050248 10 | 0.03399996 -0.10200023 0.20053035 11 | 0.01099999 -0.17500018 0.20043559 12 | 0.01099999 -0.13000019 0.20047143 13 | 0.01099999 -0.09500021 0.2004993 14 | -0.03398562 -0.24099294 0.19131138 15 | -0.06084491 -0.21411212 0.19129001 16 | -0.0905315 -0.18440176 0.19126639 -------------------------------------------------------------------------------- /tcdm/envs/assets/robots/dhand/actuators.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /tcdm/envs/assets/robots/dhand/mocaps.txt: -------------------------------------------------------------------------------- 1 | 0.000082818 -0.648000082 0.199958591 2 | -0.06663042 -0.46789366 0.199815167 3 | -0.074393043 -0.37723255 0.190742969 4 | -0.078828827 -0.325422106 0.190701711 5 | -0.011628897 -0.466981258 0.199814441 6 | -0.011483965 -0.375988569 0.190741978 7 | -0.011401147 -0.323988651 0.190700569 8 | 0.043369441 -0.468068852 0.199815307 9 | 0.051420831 -0.377432928 0.190743128 10 | 0.056021625 -0.325636876 0.190701882 11 | -0.054757847 -0.547912645 0.199878889 12 | -0.166845829 -0.557532121 0.199886549 13 | -0.220149891 -0.562106716 0.199890192 -------------------------------------------------------------------------------- /tcdm/envs/assets/robots/dmanus/actuators.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /tcdm/envs/assets/robots/dmanus/mocaps.txt: -------------------------------------------------------------------------------- 1 | 0.0 -0.60875 0.2000727 2 | -0.0445031 -0.4807516 0.2021037 3 | -0.0434769 -0.3937385 0.1856746 4 | -0.0434769 -0.3034885 0.1857465 5 | 0.0444968 -0.4807517 0.2022455 6 | 0.045523 -0.3937386 0.1858164 7 | 0.045523 -0.3034886 0.1858882 8 | -0.066955 -0.5936408 0.2014781 9 | -0.1915388 -0.6379372 0.1847443 10 | -0.346815 -0.6944772 0.184452 -------------------------------------------------------------------------------- /tcdm/envs/assets/robots/franka/actuators.xml: -------------------------------------------------------------------------------- 1 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /tcdm/envs/assets/robots/franka/mocaps.txt: -------------------------------------------------------------------------------- 1 | -0.0 -0.5 1.12 -------------------------------------------------------------------------------- /tcdm/envs/assets/task_trajs.yaml: -------------------------------------------------------------------------------- 1 | obj_mimic: 2 | - headphones_pass1.npz 3 | - elephant_pass1.npz 4 | - eyeglasses_pass1.npz 5 | - flute_pass1.npz 6 | - banana_pass1.npz 7 | - hand_inspect1.npz 8 | - binoculars_pass1.npz 9 | - stanfordbunny_inspect1.npz 10 | - toruslarge_inspect1.npz 11 | - alarmclock_see1.npz 12 | - fryingpan_cook2.npz 13 | - airplane_fly1.npz 14 | - cup_drink1.npz 15 | - scissors_use1.npz 16 | - cup_pour1.npz 17 | - mug_drink3.npz 18 | - waterbottle_shake1.npz 19 | - flashlight_on2.npz 20 | - wineglass_toast1.npz 21 | - piggybank_use1.npz 22 | - wineglass_drink2.npz 23 | - lightbulb_pass1.npz 24 | - wineglass_drink1.npz 25 | - mouse_use1.npz 26 | - knife_chop1.npz 27 | - airplane_pass1.npz 28 | - duck_inspect1.npz 29 | - hammer_use1.npz 30 | - stamp_stamp1.npz 31 | - train_play1.npz 32 | - toothpaste_lift.npz 33 | - watch_lift.npz 34 | - toothbrush_lift.npz 35 | - stapler_lift.npz 36 | - mouse_lift.npz 37 | - waterbottle_lift.npz 38 | - spheremedium_lift.npz 39 | - alarmclock_lift.npz 40 | - flashlight_lift.npz 41 | - duck_lift.npz 42 | - dhand_waterbottle.npz 43 | - dhand_alarmclock.npz 44 | - dhand_cup.npz 45 | - dhand_binoculars.npz 46 | - dhand_elephant.npz 47 | - dmanus_crackerbox.npz 48 | - dmanus_coffeecan.npz 49 | - spheremedium_relocate.npz 50 | -------------------------------------------------------------------------------- /tcdm/envs/assets/textures/granite.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/tcdm/envs/assets/textures/granite.png -------------------------------------------------------------------------------- /tcdm/envs/assets/textures/high_contrast_brick.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/tcdm/envs/assets/textures/high_contrast_brick.png -------------------------------------------------------------------------------- /tcdm/envs/assets/textures/marble.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/tcdm/envs/assets/textures/marble.png -------------------------------------------------------------------------------- /tcdm/envs/assets/textures/silverRaw.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/tcdm/envs/assets/textures/silverRaw.png -------------------------------------------------------------------------------- /tcdm/envs/assets/textures/white_marble_tile2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/tcdm/envs/assets/textures/white_marble_tile2.png -------------------------------------------------------------------------------- /tcdm/envs/assets/textures/wood.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/tcdm/envs/assets/textures/wood.png -------------------------------------------------------------------------------- /tcdm/envs/mujoco/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | 7 | from .physics import physics_from_mjcf 8 | from . import mj_models 9 | -------------------------------------------------------------------------------- /tcdm/envs/mujoco/mj_models/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | 7 | # import environments 8 | from .environments import TableEnv 9 | from .environments import EmptyEnv 10 | 11 | # import robots 12 | from .robots import get_robot 13 | from .robots import Adroit 14 | from .robots import DHand 15 | from .robots import DManus 16 | from .robots import Franka 17 | 18 | # import objects 19 | from .objects import get_object 20 | from .objects import AirplaneObject 21 | from .objects import AlarmClockObject 22 | from .objects import AppleObject 23 | from .objects import BananaObject 24 | from .objects import BinocularsObject 25 | from .objects import BodyObject 26 | from .objects import BowlObject 27 | from .objects import CameraObject 28 | from .objects import CoffeeCanObject 29 | from .objects import CoffeeMugObject 30 | from .objects import CrackerBoxObject 31 | from .objects import CubeLargeObject 32 | from .objects import CubeMediumObject 33 | from .objects import CubeMiddleObject 34 | from .objects import CubeSmallObject 35 | from .objects import CupObject 36 | from .objects import CylinderLargeObject 37 | from .objects import CylinderMediumObject 38 | from .objects import CylinderSmallObject 39 | from .objects import DAPGHammerObject 40 | from .objects import DoorObject 41 | from .objects import DoorknobObject 42 | from .objects import DuckObject 43 | from .objects import ElephantObject 44 | from .objects import EyeglassesObject 45 | from .objects import FlashlightObject 46 | from .objects import FluteObject 47 | from .objects import FryingPanObject 48 | from .objects import GameControllerObject 49 | from .objects import HammerObject 50 | from .objects import HandObject 51 | from .objects import HeadphonesObject 52 | from .objects import KnifeObject 53 | from .objects import LightBulbObject 54 | from .objects import MouseObject 55 | from .objects import MugObject 56 | from .objects import NailObject 57 | from .objects import PhoneObject 58 | from .objects import PiggyBankObject 59 | from .objects import PyramidLargeObject 60 | from .objects import PyramidMediumObject 61 | from .objects import PyramidSmallObject 62 | from .objects import RubberDuckObject 63 | from .objects import ScissorsObject 64 | from .objects import SphereLargeObject 65 | from .objects import SphereMediumObject 66 | from .objects import SphereSmallObject 67 | from .objects import StampObject 68 | from .objects import StanfordBunnyObject 69 | from .objects import StaplerObject 70 | from .objects import TableObject 71 | from .objects import TeapotObject 72 | from .objects import ToothbrushObject 73 | from .objects import ToothpasteObject 74 | from .objects import TorusLargeObject 75 | from .objects import TorusMediumObject 76 | from .objects import TorusSmallObject 77 | from .objects import TrainObject 78 | from .objects import WatchObject 79 | from .objects import WaterBottleObject 80 | from .objects import WineGlassObject 81 | from .objects import WristwatchObject 82 | -------------------------------------------------------------------------------- /tcdm/envs/mujoco/mj_models/base.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | 7 | class MjModel(object): 8 | """ """ 9 | 10 | def __init__(self, mjcf_model): 11 | self._mjcf_model = mjcf_model 12 | 13 | def attach(self, other): 14 | """ """ 15 | self.mjcf_model.attach(other.mjcf_model) 16 | other._post_attach(self.mjcf_model) 17 | 18 | @property 19 | def mjcf_model(self): 20 | return self._mjcf_model 21 | 22 | def _post_attach(self, base_mjfc_model): 23 | """ """ 24 | -------------------------------------------------------------------------------- /tcdm/envs/mujoco/mj_models/environments.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | 7 | from tcdm.envs import asset_abspath 8 | from dm_control import mjcf 9 | from .base import MjModel 10 | 11 | 12 | class BaseEnv(MjModel): 13 | def __init__(self, xml_path): 14 | xml_path = asset_abspath(xml_path) 15 | mjcf_model = mjcf.from_path(xml_path) 16 | super().__init__(mjcf_model) 17 | 18 | 19 | class TableEnv(BaseEnv): 20 | def __init__(self): 21 | super().__init__('environments/table.xml') 22 | 23 | 24 | class EmptyEnv(BaseEnv): 25 | def __init__(self): 26 | super().__init__('environments/empty.xml') 27 | -------------------------------------------------------------------------------- /tcdm/envs/mujoco/mj_models/robots.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | 7 | from tcdm.envs import asset_abspath 8 | from tcdm.envs.mujoco.physics import ROBOT_CONFIGS 9 | from dm_control import mjcf 10 | from .base import MjModel 11 | 12 | 13 | class BaseRobot(MjModel): 14 | def __init__(self, robot_name, limp=False, vis=False): 15 | self._robot_name = robot_name 16 | self._bodies = ROBOT_CONFIGS[robot_name]['BODIES'] 17 | 18 | base_model = mjcf.from_path(asset_abspath('robots/{}/base.xml'.format(robot_name))) 19 | self._attach_mocap = bool(limp) 20 | self._vis = vis 21 | if not self._attach_mocap: 22 | # adds motors to actuated model 23 | actuators = mjcf.from_path(asset_abspath('robots/{}/actuators.xml'.format(robot_name))) 24 | for a in actuators.actuator.all_children(): 25 | a_data = {} 26 | if a.tag == 'general': 27 | keys = ['name', 'class', 'joint', 'ctrllimited', 'ctrlrange', 28 | 'biastype', 'gainprm', 'biasprm', 'forcerange'] 29 | elif a.tag == 'position': 30 | keys = ['name', 'class', 'joint', 'ctrllimited', 'ctrlrange', 'kp', 'forcerange'] 31 | else: 32 | raise NotImplementedError 33 | for key in keys: 34 | val = getattr(a, key) 35 | if val is not None: 36 | a_data[key] = val 37 | base_model.actuator.add(a.tag, **a_data) 38 | 39 | # finished object initialization by passing final xml 40 | super().__init__(base_model) 41 | 42 | def _post_attach(self, env_mjfc): 43 | if self._attach_mocap: 44 | # adds mocaps to limp model 45 | with open(asset_abspath('robots/{}/mocaps.txt'.format(self._robot_name)), 'r') as f: 46 | mocap_locations = [[float(x) for x in l.split(' ')] for l in f.read().split('\n')] 47 | assert len(mocap_locations) == len(self._bodies), "Must specify mocap per body!" 48 | 49 | for i, p in enumerate(mocap_locations): 50 | # create body 51 | mocap_name = 'j{}_mocap'.format(i) 52 | mocap_body = env_mjfc.worldbody.add('body', mocap=True, name=mocap_name, pos=p) 53 | rgba = [0,0,1,1] if self._vis else [0,0,1,0] 54 | mocap_body.add('site', name='j{}'.format(i), size=(0.005,), rgba=rgba, pos=[0,0,0]) 55 | 56 | # create equality constraint 57 | robot_body = '{}/{}'.format(self._robot_name, self._bodies[i]) 58 | env_mjfc.equality.add('connect', body1=mocap_name, body2=robot_body, anchor=[0,0,0], 59 | solimp=[0.9,0.95,0.001], solref=[0.02,1]) 60 | 61 | 62 | class Adroit(BaseRobot): 63 | def __init__(self, limp=False, vis=False): 64 | super().__init__('adroit', limp, vis) 65 | 66 | 67 | class DHand(BaseRobot): 68 | def __init__(self, limp=False, vis=False): 69 | super().__init__('dhand', limp, vis) 70 | 71 | 72 | class DManus(BaseRobot): 73 | def __init__(self, limp=False, vis=False): 74 | super().__init__('dmanus', limp, vis) 75 | 76 | 77 | class Franka(BaseRobot): 78 | def __init__(self, limp=False, vis=False): 79 | super().__init__('franka', limp, vis) 80 | 81 | 82 | def get_robot(name): 83 | if name == 'adroit': 84 | return Adroit 85 | elif name == 'dhand': 86 | return DHand 87 | elif name == 'dmanus': 88 | return DManus 89 | elif name == 'franka': 90 | return Franka 91 | raise NotImplementedError 92 | -------------------------------------------------------------------------------- /tcdm/envs/suite/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | 7 | from tcdm.envs.wrappers import GymWrapper 8 | from tcdm.envs.suite.tcdm import TCDM_DOMAINS 9 | 10 | 11 | # Find all domains imported. 12 | _DOMAINS = TCDM_DOMAINS 13 | 14 | 15 | def load(domain_name, task_name, task_kwargs=None, environment_kwargs=None, gym_wrap=False): 16 | if domain_name not in _DOMAINS: 17 | raise ValueError("Domain {} does not exist!".format(domain_name)) 18 | 19 | domain = _DOMAINS[domain_name] 20 | if task_name not in domain: 21 | raise ValueError("Task {} does not exist in domain {}".format(task_name, domain_name)) 22 | 23 | task_kwargs = {} if task_kwargs is None else task_kwargs 24 | environment_kwargs = {} if environment_kwargs is None else environment_kwargs 25 | task_kwargs = dict(task_kwargs, environment_kwargs=environment_kwargs) 26 | env = domain[task_name](**task_kwargs) 27 | env = GymWrapper(env) if gym_wrap else env 28 | return env 29 | -------------------------------------------------------------------------------- /tcdm/envs/wrappers.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | 7 | from gym import core, spaces 8 | import numpy as np 9 | from dm_env import specs 10 | import collections 11 | 12 | 13 | def _spec_to_box(spec): 14 | """ 15 | Helper function sourced from: https://github.com/denisyarats/dmc2gym 16 | """ 17 | def extract_min_max(s): 18 | assert s.dtype == np.float64 or s.dtype == np.float32 19 | dim = np.int(np.prod(s.shape)) 20 | if type(s) == specs.Array: 21 | bound = np.inf * np.ones(dim, dtype=np.float32) 22 | return -bound, bound 23 | elif type(s) == specs.BoundedArray: 24 | zeros = np.zeros(dim, dtype=np.float32) 25 | return s.minimum + zeros, s.maximum + zeros 26 | 27 | mins, maxs = [], [] 28 | for s in spec: 29 | mn, mx = extract_min_max(s) 30 | mins.append(mn) 31 | maxs.append(mx) 32 | low = np.concatenate(mins, axis=0) 33 | high = np.concatenate(maxs, axis=0) 34 | assert low.shape == high.shape 35 | return spaces.Box(low, high, dtype=np.float32) 36 | 37 | 38 | class GymWrapper(core.Env): 39 | metadata = {"render.modes": ['rgb_array'], "video.frames_per_second": 25} 40 | 41 | def __init__(self, base_env): 42 | """ 43 | Initializes 44 | """ 45 | self._base_env = base_env 46 | self._flat_dict = False 47 | 48 | # parses and stores action space 49 | self.action_space = _spec_to_box([base_env.action_spec()]) 50 | # parses and stores (possibly nested) observation space 51 | if isinstance(base_env.observation_spec(), (dict, collections.OrderedDict)): 52 | obs_space = collections.OrderedDict() 53 | for k, v in base_env.observation_spec().items(): 54 | obs_space[k] = _spec_to_box([v]) 55 | self.observation_space = spaces.Dict(obs_space) 56 | if base_env.flat_obs: 57 | self.observation_space = self.observation_space['observations'] 58 | self._flat_dict = True 59 | else: 60 | self.observation_space = _spec_to_box([base_env.observation_spec()]) 61 | 62 | def reset(self): 63 | step = self._base_env.reset() 64 | obs = step.observation 65 | obs = obs['observations'] if self._flat_dict else obs 66 | return obs 67 | 68 | def step(self, action): 69 | step = self._base_env.step(action.astype(self.action_space.dtype)) 70 | o = step.observation 71 | o = o['observations'] if self._flat_dict else o 72 | r = step.reward 73 | done = step.last() 74 | info = self._base_env.task.step_info 75 | return o, r, done, info 76 | 77 | def render(self, mode='rgb_array', height=240, width=320, camera_id=None): 78 | assert mode == 'rgb_array', "env only supports rgb_array rendering" 79 | if camera_id is None: 80 | camera_id = self._base_env.default_camera_id 81 | return self._base_env.physics.render(height=height, width=width, 82 | camera_id=camera_id) 83 | 84 | @property 85 | def wrapped(self): 86 | return self._base_env 87 | -------------------------------------------------------------------------------- /tcdm/motion_util.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | 7 | import numpy as np 8 | from pyquaternion import Quaternion 9 | 10 | 11 | def to_quat(arr): 12 | if isinstance(arr, Quaternion): 13 | return arr.unit 14 | if len(arr.shape) == 2: 15 | return Quaternion(matrix=arr).unit 16 | elif len(arr.shape) == 1 and arr.shape[0] == 9: 17 | return Quaternion(matrix=arr.reshape((3,3))).unit 18 | return Quaternion(array=arr).unit 19 | 20 | 21 | def rotation_distance(q1, q2): 22 | delta_quat = to_quat(q2) * to_quat(q1).inverse 23 | return np.abs(delta_quat.angle) 24 | 25 | 26 | def root_to_point(root_pos, root_rotation, point): 27 | if isinstance(root_rotation, Quaternion) \ 28 | or root_rotation.shape != (3,3): 29 | root_rotation = to_quat(root_rotation).rotation_matrix 30 | root_rotation_inv = root_rotation.T 31 | delta = (point - root_pos).reshape((3,1)) 32 | return root_rotation_inv.dot(delta).reshape(-1) 33 | 34 | 35 | def to_transform_mat(R, t): 36 | pad = np.array([0, 0, 0, 1]).astype(np.float32).reshape((1, 4)) 37 | Rt = np.concatenate((R, t.reshape((3, 1))), 1) 38 | return np.concatenate((Rt, pad), 0) 39 | 40 | 41 | def axis_angle_to_rot(axis_angle): 42 | angle = max(1e-8, np.linalg.norm(axis_angle)) 43 | axis = axis_angle / angle 44 | quat = Quaternion(axis=axis, angle=angle) 45 | return quat.rotation_matrix 46 | 47 | 48 | class Pose(object): 49 | def __init__(self, pos, rotation): 50 | assert len(pos.shape) == 2, "pos should be batched" 51 | assert len(rotation.shape) >= 2, "rotation should be batched" 52 | assert pos.shape[0] == rotation.shape[0], "Batch sizes should match" 53 | self.pos = pos 54 | self.rot = rotation 55 | 56 | def __len__(self): 57 | return self.pos.shape[0] 58 | 59 | 60 | class PoseAndVelocity(Pose): 61 | def __init__(self, pos, rotation, linear_vel, angular_vel): 62 | super().__init__(pos, rotation) 63 | assert len(linear_vel.shape) == 2, "linear_vel should be batched" 64 | assert len(angular_vel.shape) == 2, "angular_vel should be batched" 65 | assert pos.shape[0] == angular_vel.shape[0], "Batch sizes should match" 66 | assert linear_vel.shape[0] == angular_vel.shape[0], "Batch sizes should match" 67 | self.linear_vel = linear_vel 68 | self.angular_vel = angular_vel 69 | -------------------------------------------------------------------------------- /tcdm/rl/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | 7 | from tcdm.rl import trainers, models 8 | -------------------------------------------------------------------------------- /tcdm/rl/models/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | 7 | -------------------------------------------------------------------------------- /tcdm/rl/models/distributions.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | 7 | import torch 8 | import torch.nn as nn 9 | from typing import Tuple, Union, List 10 | from stable_baselines3.common import distributions 11 | 12 | 13 | class DiagGaussianDistribution(distributions.DiagGaussianDistribution): 14 | """ 15 | Modified GaussianDistribution class from StableBaselines3: https://github.com/DLR-RM/stable-baselines3 16 | - Now includes support for vectors of standard deviations 17 | 18 | Gaussian distribution with diagonal covariance matrix, for continuous actions. 19 | :param action_dim: Dimension of the action space. 20 | """ 21 | 22 | def proba_distribution_net(self, latent_dim: int, log_std_init: Union[float, List[float]] = 0.0) -> Tuple[nn.Module, nn.Parameter]: 23 | """ 24 | Create the layers and parameter that represent the distribution: 25 | one output will be the mean of the Gaussian, the other parameter will be the 26 | standard deviation (log std in fact to allow negative values) 27 | :param latent_dim: Dimension of the last layer of the policy (before the action layer) 28 | :param log_std_init: Initial value for the log standard deviation 29 | :return: 30 | """ 31 | mean_actions = nn.Linear(latent_dim, self.action_dim) 32 | if isinstance(log_std_init, float): 33 | log_std = nn.Parameter(torch.ones(self.action_dim) * log_std_init, requires_grad=True) 34 | else: 35 | assert len(log_std_init) == self.action_dim, "must supply std for each action dimension" 36 | log_std = nn.Parameter(torch.Tensor(log_std_init).float(), requires_grad=True) 37 | return mean_actions, log_std 38 | -------------------------------------------------------------------------------- /tcdm/rl/trainers/__init__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | 7 | from .ppo import ppo_trainer 8 | from .sac import sac_trainer -------------------------------------------------------------------------------- /tcdm/rl/trainers/eval.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | 7 | import time, copy, imageio, wandb, os 8 | import numpy as np 9 | from tcdm.rl.trainers.util import make_env 10 | from stable_baselines3.common.callbacks import BaseCallback 11 | from stable_baselines3.common.evaluation import evaluate_policy 12 | 13 | 14 | def make_eval_env(multi_proc, n_eval_envs, **kwargs): 15 | """ 16 | Corrects environment kwargs for evaluation condition 17 | """ 18 | eval_args = copy.deepcopy(kwargs) 19 | eval_args['multi_proc'] = multi_proc 20 | eval_args['n_envs'] = n_eval_envs 21 | eval_args['vid_freq'] = None 22 | if 'rand_reset_prob' in eval_args['task_kwargs']: 23 | eval_args['task_kwargs']['rand_reset_prob'] = 0 24 | env = make_env(**eval_args) 25 | env.has_multiproc = multi_proc 26 | return env 27 | 28 | 29 | class EvalCallback(BaseCallback): 30 | def __init__(self, eval_freq, eval_env, verbose=0, n_eval_episodes=25): 31 | super().__init__(verbose) 32 | self._vid_log_dir = os.path.join(os.getcwd(), 'eval_videos/') 33 | if not os.path.exists(self._vid_log_dir): 34 | os.makedirs(self._vid_log_dir) 35 | self._eval_freq = eval_freq 36 | self._eval_env = eval_env 37 | self._n_eval_episodes = n_eval_episodes 38 | 39 | def _info_callback(self, locals, _): 40 | if locals['i'] == 0: 41 | env = locals['env'] 42 | if env.has_multiproc: 43 | pipe = env.remotes[0] 44 | pipe.send(("render", "rgb_array")) 45 | render = pipe.recv() 46 | else: 47 | render = env.envs[0].render('rgb_array') 48 | self._info_tracker['rollout_video'].append(render) 49 | 50 | if locals['done']: 51 | for k, v in locals['info'].items(): 52 | if isinstance(v, (float, int)): 53 | if k not in self._info_tracker: 54 | self._info_tracker[k] = [] 55 | self._info_tracker[k].append(v) 56 | 57 | def _on_step(self, fps=25) -> bool: 58 | if self.n_calls % self._eval_freq == 0 or self.n_calls <= 1: 59 | self._info_tracker = dict(rollout_video=[]) 60 | start_time = time.time() 61 | episode_rewards, episode_lengths = evaluate_policy( 62 | self.model, 63 | self._eval_env, 64 | n_eval_episodes=self._n_eval_episodes, 65 | render=False, 66 | deterministic=False, 67 | return_episode_rewards=True, 68 | warn=True, 69 | callback=self._info_callback, 70 | ) 71 | end_time = time.time() 72 | 73 | mean_reward, mean_length = np.mean(episode_rewards), np.mean(episode_lengths) 74 | self.logger.record('eval/time', end_time - start_time) 75 | self.logger.record('eval/mean_reward', mean_reward) 76 | self.logger.record('eval/mean_length', mean_length) 77 | for k, v in self._info_tracker.items(): 78 | if k == 'rollout_video': 79 | path = 'eval-call-{}.mp4'.format(self.n_calls) 80 | path = os.path.join(self._vid_log_dir, path) 81 | writer = imageio.get_writer(path, fps=fps) 82 | for i in v: 83 | writer.append_data(i) 84 | writer.close() 85 | wandb.log({'eval/rollout_video': wandb.Video(path)}) 86 | else: 87 | self.logger.record('eval/mean_{}'.format(k), np.mean(v)) 88 | self.logger.dump(self.num_timesteps) 89 | return True 90 | -------------------------------------------------------------------------------- /tcdm/rl/trainers/ppo.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | 7 | import torch 8 | from stable_baselines3 import PPO 9 | from tcdm.rl.trainers.util import make_env, make_policy_kwargs, \ 10 | InfoCallback, FallbackCheckpoint, \ 11 | get_warm_start 12 | from wandb.integration.sb3 import WandbCallback 13 | from tcdm.rl.models.policies import ActorCriticPolicy 14 | from tcdm.rl.trainers.eval import make_eval_env, EvalCallback 15 | from stable_baselines3.common.callbacks import CheckpointCallback 16 | 17 | 18 | def ppo_trainer(config, resume_model=None): 19 | total_timesteps = config.total_timesteps 20 | eval_freq = int(config.eval_freq // config.n_envs) 21 | save_freq = int(config.save_freq // config.n_envs) 22 | restore_freq = int(config.restore_checkpoint_freq // config.n_envs) 23 | n_steps = int(config.agent.params.n_steps // config.n_envs) 24 | multi_proc = bool(config.agent.multi_proc) 25 | env = make_env(multi_proc=multi_proc, **config.env) 26 | 27 | if resume_model: 28 | model = PPO.load(resume_model, env) 29 | model._last_obs = None 30 | reset_num_timesteps = False 31 | total_timesteps -= model.num_timesteps 32 | if total_timesteps <= 0: 33 | return model 34 | else: 35 | model = PPO( 36 | ActorCriticPolicy, 37 | env, verbose=1, 38 | tensorboard_log=f"logs/", 39 | n_steps=n_steps, 40 | gamma=config.agent.params.gamma, 41 | gae_lambda=config.agent.params.gae_lambda, 42 | learning_rate=config.agent.params.learning_rate, 43 | ent_coef=config.agent.params.ent_coef, 44 | vf_coef=config.agent.params.vf_coef, 45 | clip_range=config.agent.params.clip_range, 46 | batch_size=config.agent.params.batch_size, 47 | n_epochs=config.agent.params.n_epochs, 48 | policy_kwargs=make_policy_kwargs(config.agent.policy_kwargs) 49 | ) 50 | # initialize the agent with behavior cloning if desired 51 | if config.agent.params.warm_start_mean: 52 | warm_start = get_warm_start(config.env) 53 | bias = torch.from_numpy(warm_start) 54 | model.policy.set_action_bias(bias) 55 | reset_num_timesteps = True 56 | 57 | # initialize callbacks and train 58 | eval_env = make_eval_env(multi_proc, config.n_eval_envs, **config.env) 59 | eval_callback = EvalCallback(eval_freq, eval_env) 60 | restore_callback = FallbackCheckpoint(restore_freq) 61 | log_info = InfoCallback() 62 | checkpoint = CheckpointCallback(save_freq=save_freq, save_path=f'logs/', 63 | name_prefix='rl_models') 64 | wandb = WandbCallback(model_save_path="models/", verbose=2) 65 | return model.learn( 66 | total_timesteps=total_timesteps, 67 | callback=[log_info, eval_callback, checkpoint, restore_callback, wandb], 68 | reset_num_timesteps=reset_num_timesteps 69 | ) 70 | -------------------------------------------------------------------------------- /tcdm/rl/trainers/sac.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | 7 | import torch 8 | from stable_baselines3 import SAC 9 | from tcdm.rl.trainers.util import make_env, make_policy_kwargs, \ 10 | InfoCallback, FallbackCheckpoint, \ 11 | get_warm_start 12 | from wandb.integration.sb3 import WandbCallback 13 | from tcdm.rl.trainers.eval import make_eval_env, EvalCallback 14 | from stable_baselines3.common.callbacks import CheckpointCallback 15 | 16 | 17 | def sac_trainer(config, resume_model=None): 18 | total_timesteps = config.total_timesteps 19 | eval_freq = int(config.eval_freq // config.n_envs) 20 | save_freq = int(config.save_freq // config.n_envs) 21 | restore_freq = int(config.restore_checkpoint_freq // config.n_envs) 22 | multi_proc = bool(config.agent.multi_proc) 23 | env = make_env(multi_proc=multi_proc, **config.env) 24 | 25 | if resume_model: 26 | model = SAC.load(resume_model, env) 27 | model._last_obs = None 28 | reset_num_timesteps = False 29 | total_timesteps -= model.num_timesteps 30 | if total_timesteps <= 0: 31 | return model 32 | else: 33 | model = SAC( 34 | 'MlpPolicy', 35 | env, verbose=1, 36 | tensorboard_log=f"logs/", 37 | learning_rate=config.agent.params.learning_rate, 38 | buffer_size=config.agent.params.buffer_size, 39 | learning_starts=config.agent.params.learning_starts, 40 | batch_size=config.agent.params.batch_size, 41 | tau=config.agent.params.tau, 42 | gamma=config.agent.params.gamma, 43 | train_freq=config.agent.params.train_freq, 44 | gradient_steps=config.agent.params.gradient_steps, 45 | ent_coef=config.agent.params.ent_coef, 46 | target_update_interval=config.agent.params.target_update_interval, 47 | target_entropy=config.agent.params.target_entropy, 48 | policy_kwargs=make_policy_kwargs(config.agent.policy_kwargs) 49 | ) 50 | 51 | # add an ortho initialization into the actor 52 | actor = model.policy.actor 53 | log_std_init = config.agent.policy_kwargs.get('log_std_init', 0) 54 | for layer, gain, fill in zip((actor.mu, actor.log_std), (1e-2, 1e-3), (0, log_std_init)): 55 | torch.nn.init.orthogonal_(layer.weight, gain) 56 | layer.bias.data.fill_(fill) 57 | 58 | # initialize the agent to hover around initial state if needed 59 | if config.agent.params.warm_start_mean: 60 | warm_start = get_warm_start(config.env) 61 | ac_bias = torch.from_numpy(warm_start) 62 | ac_bias = ac_bias.type(actor.mu.bias.dtype).to(actor.mu.bias.device) 63 | actor.mu.bias.data.copy_(ac_bias) 64 | reset_num_timesteps = True 65 | 66 | # initialize callbacks and train 67 | eval_env = make_eval_env(multi_proc, config.n_eval_envs, **config.env) 68 | eval_callback = EvalCallback(eval_freq, eval_env) 69 | restore_callback = FallbackCheckpoint(restore_freq) 70 | log_info = InfoCallback() 71 | checkpoint = CheckpointCallback(save_freq=save_freq, save_path=f'logs/', 72 | name_prefix='rl_models') 73 | wandb = WandbCallback(model_save_path="models/", verbose=2) 74 | return model.learn( 75 | total_timesteps=total_timesteps, 76 | callback=[log_info, eval_callback, checkpoint, restore_callback, wandb], 77 | reset_num_timesteps=reset_num_timesteps 78 | ) 79 | -------------------------------------------------------------------------------- /tcdm/rl/trainers/util.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | 7 | import functools, gym 8 | import numpy as np 9 | from tcdm import suite 10 | from omegaconf import OmegaConf 11 | from stable_baselines3.common.monitor import Monitor 12 | from stable_baselines3.common.callbacks import BaseCallback 13 | from stable_baselines3.common.vec_env import DummyVecEnv, SubprocVecEnv, \ 14 | VecVideoRecorder 15 | 16 | 17 | class InfoCallback(BaseCallback): 18 | def _on_rollout_end(self) -> None: 19 | all_keys = {} 20 | for info in self.model.ep_info_buffer: 21 | for k, v in info.items(): 22 | if k in ('r', 't', 'l'): 23 | continue 24 | elif k not in all_keys: 25 | all_keys[k] = [] 26 | all_keys[k].append(v) 27 | 28 | for k, v in all_keys.items(): 29 | self.model.logger.record(f'env/{k}', np.mean(v)) 30 | 31 | def _on_step(self) -> bool: 32 | return True 33 | 34 | 35 | class _ObsExtractor(gym.Wrapper): 36 | def __init__(self, env, state_keyword): 37 | super().__init__(env=env) 38 | self._state_keyword = state_keyword 39 | self.observation_space = env.observation_space[state_keyword] 40 | 41 | def step(self, action): 42 | o, r, done, info = self.env.step(action) 43 | return o[self._state_keyword], r, done, info 44 | 45 | def reset(self, **kwargs): 46 | return self.env.reset(**kwargs)[self._state_keyword] 47 | 48 | 49 | class FallbackCheckpoint(BaseCallback): 50 | def __init__(self, checkpoint_freq=1, verbose=0): 51 | super().__init__(verbose) 52 | self.checkpoint_freq = checkpoint_freq 53 | 54 | def _on_step(self) -> bool: 55 | if self.n_calls % self.checkpoint_freq == 0 or self.n_calls <= 1: 56 | self.model.save('restore_checkpoint') 57 | return True 58 | 59 | 60 | def _env_maker(name, task_kwargs, env_kwargs, info_keywords, state_keyword): 61 | np.random.seed() 62 | domain, task = name.split('-') 63 | env = suite.load(domain, task, OmegaConf.to_container(task_kwargs), 64 | dict(env_kwargs), gym_wrap=True) 65 | env = Monitor(env, info_keywords=tuple(info_keywords)) 66 | env = _ObsExtractor(env, state_keyword) 67 | return env 68 | 69 | 70 | def make_env(multi_proc, n_envs, vid_freq, vid_length, **kwargs): 71 | env_maker = functools.partial(_env_maker, **kwargs) 72 | if multi_proc: 73 | env = SubprocVecEnv([env_maker for _ in range(n_envs)]) 74 | else: 75 | env = DummyVecEnv([env_maker for _ in range(n_envs)]) 76 | 77 | if vid_freq is not None: 78 | vid_freq = max(int(vid_freq // n_envs), 1) 79 | trigger = lambda x: x % vid_freq == 0 or x <= 1 80 | env = VecVideoRecorder(env, "videos/", 81 | record_video_trigger=trigger, 82 | video_length=vid_length) 83 | return env 84 | 85 | 86 | def get_warm_start(env_args): 87 | e = _env_maker(env_args.name, env_args.task_kwargs, 88 | env_args.env_kwargs, env_args.info_keywords, 89 | 'zero_ac') 90 | zero_ac = e.reset().copy().astype(np.float32) 91 | zero_ac[1] += 0.2; zero_ac[6:] += 0.2 92 | return np.clip(zero_ac, -1, 1) 93 | 94 | 95 | def make_policy_kwargs(policy_config): 96 | return OmegaConf.to_container(policy_config) 97 | -------------------------------------------------------------------------------- /train.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Meta Platforms, Inc. and affiliates. 2 | 3 | # This source code is licensed under the MIT license found in the 4 | # LICENSE file in the root directory of this source tree. 5 | 6 | 7 | import traceback 8 | import hydra, os, wandb, yaml 9 | from tcdm.rl import trainers 10 | from omegaconf import DictConfig, OmegaConf 11 | from hydra.core.hydra_config import HydraConfig 12 | 13 | 14 | def create_wandb_run(wandb_cfg, job_config, run_id=None): 15 | try: 16 | job_id = HydraConfig().get().job.num 17 | override_dirname = HydraConfig().get().job.override_dirname 18 | name = f'{wandb_cfg.sweep_name_prefix}-{job_id}' 19 | notes = f'{override_dirname}' 20 | except: 21 | name, notes = None, None 22 | return wandb.init( 23 | project=wandb_cfg.project, 24 | config=job_config, 25 | group=wandb_cfg.group, 26 | sync_tensorboard=True, 27 | monitor_gym=True, 28 | save_code=True, 29 | name=name, 30 | notes=notes, 31 | id=run_id, 32 | resume=run_id is not None 33 | ) 34 | 35 | 36 | cfg_path = os.path.dirname(__file__) 37 | cfg_path = os.path.join(cfg_path, 'experiments') 38 | @hydra.main(config_path=cfg_path, config_name="config.yaml") 39 | def train(cfg: DictConfig): 40 | try: 41 | cfg_yaml = OmegaConf.to_yaml(cfg) 42 | resume_model = cfg.resume_model 43 | if os.path.exists('exp_config.yaml'): 44 | old_config = yaml.load(open('exp_config.yaml', 'r')) 45 | params, wandb_id = old_config['params'], old_config['wandb_id'] 46 | run = create_wandb_run(cfg.wandb, params, wandb_id) 47 | resume_model = 'restore_checkpoint.zip' 48 | assert os.path.exists(resume_model), 'restore_checkpoint.zip does not exist!' 49 | else: 50 | defaults = HydraConfig.get().runtime.choices 51 | params = yaml.safe_load(cfg_yaml) 52 | params['defaults'] = {k: defaults[k] for k in ('agent', 'env')} 53 | 54 | run = create_wandb_run(cfg.wandb, params) 55 | save_dict = dict(wandb_id=run.id, params=params) 56 | yaml.dump(save_dict, open('exp_config.yaml', 'w')) 57 | print('Config:') 58 | print(cfg_yaml) 59 | 60 | if cfg.agent.name == 'PPO': 61 | trainers.ppo_trainer(cfg, resume_model) 62 | else: 63 | raise NotImplementedError 64 | wandb.finish() 65 | except: 66 | traceback.print_exc(file=open('exception.log', 'w')) 67 | with open('exception.log', 'r') as f: 68 | print(f.read()) 69 | 70 | 71 | if __name__ == '__main__': 72 | train() 73 | -------------------------------------------------------------------------------- /trajectories/airplane_fly1.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/airplane_fly1.npz -------------------------------------------------------------------------------- /trajectories/airplane_pass1.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/airplane_pass1.npz -------------------------------------------------------------------------------- /trajectories/alarmclock_lift.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/alarmclock_lift.npz -------------------------------------------------------------------------------- /trajectories/alarmclock_see1.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/alarmclock_see1.npz -------------------------------------------------------------------------------- /trajectories/banana_pass1.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/banana_pass1.npz -------------------------------------------------------------------------------- /trajectories/binoculars_pass1.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/binoculars_pass1.npz -------------------------------------------------------------------------------- /trajectories/cup_drink1.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/cup_drink1.npz -------------------------------------------------------------------------------- /trajectories/cup_pour1.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/cup_pour1.npz -------------------------------------------------------------------------------- /trajectories/dhand_alarmclock.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/dhand_alarmclock.npz -------------------------------------------------------------------------------- /trajectories/dhand_binoculars.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/dhand_binoculars.npz -------------------------------------------------------------------------------- /trajectories/dhand_cup.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/dhand_cup.npz -------------------------------------------------------------------------------- /trajectories/dhand_elephant.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/dhand_elephant.npz -------------------------------------------------------------------------------- /trajectories/dhand_waterbottle.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/dhand_waterbottle.npz -------------------------------------------------------------------------------- /trajectories/dmanus_coffeecan.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/dmanus_coffeecan.npz -------------------------------------------------------------------------------- /trajectories/dmanus_crackerbox.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/dmanus_crackerbox.npz -------------------------------------------------------------------------------- /trajectories/dmanus_sim2real.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/dmanus_sim2real.npz -------------------------------------------------------------------------------- /trajectories/door_open.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/door_open.npz -------------------------------------------------------------------------------- /trajectories/duck_inspect1.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/duck_inspect1.npz -------------------------------------------------------------------------------- /trajectories/duck_lift.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/duck_lift.npz -------------------------------------------------------------------------------- /trajectories/elephant_pass1.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/elephant_pass1.npz -------------------------------------------------------------------------------- /trajectories/eyeglasses_pass1.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/eyeglasses_pass1.npz -------------------------------------------------------------------------------- /trajectories/flashlight_lift.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/flashlight_lift.npz -------------------------------------------------------------------------------- /trajectories/flashlight_on2.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/flashlight_on2.npz -------------------------------------------------------------------------------- /trajectories/flute_pass1.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/flute_pass1.npz -------------------------------------------------------------------------------- /trajectories/fryingpan_cook2.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/fryingpan_cook2.npz -------------------------------------------------------------------------------- /trajectories/goal_renders/airplane_fly1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/airplane_fly1.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/airplane_pass1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/airplane_pass1.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/alarmclock_lift.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/alarmclock_lift.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/alarmclock_see1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/alarmclock_see1.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/banana_pass1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/banana_pass1.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/binoculars_pass1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/binoculars_pass1.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/cup_drink1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/cup_drink1.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/cup_pour1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/cup_pour1.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/dhand_alarmclock.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/dhand_alarmclock.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/dhand_binoculars.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/dhand_binoculars.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/dhand_cup.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/dhand_cup.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/dhand_elephant.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/dhand_elephant.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/dhand_waterbottle.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/dhand_waterbottle.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/dmanus_coffeecan.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/dmanus_coffeecan.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/dmanus_crackerbox.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/dmanus_crackerbox.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/dmanus_sim2real.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/dmanus_sim2real.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/door_open.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/door_open.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/duck_inspect1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/duck_inspect1.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/duck_lift.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/duck_lift.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/elephant_pass1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/elephant_pass1.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/eyeglasses_pass1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/eyeglasses_pass1.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/flashlight_lift.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/flashlight_lift.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/flashlight_on2.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/flashlight_on2.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/flute_pass1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/flute_pass1.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/fryingpan_cook2.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/fryingpan_cook2.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/hammer_strike.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/hammer_strike.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/hammer_use1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/hammer_use1.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/hand_inspect1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/hand_inspect1.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/headphones_pass1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/headphones_pass1.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/knife_chop1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/knife_chop1.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/lightbulb_pass1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/lightbulb_pass1.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/mouse_lift.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/mouse_lift.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/mouse_use1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/mouse_use1.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/mug_drink3.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/mug_drink3.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/piggybank_use1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/piggybank_use1.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/scissors_use1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/scissors_use1.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/spheremedium_lift.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/spheremedium_lift.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/spheremedium_relocate.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/spheremedium_relocate.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/stamp_stamp1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/stamp_stamp1.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/stanfordbunny_inspect1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/stanfordbunny_inspect1.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/stapler_lift.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/stapler_lift.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/toothbrush_lift.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/toothbrush_lift.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/toothpaste_lift.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/toothpaste_lift.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/toruslarge_inspect1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/toruslarge_inspect1.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/train_play1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/train_play1.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/watch_lift.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/watch_lift.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/waterbottle_lift.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/waterbottle_lift.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/waterbottle_shake1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/waterbottle_shake1.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/wineglass_drink1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/wineglass_drink1.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/wineglass_drink2.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/wineglass_drink2.mp4 -------------------------------------------------------------------------------- /trajectories/goal_renders/wineglass_toast1.mp4: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/goal_renders/wineglass_toast1.mp4 -------------------------------------------------------------------------------- /trajectories/hammer_strike.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/hammer_strike.npz -------------------------------------------------------------------------------- /trajectories/hammer_use1.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/hammer_use1.npz -------------------------------------------------------------------------------- /trajectories/hand_inspect1.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/hand_inspect1.npz -------------------------------------------------------------------------------- /trajectories/headphones_pass1.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/headphones_pass1.npz -------------------------------------------------------------------------------- /trajectories/knife_chop1.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/knife_chop1.npz -------------------------------------------------------------------------------- /trajectories/lightbulb_pass1.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/lightbulb_pass1.npz -------------------------------------------------------------------------------- /trajectories/mouse_lift.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/mouse_lift.npz -------------------------------------------------------------------------------- /trajectories/mouse_use1.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/mouse_use1.npz -------------------------------------------------------------------------------- /trajectories/mug_drink3.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/mug_drink3.npz -------------------------------------------------------------------------------- /trajectories/piggybank_use1.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/piggybank_use1.npz -------------------------------------------------------------------------------- /trajectories/scissors_use1.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/scissors_use1.npz -------------------------------------------------------------------------------- /trajectories/spheremedium_lift.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/spheremedium_lift.npz -------------------------------------------------------------------------------- /trajectories/spheremedium_relocate.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/spheremedium_relocate.npz -------------------------------------------------------------------------------- /trajectories/stamp_stamp1.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/stamp_stamp1.npz -------------------------------------------------------------------------------- /trajectories/stanfordbunny_inspect1.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/stanfordbunny_inspect1.npz -------------------------------------------------------------------------------- /trajectories/stapler_lift.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/stapler_lift.npz -------------------------------------------------------------------------------- /trajectories/toothbrush_lift.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/toothbrush_lift.npz -------------------------------------------------------------------------------- /trajectories/toothpaste_lift.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/toothpaste_lift.npz -------------------------------------------------------------------------------- /trajectories/toruslarge_inspect1.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/toruslarge_inspect1.npz -------------------------------------------------------------------------------- /trajectories/train_play1.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/train_play1.npz -------------------------------------------------------------------------------- /trajectories/watch_lift.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/watch_lift.npz -------------------------------------------------------------------------------- /trajectories/waterbottle_lift.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/waterbottle_lift.npz -------------------------------------------------------------------------------- /trajectories/waterbottle_shake1.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/waterbottle_shake1.npz -------------------------------------------------------------------------------- /trajectories/wineglass_drink1.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/wineglass_drink1.npz -------------------------------------------------------------------------------- /trajectories/wineglass_drink2.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/wineglass_drink2.npz -------------------------------------------------------------------------------- /trajectories/wineglass_toast1.npz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/facebookresearch/TCDM/d9bf981ca7b37c49dcb9e7edef07896e029e4f44/trajectories/wineglass_toast1.npz --------------------------------------------------------------------------------