ur/ur_communicator.py
def recv_handler(self):
        """Receives and stores sensory packets from the UR.

        Waits for packets to arrive from UR-robot through `socket.recv` call,
        checks for any delay in transmission.
        This method also handles re-establishing of a lost connection.

        Raises:
            IOError, ValueError - data convertion errors.
        """

        try:
            REALTIME_COMM_PACKET = ur_utils.get_rt_packet_def(
                self._firmware_version)

            data = self._sock.recv(
                ur_utils.get_rt_packet_size(self._firmware_version))
            self._recv_time = time.time()  # time after receiving packet

            # To fix CB2 issue
            data = data.ljust(REALTIME_COMM_PACKET.itemsize, b'\0')

            # check and parse received packet
            self.pre_check(data)

            parsed = np.frombuffer(data, dtype=REALTIME_COMM_PACKET)

            self._prev_recv_time = self._recv_time
            self._num_read_lock.acquire()
            self._num_reads += 1
            self._num_read_lock.release()

            return parsed
        except (IOError, ValueError):
            self._stop = True
            self._sock.close()
            self._dashboard_sock.close()

            self._sock = self.make_connection(
                self._host,
                ur_utils.REALTIME_COMM_CLIENT_INTERFACE_PORT,
                disable_nagle_algorithm=self._disable_nagle_algorithm)

            self._dashboard_sock = self.make_connection(
                self._host,
                ur_utils.DASHBOARD_SERVER_PORT,
                disable_nagle_algorithm=self._disable_nagle_algorithm)

            self._stop = False
        except Exception:
            raise
Receives and stores sensory packets from the UR.

        Waits for packets to arrive from UR-robot through `socket.recv` call,
        checks for any delay in transmission.
        This method also handles re-establishing of a lost connection.

        Raises:
            IOError, ValueError - data convertion errors.
        
Receives and stores sensory packets from the UR.
Waits for packets to arrive from UR-robot through `socket.recv` call,
checks for any delay in transmission.
This method also handles re-establishing of a lost connection.


Receives and stores sensory packets from the UR . Waits for packets to arrive from UR - robot through ` socket . recv ` call checks for any delay in transmission . This method also handles re - establishing of a lost connection .
def recv_handler(self):
        try:
            REALTIME_COMM_PACKET = ur_utils.get_rt_packet_def(
                self._firmware_version)
            data = self._sock.recv(
                ur_utils.get_rt_packet_size(self._firmware_version))
            self._recv_time = time.time()  
            data = data.ljust(REALTIME_COMM_PACKET.itemsize, b'\0')
            self.pre_check(data)
            parsed = np.frombuffer(data, dtype=REALTIME_COMM_PACKET)
            self._prev_recv_time = self._recv_time
            self._num_read_lock.acquire()
            self._num_reads += 1
            self._num_read_lock.release()
            return parsed
        except (IOError, ValueError):
            self._stop = True
            self._sock.close()
            self._dashboard_sock.close()
            self._sock = self.make_connection(
                self._host,
                ur_utils.REALTIME_COMM_CLIENT_INTERFACE_PORT,
                disable_nagle_algorithm=self._disable_nagle_algorithm)
            self._dashboard_sock = self.make_connection(
                self._host,
                ur_utils.DASHBOARD_SERVER_PORT,
                disable_nagle_algorithm=self._disable_nagle_algorithm)
            self._stop = False
        except Exception:
            raise
def recv_handler ( self ) : try : REALTIME_COMM_PACKET = ur_utils . get_rt_packet_def ( self . _firmware_version ) data = self . _sock . recv ( ur_utils . get_rt_packet_size ( self . _firmware_version ) ) self . _recv_time = time . time ( ) data = data . ljust ( REALTIME_COMM_PACKET . itemsize , b'\0' ) self . pre_check ( data ) parsed = np . frombuffer ( data , dtype = REALTIME_COMM_PACKET ) self . _prev_recv_time = self . _recv_time self . _num_read_lock . acquire ( ) self . _num_reads += 1 self . _num_read_lock . release ( ) return parsed except ( IOError , ValueError ) : self . _stop = True self . _sock . close ( ) self . _dashboard_sock . close ( ) self . _sock = self . make_connection ( self . _host , ur_utils . REALTIME_COMM_CLIENT_INTERFACE_PORT , disable_nagle_algorithm = self . _disable_nagle_algorithm ) self . _dashboard_sock = self . make_connection ( self . _host , ur_utils . DASHBOARD_SERVER_PORT , disable_nagle_algorithm = self . _disable_nagle_algorithm ) self . _stop = False except Exception : raise
Receives and stores sensory packets from the UR.
Receives and stores sensory packets from the UR .
"""Receives and stores sensory packets from the UR.

        Waits for packets to arrive from UR-robot through `socket.recv` call,
        checks for any delay in transmission.
        This method also handles re-establishing of a lost connection.

        Raises:
            IOError, ValueError - data convertion errors.
        """ # time after receiving packet # To fix CB2 issue # check and parse received packet
self