forked from kindredresearch/SenseAct
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsim_double_pendulum.py
More file actions
36 lines (28 loc) · 1.07 KB
/
sim_double_pendulum.py
File metadata and controls
36 lines (28 loc) · 1.07 KB
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
# Copyright (c) 2018, The SenseAct Authors.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.
from senseact.envs.sim_double_pendulum.sim_double_pendulum import DoubleInvertedPendulumEnv
import numpy as np
def main():
# Create Asynchronous Simulation of InvertedDoublePendulum-v2 mujoco environment.
env = DoubleInvertedPendulumEnv(agent_dt=0.005,
sensor_dt=[0.01, 0.0033333],
is_render=True,
)
# Start environment processes
env.start()
# Run 1000 episodes of the environment
for episode in range(1000):
done = False
obs = env.reset()
# Continue until an episode is done
while not done:
# Sample an action uniformly randomly
action = np.random.uniform(-1.0, 1.0)
obs, reward, done, _ = env.step(action)
# Shutdown the environment
env.close()
if __name__ == '__main__':
main()