-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcrowdai_submit.py
45 lines (37 loc) · 1.47 KB
/
crowdai_submit.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
45
import argparse
import opensim as osim
from osim.http.client import Client
import osim.env
import numpy as np
from baselines.ddpg import prosthetics_env
from pdb import set_trace
# Settings
remote_base = "http://grader.crowdai.org:1729"
# Command line parameters
parser = argparse.ArgumentParser(description='Submit the result to crowdAI')
parser.add_argument('--token', dest='token', action='store',
default='9c48765358e511504cf7731614afac30')
parser.add_argument('--submit', default=False, action='store_true')
args = parser.parse_args()
client = Client(remote_base)
# Create environment
observation = client.env_create(args.token, env_id="ProstheticsEnv")
#env = osim.env.ProstheticsEnv()
env = prosthetics_env.Wrapper(osim.env.ProstheticsEnv(visualize=False),
frameskip=1,
reward_shaping=False,
feature_embellishment=False,
relative_x_pos=False,
relative_z_pos=False)
# IMPLEMENTATION OF YOUR CONTROLLER
# my_controller = ... (for example the one trained in keras_rl)
while True:
print(observation)
#[observation, reward, done, info] = client.env_step(my_controller(observation), True)
[observation, reward, done, info] = client.env_step(env.action_space.sample().tolist())
if done:
observation = client.env_reset()
if not observation:
break
if args.submit:
client.submit()