Add and use a flipped X IMU
Turns out +x is backwards on our robot. So it's wildly unstable.
Change-Id: If9dfb3ed72258b1084916613d5ccb8a45325f405
diff --git a/frc971/control_loops/drivetrain/drivetrain.cc b/frc971/control_loops/drivetrain/drivetrain.cc
index 58ce2a1..0015b70 100644
--- a/frc971/control_loops/drivetrain/drivetrain.cc
+++ b/frc971/control_loops/drivetrain/drivetrain.cc
@@ -151,6 +151,9 @@
case IMUType::IMU_X:
last_accel_ = -::frc971::imu_values->accelerometer_x;
break;
+ case IMUType::IMU_FLIPPED_X:
+ last_accel_ = ::frc971::imu_values->accelerometer_x;
+ break;
case IMUType::IMU_Y:
last_accel_ = -::frc971::imu_values->accelerometer_y;
break;
diff --git a/frc971/control_loops/drivetrain/drivetrain_config.h b/frc971/control_loops/drivetrain/drivetrain_config.h
index 53c2315..685516f 100644
--- a/frc971/control_loops/drivetrain/drivetrain_config.h
+++ b/frc971/control_loops/drivetrain/drivetrain_config.h
@@ -34,8 +34,9 @@
};
enum class IMUType : int32_t {
- IMU_X = 0, // Use the x-axis of the IMU.
- IMU_Y = 1, // Use the y-axis of the IMU.
+ IMU_X = 0, // Use the x-axis of the IMU.
+ IMU_Y = 1, // Use the y-axis of the IMU.
+ IMU_FLIPPED_X = 2, // Use the flipped x-axis of the IMU.
};
template <typename Scalar = double>