@Override protected void doRun() { connectToVideoDataPort(); initializeCommunication(); setReady(); while (!isStopped()) { try { udpComponent.receive(incomingDataPacket); processData(); udpComponent.sendKeepAlivePacket(); } catch (RuntimeException e) { // This happens sometimes, but does not hinder the video data from being displayed } } disconnectFromVideoDataPort(); }
private void initializeCommunication() { udpComponent.sendKeepAlivePacket(); sleep(1000); }
private void connectToVideoDataPort() { logger.info(String.format("Connecting to video data port %d", getVideoDataPort())); udpComponent.connect(getDroneAddress(), getVideoDataPort()); }
private void disconnectFromVideoDataPort() { logger.info(String.format("Disconnecting from video data port %d", getVideoDataPort())); udpComponent.disconnect(); }