mirror of
https://github.com/brendanhaines/ECEN5458_Project.git
synced 2024-11-09 21:14:47 -07:00
add default state if all sensors detect white
This commit is contained in:
parent
76863fa3ea
commit
453c155d5d
|
@ -110,6 +110,8 @@ def control_thread():
|
||||||
|
|
||||||
brightness = np.clip([get_normalized_reflectivity(c) for c in range(8)], 0, 1)
|
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)
|
line_position = np.sum((1 - brightness) * (np.arange(8) - 3.5))/np.sum(1-brightness)
|
||||||
|
if np.isnan(line_position):
|
||||||
|
line_position = 0
|
||||||
# TODO: implement control stuff and drive outputs
|
# TODO: implement control stuff and drive outputs
|
||||||
|
|
||||||
new_time_data = [[this_time, line_position]]
|
new_time_data = [[this_time, line_position]]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user