|
a |
|
b/examples/submission.py |
|
|
1 |
import opensim as osim |
|
|
2 |
from osim.http.client import Client |
|
|
3 |
import numpy as np |
|
|
4 |
|
|
|
5 |
# Settings |
|
|
6 |
remote_base = "http://osim-rl-grader.aicrowd.com/" |
|
|
7 |
aicrowd_token = "a66245c8324e2d37b92f098a57ef3f99" # use your aicrowd token |
|
|
8 |
# your aicrowd token (API KEY) can be found at your prorfile page at https://www.aicrowd.com |
|
|
9 |
|
|
|
10 |
client = Client(remote_base) |
|
|
11 |
|
|
|
12 |
# Create environment |
|
|
13 |
observation = client.env_create(aicrowd_token, env_id='L2M2019Env') |
|
|
14 |
|
|
|
15 |
# IMPLEMENTATION OF YOUR CONTROLLER |
|
|
16 |
# my_controller = ... (for example the one trained in keras_rl) |
|
|
17 |
|
|
|
18 |
while True: |
|
|
19 |
#action = my_controller.update(observation) |
|
|
20 |
action = [.5]*22 |
|
|
21 |
[observation, reward, done, info] = client.env_step(action) |
|
|
22 |
print(observation) |
|
|
23 |
if done: |
|
|
24 |
observation = client.env_reset() |
|
|
25 |
if not observation: |
|
|
26 |
break |
|
|
27 |
|
|
|
28 |
client.submit() |