Skip to content

Commit

Permalink
SYNC: MyoSuite f9873cba1186843700cc91f63220f0391cbaa85a
Browse files Browse the repository at this point in the history
- Updating to myochallenge'23 envs release
  • Loading branch information
vikashplus committed Jan 20, 2024
1 parent 77b4347 commit 3f74d12
Show file tree
Hide file tree
Showing 4 changed files with 307 additions and 13 deletions.
8 changes: 8 additions & 0 deletions robohive/envs/myo/myobase/walk_v0.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ def _setup(self,
# Change the alpha value to make it transparent
self.sim.model.geom_rgba[geom_1_indices, 3] = 0

# move heightfield down if not used
self.sim.model.geom_rgba[self.sim.model.geom_name2id('terrain')][-1] = 0.0
self.sim.model.geom_pos[self.sim.model.geom_name2id('terrain')] = np.array([0, 0, -10])


def get_obs_dict(self, sim):
obs_dict = {}
Expand Down Expand Up @@ -207,6 +211,10 @@ def _setup(self,
self.init_qpos[:] = self.sim.model.key_qpos[0]
self.init_qvel[:] = 0.0

# move heightfield down if not used
self.sim.model.geom_rgba[self.sim.model.geom_name2id('terrain')][-1] = 0.0
self.sim.model.geom_pos[self.sim.model.geom_name2id('terrain')] = np.array([0, 0, -10])

def get_obs_dict(self, sim):
obs_dict = {}
obs_dict['t'] = np.array([sim.data.time])
Expand Down
49 changes: 47 additions & 2 deletions robohive/envs/myo/myochallenge/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
from robohive.utils import gym; register=gym.register


import os
curr_dir = os.path.dirname(os.path.abspath(__file__))
import numpy as np
Expand Down Expand Up @@ -42,6 +40,26 @@
}
)

# Register MyoChallenge Manipulation P2 Evals
register(id='myoChallengeRelocateP2eval-v0',
entry_point='robohive.envs.myo.myochallenge.relocate_v0:RelocateEnvV0',
max_episode_steps=150,
kwargs={
'model_path': curr_dir + '/../assets/arm/myoarm_relocate.xml',
'normalize_act': True,
'frame_skip': 5,
'pos_th': 0.1, # cover entire base of the receptacle
'rot_th': np.inf, # ignore rotation errors
'qpos_noise_range':0.015, # jnt initialization range
'target_xyz_range': {'high':[0.4, -.1, 1.1], 'low':[-.5, -.5, .9]},
'target_rxryrz_range': {'high':[.3, .3, .3], 'low':[-.3, -.3, -.3]},
'obj_xyz_range': {'high':[0.15, -.10, 1.0], 'low':[-0.20, -.40, 1.0]},
'obj_geom_range': {'high':[.025, .025, .035], 'low':[.015, 0.015, 0.015]},
'obj_mass_range': {'high':0.300, 'low':0.050},# 50gms to 250 gms
'obj_friction_range': {'high':[1.2, 0.006, 0.00012], 'low':[0.8, 0.004, 0.00008]}
}
)


## MyoChallenge Locomotion P1
register(id='myoChallengeChaseTagP1-v0',
Expand All @@ -58,6 +76,7 @@
'hills_range': (0.0, 0.0),
'rough_range': (0.0, 0.0),
'relief_range': (0.0, 0.0),
'opponent_probabilities': (0.1, 0.45, 0.45),
}
)

Expand All @@ -77,9 +96,35 @@
'hills_range': (0.03, 0.23),
'rough_range': (0.05, 0.1),
'relief_range': (0.1, 0.3),
'repeller_opponent': False,
'chase_vel_range': (1.0, 1.0),
'random_vel_range': (-2, 2),
'opponent_probabilities': (0.1, 0.45, 0.45),
}
)

# Register MyoChallenge Locomotion P2 Evals
register(id='myoChallengeChaseTagP2eval-v0',
entry_point='robohive.envs.myo.myochallenge.chasetag_v0:ChaseTagEnvV0',
max_episode_steps=2000,
kwargs={
'model_path': curr_dir+'/../assets/leg/myolegs_chasetag.xml',
'normalize_act': True,
'win_distance': 0.5,
'min_spawn_distance': 2,
'reset_type': 'random', # none, init, random
'terrain': 'random', # FLAT, random
'task_choice': 'random', # CHASE, EVADE, random
'hills_range': (0.03, 0.23),
'rough_range': (0.05, 0.1),
'relief_range': (0.1, 0.3),
'repeller_opponent': True,
'chase_vel_range': (1, 5),
'random_vel_range': (-2, 2),
'repeller_vel_range': (0.3, 1),
'opponent_probabilities': (0.1, 0.35, 0.35, 0.2),
}
)

# MyoChallenge 2022 envs ==============================================
# MyoChallenge Die: Trial env
Expand Down
Loading

0 comments on commit 3f74d12

Please sign in to comment.