re-enable position tracker

This commit is contained in:
Sebastien Bourdeauducq 2020-08-11 16:24:50 +08:00
parent b28d0ad337
commit 79a61a4073
2 changed files with 10 additions and 3 deletions

7
dmi.py
View File

@ -49,8 +49,11 @@ def main():
# Update the MEAS GUI at the same time so it's synchronized # Update the MEAS GUI at the same time so it's synchronized
gui.update_meas(samples_meas) gui.update_meas(samples_meas)
#position, leakage = position_tracker.input(samples_ref, samples_meas) if stabilizer.locked():
#print(np.sum(position)/len(position), leakage) position, leakage = position_tracker.input(samples_ref, samples_meas)
print(np.sum(position)/len(position), leakage)
else:
position_tracker.reset()
finally: finally:
buf_sdr.dispose(buffers) buf_sdr.dispose(buffers)
finally: finally:

View File

@ -170,9 +170,13 @@ def continuous_unwrap(last_phase, last_phase_unwrapped, p):
class PositionTracker: class PositionTracker:
def __init__(self, leakage_avg): def __init__(self, leakage_avg):
self.leakage_avg = leakage_avg
self.reset()
def reset(self):
self.last_phase = 0.0 self.last_phase = 0.0
self.last_position = 0.0 self.last_position = 0.0
self.leakage = np.zeros(leakage_avg) self.leakage = np.zeros(self.leakage_avg)
self.leakage_ptr = 0 self.leakage_ptr = 0
def input(self, ref, meas): def input(self, ref, meas):