Move Position, robot_state, and joystick_state over
ControlLoop should now be completely using the event loop.
Change-Id: Ifb936c384d1031abbc9e61d834b1ef157ad0841c
diff --git a/y2014/control_loops/claw/claw.cc b/y2014/control_loops/claw/claw.cc
index 088472c..82ca3a5 100644
--- a/y2014/control_loops/claw/claw.cc
+++ b/y2014/control_loops/claw/claw.cc
@@ -604,9 +604,7 @@
return (
(top_claw_.zeroing_state() == ZeroedStateFeedbackLoop::CALIBRATED &&
bottom_claw_.zeroing_state() == ZeroedStateFeedbackLoop::CALIBRATED) ||
- (((::aos::joystick_state.get() == NULL)
- ? true
- : ::aos::joystick_state->autonomous) &&
+ ((has_joystick_state() ? joystick_state().autonomous : true) &&
((top_claw_.zeroing_state() == ZeroedStateFeedbackLoop::CALIBRATED ||
top_claw_.zeroing_state() ==
ZeroedStateFeedbackLoop::DISABLED_CALIBRATION) &&
@@ -674,12 +672,12 @@
}
bool autonomous, enabled;
- if (::aos::joystick_state.get() == nullptr) {
+ if (has_joystick_state()) {
+ autonomous = joystick_state().autonomous;
+ enabled = joystick_state().enabled;
+ } else {
autonomous = true;
enabled = false;
- } else {
- autonomous = ::aos::joystick_state->autonomous;
- enabled = ::aos::joystick_state->enabled;
}
double bottom_claw_velocity_ = 0.0;
diff --git a/y2014/control_loops/shooter/shooter.cc b/y2014/control_loops/shooter/shooter.cc
index f61cc02..7f3a3b0 100644
--- a/y2014/control_loops/shooter/shooter.cc
+++ b/y2014/control_loops/shooter/shooter.cc
@@ -249,8 +249,7 @@
// Don't even let the control loops run.
bool shooter_loop_disable = false;
- const bool disabled =
- !::aos::joystick_state.get() || !::aos::joystick_state->enabled;
+ const bool disabled = !has_joystick_state() || !joystick_state().enabled;
// If true, move the goal if we saturate.
bool cap_goal = false;
@@ -549,7 +548,7 @@
shooter_.absolute_position()) > 0.0005 &&
cycles_not_moved_ > 6) ||
monotonic_clock::now() > shot_end_time_) &&
- ::aos::robot_state->voltage_battery > 10.5) {
+ robot_state().voltage_battery > 10.5) {
state_ = STATE_REQUEST_LOAD;
++shot_count_;
}