Ejemplo n.º 1
0
swarm_tasks.utils.robot.DEFAULT_SIZE = 0.4
swarm_tasks.utils.robot.MAX_SPEED = 1.5
swarm_tasks.utils.robot.MAX_ANGULAR: 1
np.random.seed(10)
random.seed(10)

from swarm_tasks.simulation import simulation as sim
from swarm_tasks.simulation import visualizer as viz
from swarm_tasks.simulation import scenarios

import swarm_tasks.utils as utils
import swarm_tasks.controllers.base_control as base_control

from swarm_tasks.tasks import foraging as frg

s = sim.Simulation(num_bots=20, env_name='empty_world')

gui = viz.Gui(s)
gui.show_env()
gui.show_bots()

while 1:
    for b in s.swarm:

        cmd = frg.gather_resources(b)
        cmd.exec(b)

    scenarios.movable_resources(s, 5)

    gui.update()
    s.time_elapsed += 1
Ejemplo n.º 2
0
from swarm_tasks.simulation import simulation as sim
from swarm_tasks.simulation import visualizer as viz

import swarm_tasks.utils as utils
import swarm_tasks.envs as envs
import swarm_tasks.controllers as ctrl
import swarm_tasks.controllers.potential_field as potf
import swarm_tasks.controllers.base_control as base_control

from swarm_tasks.tasks import area_coverage as cvg

import numpy as np

s = sim.Simulation(num_bots=10,
                   env_name='rectangles',
                   contents_file='attractors')

gui = viz.Gui(s)
gui.show_env()
gui.show_bots()
gui.show_grid()

while 1:
    for b in s.swarm:

        cmd = cvg.disp_exp_area_cvg(b)
        cmd.exec(b)

    s.update_grid()
    gui.show_grid()
Ejemplo n.º 3
0
swarm_tasks.utils.robot.DEFAULT_NEIGHBOURHOOD_VAL = 6
swarm_tasks.utils.robot.DEFAULT_SIZE = 0.4
swarm_tasks.utils.robot.MAX_SPEED = 1.5
swarm_tasks.utils.robot.MAX_ANGULAR: 0.3
np.random.seed(42)
random.seed(42)

from swarm_tasks.simulation import simulation as sim
from swarm_tasks.simulation import visualizer as viz

#Required modules
import swarm_tasks.controllers.base_control as base_control
from swarm_tasks.modules.aggregation import aggr_centroid

#Initialize Simulation and GUI
s = sim.Simulation(env_name='rectangles')
gui = viz.Gui(s)
gui.show_env()

while (1):
    for b in s.swarm:
        #Base control
        cmd = base_control.base_control(b)
        cmd += base_control.obstacle_avoidance(b)

        #Behaviour
        cmd += aggr_centroid(b)

        #Execute
        cmd.exec(b)
Ejemplo n.º 4
0
from swarm_tasks.modules.aggregation import aggr_centroid, aggr_field
from swarm_tasks.modules.dispersion import disp_field
from swarm_tasks.modules.formations import circle
from swarm_tasks.modules.formations import line

from swarm_tasks.modules.surround import surround_attractor
from swarm_tasks.modules import exploration as exp
from swarm_tasks.modules import follow

from swarm_tasks.modules import decisions

import swarm_tasks.utils.logging as logging

import numpy as np

s = sim.Simulation(env_name='empty_world', contents_file='attractors')
#s = sim.Simulation(env_name='rectangles', contents_file='attractors')
#s = sim.Simulation(env_name='empty_world')
#s = sim.Simulation(num_bots=15,env_name='empty_world', contents_file='attractors')
#s = sim.Simulation(num_bots=20, env_name='rectangles', contents_file='attractors',\
#num_initial_states =2)

gui = viz.Gui(s)

gui.show_env()

gui.show_bots()

#s.swarm[0].set_goal(6,1)
#gui.show_grid()
Ejemplo n.º 5
0
swarm_tasks.utils.robot.MAX_SPEED = 1.5
swarm_tasks.utils.robot.MAX_ANGULAR: 0.3
np.random.seed(42)
random.seed(42)
CIRCLE_RADIUS = 4

from swarm_tasks.simulation import simulation as sim
from swarm_tasks.simulation import visualizer as viz

#Required modules
import swarm_tasks.controllers.base_control as base_control
from swarm_tasks.modules.formations import circle

#Initialize Simulation and GUI
s = sim.Simulation(num_bots=15,
                   env_name='empty_world',
                   contents_file='attractors')
gui = viz.Gui(s)
gui.show_env()

while (1):
    for b in s.swarm:
        #Base control
        cmd = base_control.base_control(b)
        cmd += base_control.obstacle_avoidance(b)

        #Behaviour
        cmd += circle(b, CIRCLE_RADIUS)

        #Execute
        cmd.exec(b)
Ejemplo n.º 6
0
swarm_tasks.utils.robot.MAX_SPEED = 1.5
swarm_tasks.utils.robot.MAX_ANGULAR: 1
np.random.seed(42)
random.seed(42)

from swarm_tasks.simulation import simulation as sim
from swarm_tasks.simulation import visualizer as viz
from swarm_tasks.simulation import scenarios

import swarm_tasks.utils as utils

from swarm_tasks.tasks import remove_contamination as remcon

import numpy as np

s = sim.Simulation(num_bots=15, env_name='rectangles')

gui = viz.Gui(s)
gui.show_env()
gui.show_bots()

while 1:
    for b in s.swarm:

        cmd = remcon.remove_contamination(b)
        cmd.exec(b)

    scenarios.contaminations(s, 0.0025, 40)  #0.004 for 20 bots

    gui.update()
    s.time_elapsed += 1
Ejemplo n.º 7
0
swarm_tasks.utils.robot.DEFAULT_SIZE = 0.4
swarm_tasks.utils.robot.MAX_SPEED = 1.5
swarm_tasks.utils.robot.MAX_ANGULAR: 0.3
np.random.seed(42)
random.seed(42)

from swarm_tasks.simulation import simulation as sim
from swarm_tasks.simulation import visualizer as viz

#Required modules
import swarm_tasks.controllers.base_control as base_control
from swarm_tasks.modules.dispersion import disp_field
from swarm_tasks.modules.surround import surround_attractor

#Initialize Simulation and GUI
s = sim.Simulation(env_name='rectangles', contents_file='attractors')
gui = viz.Gui(s)
gui.show_env()

while (1):
    for b in s.swarm:
        #Base control
        cmd = base_control.base_control(b)
        cmd += base_control.obstacle_avoidance(b)

        #Behaviour
        cmd += disp_field(b) * 0.05
        cmd += surround_attractor(b)

        #Execute
        cmd.exec(b)