dirpath = os.path.dirname(os.path.realpath(__file__)) + '/Images' timestart = time() speedfactor = 0.6 speedlimit = 70 turnspeedlimit = 60 ################### Setup Bluetooth ############################# oldvals = [0, 0, 0, 0] sendcount = 0 bd_addr = '98:D3:91:FD:46:C9' # use: 'hcitool scan' to scan for your T-Bot address port = 1 #btcom = tbt.bt_connect(bd_addr,port,'PyBluez') btcom = tbt.bt_connect(bd_addr, port, 'Socket') #port = 'COM5' #port = '/dev/tty.George-DevB' #baudrate = 38400 #btcom = tbt.bt_connect(bd_addr,port,'PySerial',baudrate) ################### Screen Text Class ############################# class TextPrint(object): def __init__(self): self.reset() self.font = pygame.font.Font(None, 15) def tprint(self, screen, textString):
#-------------------- Define functions ------------------------------# geom = geometry.geometry(1) # scale factor to convert pixels to mm #--------------------- Setup Bluetooth --------------------------------# data = [0, 0, 0, 0] sendcount = 0 #------------------------------------------------------------------ # For Linux / Raspberry Pi #------------------------------------------------------------------ bd_addr = '98:D3:51:FD:81:AC' # use: 'hcitool scan' to scan for your T-Bot address #bd_addr = '98:D3:51:FD:82:95' # George #bd_addr = '98:D3:91:FD:46:C9' # B #bd_addr = '98:D3:32:21:3D:77' port = 1 btcom = tbt.bt_connect(bd_addr, port, 'PyBluez') # PyBluez works well for the Raspberry Pi #btcom = tbt.bt_connect(bd_addr,port,'Socket') #----------------------------------------------------------------------# # For Windows and Mac #----------------------------------------------------------------------# #port = 'COM5' #port = '/dev/tty.George-DevB' #baudrate = 38400 #bd_addr = 'Empty' #btcom = tbt.bt_connect(bd_addr,port,'PySerial',baudrate) #---------------------- Setup the Camera ----------------------------# cap = cv2.VideoCapture(0) cap.set(cv2.CAP_PROP_AUTOFOCUS, 0) cap.set(cv2.CAP_PROP_FRAME_WIDTH, 720)
#----------------------------------------------------------------------# # For Linux / Raspberry Pi #----------------------------------------------------------------------# #bd_addr = '98:D3:51:FD:81:AC' # use: 'hcitool scan' to scan for your T-Bot address #bd_addr = '98:D3:32:21:3D:77' bd_addr = '98:D3:91:FD:46:C9' # B #bd_addr = '98:D3:32:21:3D:A2' # Foxy #bd_addr = '98:D3:91:FD:46:9C' # T-Bot #bd_addr = '98:D3:32:21:3D:77' # Cinemon #bd_addr = '98:D3:51:FD:82:95' # George bd_addr = '98:D3:71:FD:44:F7' port = 1 btcom = tbt.bt_connect(bd_addr, port, 'PyBluez') #btcom = tbt.bt_connect(bd_addr,port,'Socket') #----------------------------------------------------------------------# # For Windows and Mac #----------------------------------------------------------------------# #port = 'COM5' #port = '/dev/tty.George-DevB' #baudrate = 38400 #bd_addr = 'Empty' #btcom = tbt.bt_connect(bd_addr,port,'PySerial',baudrate) #------------------ Define some colors ---------------------------# BLACK = pygame.Color('black')
data1 = [0, 0, 0, 0] data2 = [0, 0, 0, 0] sendcount1 = 0 sendcount2 = 0 #----------------------------------------------------------------------# # For Linux / Raspberry Pi # use: 'hcitool scan' to scan for your T-Bot address # Note: you will have to connect to the T-Bot using your # system's bluetooth application using the 1234 as the password #----------------------------------------------------------------------# bd_addr2 = '98:D3:71:FD:46:9C' # Trailblazer bd_addr = '98:D3:51:FD:82:95' # George port = 1 btcom1 = tbt.bt_connect(bd_addr, port, 'PyBluez') # PyBluez works well for the Raspberry Pi btcom2 = tbt.bt_connect(bd_addr2, port, 'Socket') # PyBluez works well for the Raspberry Pi #btcom = tbt.bt_connect(bd_addr,port,'Socket') #----------------------------------------------------------------------# # For Windows and Mac #----------------------------------------------------------------------# #port = 'COM5' #port = '/dev/tty.George-DevB' #baudrate = 38400 #bd_addr = 'Empty' #btcom = tbt.bt_connect(bd_addr,port,'PySerial',baudrate) ######################################################################## #----------------------- Start main loop ----------------------------#