Default to ignoring accelerometer readings in 2022 localizer
I haven't validated the full inertials on the 2022 robot, so default to
off until that point.
Change-Id: I42b211827190bd96fc4091f96ae999ecd9dfec20
Signed-off-by: James Kuszmaul <jabukuszmaul@gmail.com>
diff --git a/y2022/localizer/localizer.cc b/y2022/localizer/localizer.cc
index 964bf74..1971312 100644
--- a/y2022/localizer/localizer.cc
+++ b/y2022/localizer/localizer.cc
@@ -5,6 +5,9 @@
#include "frc971/wpilib/imu_batch_generated.h"
#include "y2022/constants.h"
+DEFINE_bool(ignore_accelerometer, false,
+ "If set, ignores the accelerometer readings.");
+
namespace frc971::controls {
namespace {
@@ -372,7 +375,8 @@
constexpr size_t kShareStates = kNModelStates;
static_assert(kUseModelThreshold < kUseAccelThreshold);
if (using_model_) {
- if (filtered_residual_ > kUseAccelThreshold) {
+ if (!FLAGS_ignore_accelerometer &&
+ filtered_residual_ > kUseAccelThreshold) {
hysteresis_count_++;
} else {
hysteresis_count_ = 0;