def bob_client(ctx): print("STARTING BOB") bob = zmq.Socket(CTX, zmq.REQ) bob.connect("ipc:///tmp/test") bob.send(str(drive_UK).encode('ascii')) print("BOB GOT:", bob.recv())
def __init__(self, master=None): super().__init__(master) self.pack() self.create_widgets() print("STARTING BOB") self.bob = zmq.Socket(CTX, zmq.REQ) self.bob.connect("ipc:///tmp/test") self.drive_UK = False
def bob_client(ctx, count): print("STARTING BOB") bob = zmq.Socket(CTX, zmq.REQ) bob.connect("ipc:///tmp/test") for i in range(0, count): print("BOB SENDING") bob.send("HI") print("BOB GOT:", bob.recv())
def alice_server(ctx, count): print("STARTING ALICE") alice = zmq.Socket(CTX, zmq.REP) alice.bind("ipc:///tmp/test") print("ALICE READY") for i in range(0, count): print("ALICE GOT:", alice.recv()) print("ALIC SENDING") alice.send("HI BACK")
def __init__(self, frame_len, filename=None, zmq_addr=None, fps=None): # Save values self.fps = fps self.frame_len = frame_len # Can't be both if (filename is not None) and (zmq_addr is not None): raise RuntimeError("Can't read both from file and from ZMQ !") # Init file if filename is not None: self._file = file(filename, 'rb') self._read = self._read_file # Init ZMQ else: self._zmq = zmq.Socket(zmq.Context(), zmq.SUB) self._zmq.connect(zmq_addr) self._zmq.setsockopt(zmq.SUBSCRIBE, "") self._read = self._read_zmq self._frame = '' # Start the thread eventlet.spawn(self._run)
sio = socketio.Server() app = Flask(__name__) model = None prev_image_array = None #global #count_lane_side = 0 drive_UK = False from eventlet.green import zmq import eventlet CTX = zmq.Context(1) print("STARTING ALICE") alice = zmq.Socket(CTX, zmq.REP) alice.bind("ipc:///tmp/test") print("ALICE READY") @sio.on('telemetry') def telemetry(sid, data): if data: # The current steering angle of the car steering_angle = data["steering_angle"] # The current throttle of the car throttle = data["throttle"] # The current speed of the car speed = data["speed"] # The current image from the center camera of the car