fancy_gym/alr_envs/envs/__init__.py

671 lines
22 KiB
Python
Raw Normal View History

2022-06-30 17:33:05 +02:00
from copy import deepcopy
import numpy as np
from gym import register
from . import classic_control, mujoco
from .classic_control.hole_reacher.hole_reacher import HoleReacherEnv
from .classic_control.simple_reacher.simple_reacher import SimpleReacherEnv
from .classic_control.viapoint_reacher.viapoint_reacher import ViaPointReacherEnv
2022-06-30 17:33:05 +02:00
from .mujoco.ant_jump.ant_jump import MAX_EPISODE_STEPS_ANTJUMP
2022-04-13 17:28:25 +02:00
from .mujoco.half_cheetah_jump.half_cheetah_jump import MAX_EPISODE_STEPS_HALFCHEETAHJUMP
from .mujoco.hopper_jump.hopper_jump import MAX_EPISODE_STEPS_HOPPERJUMP
from .mujoco.hopper_jump.hopper_jump_on_box import MAX_EPISODE_STEPS_HOPPERJUMPONBOX
from .mujoco.hopper_throw.hopper_throw import MAX_EPISODE_STEPS_HOPPERTHROW
from .mujoco.hopper_throw.hopper_throw_in_basket import MAX_EPISODE_STEPS_HOPPERTHROWINBASKET
2022-07-13 09:52:51 +02:00
from .mujoco.beerpong.beerpong import MAX_EPISODE_STEPS_BEERPONG
2022-06-30 17:33:05 +02:00
from .mujoco.reacher.reacher import ReacherEnv
2022-04-13 17:28:25 +02:00
from .mujoco.walker_2d_jump.walker_2d_jump import MAX_EPISODE_STEPS_WALKERJUMP
ALL_ALR_MOVEMENT_PRIMITIVE_ENVIRONMENTS = {"DMP": [], "ProMP": []}
DEFAULT_BB_DICT_ProMP = {
"name": 'EnvName',
"wrappers": [],
"trajectory_generator_kwargs": {
2022-06-30 17:33:05 +02:00
'trajectory_generator_type': 'promp'
},
"phase_generator_kwargs": {
'phase_generator_type': 'linear'
},
"controller_kwargs": {
'controller_type': 'motor',
2022-06-29 12:25:40 +02:00
"p_gains": 1.0,
"d_gains": 0.1,
},
"basis_generator_kwargs": {
'basis_generator_type': 'zero_rbf',
'num_basis': 5,
2022-06-30 14:55:34 +02:00
'num_basis_zero_start': 1
}
}
DEFAULT_BB_DICT_DMP = {
"name": 'EnvName',
"wrappers": [],
"trajectory_generator_kwargs": {
'trajectory_generator_type': 'dmp'
},
"phase_generator_kwargs": {
'phase_generator_type': 'exp'
},
"controller_kwargs": {
'controller_type': 'motor',
"p_gains": 1.0,
"d_gains": 0.1,
},
"basis_generator_kwargs": {
'basis_generator_type': 'rbf',
'num_basis': 5
}
}
# Classic Control
## Simple Reacher
register(
id='SimpleReacher-v0',
entry_point='alr_envs.envs.classic_control:SimpleReacherEnv',
max_episode_steps=200,
kwargs={
"n_links": 2,
}
)
register(
id='LongSimpleReacher-v0',
entry_point='alr_envs.envs.classic_control:SimpleReacherEnv',
max_episode_steps=200,
kwargs={
"n_links": 5,
}
)
## Viapoint Reacher
register(
id='ViaPointReacher-v0',
entry_point='alr_envs.envs.classic_control:ViaPointReacherEnv',
max_episode_steps=200,
kwargs={
"n_links": 5,
"allow_self_collision": False,
"collision_penalty": 1000
}
)
## Hole Reacher
register(
id='HoleReacher-v0',
entry_point='alr_envs.envs.classic_control:HoleReacherEnv',
max_episode_steps=200,
kwargs={
"n_links": 5,
"random_start": True,
"allow_self_collision": False,
"allow_wall_collision": False,
"hole_width": None,
"hole_depth": 1,
"hole_x": None,
"collision_penalty": 100,
}
)
# Mujoco
## Reacher
2022-06-30 17:33:05 +02:00
for _dims in [5, 7]:
register(
id=f'Reacher{_dims}d-v0',
entry_point='alr_envs.envs.mujoco:ReacherEnv',
2022-06-30 17:33:05 +02:00
max_episode_steps=200,
kwargs={
"n_links": _dims,
}
)
2022-06-30 17:33:05 +02:00
register(
id=f'Reacher{_dims}dSparse-v0',
entry_point='alr_envs.envs.mujoco:ReacherEnv',
2022-06-30 17:33:05 +02:00
max_episode_steps=200,
kwargs={
"sparse": True,
"n_links": _dims,
}
)
register(
2022-06-30 17:33:05 +02:00
id='HopperJumpSparse-v0',
entry_point='alr_envs.envs.mujoco:HopperJumpEnv',
2022-06-30 17:33:05 +02:00
max_episode_steps=MAX_EPISODE_STEPS_HOPPERJUMP,
kwargs={
2022-06-30 17:33:05 +02:00
"sparse": True,
}
)
register(
2022-06-30 17:33:05 +02:00
id='HopperJump-v0',
entry_point='alr_envs.envs.mujoco:HopperJumpEnv',
2022-06-30 17:33:05 +02:00
max_episode_steps=MAX_EPISODE_STEPS_HOPPERJUMP,
kwargs={
2022-06-30 17:33:05 +02:00
"sparse": False,
2022-07-06 09:05:35 +02:00
"healthy_reward": 1.0,
"contact_weight": 0.0,
"height_weight": 3.0,
}
)
2022-04-13 17:28:25 +02:00
register(
2022-07-12 15:43:46 +02:00
id='AntJump-v0',
entry_point='alr_envs.envs.mujoco:AntJumpEnv',
2022-04-13 17:28:25 +02:00
max_episode_steps=MAX_EPISODE_STEPS_ANTJUMP,
)
register(
2022-07-12 15:43:46 +02:00
id='HalfCheetahJump-v0',
entry_point='alr_envs.envs.mujoco:HalfCheetahJumpEnv',
2022-04-13 17:28:25 +02:00
max_episode_steps=MAX_EPISODE_STEPS_HALFCHEETAHJUMP,
2022-04-20 10:50:41 +02:00
)
2022-04-13 17:28:25 +02:00
register(
2022-06-30 17:33:05 +02:00
id='HopperJumpOnBox-v0',
entry_point='alr_envs.envs.mujoco:HopperJumpOnBoxEnv',
2022-04-13 17:28:25 +02:00
max_episode_steps=MAX_EPISODE_STEPS_HOPPERJUMPONBOX,
)
register(
id='ALRHopperThrow-v0',
2022-07-12 15:43:46 +02:00
entry_point='alr_envs.envs.mujoco:HopperThrowEnv',
2022-04-13 17:28:25 +02:00
max_episode_steps=MAX_EPISODE_STEPS_HOPPERTHROW,
2022-04-20 10:50:41 +02:00
)
2022-04-13 17:28:25 +02:00
register(
id='ALRHopperThrowInBasket-v0',
2022-07-12 15:43:46 +02:00
entry_point='alr_envs.envs.mujoco:HopperThrowInBasketEnv',
2022-04-13 17:28:25 +02:00
max_episode_steps=MAX_EPISODE_STEPS_HOPPERTHROWINBASKET,
2022-04-20 10:50:41 +02:00
)
2022-04-13 17:28:25 +02:00
register(
id='ALRWalker2DJump-v0',
2022-07-12 15:43:46 +02:00
entry_point='alr_envs.envs.mujoco:Walker2dJumpEnv',
2022-04-13 17:28:25 +02:00
max_episode_steps=MAX_EPISODE_STEPS_WALKERJUMP,
)
2022-04-20 10:50:41 +02:00
2022-01-28 19:24:34 +01:00
register(
2022-07-05 10:12:01 +02:00
id='BeerPong-v0',
entry_point='alr_envs.envs.mujoco:BeerPongEnv',
2022-07-13 09:52:51 +02:00
max_episode_steps=MAX_EPISODE_STEPS_BEERPONG,
)
# Here we use the same reward as in BeerPong-v0, but now consider after the release,
# only one time step, i.e. we simulate until the end of th episode
2022-06-04 17:43:35 +02:00
register(
2022-07-05 10:12:01 +02:00
id='BeerPongStepBased-v0',
entry_point='alr_envs.envs.mujoco:BeerPongEnvStepBasedEpisodicReward',
2022-07-13 09:52:51 +02:00
max_episode_steps=MAX_EPISODE_STEPS_BEERPONG,
)
2022-02-08 09:50:01 +01:00
2022-06-21 17:15:01 +02:00
# Beerpong with episodic reward, but fixed release time step
register(
2022-07-05 10:12:01 +02:00
id='BeerPongFixedRelease-v0',
entry_point='alr_envs.envs.mujoco:BeerPongEnvFixedReleaseStep',
2022-07-13 09:52:51 +02:00
max_episode_steps=MAX_EPISODE_STEPS_BEERPONG,
)
2022-06-21 17:15:01 +02:00
# Motion Primitive Environments
## Simple Reacher
_versions = ["SimpleReacher-v0", "LongSimpleReacher-v0"]
for _v in _versions:
_name = _v.split("-")
_env_id = f'{_name[0]}DMP-{_name[1]}'
kwargs_dict_simple_reacher_dmp = deepcopy(DEFAULT_BB_DICT_DMP)
kwargs_dict_simple_reacher_dmp['wrappers'].append(classic_control.simple_reacher.MPWrapper)
kwargs_dict_simple_reacher_dmp['controller_kwargs']['p_gains'] = 0.6
kwargs_dict_simple_reacher_dmp['controller_kwargs']['d_gains'] = 0.075
kwargs_dict_simple_reacher_dmp['trajectory_generator_kwargs']['weight_scale'] = 50
kwargs_dict_simple_reacher_dmp['phase_generator_kwargs']['alpha_phase'] = 2
kwargs_dict_simple_reacher_dmp['name'] = f"{_v}"
register(
id=_env_id,
entry_point='alr_envs.utils.make_env_helpers:make_bb_env_helper',
kwargs=kwargs_dict_simple_reacher_dmp
)
ALL_ALR_MOVEMENT_PRIMITIVE_ENVIRONMENTS["DMP"].append(_env_id)
_env_id = f'{_name[0]}ProMP-{_name[1]}'
kwargs_dict_simple_reacher_promp = deepcopy(DEFAULT_BB_DICT_ProMP)
2022-06-30 14:55:34 +02:00
kwargs_dict_simple_reacher_promp['wrappers'].append(classic_control.simple_reacher.MPWrapper)
kwargs_dict_simple_reacher_promp['controller_kwargs']['p_gains'] = 0.6
kwargs_dict_simple_reacher_promp['controller_kwargs']['d_gains'] = 0.075
kwargs_dict_simple_reacher_promp['name'] = _v
register(
id=_env_id,
entry_point='alr_envs.utils.make_env_helpers:make_bb_env_helper',
kwargs=kwargs_dict_simple_reacher_promp
)
ALL_ALR_MOVEMENT_PRIMITIVE_ENVIRONMENTS["ProMP"].append(_env_id)
# Viapoint reacher
kwargs_dict_via_point_reacher_dmp = deepcopy(DEFAULT_BB_DICT_DMP)
kwargs_dict_via_point_reacher_dmp['wrappers'].append(classic_control.viapoint_reacher.MPWrapper)
kwargs_dict_via_point_reacher_dmp['controller_kwargs']['controller_type'] = 'velocity'
kwargs_dict_via_point_reacher_dmp['trajectory_generator_kwargs']['weight_scale'] = 50
kwargs_dict_via_point_reacher_dmp['phase_generator_kwargs']['alpha_phase'] = 2
kwargs_dict_via_point_reacher_dmp['name'] = "ViaPointReacher-v0"
register(
id='ViaPointReacherDMP-v0',
entry_point='alr_envs.utils.make_env_helpers:make_bb_env_helper',
# max_episode_steps=1,
kwargs=kwargs_dict_via_point_reacher_dmp
)
ALL_ALR_MOVEMENT_PRIMITIVE_ENVIRONMENTS["DMP"].append("ViaPointReacherDMP-v0")
kwargs_dict_via_point_reacher_promp = deepcopy(DEFAULT_BB_DICT_ProMP)
2022-06-30 14:55:34 +02:00
kwargs_dict_via_point_reacher_promp['wrappers'].append(classic_control.viapoint_reacher.MPWrapper)
kwargs_dict_via_point_reacher_promp['controller_kwargs']['controller_type'] = 'velocity'
kwargs_dict_via_point_reacher_promp['name'] = "ViaPointReacher-v0"
register(
id="ViaPointReacherProMP-v0",
entry_point='alr_envs.utils.make_env_helpers:make_bb_env_helper',
kwargs=kwargs_dict_via_point_reacher_promp
)
ALL_ALR_MOVEMENT_PRIMITIVE_ENVIRONMENTS["ProMP"].append("ViaPointReacherProMP-v0")
## Hole Reacher
_versions = ["HoleReacher-v0"]
for _v in _versions:
_name = _v.split("-")
_env_id = f'{_name[0]}DMP-{_name[1]}'
kwargs_dict_hole_reacher_dmp = deepcopy(DEFAULT_BB_DICT_DMP)
kwargs_dict_hole_reacher_dmp['wrappers'].append(classic_control.hole_reacher.MPWrapper)
kwargs_dict_hole_reacher_dmp['controller_kwargs']['controller_type'] = 'velocity'
# TODO: Before it was weight scale 50 and goal scale 0.1. We now only have weight scale and thus set it to 500. Check
kwargs_dict_hole_reacher_dmp['trajectory_generator_kwargs']['weight_scale'] = 500
kwargs_dict_hole_reacher_dmp['phase_generator_kwargs']['alpha_phase'] = 2.5
kwargs_dict_hole_reacher_dmp['name'] = _v
register(
id=_env_id,
entry_point='alr_envs.utils.make_env_helpers:make_bb_env_helper',
# max_episode_steps=1,
kwargs=kwargs_dict_hole_reacher_dmp
)
ALL_ALR_MOVEMENT_PRIMITIVE_ENVIRONMENTS["DMP"].append(_env_id)
_env_id = f'{_name[0]}ProMP-{_name[1]}'
kwargs_dict_hole_reacher_promp = deepcopy(DEFAULT_BB_DICT_ProMP)
2022-06-30 14:55:34 +02:00
kwargs_dict_hole_reacher_promp['wrappers'].append(classic_control.hole_reacher.MPWrapper)
kwargs_dict_hole_reacher_promp['trajectory_generator_kwargs']['weight_scale'] = 2
kwargs_dict_hole_reacher_promp['controller_kwargs']['controller_type'] = 'velocity'
2022-07-06 09:05:35 +02:00
kwargs_dict_hole_reacher_promp['name'] = f"{_v}"
2021-11-15 09:10:03 +01:00
register(
id=_env_id,
entry_point='alr_envs.utils.make_env_helpers:make_bb_env_helper',
kwargs=kwargs_dict_hole_reacher_promp
2021-11-15 09:10:03 +01:00
)
ALL_ALR_MOVEMENT_PRIMITIVE_ENVIRONMENTS["ProMP"].append(_env_id)
2021-11-15 09:10:03 +01:00
2022-07-06 09:05:35 +02:00
## ReacherNd
_versions = ["Reacher5d-v0", "Reacher7d-v0", "Reacher5dSparse-v0", "Reacher7dSparse-v0"]
2022-01-25 15:23:57 +01:00
for _v in _versions:
_name = _v.split("-")
_env_id = f'{_name[0]}DMP-{_name[1]}'
kwargs_dict_reacherNd_dmp = deepcopy(DEFAULT_BB_DICT_DMP)
kwargs_dict_reacherNd_dmp['wrappers'].append(mujoco.reacher.MPWrapper)
kwargs_dict_reacherNd_dmp['trajectory_generator_kwargs']['weight_scale'] = 5
kwargs_dict_reacherNd_dmp['phase_generator_kwargs']['alpha_phase'] = 2
kwargs_dict_reacherNd_dmp['basis_generator_kwargs']['num_basis'] = 2
kwargs_dict_reacherNd_dmp['name'] = _v
2022-01-25 15:23:57 +01:00
register(
id=_env_id,
entry_point='alr_envs.utils.make_env_helpers:make_bb_env_helper',
2022-01-25 15:23:57 +01:00
# max_episode_steps=1,
kwargs=kwargs_dict_reacherNd_dmp
2022-01-25 15:23:57 +01:00
)
ALL_ALR_MOVEMENT_PRIMITIVE_ENVIRONMENTS["DMP"].append(_env_id)
2022-01-25 15:23:57 +01:00
_env_id = f'{_name[0]}ProMP-{_name[1]}'
kwargs_dict_alr_reacher_promp = deepcopy(DEFAULT_BB_DICT_ProMP)
2022-06-30 14:55:34 +02:00
kwargs_dict_alr_reacher_promp['wrappers'].append(mujoco.reacher.MPWrapper)
kwargs_dict_alr_reacher_promp['controller_kwargs']['p_gains'] = 1
kwargs_dict_alr_reacher_promp['controller_kwargs']['d_gains'] = 0.1
kwargs_dict_alr_reacher_promp['name'] = _v
2022-01-25 15:23:57 +01:00
register(
id=_env_id,
2022-07-06 09:05:35 +02:00
entry_point='alr_envs.utils.make_env_helpers:make_bb_env_helper',
kwargs=kwargs_dict_alr_reacher_promp
2022-01-25 15:23:57 +01:00
)
ALL_ALR_MOVEMENT_PRIMITIVE_ENVIRONMENTS["ProMP"].append(_env_id)
2021-11-15 09:10:03 +01:00
########################################################################################################################
## Beerpong ProMP
2022-07-05 10:12:01 +02:00
_versions = ['BeerPong-v0']
for _v in _versions:
_name = _v.split("-")
_env_id = f'{_name[0]}ProMP-{_name[1]}'
kwargs_dict_bp_promp = deepcopy(DEFAULT_BB_DICT_ProMP)
2022-06-30 14:55:34 +02:00
kwargs_dict_bp_promp['wrappers'].append(mujoco.beerpong.MPWrapper)
kwargs_dict_bp_promp['phase_generator_kwargs']['learn_tau'] = True
kwargs_dict_bp_promp['controller_kwargs']['p_gains'] = np.array([1.5, 5, 2.55, 3, 2., 2, 1.25])
kwargs_dict_bp_promp['controller_kwargs']['d_gains'] = np.array([0.02333333, 0.1, 0.0625, 0.08, 0.03, 0.03, 0.0125])
kwargs_dict_bp_promp['basis_generator_kwargs']['num_basis'] = 2
2022-06-30 14:55:34 +02:00
kwargs_dict_bp_promp['basis_generator_kwargs']['num_basis_zero_start'] = 2
kwargs_dict_bp_promp['name'] = _v
2022-06-21 17:15:01 +02:00
register(
id=_env_id,
entry_point='alr_envs.utils.make_env_helpers:make_bb_env_helper',
kwargs=kwargs_dict_bp_promp
2022-06-21 17:15:01 +02:00
)
ALL_ALR_MOVEMENT_PRIMITIVE_ENVIRONMENTS["ProMP"].append(_env_id)
2022-06-21 17:15:01 +02:00
### BP with Fixed release
2022-07-05 10:12:01 +02:00
_versions = ["BeerPongStepBased-v0", "BeerPongFixedRelease-v0"]
2021-12-07 14:46:31 +01:00
for _v in _versions:
_name = _v.split("-")
_env_id = f'{_name[0]}ProMP-{_name[1]}'
kwargs_dict_bp_promp = deepcopy(DEFAULT_BB_DICT_ProMP)
2022-06-30 14:55:34 +02:00
kwargs_dict_bp_promp['wrappers'].append(mujoco.beerpong.MPWrapper)
kwargs_dict_bp_promp['phase_generator_kwargs']['tau'] = 0.62
kwargs_dict_bp_promp['controller_kwargs']['p_gains'] = np.array([1.5, 5, 2.55, 3, 2., 2, 1.25])
kwargs_dict_bp_promp['controller_kwargs']['d_gains'] = np.array([0.02333333, 0.1, 0.0625, 0.08, 0.03, 0.03, 0.0125])
kwargs_dict_bp_promp['basis_generator_kwargs']['num_basis'] = 2
2022-06-30 14:55:34 +02:00
kwargs_dict_bp_promp['basis_generator_kwargs']['num_basis_zero_start'] = 2
kwargs_dict_bp_promp['name'] = _v
2021-12-07 14:46:31 +01:00
register(
id=_env_id,
entry_point='alr_envs.utils.make_env_helpers:make_bb_env_helper',
kwargs=kwargs_dict_bp_promp
2021-12-07 14:46:31 +01:00
)
ALL_ALR_MOVEMENT_PRIMITIVE_ENVIRONMENTS["ProMP"].append(_env_id)
########################################################################################################################
## Table Tennis needs to be fixed according to Zhou's implementation
2022-06-21 17:15:01 +02:00
2022-07-07 10:47:04 +02:00
# TODO: Add later when finished
# ########################################################################################################################
#
# ## AntJump
# _versions = ['ALRAntJump-v0']
# for _v in _versions:
# _name = _v.split("-")
# _env_id = f'{_name[0]}ProMP-{_name[1]}'
# kwargs_dict_ant_jump_promp = deepcopy(DEFAULT_BB_DICT_ProMP)
# kwargs_dict_ant_jump_promp['wrappers'].append(mujoco.ant_jump.MPWrapper)
# kwargs_dict_ant_jump_promp['name'] = _v
# register(
# id=_env_id,
# entry_point='alr_envs.utils.make_env_helpers:make_bb_env_helper',
# kwargs=kwargs_dict_ant_jump_promp
# )
# ALL_ALR_MOVEMENT_PRIMITIVE_ENVIRONMENTS["ProMP"].append(_env_id)
2022-07-07 10:47:04 +02:00
#
# ########################################################################################################################
#
# ## HalfCheetahJump
# _versions = ['ALRHalfCheetahJump-v0']
# for _v in _versions:
# _name = _v.split("-")
# _env_id = f'{_name[0]}ProMP-{_name[1]}'
# kwargs_dict_halfcheetah_jump_promp = deepcopy(DEFAULT_BB_DICT_ProMP)
# kwargs_dict_halfcheetah_jump_promp['wrappers'].append(mujoco.half_cheetah_jump.MPWrapper)
# kwargs_dict_halfcheetah_jump_promp['name'] = _v
# register(
# id=_env_id,
# entry_point='alr_envs.utils.make_env_helpers:make_bb_env_helper',
# kwargs=kwargs_dict_halfcheetah_jump_promp
# )
# ALL_ALR_MOVEMENT_PRIMITIVE_ENVIRONMENTS["ProMP"].append(_env_id)
2022-07-07 10:47:04 +02:00
#
# ########################################################################################################################
2022-05-29 11:58:01 +02:00
## HopperJump
2022-07-07 10:47:04 +02:00
_versions = ['HopperJump-v0', 'HopperJumpSparse-v0',
# 'ALRHopperJumpOnBox-v0', 'ALRHopperThrow-v0', 'ALRHopperThrowInBasket-v0'
]
2022-06-30 14:55:34 +02:00
# TODO: Check if all environments work with the same MPWrapper
2022-04-20 10:50:41 +02:00
for _v in _versions:
_name = _v.split("-")
_env_id = f'{_name[0]}ProMP-{_name[1]}'
kwargs_dict_hopper_jump_promp = deepcopy(DEFAULT_BB_DICT_ProMP)
2022-06-30 14:55:34 +02:00
kwargs_dict_hopper_jump_promp['wrappers'].append(mujoco.hopper_jump.MPWrapper)
kwargs_dict_hopper_jump_promp['name'] = _v
2022-04-20 10:50:41 +02:00
register(
id=_env_id,
entry_point='alr_envs.utils.make_env_helpers:make_bb_env_helper',
kwargs=kwargs_dict_hopper_jump_promp
2022-04-20 10:50:41 +02:00
)
ALL_ALR_MOVEMENT_PRIMITIVE_ENVIRONMENTS["ProMP"].append(_env_id)
2022-04-13 17:28:25 +02:00
2022-07-07 10:47:04 +02:00
# ########################################################################################################################
#
#
# ## Walker2DJump
# _versions = ['ALRWalker2DJump-v0']
# for _v in _versions:
# _name = _v.split("-")
# _env_id = f'{_name[0]}ProMP-{_name[1]}'
# kwargs_dict_walker2d_jump_promp = deepcopy(DEFAULT_BB_DICT_ProMP)
# kwargs_dict_walker2d_jump_promp['wrappers'].append(mujoco.walker_2d_jump.MPWrapper)
# kwargs_dict_walker2d_jump_promp['name'] = _v
# register(
# id=_env_id,
# entry_point='alr_envs.utils.make_env_helpers:make_bb_env_helper',
# kwargs=kwargs_dict_walker2d_jump_promp
# )
# ALL_ALR_MOVEMENT_PRIMITIVE_ENVIRONMENTS["ProMP"].append(_env_id)
2022-04-13 17:28:25 +02:00
### Depricated, we will not provide non random starts anymore
"""
2022-04-20 14:50:02 +02:00
register(
id='SimpleReacher-v1',
entry_point='alr_envs.envs.classic_control:SimpleReacherEnv',
max_episode_steps=200,
2022-04-20 14:50:02 +02:00
kwargs={
"n_links": 2,
"random_start": False
}
2022-04-20 14:50:02 +02:00
)
2022-05-29 11:58:01 +02:00
register(
id='LongSimpleReacher-v1',
entry_point='alr_envs.envs.classic_control:SimpleReacherEnv',
max_episode_steps=200,
2022-05-29 11:58:01 +02:00
kwargs={
"n_links": 5,
"random_start": False
}
)
register(
id='HoleReacher-v1',
entry_point='alr_envs.envs.classic_control:HoleReacherEnv',
max_episode_steps=200,
kwargs={
"n_links": 5,
"random_start": False,
"allow_self_collision": False,
"allow_wall_collision": False,
"hole_width": 0.25,
"hole_depth": 1,
"hole_x": None,
"collision_penalty": 100,
}
)
register(
id='HoleReacher-v2',
entry_point='alr_envs.envs.classic_control:HoleReacherEnv',
max_episode_steps=200,
kwargs={
"n_links": 5,
"random_start": False,
"allow_self_collision": False,
"allow_wall_collision": False,
"hole_width": 0.25,
"hole_depth": 1,
"hole_x": 2,
"collision_penalty": 1,
}
2022-05-29 11:58:01 +02:00
)
2022-05-31 19:41:08 +02:00
# CtxtFree are v0, Contextual are v1
2022-05-31 19:41:08 +02:00
register(
id='ALRAntJump-v0',
entry_point='alr_envs.envs.mujoco:AntJumpEnv',
max_episode_steps=MAX_EPISODE_STEPS_ANTJUMP,
2022-05-31 19:41:08 +02:00
kwargs={
"max_episode_steps": MAX_EPISODE_STEPS_ANTJUMP,
"context": False
}
)
# CtxtFree are v0, Contextual are v1
register(
id='ALRHalfCheetahJump-v0',
2022-07-12 15:43:46 +02:00
entry_point='alr_envs.envs.mujoco:HalfCheetahJumpEnv',
max_episode_steps=MAX_EPISODE_STEPS_HALFCHEETAHJUMP,
kwargs={
"max_episode_steps": MAX_EPISODE_STEPS_HALFCHEETAHJUMP,
"context": False
}
)
register(
id='ALRHopperJump-v0',
entry_point='alr_envs.envs.mujoco:HopperJumpEnv',
max_episode_steps=MAX_EPISODE_STEPS_HOPPERJUMP,
kwargs={
"max_episode_steps": MAX_EPISODE_STEPS_HOPPERJUMP,
"context": False,
"healthy_reward": 1.0
}
2022-05-31 19:41:08 +02:00
)
"""
### Deprecated used for CorL paper
"""
_vs = np.arange(101).tolist() + [1e-5, 5e-5, 1e-4, 5e-4, 1e-3, 5e-3, 1e-2, 5e-2, 1e-1, 5e-1]
for i in _vs:
_env_id = f'ALRReacher{i}-v0'
2022-04-20 10:50:41 +02:00
register(
id=_env_id,
entry_point='alr_envs.envs.mujoco:ReacherEnv',
max_episode_steps=200,
2022-04-20 10:50:41 +02:00
kwargs={
"steps_before_reward": 0,
"n_links": 5,
"balance": False,
'ctrl_cost_weight': i
2022-04-13 17:28:25 +02:00
}
2022-04-20 10:50:41 +02:00
)
2022-04-13 17:28:25 +02:00
_env_id = f'ALRReacherSparse{i}-v0'
2022-04-20 10:50:41 +02:00
register(
id=_env_id,
entry_point='alr_envs.envs.mujoco:ReacherEnv',
max_episode_steps=200,
2022-04-20 10:50:41 +02:00
kwargs={
"steps_before_reward": 200,
"n_links": 5,
"balance": False,
'ctrl_cost_weight': i
2022-04-13 17:28:25 +02:00
}
2022-04-20 10:50:41 +02:00
)
_vs = np.arange(101).tolist() + [1e-5, 5e-5, 1e-4, 5e-4, 1e-3, 5e-3, 1e-2, 5e-2, 1e-1, 5e-1]
for i in _vs:
_env_id = f'ALRReacher{i}ProMP-v0'
2022-04-20 10:50:41 +02:00
register(
id=_env_id,
entry_point='alr_envs.utils.make_env_helpers:make_promp_env_helper',
kwargs={
2022-07-06 09:05:35 +02:00
"name": f"{_env_id.replace('ProMP', '')}",
"wrappers": [mujoco.reacher.MPWrapper],
2022-04-20 10:50:41 +02:00
"mp_kwargs": {
"num_dof": 5,
2022-04-20 10:50:41 +02:00
"num_basis": 5,
"duration": 4,
2022-04-20 10:50:41 +02:00
"policy_type": "motor",
# "weights_scale": 5,
"n_zero_basis": 1,
2022-04-20 10:50:41 +02:00
"zero_start": True,
"policy_kwargs": {
"p_gains": 1,
"d_gains": 0.1
2022-04-20 10:50:41 +02:00
}
2022-04-13 17:28:25 +02:00
}
}
2022-04-20 10:50:41 +02:00
)
2022-04-13 17:28:25 +02:00
_env_id = f'ALRReacherSparse{i}ProMP-v0'
2022-04-20 10:50:41 +02:00
register(
id=_env_id,
entry_point='alr_envs.utils.make_env_helpers:make_promp_env_helper',
kwargs={
2022-07-06 09:05:35 +02:00
"name": f"{_env_id.replace('ProMP', '')}",
"wrappers": [mujoco.reacher.MPWrapper],
2022-04-20 10:50:41 +02:00
"mp_kwargs": {
"num_dof": 5,
2022-04-20 10:50:41 +02:00
"num_basis": 5,
"duration": 4,
2022-04-20 10:50:41 +02:00
"policy_type": "motor",
# "weights_scale": 5,
"n_zero_basis": 1,
2022-04-20 10:50:41 +02:00
"zero_start": True,
"policy_kwargs": {
"p_gains": 1,
"d_gains": 0.1
2022-04-20 10:50:41 +02:00
}
2022-04-13 17:28:25 +02:00
}
}
2022-04-20 10:50:41 +02:00
)
register(
id='ALRHopperJumpOnBox-v0',
entry_point='alr_envs.envs.mujoco:HopperJumpOnBoxEnv',
max_episode_steps=MAX_EPISODE_STEPS_HOPPERJUMPONBOX,
kwargs={
"max_episode_steps": MAX_EPISODE_STEPS_HOPPERJUMPONBOX,
"context": False
}
)
register(
id='ALRHopperThrow-v0',
2022-07-12 15:43:46 +02:00
entry_point='alr_envs.envs.mujoco:HopperThrowEnv',
max_episode_steps=MAX_EPISODE_STEPS_HOPPERTHROW,
kwargs={
"max_episode_steps": MAX_EPISODE_STEPS_HOPPERTHROW,
"context": False
}
)
register(
id='ALRHopperThrowInBasket-v0',
2022-07-12 15:43:46 +02:00
entry_point='alr_envs.envs.mujoco:HopperThrowInBasketEnv',
max_episode_steps=MAX_EPISODE_STEPS_HOPPERTHROWINBASKET,
kwargs={
"max_episode_steps": MAX_EPISODE_STEPS_HOPPERTHROWINBASKET,
"context": False
}
)
register(
id='ALRWalker2DJump-v0',
2022-07-12 15:43:46 +02:00
entry_point='alr_envs.envs.mujoco:Walker2dJumpEnv',
max_episode_steps=MAX_EPISODE_STEPS_WALKERJUMP,
kwargs={
"max_episode_steps": MAX_EPISODE_STEPS_WALKERJUMP,
"context": False
}
)
register(id='TableTennis2DCtxt-v1',
entry_point='alr_envs.envs.mujoco:TTEnvGym',
max_episode_steps=MAX_EPISODE_STEPS,
kwargs={'ctxt_dim': 2, 'fixed_goal': True})
register(
id='ALRBeerPong-v0',
entry_point='alr_envs.envs.mujoco:ALRBeerBongEnv',
max_episode_steps=300,
kwargs={
"rndm_goal": False,
"cup_goal_pos": [0.1, -2.0],
"frame_skip": 2
}
)
"""