def __init__(self, addr): #Chassis values self.g = graph.Graph() self.addr = addr self.r = robot() self.r.connect(self.addr) self.pose = [0,0,0] #X,Y, Theta self.lspeed = 98 self.rspeed = 100 self.distance_travelled = 0 #Sensor access constants self.LEFT = -1 self.CENTER = 0 self.RIGHT = 1 self.SLEFT = 180 self.SRIGHT = 0 #Sensor variables self.destinations = (self.LEFT, self.CENTER, self.RIGHT) self.sensors = {self.LEFT:0, self.CENTER:0, self.RIGHT:0} self.encoders = {self.LEFT:0, self.RIGHT:0} self.junctions = {self.LEFT: False, self.CENTER: False, self.RIGHT: False} self.GraphSLAMDone = False print "A.I. loaded."
def connect(): global r address = "localhost" if len(sys.argv) == 2: address = "robo-wifi" + sys.argv[1] + ".csd.abdn.ac.uk" r = robot() r.connect(address)
def connect(): global r address = "localhost" if len(sys.argv) == 2: address = "robo-wifi"+sys.argv[1]+".csd.abdn.ac.uk" r = robot() r.connect(address)
#print sensors[15] turn_by(360,1,r) #print get_ranger_distance(-1) #print get_ranger_distance(0) #print get_ranger_distance(1) #while(True): # sensors = sensor_values() # go_straight(10) #calibrate() #r.setPT(90, 90) #this sets the pan/tilt head to 90 90 (pan,tilt) #sensor_values = r.get_sensors() #while(len(sensor_values) > 0): # sensor_values = r.get_sensors() # print sensor_values # if(sensor_values[14] < 400): # move(100, 0.5, 100, 0.5) # else: # move() # time.sleep(0.5) if __name__ == "__main__": address = "localhost" if len(sys.argv) == 2: address = "robo-wifi"+sys.argv[1]+".csd.abdn.ac.uk" r = robot() r.connect(address) main() r.disconnect()