forked from m312z/simple_satellite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
40 lines (31 loc) · 1023 Bytes
/
main.py
File metadata and controls
40 lines (31 loc) · 1023 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
38
39
40
import os
os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = '1'
import pygame
from agent.AgentGreedy import GreedyAgent
from agent.AgentPDDL import PDDLAgent
from simulation.DrawSim import SatelliteView
from simulation.Simulation import SatelliteSim
if __name__ == '__main__':
pygame.display.init()
finished = False
clock = pygame.time.Clock()
# create simulation
sim = SatelliteSim()
sim.initRandomStations(2)
sim.initRandomTargets(10)
sim.goalRef.generateSingleGoals(sim.targets, 5)
sim.goalRef.generateCampaigns(sim.targets, sim.goalRef.MAX_CAMPAIGNS)
view = SatelliteView()
# create agent
agent = PDDLAgent()
#agent = GreedyAgent()
while not finished:
# check for window closed
for event in pygame.event.get():
if event.type == pygame.QUIT:
finished = True
view.drawSim(sim)
action = agent.getAction(sim)
finished = finished or sim.update(action, 0.5)
clock.tick(60)
pygame.quit()