Exemple #1
0
import sys
import signal
from ahoy.world import World
from ahoy.commsengines.logloss import LogLossComms
from ahoy.simulation import Simulation
from ahoy.entities.node import Node
from ahoy.sensors.chemicalsensor import ChemicalSensor
from ahoy.events.chemical import ChemicalSpillEvent
from ahoy.agents.chemspillannounce import ChemicalSpillAnnounceAgent

world = World()

node = Node(0)
node.add_sensor('chemical', ChemicalSensor(interval=1, use_event_channel=True))
node.set_position(39.883531, -75.193963, 0) #sw of navy yard
world.add_entity(node)

node1 = Node(1)
node1.add_sensor('chemical', ChemicalSensor(interval=1, use_event_channel=True))
node1.set_position(39.890776,-75.195594, 0) #w of navy yard
world.add_entity(node1)

node2 = Node(2)
node2.set_position(39.892223,-75.196788, 0) #immediately east of I-95 bridge, on water
node2.add_agent( ChemicalSpillAnnounceAgent(2, 1, 4, 0.1) )   #ID, interval, announce time, spill rate in km/s
world.add_entity(node2)

if __name__ == '__main__' :
    sim = Simulation(world)

    def quit(signal, frame) :
Exemple #2
0
import sys
import signal
from ahoy.world import World
from ahoy.commsengines.logloss import LogLossComms
from ahoy.simulation import Simulation
from ahoy.entities.node import Node
from ahoy.sensors.sonarsensor import SonarSensor
from ahoy.util.units import *

world = World()

node = Node(0)
node.add_sensor('radar', SonarSensor(source_level=220, source_bw=10, array_size=360, interval=5, min_snr=2))
#node.set_position(39.95324, -75.13752, 0) #west pylon
node.set_position(39.95102, -75.13517, 0) #middle river
#node.set_position(42.67205, -86.83878, 0)

world.add_entity(node)

node1 = Node(1)
node1.set_position(39.94302, -75.13753, 0)
node1.set_parameter('sonar_level', 25)
world.add_entity(node1)

if __name__ == '__main__' :
    sim = Simulation(world)

    def quit(signal, frame) :
        print 'Stopping...'
        sim.stop()
        sys.exit(0)
Exemple #3
0
    n.add_agent(ship)
    world.add_entity(n)


# Make sensor interfaces
s1net = Network('sonar1n', LogLossComms())
world.add_network(s1net)
s2net = Network('sonar2n', LogLossComms())
world.add_network(s2net)
r1net = Network('radar1n', LogLossComms())
world.add_network(r1net)

# SW tip of airport
sonar1n = Node(901)
sonar1n.set_position(39.8560599677, -75.255277528, 0)
sonar1n.add_sensor('sonar', SonarSensor(source_level=220, source_bw=10, array_size=360, interval=5, min_snr=120, use_event_channel=True))
sonar1n.add_interface(Interface('sonar1', s1net, power=120))
#sonar1n.add_agent(SensorForwardAgent(sonar1n.get_uid(), 'sonar', 'sonar1'))
world.add_entity(sonar1n)
#print 'sonar1n id: ', sonar1n.get_uid()

# Eastern bank of river, north of 76 bridge to NJ
sonar2n = Node(902)
sonar2n.set_position(39.9103365806, -75.1257383781, 0)
sonar2n.add_sensor('sonar', SonarSensor(source_level=220, source_bw=10, array_size=360, interval=5, min_snr=120, use_event_channel=True))
sonar2n.add_interface(Interface('sonar2', s2net, power=120))
#sonar2n.add_agent(SensorForwardAgent(sonar2n.get_uid(), 'sonar', 'sonar2'))
world.add_entity(sonar2n)

# On pier of naval yard
Exemple #4
0
    (39.9410, -75.1420, 39.9360, -75.1321), 
    (39.9330, -75.1418, 39.9281, -75.1311)
]
for i, loc in enumerate(heli_areas) :
    heli = Node(i)
    heli.set_position(loc[0], loc[1], feet(i * 100))
    nw = (loc[0], loc[1])
    se = (loc[2], loc[3])
    heli.add_agent(RectangleSurveilAgent(i, nw, se, feet(150)))

    heli.add_interface(Interface('wlan0', wlan, power=120))
    world.add_entity(heli)

radar = Node(len(world.get_entities()))
radar.set_position(39.9485, -75.1325, 0)
radar.add_sensor('radar', RadarSensor(watts(6000), 25, 1, 5, 1, 3/360.0, 1, use_event_channel=True))
world.add_entity(radar)

paths = [
    [feet(15), (39.9545, -75.1358, 0), (39.9432, -75.1363, 0), (39.9273, -75.1348, 0)],
    [feet(100), (39.9534, -75.1320, 0), (39.9374, -75.1367, 0), (39.9263, -75.1322, 0)],
    [feet(25), (39.9281, -75.1385, 0), (39.9416, -75.1393, 0), (39.9591, -75.1341, 0)],
    [feet(50), (39.9268, -75.1322, 0), (39.9333, -75.1340, 0), (39.9482, -75.1337, 0), (39.9583, -75.1322, 0)]
]

for path in paths :
    e = Scripted(len(world.get_entities()), path[2:], path[0], 0)
    e.set_position(*path[1])
    world.add_entity(e)

if __name__ == '__main__' :
Exemple #5
0
from ahoy.sensors.camerasensor import CameraSensor

world = World()
wlan = Network('wlan0', LogLossComms())
uavnet = Network('uavnet',LogLossComms())

world.add_network(wlan)
world.add_network(uavnet)
path = "agents/paths/path"
pathfile = "agents/paths/tpaths.dat"

