Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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 = 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)
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)
speed=0.15
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)