How to use the marabunta.models.PerimeterDefenseRobot function in marabunta

To help you get started, we’ve selected a few marabunta examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github david-mateo / marabunta / examples / spreading / spreading.py View on Github external
def new_robot(s, log):
    body = MockBody(s.get("pos"), s.get("heading") )
    network = MockNetwork(log,s.get("ID"))
    bot = PerimeterDefenseRobot( body, network, 0.02)
    bot.turn_on()
    return bot
github david-mateo / marabunta / examples / dr3 / dr3_demo.py View on Github external
num_friends = float(sys.argv[1])-1
except:
    num_friends = 4-1

# These parameters have to be manually
# set for each robot.
init_pos = s["position"]
init_heading = s["heading"]
ID=s["ID"]
slot = s["slot"]


mylock = Lock()
body = ebotBody( init_pos , init_heading, mylock)
network = XBeeExpirationNetwork( 1.4, slot, slot+0.1, 1, ID , mylock)
robot = PerimeterDefenseRobot( body, network, 0.02 )
robot.turn_on()
robot.broadcast_state()

friends = len(robot.get_agents())
patience = 50

while friends < num_friends and patience>0:
    patience -= 1
    print "# Only %i friends detected so far"%friends
    print "#", "\t".join(robot.get_agents().keys())
    friends = len(robot.get_agents())
    robot.broadcast_state()
    sleep(0.2)

# MAIN LOOP
end_time = time() + total_time