Add Basic Swerve Joystick Reader
Signed-off-by: Nikolai Sohmers <nikolai@sohmers.com>
Change-Id: I97f6af6b978b8383d97f5549ca2d3ea82def5359
diff --git a/frc971/input/swerve_joystick_input.cc b/frc971/input/swerve_joystick_input.cc
new file mode 100644
index 0000000..fbd7f01
--- /dev/null
+++ b/frc971/input/swerve_joystick_input.cc
@@ -0,0 +1,28 @@
+#include "frc971/input/swerve_joystick_input.h"
+
+#include "frc971/input/driver_station_data.h"
+#include "frc971/input/redundant_joystick_data.h"
+
+using frc971::input::driver_station::ControlBit;
+
+namespace frc971::input {
+
+void SwerveJoystickInput::RunIteration(
+ const ::frc971::input::driver_station::Data &unsorted_data) {
+ if (input_config_.use_redundant_joysticks) {
+ driver_station::RedundantData redundant_data_storage(unsorted_data);
+ DoRunIteration(redundant_data_storage);
+ } else {
+ DoRunIteration(unsorted_data);
+ }
+}
+
+void SwerveJoystickInput::DoRunIteration(
+ const ::frc971::input::driver_station::Data &data) {
+ drivetrain_input_reader_->HandleDrivetrain(data);
+ HandleTeleop(data);
+ action_queue_.Tick();
+ was_running_ = action_queue_.Running();
+}
+
+} // namespace frc971::input