-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_env.py
More file actions
37 lines (30 loc) · 724 Bytes
/
Copy pathdebug_env.py
File metadata and controls
37 lines (30 loc) · 724 Bytes
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
import env
import numpy as np
import gymnasium as gym
from gymnasium.wrappers import FlattenObservation
from wrapper import RelativePosition
from stable_baselines3 import A2C, PPO
from system import DynamicalSystem
def main():
size = 10
# Create system
system = DynamicalSystem(size = size,
random_force_probability=0.01,
wind_gust=[0.1, 0.1],)
# Create environment
env = gym.make(
"DynamicalSystem-v0",
render_mode="human",
size=size,
distance_threshold=0.2,
system=system,
)
env = RelativePosition(env)
env = FlattenObservation(env)
env.reset()
while True:
action = np.zeros(2)
obs, reward, done, _, information = env.step(action)
env.render()
if __name__ == "__main__":
main()