00001 #from threading import Thread 00002 import numpy 00003 00004 def wrap_to_pi(x): 00005 return numpy.mod(x+numpy.pi,2*numpy.pi)-numpy.pi 00006 00007 def sign(x): 00008 if x > 0: return +1 00009 if x < 0: return -1 00010 return 0 00011 00012 # 00013 #class WorkerThread(Thread): 00014 # 00015 # """Convenience wrapper around Thread""" 00016 # 00017 # def __init__(self, run_callback, finished_callback = None): 00018 # super(WorkerThread, self).__init__() 00019 # self._run_callback = run_callback 00020 # self._finished_callback = finished_callback 00021 # 00022 ## def start(self): 00023 ## self.run = self._run_callback 00024 # 00025 # def run(self): 00026 # self._run_callback() 00027 # if self._finished_callback: 00028 # self._finished_callback() 00029