fix position math

This commit is contained in:
Sebastien Bourdeauducq 2020-08-16 17:45:28 +08:00
parent dadd09d914
commit 5c4f541669
2 changed files with 3 additions and 4 deletions

View File

@ -72,7 +72,7 @@ class MainWindow(pg.GraphicsLayoutWidget):
def update_position(self, position):
self.position_history = np.roll(self.position_history, -1)
self.position_history[-1] = position*632.816/2
self.position_history[-1] = position*632.816/(4.0*np.pi)
self.position.clear()
self.position.plot(self.position_history)

View File

@ -184,9 +184,8 @@ class PositionTracker:
self.last_position = 0.0
def input(self, ref, meas):
demod = np.conjugate(ref)*meas
phase = np.angle(demod)
position = continuous_unwrap(self.last_phase, self.last_position, phase)/(2.0*np.pi)
phase = np.angle(meas*ref.conj())
position = continuous_unwrap(self.last_phase, self.last_position, phase)
self.last_phase = phase[-1]
self.last_position = position[-1]
return position