forked from hardmaru/estool
-
Notifications
You must be signed in to change notification settings - Fork 0
/
env.py
44 lines (43 loc) · 1.73 KB
/
env.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
44
import numpy as np
import gym
import pybullet as p
import pybullet_envs
import pybullet_envs.bullet.minitaur_gym_env as minitaur_gym_env
import pybullet_envs.bullet.racecarGymEnv as racecarGymEnv
import pybullet_envs.bullet.kukaGymEnv as kukaGymEnv
from custom_envs.minitaur_duck import MinitaurDuckBulletEnv
from custom_envs.minitaur_ball import MinitaurBallBulletEnv
def make_env(env_name, seed=-1, render_mode=False):
if (env_name.startswith("RacecarBulletEnv")):
print("bullet_racecar_started")
env = racecarGymEnv.RacecarGymEnv(isDiscrete=False, renders=render_mode)
elif (env_name.startswith("MinitaurBulletEnv")):
print("bullet_minitaur_started")
env = minitaur_gym_env.MinitaurBulletEnv(render=render_mode)
elif (env_name.startswith("MinitaurDuckBulletEnv")):
print("bullet_minitaur_duck_started")
env = MinitaurDuckBulletEnv(render=render_mode)
elif (env_name.startswith("MinitaurBallBulletEnv")):
print("bullet_minitaur_ball_started")
env = MinitaurBallBulletEnv(render=render_mode)
elif (env_name.startswith("KukaBulletEnv")):
print("bullet_kuka_grasping started")
env = kukaGymEnv.KukaGymEnv(renders=render_mode,isDiscrete=False)
else:
if env_name.startswith("Roboschool"):
import roboschool
env = gym.make(env_name)
if render_mode and not env_name.startswith("Roboschool"):
env.render("human")
if (seed >= 0):
env.seed(seed)
'''
print("environment details")
print("env.action_space", env.action_space)
print("high, low", env.action_space.high, env.action_space.low)
print("environment details")
print("env.observation_space", env.observation_space)
print("high, low", env.observation_space.high, env.observation_space.low)
assert False
'''
return env