Skip to content

Commit

Permalink
tasks
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhengyiLuo committed Aug 3, 2024
1 parent 1f38d4c commit a80b3e1
Show file tree
Hide file tree
Showing 9 changed files with 259 additions and 10 deletions.
21 changes: 17 additions & 4 deletions README.MD
Original file line number Diff line number Diff line change
Expand Up @@ -96,25 +96,38 @@ python phc/run_hydra.py env.task=HumanoidImDistillGetup env=env_im_vae exp_name=

Speed:
```
python phc/run_hydra.py env.task=HumanoidSpeedZ env=env_pulse_amp exp_name=pulse_speed robot.real_weight_porpotion_boxes=False learning=pulse_z_task env.models=['output/HumanoidIm/pulse_vae_iclr/Humanoid.pth'] env.motion_file=[insert your data pkl]
python phc/run_hydra.py env.task=HumanoidSpeedZ env=env_pulse_amp exp_name=pulse_speed robot.real_weight_porpotion_boxes=False learning=pulse_z_task env.models=['output/HumanoidIm/pulse_vae_iclr/Humanoid.pth'] env.motion_file=sample_data/amass_isaac_simple_run_upright_slim.pkl
```

Reach:
```
python phc/run_hydra.py env.task=HumanoidReachZ env=env_pulse_amp exp_name=pulse_reach robot.real_weight_porpotion_boxes=False learning=pulse_z_task env.models=['output/HumanoidIm/pulse_vae_iclr/Humanoid.pth'] env.motion_file=[insert your data pkl] +env.tarSpeed=1.0 +env.tarChangeStepsMin=50 +env.tarChangeStepsMax=100 +env.tarDistMax=1 +env.tarHeightMin=0.2 +env.tarHeightMax=2.0 +env.reachBodyName="R_Hand"
python phc/run_hydra.py env.task=HumanoidReachZ env=env_pulse_amp exp_name=pulse_reach robot.real_weight_porpotion_boxes=False learning=pulse_z_task env.models=['output/HumanoidIm/pulse_vae_iclr/Humanoid.pth'] env.motion_file=sample_data/amass_isaac_simple_run_upright_slim.pkl +env.tarSpeed=1.0 +env.tarChangeStepsMin=50 +env.tarChangeStepsMax=100 +env.tarDistMax=1 +env.tarHeightMin=0.2 +env.tarHeightMax=2.0 +env.reachBodyName="R_Hand"
```

Strike:
```
python phc/run_hydra.py env.task=HumanoidStrikeZ env=env_pulse_amp exp_name=pulse_strike robot.real_weight_porpotion_boxes=False learning=pulse_z_task env.models=['output/HumanoidIm/pulse_vae_iclr/Humanoid.pth'] env.motion_file=[insert your data pkl] +env.strikeBodyNames=["R_Hand","R_Wrist","R_Elbow"]
python phc/run_hydra.py env.task=HumanoidStrikeZ env=env_pulse_amp exp_name=pulse_strike robot.real_weight_porpotion_boxes=False learning=pulse_z_task env.models=['output/HumanoidIm/pulse_vae_iclr/Humanoid.pth'] env.motion_file=sample_data/amass_isaac_simple_run_upright_slim.pkl +env.strikeBodyNames=["R_Hand","R_Wrist","R_Elbow"]
```

Terrain
```
python phc/run_hydra.py env.task=HumanoidPedestrianTerrainZ env=env_pulse_terrain exp_name=pulse_terrain robot.real_weight_porpotion_boxes=False learning=pulse_z_task env.models=['output/HumanoidIm/pulse_vae_iclr/Humanoid.pth'] env.motion_file=sample_data/amass_isaac_simple_run_upright_slim.pkl
```

VR Controller Tracking
```
python phc/run_hydra.py env.task=HumanoidIm env=env_pulse_im exp_name=pulse_vr robot.real_weight_porpotion_boxes=False learning=pulse_z_task env.models=['output/HumanoidIm/pulse_vae_iclr/Humanoid.pth'] env.motion_file=[insert amass data]
```






## Testing

## Training
For testing, append `epoch=-1 test=True env.num_envs=1 headless=False no_virtual_display=True` to the command



