fix position math
This commit is contained in:
parent
dadd09d914
commit
5c4f541669
|
@ -72,7 +72,7 @@ class MainWindow(pg.GraphicsLayoutWidget):
|
||||||
|
|
||||||
def update_position(self, position):
|
def update_position(self, position):
|
||||||
self.position_history = np.roll(self.position_history, -1)
|
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.clear()
|
||||||
self.position.plot(self.position_history)
|
self.position.plot(self.position_history)
|
||||||
|
|
||||||
|
|
|
@ -184,9 +184,8 @@ class PositionTracker:
|
||||||
self.last_position = 0.0
|
self.last_position = 0.0
|
||||||
|
|
||||||
def input(self, ref, meas):
|
def input(self, ref, meas):
|
||||||
demod = np.conjugate(ref)*meas
|
phase = np.angle(meas*ref.conj())
|
||||||
phase = np.angle(demod)
|
position = continuous_unwrap(self.last_phase, self.last_position, phase)
|
||||||
position = continuous_unwrap(self.last_phase, self.last_position, phase)/(2.0*np.pi)
|
|
||||||
self.last_phase = phase[-1]
|
self.last_phase = phase[-1]
|
||||||
self.last_position = position[-1]
|
self.last_position = position[-1]
|
||||||
return position
|
return position
|
||||||
|
|
Loading…
Reference in New Issue