bug and improvement in deb file
This commit is contained in:
parent
d5808fe319
commit
18eb417933
2
debian/python3-urx.install
vendored
2
debian/python3-urx.install
vendored
@ -1 +1 @@
|
|||||||
urx /usr/lib/python3/dist-packages
|
urx/*.py /usr/lib/python3/dist-packages/urx
|
||||||
|
48
tracker.py
48
tracker.py
@ -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()
|
|
||||||
|
|
||||||
|
|
@ -47,8 +47,6 @@ class URRTMonitor(threading.Thread):
|
|||||||
self._qTarget = None
|
self._qTarget = None
|
||||||
self._tcp = None
|
self._tcp = None
|
||||||
self._tcp_force = None
|
self._tcp_force = None
|
||||||
# self._fwkin = pymoco.kinematics.FrameComputer(
|
|
||||||
# robotDef=pymoco.robot.getRobotType('UR6855A'))
|
|
||||||
|
|
||||||
def __recv_bytes(self, nBytes):
|
def __recv_bytes(self, nBytes):
|
||||||
''' Facility method for receiving exactly "nBytes" bytes from
|
''' Facility method for receiving exactly "nBytes" bytes from
|
||||||
@ -108,7 +106,6 @@ class URRTMonitor(threading.Thread):
|
|||||||
if wait:
|
if wait:
|
||||||
self.wait()
|
self.wait()
|
||||||
with self._dataAccess:
|
with self._dataAccess:
|
||||||
# tcf = self._fwkin(self._qActual)
|
|
||||||
tcf = self._tcp
|
tcf = self._tcp
|
||||||
if timestamp:
|
if timestamp:
|
||||||
return self._timestamp, tcf
|
return self._timestamp, tcf
|
||||||
@ -155,6 +152,17 @@ class URRTMonitor(threading.Thread):
|
|||||||
with self._dataEvent:
|
with self._dataEvent:
|
||||||
self._dataEvent.notifyAll()
|
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):
|
def stop(self):
|
||||||
#print(self.__class__.__name__+': Stopping')
|
#print(self.__class__.__name__+': Stopping')
|
||||||
self._stop = True
|
self._stop = True
|
||||||
@ -170,12 +178,6 @@ class URRTMonitor(threading.Thread):
|
|||||||
self.__recv_rt_data()
|
self.__recv_rt_data()
|
||||||
self._rtSock.close()
|
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
|
i = 1
|
||||||
def dumptcp():
|
def dumptcp():
|
||||||
global i
|
global i
|
||||||
|
Loading…
x
Reference in New Issue
Block a user