Only pull shooter back when the battery voltage is high.
Change-Id: I9b57e181a875005227a1c46f2a78326f61664178
diff --git a/aos/common/controls/control_loop_test.cc b/aos/common/controls/control_loop_test.cc
index fd461b6..6c881f2 100644
--- a/aos/common/controls/control_loop_test.cc
+++ b/aos/common/controls/control_loop_test.cc
@@ -50,6 +50,7 @@
new_state->voltage_5v = 5.0;
new_state->voltage_roborio_in = 12.4;
+ new_state->voltage_battery = 12.4;
new_state.Send();
}
diff --git a/y2014/control_loops/shooter/shooter.cc b/y2014/control_loops/shooter/shooter.cc
index 5211967..52589f7 100644
--- a/y2014/control_loops/shooter/shooter.cc
+++ b/y2014/control_loops/shooter/shooter.cc
@@ -530,10 +530,11 @@
// If we have moved any amount since the start and the shooter has now
// been still for a couple cycles, the shot finished.
// Also move on if it times out.
- if ((::std::abs(firing_starting_position_ -
- shooter_.absolute_position()) > 0.0005 &&
- cycles_not_moved_ > 3) ||
- Time::Now() > shot_end_time_) {
+ if (((::std::abs(firing_starting_position_ -
+ shooter_.absolute_position()) > 0.0005 &&
+ cycles_not_moved_ > 3) ||
+ Time::Now() > shot_end_time_) &&
+ ::aos::robot_state->voltage_battery > 10.5) {
state_ = STATE_REQUEST_LOAD;
++shot_count_;
}