Skip to content

Commit

Permalink
Merge remote-tracking branch 'Rofunc-secret/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
Skylark0924 committed Jul 20, 2024
2 parents 07746bc + c8775b1 commit 9e99ff3
Show file tree
Hide file tree
Showing 720 changed files with 345,378 additions and 3,553 deletions.
21 changes: 20 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -185,4 +185,23 @@ rofunc/simulator/assets/urdf/ycb/*

examples/learning_rl/saved_runs/
saved_runs/
wandb
wandb

*_optitrack2bruce.npy
*_optitrack2bruce_dof_states.npy
*_optitrack2h1.npy
*_optitrack2h1_dof_states.npy
*_optitrack2walker.npy
*_optitrack2walker_dof_states.npy
*_optitrack2hotu.npy
*_optitrack2hotu_dof_states.npy
*_optitrack2zju.npy
*_optitrack2zju_dof_states.npy
*_optitrack2curi.npy
*_optitrack2curi_dof_states.npy
rofunc/simulator/assets/urdf/themis/archive/
/rofunc/utils/robolab/rdf/data/

examples/data/robolab/rdf/

rofunc/simulator/assets/urdf/franka_description/rdf/
1 change: 1 addition & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
> - 🚄 for planning and control updates
> - 🖼️ for Visualab updates
> - 📈 for Datalab updates
> - 🦾 for Robolab updates
> - 📚 for documentation updates
> - 🎮 for simulator updates
> - 🐛 for bug fixes
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
30 changes: 30 additions & 0 deletions examples/data/hotu2/20240509/all_bruce_motion.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
motions:
- file: "Boxing_Take 2024-05-09 04.19.43 PM_optitrack2bruce.npy"
weight: 1
- file: "Chest pressing_Take 2024-05-09 04.21.46 PM_optitrack2bruce.npy"
weight: 1
- file: "Finger movememnt_Take 2024-05-09 04.17.53 PM_optitrack2bruce.npy"
weight: 1
- file: "Handshake_Take 2024-05-09 04.20.17 PM_optitrack2bruce.npy"
weight: 1
- file: "Hook_Take 2024-05-09 04.34.03 PM_optitrack2bruce.npy"
weight: 1
- file: "Jumping_Take 2024-05-09 04.15.38 PM_optitrack2bruce.npy"
weight: 1
- file: "Kung fu_Take 2024-05-09 04.19.23 PM_optitrack2bruce.npy"
weight: 1
- file: "Leg stretch_Take 2024-05-09 04.21.17 PM_optitrack2bruce.npy"
weight: 1
- file: "Moving box_Take 2024-05-09 04.33.08 PM_optitrack2bruce.npy"
weight: 1
- file: "Ramdom (good)_Take 2024-05-09 04.49.16 PM_optitrack2bruce.npy"
weight: 1
- file: "Slapping_Take 2024-05-09 04.20.43 PM_optitrack2bruce.npy"
weight: 1
- file: "Squating_Take 2024-05-09 04.21.34 PM_optitrack2bruce.npy"
weight: 1
- file: "Thumbs up_Take 2024-05-09 04.33.36 PM_optitrack2bruce.npy"
weight: 1
- file: "Waving hand_Take 2024-05-09 04.20.29 PM_optitrack2bruce.npy"
weight: 1

30 changes: 30 additions & 0 deletions examples/data/hotu2/20240509/all_h1_motion.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
motions:
- file: "Boxing_Take 2024-05-09 04.19.43 PM_optitrack2h1.npy"
weight: 1
- file: "Chest pressing_Take 2024-05-09 04.21.46 PM_optitrack2h1.npy"
weight: 1
- file: "Finger movememnt_Take 2024-05-09 04.17.53 PM_optitrack2h1.npy"
weight: 1
- file: "Handshake_Take 2024-05-09 04.20.17 PM_optitrack2h1.npy"
weight: 1
- file: "Hook_Take 2024-05-09 04.34.03 PM_optitrack2h1.npy"
weight: 1
- file: "Jumping_Take 2024-05-09 04.15.38 PM_optitrack2h1.npy"
weight: 1
- file: "Kung fu_Take 2024-05-09 04.19.23 PM_optitrack2h1.npy"
weight: 1
- file: "Leg stretch_Take 2024-05-09 04.21.17 PM_optitrack2h1.npy"
weight: 1
- file: "Moving box_Take 2024-05-09 04.33.08 PM_optitrack2h1.npy"
weight: 1
- file: "Ramdom (good)_Take 2024-05-09 04.49.16 PM_optitrack2h1.npy"
weight: 1
- file: "Slapping_Take 2024-05-09 04.20.43 PM_optitrack2h1.npy"
weight: 1
- file: "Squating_Take 2024-05-09 04.21.34 PM_optitrack2h1.npy"
weight: 1
- file: "Thumbs up_Take 2024-05-09 04.33.36 PM_optitrack2h1.npy"
weight: 1
- file: "Waving hand_Take 2024-05-09 04.20.29 PM_optitrack2h1.npy"
weight: 1

30 changes: 30 additions & 0 deletions examples/data/hotu2/20240509/all_hotu_motion.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
motions:
- file: "Boxing_Take 2024-05-09 04.19.43 PM_optitrack2hotu.npy"
weight: 1
- file: "Chest pressing_Take 2024-05-09 04.21.46 PM_optitrack2hotu.npy"
weight: 1
- file: "Finger movememnt_Take 2024-05-09 04.17.53 PM_optitrack2hotu.npy"
weight: 1
- file: "Handshake_Take 2024-05-09 04.20.17 PM_optitrack2hotu.npy"
weight: 1
- file: "Hook_Take 2024-05-09 04.34.03 PM_optitrack2hotu.npy"
weight: 1
- file: "Jumping_Take 2024-05-09 04.15.38 PM_optitrack2hotu.npy"
weight: 1
- file: "Kung fu_Take 2024-05-09 04.19.23 PM_optitrack2hotu.npy"
weight: 1
- file: "Leg stretch_Take 2024-05-09 04.21.17 PM_optitrack2hotu.npy"
weight: 1
- file: "Moving box_Take 2024-05-09 04.33.08 PM_optitrack2hotu.npy"
weight: 1
- file: "Ramdom (good)_Take 2024-05-09 04.49.16 PM_optitrack2hotu.npy"
weight: 1
- file: "Slapping_Take 2024-05-09 04.20.43 PM_optitrack2hotu.npy"
weight: 1
- file: "Squating_Take 2024-05-09 04.21.34 PM_optitrack2hotu.npy"
weight: 1
- file: "Thumbs up_Take 2024-05-09 04.33.36 PM_optitrack2hotu.npy"
weight: 1
- file: "Waving hand_Take 2024-05-09 04.20.29 PM_optitrack2hotu.npy"
weight: 1

30 changes: 30 additions & 0 deletions examples/data/hotu2/20240509/all_walker_motion.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
motions:
- file: "Boxing_Take 2024-05-09 04.19.43 PM_optitrack2walker.npy"
weight: 1
- file: "Chest pressing_Take 2024-05-09 04.21.46 PM_optitrack2walker.npy"
weight: 1
- file: "Finger movememnt_Take 2024-05-09 04.17.53 PM_optitrack2walker.npy"
weight: 1
- file: "Handshake_Take 2024-05-09 04.20.17 PM_optitrack2walker.npy"
weight: 1
- file: "Hook_Take 2024-05-09 04.34.03 PM_optitrack2walker.npy"
weight: 1
- file: "Jumping_Take 2024-05-09 04.15.38 PM_optitrack2walker.npy"
weight: 1
- file: "Kung fu_Take 2024-05-09 04.19.23 PM_optitrack2walker.npy"
weight: 1
- file: "Leg stretch_Take 2024-05-09 04.21.17 PM_optitrack2walker.npy"
weight: 1
- file: "Moving box_Take 2024-05-09 04.33.08 PM_optitrack2walker.npy"
weight: 1
- file: "Ramdom (good)_Take 2024-05-09 04.49.16 PM_optitrack2walker.npy"
weight: 1
- file: "Slapping_Take 2024-05-09 04.20.43 PM_optitrack2walker.npy"
weight: 1
- file: "Squating_Take 2024-05-09 04.21.34 PM_optitrack2walker.npy"
weight: 1
- file: "Thumbs up_Take 2024-05-09 04.33.36 PM_optitrack2walker.npy"
weight: 1
- file: "Waving hand_Take 2024-05-09 04.20.29 PM_optitrack2walker.npy"
weight: 1

30 changes: 30 additions & 0 deletions examples/data/hotu2/20240509/all_zju_motion.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
motions:
- file: "Boxing_Take 2024-05-09 04.19.43 PM_optitrack2zju.npy"
weight: 1
- file: "Chest pressing_Take 2024-05-09 04.21.46 PM_optitrack2zju.npy"
weight: 1
# - file: "Finger movememnt_Take 2024-05-09 04.17.53 PM_optitrack2zju.npy"
# weight: 1
- file: "Handshake_Take 2024-05-09 04.20.17 PM_optitrack2zju.npy"
weight: 1
- file: "Hook_Take 2024-05-09 04.34.03 PM_optitrack2zju.npy"
weight: 1
- file: "Jumping_Take 2024-05-09 04.15.38 PM_optitrack2zju.npy"
weight: 1
- file: "Kung fu_Take 2024-05-09 04.19.23 PM_optitrack2zju.npy"
weight: 1
- file: "Leg stretch_Take 2024-05-09 04.21.17 PM_optitrack2zju.npy"
weight: 1
- file: "Moving box_Take 2024-05-09 04.33.08 PM_optitrack2zju.npy"
weight: 1
- file: "Ramdom (good)_Take 2024-05-09 04.49.16 PM_optitrack2zju.npy"
weight: 1
- file: "Slapping_Take 2024-05-09 04.20.43 PM_optitrack2zju.npy"
weight: 1
- file: "Squating_Take 2024-05-09 04.21.34 PM_optitrack2zju.npy"
weight: 1
- file: "Thumbs up_Take 2024-05-09 04.33.36 PM_optitrack2zju.npy"
weight: 1
- file: "Waving hand_Take 2024-05-09 04.20.29 PM_optitrack2zju.npy"
weight: 1

Binary file not shown.
Binary file added examples/data/hotu2/test_data_01_optitrack2h1.npy
Binary file not shown.
Binary file modified examples/data/hotu2/test_data_01_optitrack2hotu.npy
Binary file not shown.
Binary file not shown.
Binary file modified examples/data/hotu2/test_data_02_optitrack2hotu.npy
Binary file not shown.
Binary file modified examples/data/hotu2/test_data_03_optitrack2hotu.npy
Binary file not shown.
Binary file modified examples/data/hotu2/test_data_04_optitrack2hotu.npy
Binary file not shown.
Binary file not shown.
Binary file added examples/data/hotu2/test_data_05_optitrack.fbx
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added examples/data/hotu2/test_data_05_optitrack2h1.npy
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@


def inference(custom_args):
view_motion_config = load_view_motion_config(custom_args.config_name)
task_name = "HumanoidASEViewMotion"
args_overrides = [
f"task={task_name}",
Expand All @@ -26,11 +25,7 @@ def inference(custom_args):
]
cfg = get_config("./learning/rl", "config", args=args_overrides)
cfg.task.env.motion_file = custom_args.motion_file

# Overwrite
cfg.task.env.asset.assetFileName = view_motion_config["asset_name"]
cfg.task.env.asset.assetBodyNum = view_motion_config["asset_body_num"]
cfg.task.env.asset.assetJointNum = view_motion_config["asset_joint_num"]
cfg.task.env.asset.assetFileName = custom_args.asset

cfg_dict = omegaconf_to_dict(cfg.task)

Expand Down Expand Up @@ -59,12 +54,16 @@ def inference(custom_args):
gpu_id = 1

parser = argparse.ArgumentParser()
# Find or define your own config in `rofunc/config/view_motion`
parser.add_argument("--config_name", type=str, default="HOTUHumanoid")
# Available types of asset file path:
# 1. mjcf/hotu_humanoid_w_qbhand_no_virtual.xml
# 2. mjcf/amp_humanoid_sword_shield.xml
# 3. mjcf/hotu/hotu_humanoid.xml
# 4. mjcf/amp_humanoid.xml
parser.add_argument("--asset", type=str, default="mjcf/hotu/hotu_humanoid.xml")
# Available types of motion file path:
# 1. test data provided by rofunc: `examples/data/amp/*.npy`
# 2. custom motion file with absolute path
parser.add_argument("--motion_file", type=str, default="examples/data/amp/ase_humanoid_jog.npy")
parser.add_argument("--motion_file", type=str, default="/home/ubuntu/Github/HOTU/hotu/data/hotu/010_amp.npy")
custom_args = parser.parse_args()

inference(custom_args)
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
"""
HumanoidAMP (RofuncRL)
===========================
Humanoid backflip/walk/run/dance/hop, trained by RofuncRL
"""

import isaacgym
import argparse

from rofunc.config.utils import omegaconf_to_dict, get_config
from rofunc.learning.RofuncRL.tasks import Tasks
from rofunc.learning.RofuncRL.trainers import Trainers
from rofunc.learning.pre_trained_models.download import model_zoo
from rofunc.learning.utils.utils import set_seed


def train(custom_args):
# Config task and trainer parameters for Isaac Gym environments
args_overrides = ["task={}".format(custom_args.task),
"train={}{}RofuncRL".format(custom_args.task, custom_args.agent.upper()),
"device_id={}".format(custom_args.sim_device),
"rl_device=cuda:{}".format(custom_args.rl_device),
"headless={}".format(custom_args.headless),
"num_envs={}".format(custom_args.num_envs)]
cfg = get_config('./learning/rl', 'config', args=args_overrides)
cfg.task.env.motion_file = custom_args.motion_file
cfg_dict = omegaconf_to_dict(cfg.task)

set_seed(cfg.train.Trainer.seed)

# Instantiate the Isaac Gym environment
env = Tasks().task_map[custom_args.task](cfg=cfg_dict,
rl_device=cfg.rl_device,
sim_device=f'cuda:{cfg.device_id}',
graphics_device_id=cfg.device_id,
headless=cfg.headless,
virtual_screen_capture=cfg.capture_video, # TODO: check
force_render=cfg.force_render)

# Instantiate the RL trainer
trainer = Trainers().trainer_map[custom_args.agent](cfg=cfg,
env=env,
device=cfg.rl_device,
env_name=custom_args.task)
if custom_args.ckpt_path is not None:
trainer.agent.load_ckpt(custom_args.ckpt_path)
# Start training
trainer.train()


def inference(custom_args):
# Config task and trainer parameters for Isaac Gym environments
args_overrides = ["task={}".format(custom_args.task),
"train={}{}RofuncRL".format(custom_args.task, custom_args.agent.upper()),
"device_id={}".format(custom_args.sim_device),
"rl_device=cuda:{}".format(custom_args.rl_device),
"headless={}".format(False),
"num_envs={}".format(16)]
cfg = get_config('./learning/rl', 'config', args=args_overrides)
cfg.task.env.motion_file = custom_args.motion_file
cfg_dict = omegaconf_to_dict(cfg.task)

set_seed(cfg.train.Trainer.seed)

# Instantiate the Isaac Gym environment
infer_env = Tasks().task_map[custom_args.task](cfg=cfg_dict,
rl_device=cfg.rl_device,
sim_device=f'cuda:{cfg.device_id}',
graphics_device_id=cfg.device_id,
headless=cfg.headless,
virtual_screen_capture=cfg.capture_video, # TODO: check
force_render=cfg.force_render)

# Instantiate the RL trainer
trainer = Trainers().trainer_map[custom_args.agent](cfg=cfg,
env=infer_env,
device=cfg.rl_device,
env_name=custom_args.task,
inference=True)

# load checkpoint
if custom_args.ckpt_path is None:
custom_args.ckpt_path = model_zoo(name=f"{custom_args.task}.pth")
trainer.agent.load_ckpt(custom_args.ckpt_path)

# Start inference
trainer.inference()


if __name__ == '__main__':
gpu_id = 0

parser = argparse.ArgumentParser()
# Available tasks: HumanoidAMP_backflip, HumanoidAMP_walk, HumanoidAMP_run, HumanoidAMP_dance, HumanoidAMP_hop
parser.add_argument("--task", type=str, default="HumanoidAMP")
parser.add_argument("--motion_file", type=str, default="/home/ubuntu/Github/HOTU/hotu/data/hotu/011_amp.npy")
parser.add_argument("--agent", type=str, default="amp") # Available agent: amp
parser.add_argument("--num_envs", type=int, default=4096)
parser.add_argument("--sim_device", type=int, default=0)
parser.add_argument("--rl_device", type=int, default=gpu_id)
parser.add_argument("--headless", type=str, default="False")
parser.add_argument("--inference", action="store_true", help="turn to inference mode while adding this argument")
parser.add_argument("--ckpt_path", type=str,
default="/home/ubuntu/Github/SmartEase/Rofunc-secret/examples/learning_rl/IsaacGym_RofuncRL/runs/RofuncRL_AMPTrainer_HumanoidAMP_24-03-26_18-01-15-506194/checkpoints/ckpt_100000.pth")
custom_args = parser.parse_args()

if not custom_args.inference:
train(custom_args)
else:
inference(custom_args)
Loading

0 comments on commit 9e99ff3

Please sign in to comment.