-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathexample.py
35 lines (26 loc) · 1.17 KB
/
example.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
import numpy as np
import veca.gym
import random, time
import matplotlib.pyplot as plt
import os, subprocess
if __name__=="__main__":
print(veca.gym.list_tasks()) # List available VECA tasks
num_envs = 1
env = veca.gym.make(
task = "kicktheballrandomscene", # VECA task name
num_envs = num_envs, # Number of parallel environment instances to execute
args = ["--train", "--useaudio"], # VECA task additional arguments. Append "--help" to list valid arguments.
seeds = random.sample(range(0, 2000), num_envs), # seeds per env instances
remote_env = False # Whether to use the Environment Orchestrator process at a remote server.
)
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 infos:", infos.keys(), obs.keys() )
if any(done):
env.reset()
env.close()
print("Env Close")