-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathenv_test.py
39 lines (31 loc) · 969 Bytes
/
env_test.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
import itertools
import argparse
from agent import ContinuousDubinGym, DiscreteDubinGym
from stable_baselines.common.env_checker import check_env
parser = argparse.ArgumentParser(description='PyTorch Soft Actor-Critic Args')
parser.add_argument('--env-name', default="ContinuousDubinGym",
help='Dubin Gym environment (default: ContinuousDubinGym)')
args = parser.parse_args()
def main():
if args.env_name == "ContinuousDubinGym":
env = ContinuousDubinGym()
else:
env = DiscreteDubinGym()
print("Issues with Custom Environment : ", check_env(env))
print("Testing sample action...")
max_steps = int(1e6)
state = env.reset()
for ep in range(3):
state = env.reset()
for i in range(max_steps):
if args.env_name == "ContinuousDubinGym":
action = [1., 0.]
else:
action = 7
n_state,reward,done,info = env.step(action)
env.render()
if done:
done = False
break
if __name__ == '__main__':
main()