-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathexample_remoteenv.py
36 lines (26 loc) · 1.21 KB
/
example_remoteenv.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
import numpy as np
import veca.gym
import random
if __name__=="__main__":
print(veca.gym.list_tasks()) # List available VECA tasks
num_envs = 3
env = veca.gym.make(
task = "kicktheballrandomscene", # VECA task name
num_envs = num_envs, # Number of parallel environment instances to execute
args = ["-train"], # VECA task additional arguments
seeds = random.sample(range(0, 2000), num_envs), # seeds per env instances
remote_env = True, # Whether to use the Environment Orchestrator process at a remote server. If True, the orchestrator's ip and port should be given.
port= 8872, # Exposed port of VECA GYM API
)
action_dim = env.action_space
env.reset()
print("Env Init")
for i in range(100):
action = np.random.rand(num_envs, action_dim) * 2 - 1
obs, reward, done, infos = env.step(action)
print("Env Step")
print("Env infos:", infos.keys())
if any(done):
env.reset()
env.close()
print("Env Close")