fixed the shooter firing randomly
diff --git a/aos/common/control_loop/ControlLoop.h b/aos/common/control_loop/ControlLoop.h
index f1109e6..0bce1e3 100644
--- a/aos/common/control_loop/ControlLoop.h
+++ b/aos/common/control_loop/ControlLoop.h
@@ -79,9 +79,12 @@
decltype(*(static_cast<T *>(NULL)->output.MakeMessage().get()))>::type
OutputType;
- // Constructs and sends a message on the output queue which will stop all the
- // motors. Calls Zero to clear all the state.
- void ZeroOutputs();
+ // Constructs and sends a message on the output queue which sets everything to
+ // a safe state (generally motors off). For some subclasses, this will be a
+ // bit different (ie pistons).
+ // The implementation here creates a new Output message, calls Zero() on it,
+ // and then sends it.
+ virtual void ZeroOutputs();
// Returns true if the device reading the sensors reset and potentially lost
// track of encoder counts. Calling this read method clears the flag. After
@@ -139,6 +142,9 @@
OutputType *output,
StatusType *status) = 0;
+ T *queue_group() { return control_loop_; }
+ const T *queue_group() const { return control_loop_; }
+
private:
// Pointer to the queue group
T *control_loop_;
diff --git a/frc971/control_loops/shooter/shooter.cc b/frc971/control_loops/shooter/shooter.cc
index 732b882..957b553 100755
--- a/frc971/control_loops/shooter/shooter.cc
+++ b/frc971/control_loops/shooter/shooter.cc
@@ -649,5 +649,13 @@
status->shots = shot_count_;
}
+void ShooterMotor::ZeroOutputs() {
+ queue_group()->output.MakeWithBuilder()
+ .voltage(0)
+ .latch_piston(latch_piston_)
+ .brake_piston(brake_piston_)
+ .Send();
+}
+
} // namespace control_loops
} // namespace frc971
diff --git a/frc971/control_loops/shooter/shooter.h b/frc971/control_loops/shooter/shooter.h
index a2d405b..649b00b 100755
--- a/frc971/control_loops/shooter/shooter.h
+++ b/frc971/control_loops/shooter/shooter.h
@@ -150,6 +150,9 @@
ShooterGroup::Output *output, ShooterGroup::Status *status);
private:
+ // We have to override this to keep the pistons in the correct positions.
+ virtual void ZeroOutputs();
+
// Friend the test classes for acces to the internal state.
friend class testing::ShooterTest_UnloadWindupPositive_Test;
friend class testing::ShooterTest_UnloadWindupNegative_Test;