-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy path__init__.py
43 lines (36 loc) · 1.29 KB
/
__init__.py
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
import gin
import gymnasium as gym
import pkg_resources
config_file_path = pkg_resources.resource_filename(
"a2perf", "domains/quadruped_locomotion/motion_imitation/configs/envdesign.gin"
)
gin.parse_config_files_and_bindings([config_file_path], None, finalize_config=False)
motion_files = {
"pace": pkg_resources.resource_filename(
"a2perf",
"domains/quadruped_locomotion/motion_imitation/data/motions/dog_pace.txt",
),
"trot": pkg_resources.resource_filename(
"a2perf",
"domains/quadruped_locomotion/motion_imitation/data/motions/dog_trot.txt",
),
"spin": pkg_resources.resource_filename(
"a2perf",
"domains/quadruped_locomotion/motion_imitation/data/motions/dog_spin.txt",
),
}
def register_env(gait, motion_file):
env_id = f"QuadrupedLocomotion-Dog{gait.capitalize()}-v0"
gym.envs.register(
id=env_id,
apply_api_compatibility=True,
entry_point="a2perf.domains.quadruped_locomotion.motion_imitation.envs.env_builder:build_imitation_env",
kwargs={
"motion_files": [motion_file],
"enable_rendering": False,
"mode": "train",
"num_parallel_envs": 1,
},
)
for gait, motion_file in motion_files.items():
register_env(gait, motion_file)