uavnode = Node(1)
uavnode.set_position(39.8661,-75.2549, 0.0001)
#uavnode.set_position(39.8656978,-75.21841399, 0.0001)
uavnode.add_interface(Interface('uavnet',uavnet,power=120))
uavnode.add_sensor('camera', CameraSensor(1.75,0.25,use_event_channel=True))
uavnode.add_agent(SensorForwardAgent(uavnode.get_uid(),'camera','uavnet'))
uavnode.add_agent(UAV(8,1.0,0.045,0.015))


world.add_entity(uavnode)


for i in range(0,9):
    n = Node(i+100)
    ship = SmallShip(i+200, i, 0.02, path + str(i) + ".dat")
    n.add_agent(ship)
    world.add_entity(n)

if __name__ == '__main__' :
    sim = Simulation(world)
Exemple #6
0
groundst.add_agent(DivertAgent(len(world.get_entities()),'aisn'))
world.add_entity(groundst)

#create tanker
tanknode = Node(len(world.get_entities()))
tanknode.add_interface(Interface('aisn',aisnet,power=120))
tanknode.add_agent(Tanker(80,0.08,'aisn',pathfile))
world.add_entity(tanknode)

active = [[39.890750000000004, -75.196423312500002], [39.883578125, -75.195800625000004], [39.878743749999998, -75.196907624999994], [39.873325000000001, -75.202165874999992], [39.869075000000002, -75.208600312499996], [39.8930875, -75.193794187500004], [39.888784375, -75.193725000000001], [39.886287500000002, -75.196215749999993], [39.885490625000003, -75.193309874999997], [39.882303125, -75.192272062499995], [39.881718750000005, -75.198222187499994], [39.880125, -75.201612374999996], [39.877787500000004, -75.204725812500001], [39.875450000000001, -75.207008999999999], [39.872740624999999, -75.211437000000004], [39.876512500000004, -75.201681562499999], [39.869871875000001, -75.204379875000001], [39.86981875, -75.214204499999994], [39.875396875, -75.197599499999995], [39.879062500000003, -75.191856937499992], [39.867587499999999, -75.220292999999998], [39.866631250000005, -75.215934187499997], [39.863975000000003, -75.213581812499996], [39.863709374999999, -75.219808687499992], [39.864931249999998, -75.226589062499997], [39.892609374999999, -75.201197249999993], [39.894893750000001, -75.203480437500005], [39.894309374999999, -75.207285749999997], [39.896646875000002, -75.208600312499996], [39.898293750000001, -75.213305062499998], [39.900950000000002, -75.212889937499995], [39.872475000000001, -75.207147374999991], [39.870350000000002, -75.199744312500002], [39.875450000000001, -75.193863374999992], [39.872262500000005, -75.196077375000002], [39.861637500000001, -75.218632499999998], [39.861212500000001, -75.226727437500003], [39.862275000000004, -75.232262437499998]]

for loc in active :
#for i in range(0,len(active),2) :
#    loc = active[i]
    chem = Node(len(world.get_entities()))
    chem.add_sensor('chemical', ChemicalSensor(interval=1, use_event_channel='hey aaron i think this is broken'))
    chem.set_position(loc[0], loc[1], 0)
    world.add_entity(chem)

inactive = [[39.857068750000003, -75.224790187499991], [39.857387500000002, -75.217594687499997], [39.860468750000003, -75.213235874999995], [39.863921875000003, -75.206178749999992], [39.866790625, -75.209914874999996], [39.866418750000001, -75.202304249999997], [39.869659375000005, -75.197115187500003], [39.865834374999999, -75.195731437500001], [39.869978125000003, -75.192064500000001], [39.874546875, -75.188328374999998], [39.876193749999999, -75.183762000000002], [39.877043749999999, -75.190127250000003], [39.879646874999999, -75.186944624999995], [39.882621874999998, -75.188051625], [39.885278124999999, -75.186321937499997], [39.885278124999999, -75.182793375000003], [39.885596875000005, -75.178088625000001], [39.882674999999999, -75.183346874999998], [39.880284375000002, -75.182378249999999], [39.877787500000004, -75.179956687499995], [39.879168749999998, -75.175943812499995], [39.881240625000004, -75.178434562500001], [39.883259375000002, -75.178642124999996], [39.879168749999998, -75.171654187499996], [39.883206250000001, -75.173037937499998], [39.88618125, -75.172553624999992], [39.882834375000002, -75.168402374999999], [39.885862500000002, -75.1670878125], [39.879009375000003, -75.165496500000003], [39.88660625, -75.161552812500005], [39.883365625000003, -75.162867375000005], [39.878690625000004, -75.160999312499996], [39.881240625000004, -75.158646937499995], [39.885012500000002, -75.156848062500003], [39.878425, -75.155118375000001], [39.881718750000005, -75.154218937500005], [39.887137500000001, -75.153250312499992], [39.884693750000004, -75.150552000000005], [39.880390625000004, -75.149929312499992], [39.878690625000004, -75.146400749999998], [39.882621874999998, -75.145570500000005], [39.887509375, -75.146885062500004]]

#for i in range(0,len(inactive),2) :
#    loc = inactive[i]
for loc in inactive :
    chem = Node(len(world.get_entities()))
    chem.add_sensor('chemical', ChemicalSensor(interval=9000))
    chem.set_position(loc[0], loc[1], 0)
    world.add_entity(chem)

chemspill = Node(len(world.get_entities()))
chemspill.set_position(39.892223,-75.196788, 0) #immediately east of I-95 bridge, on water