From 453c155d5d173ab8afd8deefc7cba94338d75404 Mon Sep 17 00:00:00 2001 From: Brendan Haines Date: Mon, 2 Mar 2020 20:17:17 -0700 Subject: [PATCH] add default state if all sensors detect white --- Software/python/hwtest.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Software/python/hwtest.py b/Software/python/hwtest.py index ed7e131..5e8e693 100644 --- a/Software/python/hwtest.py +++ b/Software/python/hwtest.py @@ -110,6 +110,8 @@ def control_thread(): 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 np.isnan(line_position): + line_position = 0 # TODO: implement control stuff and drive outputs new_time_data = [[this_time, line_position]]