-
Notifications
You must be signed in to change notification settings - Fork 1
/
runner.py
41 lines (30 loc) · 1.01 KB
/
runner.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
37
38
39
40
41
from core.deeco import Node
from core.sim import Sim
from core.position import Position
from plugins.identity_replicas import IdentityReplicas
from plugins.simplenetwork import SimpleNetwork
from plugins.walker import Walker
from plugins.knowledgepublisher import KnowledgePublisher
from plugins.ensemblereactor import EnsembleReactor
from robot import Robot
from robotgroup import RobotGroup
from plugins.snapshoter import Snapshoter
print("Running simulation")
sim = Sim()
# Add snapshoter plugin
Snapshoter(sim, period_ms=100)
# Add identity replicas plugin (provides replicas using deep copies of original knowledge)
IdentityReplicas(sim)
# Add simple network device
SimpleNetwork(sim, range_m=3, delay_ms_mu=20, delay_ms_sigma=5)
# Add X nodes hosting one component each
for i in range(0, 5):
position = Position(2 * i, 3 * i)
node = Node(sim)
Walker(node, position)
KnowledgePublisher(node)
EnsembleReactor(node, [RobotGroup()])
robot = Robot(node)
node.add_component(robot)
# Run the simulation
sim.run(60000)