mirror of
https://github.com/brendanhaines/ECEN5458_Project.git
synced 2024-11-09 21:14:47 -07:00
add line position calculation
This commit is contained in:
parent
60d2905b3a
commit
46dba2f32c
|
@ -95,17 +95,15 @@ curdoc().add_periodic_callback(update_plot, 250)
|
||||||
|
|
||||||
def control_thread():
|
def control_thread():
|
||||||
global brightness
|
global brightness
|
||||||
ii = 0
|
|
||||||
while True:
|
while True:
|
||||||
time.sleep(0.01)
|
time.sleep(0.01)
|
||||||
brightness = [get_normalized_reflectivity(c) for c in range(8)]
|
brightness = np.clip([get_normalized_reflectivity(c) for c in range(8)], 0, 1)
|
||||||
|
line_position = np.sum((1 - brightness) * (np.arange(8) - 3.5))/np.sum(1-brightness)
|
||||||
if DEBUG:
|
if DEBUG:
|
||||||
for b in brightness:
|
for b in brightness:
|
||||||
print(f"{b:1.2f}\t", end="")
|
print(f"{b:1.2f}\t", end="")
|
||||||
|
print(f"{line_position:+1.2f}", end="")
|
||||||
print()
|
print()
|
||||||
ii += 1
|
|
||||||
if ii == 10:
|
|
||||||
ii = 0
|
|
||||||
|
|
||||||
|
|
||||||
t = threading.Thread(target=control_thread)
|
t = threading.Thread(target=control_thread)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user