add error message if no data outside of adjustment range
@@ -926,6 +926,10 @@ def attempt_to_make_angle_continuous(
raise ValueError("The adjustment range was larger than the maximum")
within_adjustment_range = np.abs(angle) >= 180 - init_range_to_adjust
+ outside_adjustment_range = np.invert(within_adjustment_range)
+
+ if not np.any(outside_adjustment_range):
+ raise ValueError("No data outside the safe angle bounds.")
index_within = np.where(within_adjustment_range)[0]
index_outside = np.where(np.invert(within_adjustment_range))[0]
@@ -960,12 +964,8 @@ def attempt_to_make_angle_continuous(
angle[closest_left_leaning][sign_to_be_adjusted]
)
- st.write(angles_to_be_adjusted)
-
angle[index_within[sign_to_be_adjusted]] = angles_to_be_adjusted
- st.write(angle)
-
rpm = determine_speed(angle, time)
if np.any(rpm > speed_limit):
angle = attempt_to_make_angle_continuous(
