Check against actual superstructure voltage limits
The superstructure uses 5V when "slow moving". Someone added checks
against a hard-coded 4V though so two tests were causing the test
binary to crash.
Change-Id: I32c4a1e0b1c26bcd9ef66e5d503fe780e2fd316a
diff --git a/y2016/control_loops/superstructure/superstructure.cc b/y2016/control_loops/superstructure/superstructure.cc
index ba49675..8147fc2 100644
--- a/y2016/control_loops/superstructure/superstructure.cc
+++ b/y2016/control_loops/superstructure/superstructure.cc
@@ -14,8 +14,6 @@
namespace superstructure {
namespace {
-constexpr double kZeroingVoltage = 5.0;
-constexpr double kOperatingVoltage = 12.0;
constexpr double kLandingShoulderDownVoltage = -2.0;
// The maximum voltage the intake roller will be allowed to use.
constexpr float kMaxIntakeTopVoltage = 12.0;
@@ -644,6 +642,8 @@
last_state_ = state_before_switch;
}
+constexpr double Superstructure::kZeroingVoltage;
+constexpr double Superstructure::kOperatingVoltage;
constexpr double Superstructure::kShoulderMiddleAngle;
constexpr double Superstructure::kLooseTolerance;
constexpr double Superstructure::kIntakeUpperClear;
diff --git a/y2016/control_loops/superstructure/superstructure.h b/y2016/control_loops/superstructure/superstructure.h
index 2967a72..d922972 100644
--- a/y2016/control_loops/superstructure/superstructure.h
+++ b/y2016/control_loops/superstructure/superstructure.h
@@ -101,6 +101,9 @@
control_loops::SuperstructureQueue *my_superstructure =
&control_loops::superstructure_queue);
+ static constexpr double kZeroingVoltage = 5.0;
+ static constexpr double kOperatingVoltage = 12.0;
+
// This is the angle above which we will do a HIGH_ARM_ZERO, and below which
// we will do a LOW_ARM_ZERO.
static constexpr double kShoulderMiddleAngle = M_PI / 4.0;
diff --git a/y2016/control_loops/superstructure/superstructure_lib_test.cc b/y2016/control_loops/superstructure/superstructure_lib_test.cc
index bc33c9b..f2c29e4 100644
--- a/y2016/control_loops/superstructure/superstructure_lib_test.cc
+++ b/y2016/control_loops/superstructure/superstructure_lib_test.cc
@@ -170,18 +170,18 @@
superstructure_queue_.status->state ==
Superstructure::LANDING_RUNNING) {
CHECK_LE(::std::abs(superstructure_queue_.output->voltage_intake),
- 12.00001);
+ Superstructure::kOperatingVoltage);
CHECK_LE(::std::abs(superstructure_queue_.output->voltage_shoulder),
- 12.00001);
+ Superstructure::kOperatingVoltage);
CHECK_LE(::std::abs(superstructure_queue_.output->voltage_wrist),
- 12.00001);
+ Superstructure::kOperatingVoltage);
} else {
CHECK_LE(::std::abs(superstructure_queue_.output->voltage_intake),
- 4.00001);
+ Superstructure::kZeroingVoltage);
CHECK_LE(::std::abs(superstructure_queue_.output->voltage_shoulder),
- 4.00001);
+ Superstructure::kZeroingVoltage);
CHECK_LE(::std::abs(superstructure_queue_.output->voltage_wrist),
- 4.00001);
+ Superstructure::kZeroingVoltage);
}
if (arm_plant_->X(0, 0) <=
Superstructure::kShoulderTransitionToLanded + 1e-4) {