Fix incorrect high/low gear in joystick
Change-Id: I77710d2935a3e0a1d8a97da9ccbc21fa171ab31d
diff --git a/y2012/joystick_reader.cc b/y2012/joystick_reader.cc
index b1af0bb..b977672 100644
--- a/y2012/joystick_reader.cc
+++ b/y2012/joystick_reader.cc
@@ -27,7 +27,7 @@
namespace joysticks {
const JoystickAxis kSteeringWheel(1, 1), kDriveThrottle(2, 2);
-const ButtonLocation kShiftHigh(2, 1), kShiftLow(2, 3);
+const ButtonLocation kShiftHigh(2, 3), kShiftLow(2, 1);
const ButtonLocation kQuickTurn(1, 5);
const ButtonLocation kCatch(3, 10);
@@ -93,10 +93,10 @@
void HandleDrivetrain(const ::aos::input::driver_station::Data &data) {
const double wheel = -data.GetAxis(kSteeringWheel);
const double throttle = -data.GetAxis(kDriveThrottle);
- if (data.PosEdge(kShiftHigh)) {
+ if (data.PosEdge(kShiftLow)) {
is_high_gear_ = false;
}
- if (data.PosEdge(kShiftLow)) {
+ if (data.PosEdge(kShiftHigh)) {
is_high_gear_ = true;
}
if (!drivetrain_queue.goal.MakeWithBuilder()
diff --git a/y2014/joystick_reader.cc b/y2014/joystick_reader.cc
index 137856f..d2d1375 100644
--- a/y2014/joystick_reader.cc
+++ b/y2014/joystick_reader.cc
@@ -35,7 +35,7 @@
const ButtonLocation kDriveControlLoopEnable1(1, 7),
kDriveControlLoopEnable2(1, 11);
const JoystickAxis kSteeringWheel(1, 1), kDriveThrottle(2, 2);
-const ButtonLocation kShiftHigh(2, 1), kShiftLow(2, 3);
+const ButtonLocation kShiftHigh(2, 3), kShiftLow(2, 1);
const ButtonLocation kQuickTurn(1, 5);
const ButtonLocation kCatch(3, 10);
@@ -241,10 +241,10 @@
.Send()) {
LOG(WARNING, "sending stick values failed\n");
}
- if (data.PosEdge(kShiftHigh)) {
+ if (data.PosEdge(kShiftLow)) {
is_high_gear_ = false;
}
- if (data.PosEdge(kShiftLow)) {
+ if (data.PosEdge(kShiftHigh)) {
is_high_gear_ = true;
}
}
diff --git a/y2014_bot3/joystick_reader.cc b/y2014_bot3/joystick_reader.cc
index 3e6e3e2..6dfcbb4 100644
--- a/y2014_bot3/joystick_reader.cc
+++ b/y2014_bot3/joystick_reader.cc
@@ -30,7 +30,7 @@
// Joystick & button addresses.
const JoystickAxis kSteeringWheel(1, 1), kDriveThrottle(2, 2);
-const ButtonLocation kShiftHigh(2, 1), kShiftLow(2, 3);
+const ButtonLocation kShiftHigh(2, 3), kShiftLow(2, 1);
const ButtonLocation kQuickTurn(1, 5);
const ButtonLocation kFrontRollersIn(3, 8);
@@ -75,11 +75,11 @@
LOG(WARNING, "sending stick values failed\n");
}
- if (data.PosEdge(kShiftHigh)) {
+ if (data.PosEdge(kShiftLow)) {
is_high_gear_ = false;
}
- if (data.PosEdge(kShiftLow)) {
+ if (data.PosEdge(kShiftHigh)) {
is_high_gear_ = true;
}
}
diff --git a/y2015/joystick_reader.cc b/y2015/joystick_reader.cc
index f949c1a..4b5ced8 100644
--- a/y2015/joystick_reader.cc
+++ b/y2015/joystick_reader.cc
@@ -65,7 +65,7 @@
constexpr actors::ProfileParams kElevatorMove{0.3, 1.0};
const JoystickAxis kSteeringWheel(1, 1), kDriveThrottle(2, 2);
-const ButtonLocation kShiftHigh(2, 1), kShiftLow(2, 3);
+const ButtonLocation kShiftHigh(2, 3), kShiftLow(2, 1);
const ButtonLocation kQuickTurn(1, 5);
//const ButtonLocation kClawClosed(3, 5);
diff --git a/y2015_bot3/joystick_reader.cc b/y2015_bot3/joystick_reader.cc
index be9bd7f..a65bfa9 100644
--- a/y2015_bot3/joystick_reader.cc
+++ b/y2015_bot3/joystick_reader.cc
@@ -48,7 +48,7 @@
// Joystick & button addresses.
const JoystickAxis kSteeringWheel(1, 1), kDriveThrottle(2, 2);
-const ButtonLocation kShiftHigh(2, 1), kShiftLow(2, 3);
+const ButtonLocation kShiftHigh(2, 3), kShiftLow(2, 1);
const ButtonLocation kQuickTurn(1, 5);
// essential
diff --git a/y2016/joystick_reader.cc b/y2016/joystick_reader.cc
index c50b092..71f4ff2 100644
--- a/y2016/joystick_reader.cc
+++ b/y2016/joystick_reader.cc
@@ -27,7 +27,7 @@
namespace joysticks {
const JoystickAxis kSteeringWheel(1, 1), kDriveThrottle(2, 2);
-const ButtonLocation kShiftHigh(2, 1), kShiftLow(2, 3);
+const ButtonLocation kShiftHigh(2, 3), kShiftHigh2(2, 2), kShiftLow(2, 1);
const ButtonLocation kQuickTurn(1, 5);
class Reader : public ::aos::input::JoystickInput {
@@ -75,11 +75,11 @@
LOG(WARNING, "sending stick values failed\n");
}
- if (data.PosEdge(kShiftHigh)) {
+ if (data.PosEdge(kShiftLow)) {
is_high_gear_ = false;
}
- if (data.PosEdge(kShiftLow)) {
+ if (data.PosEdge(kShiftHigh) || data.PosEdge(kShiftHigh2)) {
is_high_gear_ = true;
}
}