Expand Down
3 changes: 2 additions & 1 deletion download_data.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ gdown https://drive.google.com/uc?id=1bLp4SNIZROMB7Sxgt0Mh4-4BLOPGV9_U -O sampl
gdown https://drive.google.com/uc?id=1arpCsue3Knqttj75Nt9Mwo32TKC4TYDx -O sample_data/ # all shapes from AMASS
gdown https://drive.google.com/uc?id=1fFauJE0W0nJfihUvjViq9OzmFfHo_rq0 -O sample_data/ # sample standing neutral data.
gdown https://drive.google.com/uc?id=1uzFkT2s_zVdnAohPWHOLFcyRDq372Fmc -O sample_data/ # amass_occlusion_v3
gdown https://drive.google.com/uc?id=1BDUJ3nlub9tv1fF0UMANVUryJo1h5-lo -O sample_data/ # amass_isaac_simple_run_upright_slim
gdown https://drive.google.com/uc?id=1ztyljPCzeRwQEJqtlME90gZwMXLhGTOQ -O output/HumanoidIm/pulse_vae_iclr/
gdown https://drive.google.com/uc?id=1S7_9LesLjfsFYqi4Ps6Sjzyuyun0Oaxi -O output/HumanoidIm/pulse_vae_x/
gdown https://drive.google.com/uc?id=1JbK9Vzo1bEY8Pig6D92yAUv8l-1rKWo3 -O output/HumanoidIm/phc_comp_3/
gdown https://drive.google.com/uc?id=1pS1bRUbKFDp6o6ZJ9XSFaBlXv6_PrhNc -O output/HumanoidIm/phc_3/
gdown https://drive.google.com/uc?id=1pS1bRUbKFDp6o6ZJ9XSFaBlXv6_PrhNc -O output/HumanoidIm/phc_3/
62 changes: 62 additions & 0 deletions phc/data/assets/urdf/strike_target.urdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?xml version="1.0"?>
<robot name="object">
<link name="object">
<visual>
<origin xyz="0 0 0"/>
<geometry>
<box size="0.4 0.4 1.8"/>
</geometry>
<material name="mat">
<color rgba="0.7 0.8 0.9 1"/>
</material>
</visual>

<visual>
<origin xyz="-0.12 0.2 0.5"/>
<geometry>
<box size="0.14 0.04 0.04"/>
</geometry>
<material name="mat">
<color rgba="0.3 0.3 0.3 1"/>
</material>
</visual>

<visual>
<origin xyz="0.12 0.2 0.5"/>
<geometry>
<box size="0.14 0.04 0.04"/>
</geometry>
<material name="mat">
<color rgba="0.3 0.3 0.3 1"/>
</material>
</visual>

<visual>
<origin xyz="0.03 0.2 0.35" rpy="0 0.8 0"/>
<geometry>
<box size="0.11 0.04 0.04"/>
</geometry>
<material name="mat">
<color rgba="0.3 0.3 0.3 1"/>
</material>
</visual>

<visual>
<origin xyz="-0.03 0.2 0.35" rpy="0 -0.8 0"/>
<geometry>
<box size="0.11 0.04 0.04"/>
</geometry>
<material name="mat">
<color rgba="0.3 0.3 0.3 1"/>
</material>
</visual>


<collision>
<origin xyz="0 0 0"/>
<geometry>
<box size="0.4 0.4 1.8"/>
</geometry>
</collision>
</link>
</robot>
77 changes: 77 additions & 0 deletions phc/data/cfg/env/env_pulse_im.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
task: HumanoidSpeedZ
motion_file: ""
num_envs: 1536
env_spacing: 5
episode_length: 300
isFlagrun: False
enable_debug_vis: False

embedding_norm: 1
embedding_size: 32

z_readout: False
fitting: False

use_vae_prior: True
use_vae_sphere_posterior: False
use_vae_fixed_prior: False
use_vae_sphere_prior: False
use_vae_prior_loss: False

distill: false
save_kin_info: False
distill_z_model: false
z_read: False
distill_model_config:
embedding_norm: 1
embedding_size: 32
fut_tracks_dropout: False
fut_tracks: False
trajSampleTimestepInv: 5
numTrajSamples: 10
z_activation: "silu"
z_type: "vae"
models: ['output/HumanoidIm/pulse_vae_iclr/Humanoid.pth']

power_reward: False
power_usage_reward: False
power_usage_coefficient: 0.01

has_shape_obs: false
has_shape_obs_disc: false
has_shape_variation: False
shape_resampling_interval: 250

# Task specific parameters
tarSpeedMin: 0.0
tarSpeedMax: 5
speedChangeStepsMin: 100
speedChangeStepsMax: 200
enableTaskObs: True

control_mode: "isaac_pd"
power_scale: 1.0
controlFrequencyInv: 2 # 30 Hz
stateInit: "Random"
hybridInitProb: 0.5
numAMPObsSteps: 10

local_root_obs: True
root_height_obs: True
key_bodies: ["R_Ankle", "L_Ankle", "R_Wrist", "L_Wrist"]
contact_bodies: ["R_Ankle", "L_Ankle", "R_Toe", "L_Toe"]
reset_bodies: ["Head", "L_Hand", "R_Hand"]
trackBodies: ["Head", "L_Hand", "R_Hand"]
terminationHeight: 0.15
enableEarlyTermination: True
terminationDistance: 0.25

asset:
assetRoot: "/"
assetFileName: "mjcf/smpl_humanoid.xml"

plane:
staticFriction: 1.0
dynamicFriction: 1.0
restitution: 0.0

94 changes: 94 additions & 0 deletions phc/data/cfg/env/env_pulse_terrain.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
task: HumanoidSpeedZ
motion_file: ""
num_envs: 1536
env_spacing: 5
episode_length: 300
isFlagrun: False
enable_debug_vis: False

embedding_norm: 1
embedding_size: 32

z_readout: False
fitting: False

