def ascension(e): fob = Fob() fid = open('fob.dat', 'w') e.set() t0 = time.time() tp = time.time() while time.time() - t0 < WINL: ti = time.time() if ti - tp >= (0.0075): tp = time.time() x, y, z, roll, pitch, yaw = fob.get_posang() fid.write("%8.3f %8.3f %8.3f %8.3f %8.3f %8.3f %8.3f\n" % (tp - t0, x, y, z, roll, pitch, yaw)) fid.close() fob.close() print 'Ascension stop...'
class FobLogger(threading.Thread): def __init__(self, lock): threading.Thread.__init__(self) self.lock = lock self.fob = Fob() def run(self): while True: time.sleep(0.01) self.lock.acquire() main.coordinate = self.fob.getcord() # I hope this will work!, but now I dont have time deal with it; self.lock.release()
class Foblogger(threading.Thread): def __init__(self, t_name): threading.Thread.__init__(self, name=t_name) self.fob = Fob() def run(self): global COORD global FLAG global data_fob t0 = time.time() tp = time.time() while FLAG: ti = time.time() if ti - tp >= (0.0075): tp = time.time() MY_LOCK.acquire() COORD = self.fob.getcord() MY_LOCK.release() COORD.append(tp - t0) x = np.array([COORD]) data_fob = np.concatenate((data_fob, x), axis=0) print 'fob logger thread exiting...'
def __init__(self, t_name): threading.Thread.__init__(self, name=t_name) self.fob = Fob()
def __init__(self, lock): threading.Thread.__init__(self) self.lock = lock self.fob = Fob()