Add ability to handle an upside-down Z IMU
Change-Id: I389eebcefec62c55a11661848167d168cf6b1f9a
diff --git a/frc971/control_loops/drivetrain/drivetrain.cc b/frc971/control_loops/drivetrain/drivetrain.cc
index a4401ea..177c0a5 100644
--- a/frc971/control_loops/drivetrain/drivetrain.cc
+++ b/frc971/control_loops/drivetrain/drivetrain.cc
@@ -192,6 +192,13 @@
last_gyro_time_ = monotonic_now;
}
break;
+ case GyroType::FLIPPED_IMU_Z_GYRO:
+ if (is_latest_imu_values) {
+ LOG_STRUCT(DEBUG, "using", *imu_values.get());
+ last_gyro_rate_ = -imu_values->gyro_z;
+ last_gyro_time_ = monotonic_now;
+ }
+ break;
case GyroType::SPARTAN_GYRO:
if (gyro_reading.FetchLatest()) {
LOG_STRUCT(DEBUG, "using", *gyro_reading.get());