diff --git a/debian/python3-urx.install b/debian/python3-urx.install index 22b35a2..9710648 100644 --- a/debian/python3-urx.install +++ b/debian/python3-urx.install @@ -1 +1 @@ -urx /usr/lib/python3/dist-packages +urx/*.py /usr/lib/python3/dist-packages/urx diff --git a/tracker.py b/tracker.py deleted file mode 100644 index 1faf834..0000000 --- a/tracker.py +++ /dev/null @@ -1,48 +0,0 @@ -import time -from multiprocessing import Process, Queue, Event - - -class Tracker(Process): - def __init__(self): - self._queue = Queue() - Process.__init__(self, args=(self._queue,)) - self._stop = Event() - self._finished = Event() - - def run(self): - print("Running") - while not self._stop.is_set(): - time.sleep(1) - self._queue.put([1,2,3,4,5,"lkj"]) - self._finished.set() - print("Closing") - - def start_acquisition(self): - self.start() - - def stop_acquisition(self): - self._stop.set() - - def get_result(self): - self._stop.set() - while not self._finished.is_set(): - time.sleep(0.1) - return self._queue.get() - - def shutdown(self): - self._stop.set() # just to make sure - self.join() - - -if __name__ == "__main__": - p = Tracker() - try: - p.start_acquisition() - time.sleep(3) - p.stop_acquisition() - a = p.get_result() - print("Result is: ", a) - finally: - p.shutdown() - - diff --git a/urx/urrtmon.py b/urx/urrtmon.py index 6cca635..c08e7fd 100644 --- a/urx/urrtmon.py +++ b/urx/urrtmon.py @@ -47,8 +47,6 @@ class URRTMonitor(threading.Thread): self._qTarget = None self._tcp = None self._tcp_force = None - # self._fwkin = pymoco.kinematics.FrameComputer( - # robotDef=pymoco.robot.getRobotType('UR6855A')) def __recv_bytes(self, nBytes): ''' Facility method for receiving exactly "nBytes" bytes from @@ -108,7 +106,6 @@ class URRTMonitor(threading.Thread): if wait: self.wait() with self._dataAccess: - # tcf = self._fwkin(self._qActual) tcf = self._tcp if timestamp: return self._timestamp, tcf @@ -155,6 +152,17 @@ class URRTMonitor(threading.Thread): with self._dataEvent: self._dataEvent.notifyAll() + def get_all_data(self, wait=True): + """ + return all data parsed from robot as dict + The content of the dict may vary depending on version of parser and robot controller + but their name should stay constant + """ + if wait: + self.wait() + with self._dataAccess: + return dict(timestamp=self._timestamp, qActual=self._qActual, qTarget=self._qTarget, tcp=self._tcp, tcp_force=self._tcp_force) + def stop(self): #print(self.__class__.__name__+': Stopping') self._stop = True @@ -170,12 +178,6 @@ class URRTMonitor(threading.Thread): self.__recv_rt_data() self._rtSock.close() -def logDeviation(logDT=0.1): - np.set_printoptions(precision=4) - while True: - print urRTMon.getTarget()-urRTMon.getActual() - time.sleep(logDT) - i = 1 def dumptcp(): global i