-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
36 lines (27 loc) · 1.08 KB
/
main.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
35
36
import pybullet
import simulation
import bots
import timing
import sim_interface
class Scheduler:
"""Gets everything running, switch between bots here"""
def __init__(self):
"""initializes simulation, interface, timer and control-system"""
print("loading...")
self.sim = simulation.Simulation(True)
self.physicsClientId = self.sim.client_id
print("simulation loaded\n")
self.interface = sim_interface.SimInterface(self.sim)
self.timer = timing.Timer(self.sim)
# chose the control-system for the bot.
self.control_system = bots.SlowMoBot(self.interface) # bots.<CurrentBot>(self.interface)
def run_sim(self):
"""starts the main loop of the simulation"""
while pybullet.isConnected(self.physicsClientId):
if not self.sim.paused:
self.control_system.step() # updates the bots' control-system
self.timer.step_simulation() # step physics
print("\n--simulation terminated--")
if __name__ == "__main__":
scheduler = Scheduler()
scheduler.run_sim()