def main(): comm = HID_Comm() try: comm.open() except IOError, ex: print "Spark not found:",ex
def main(): comm = HID_Comm() try: comm.open() except IOError, ex: print "Spark not found:", ex
def main(): address = raw_input("Address of Spark or press 'return' if using board") if address == "-": address == "tcp://CoroBotSpark.local:4567" elif address == "": comm = HID_Comm() try: comm.open() except IOError, ex: print("Spark not found:", ex) sys.exit()
def main(): addr = raw_input("Address of target (tcp://its.ip.add.ress:port) or hit enter for local USB:") if addr == "-": addr = "tcp://raspberrypi.local:4567" if addr == "": comm = HID_Comm() try: comm.open() except IOError, ex: print "Spark not found:",ex sys.exit()
def main(): addr = raw_input( "Address of target (tcp://its.ip.add.ress:port) or hit enter for local USB:" ) if addr == "-": addr = "tcp://raspberrypi.local:4567" if addr == "": comm = HID_Comm() try: comm.open() except IOError, ex: print "Spark not found:", ex sys.exit()
def main(): ctx = zmq.Context() comm = HID_Comm() comm.open() zsock = ctx.socket(zmq.XREP) zsock.bind("tcp://*:4567") while (True): indat = zsock.recv_multipart() origin = indat[0] frame = bytearray(indat[1]) replyflag = indat[2] comm.send(frame) print "B" if replyflag == "1": replydata = comm.receive() zsock.send_multipart([origin, bytearray(replydata)])
tune_val = 2 for control in controller: weighted_sum_deriv = ((abs(control_last-controller))*control_weight)+weighted_sum_deriv if((weighted_sum_deriv * time_since_last_pkt)>tune_val): return controller else: return None if __name__ == '__main__': addr = "" try: if not sys.argv[1] == "-q": addr = raw_input("Address of target (its.ip.add.ress:port) or hit enter for local USB:") except: addr = raw_input("Address of target (its.ip.add.ress:port) or hit enter for local USB:") if addr == "": comm = HID_Comm() try: comm.open() except IOError, ex: print "Spark not found:",ex sys.exit() else: comm = NET_ZMQ_Comm() try: comm.open("tcp://"+addr) except: print "Error connecting to Spark" sys.exit() sparkout = Spark_Drive(comm) gamepad = Spark_Gamepad(sparkout)