Add logic to read out of order joysticks
If joysticks get out of order on the driverstation, we won't
get the wrong inputs.
The id is encoded as a two bit number in buttons 14 and 15.
Signed-off-by: Ravago Jones <ravagojones@gmail.com>
Change-Id: I569ad6a991c4fda1596aba85b4b697da9c2ecab9
diff --git a/y2023/joystick_reader.cc b/y2023/joystick_reader.cc
index efd7537..dcba253 100644
--- a/y2023/joystick_reader.cc
+++ b/y2023/joystick_reader.cc
@@ -16,6 +16,7 @@
#include "frc971/input/driver_station_data.h"
#include "frc971/input/drivetrain_input.h"
#include "frc971/input/joystick_input.h"
+#include "frc971/input/redundant_joystick_data.h"
#include "frc971/zeroing/wrap.h"
#include "y2023/constants.h"
#include "y2023/control_loops/drivetrain/drivetrain_base.h"
@@ -46,7 +47,7 @@
constexpr double kCubeWrist = 1.0;
// TODO(milind): add correct locations
-const ButtonLocation kDriverSpit(2, 1);
+const ButtonLocation kDriverSpit(1, 1);
const ButtonLocation kSpit(4, 13);
const ButtonLocation kHighConeScoreLeft(4, 14);
@@ -369,7 +370,8 @@
: ::frc971::input::ActionJoystickInput(
event_loop,
::y2023::control_loops::drivetrain::GetDrivetrainConfig(),
- ::frc971::input::DrivetrainInputReader::InputType::kPistol, {}),
+ ::frc971::input::DrivetrainInputReader::InputType::kPistol,
+ {.use_redundant_joysticks = true}),
superstructure_goal_sender_(
event_loop->MakeSender<superstructure::Goal>("/superstructure")),
target_selector_hint_sender_(
@@ -519,7 +521,7 @@
superstructure::Goal::Builder superstructure_goal_builder =
builder.MakeBuilder<superstructure::Goal>();
- superstructure_goal_builder.add_arm_goal_position(arm_goal_position_);
+ superstructure_goal_builder.add_arm_goal_position(arm::NeutralIndex());
superstructure_goal_builder.add_roller_goal(roller_goal);
superstructure_goal_builder.add_wrist(wrist_offset);
if (builder.Send(superstructure_goal_builder.Finish()) !=