How to use the marabunta.XBeeExpirationNetwork 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 / dr3 / heading.py View on Github external
try:
    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 = HeadingConsensusRobot( body, network )
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
github david-mateo / marabunta / examples / dr3 / leader.py View on Github external
try:
    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 = Leader( body, network )
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