use_vae_prior: True
use_vae_sphere_posterior: False
use_vae_fixed_prior: False
use_vae_sphere_prior: False
use_vae_prior_loss: False

distill: false
save_kin_info: False
distill_z_model: false
z_read: False
distill_model_config:
embedding_norm: 1
embedding_size: 32
fut_tracks_dropout: False
fut_tracks: False
trajSampleTimestepInv: 5
numTrajSamples: 10
z_activation: "silu"
z_type: "vae"
models: ['output/HumanoidIm/pulse_vae_iclr/Humanoid.pth']

power_reward: False
power_usage_reward: False
power_usage_coefficient: 0.01

has_shape_obs: false
has_shape_obs_disc: false
has_shape_variation: False
shape_resampling_interval: 250

# Task specific parameters
numTrajSamples: 10
trajSampleTimestep: 0.5
speedMin: 0.0
speedMax: 3.0
accelMax: 2.0
sharpTurnProb: 0.02
enableTaskObs: True

control_mode: "isaac_pd"
power_scale: 1.0
controlFrequencyInv: 2 # 30 Hz
stateInit: "Random"
hybridInitProb: 0.5
numAMPObsSteps: 10

local_root_obs: True
root_height_obs: True
ampRootHeightObs: False
key_bodies: ["R_Ankle", "L_Ankle", "R_Wrist", "L_Wrist"]
contact_bodies: ["R_Ankle", "L_Ankle", "R_Toe", "L_Toe"]
terminationHeight: 0.15
enableEarlyTermination: True

terrain:
terrainType: trimesh # none, plane, or trimesh
staticFriction: 1.0 # [-]
dynamicFriction: 1.0 # [-]
restitution: 0. # [-]
# rough terrain only:
curriculum: true
maxInitMapLevel: 0
mapLength: 20.
mapWidth: 20.
numLevels: 5
numTerrains: 20
# terrain types: [smooth slope, rough slope, stairs up, stairs down, discrete, stepping, poles, flat]
terrainProportions: [0.2, 0.1, 0.15, 0.15, 0.05, 0., 0.25, 0.1]
# tri mesh only:
slopeTreshold: 0.9

asset:
assetRoot: "/"
assetFileName: "mjcf/smpl_humanoid.xml"

plane:
staticFriction: 1.0
dynamicFriction: 1.0
restitution: 0.0

3 changes: 2 additions & 1 deletion phc/env/tasks/humanoid.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ def __init__(self, cfg, sim_params, physics_engine, device_type, device_id, head
self.sim_params = sim_params
self.physics_engine = physics_engine
self.has_task = False

self.load_humanoid_configs(cfg)

self.control_mode = self.cfg["env"]["control_mode"]
Expand Down Expand Up @@ -252,6 +252,7 @@ def load_humanoid_configs(self, cfg):


def load_common_humanoid_configs(self, cfg):

self._divide_group = cfg["env"].get("divide_group", False)
self._group_obs = cfg["env"].get("group_obs", False)
self._disable_group_obs = cfg["env"].get("disable_group_obs", False)
Expand Down
5 changes: 3 additions & 2 deletions phc/env/tasks/humanoid_pedestrian_terrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def __init__(self, cfg, sim_params, physics_engine, device_type, device_id,

# self.real_mesh = cfg['args'].real_mesh
self.real_mesh = False
self.load_humanoid_configs(cfg)
self.load_smpl_configs(cfg)
self.cfg = cfg
self.num_envs = cfg["env"]["num_envs"]
Expand Down Expand Up @@ -69,7 +70,7 @@ def __init__(self, cfg, sim_params, physics_engine, device_type, device_id,
self.center_height_points = self.init_center_height_points()
self.height_meas_scale = 5

self.show_sensors = self.cfg['args'].show_sensors
self.show_sensors = self.cfg['env'].get("show_sensors", False)
if (not self.headless) and self.show_sensors:
self._sensor_handles = [[] for _ in range(self.num_envs)]

Expand Down Expand Up @@ -815,7 +816,7 @@ def create_mesh_ground(self):
return

def create_training_ground(self):
if flags.small_terrain:
if self.cfg["env"].get("small_terrain", False):
self.cfg["env"]["terrain"]['mapLength'] = 8
self.cfg["env"]["terrain"]['mapWidth'] = 8

Expand Down
2 changes: 1 addition & 1 deletion phc/env/tasks/humanoid_reach.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def _create_envs(self, num_envs, spacing, num_per_row):
return

def _load_marker_asset(self):
asset_root = "phc/data/assets/mjcf/"
asset_root = "phc/data/assets/urdf/"
asset_file = "location_marker.urdf"

asset_options = gymapi.AssetOptions()
Expand Down
2 changes: 1 addition & 1 deletion phc/env/tasks/humanoid_strike.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def _build_env(self, env_id, env_ptr, humanoid_asset):
return

def _load_target_asset(self):
asset_root = "pulse/data/assets/urdf/"
asset_root = "phc/data/assets/urdf/"
asset_file = "strike_target.urdf"

asset_options = gymapi.AssetOptions()
Expand Down

0 comments on commit a80b3e1

Please sign in to comment.