Renamed ZeroingEstimator to PotAndIndexPulseZeroingEstimator
Renamed to allow for creating a new interface named ZeroingEstimator
in the future.
Change-Id: I374808cdc39dd4141ea67c81de69bbac98326648
diff --git a/frc971/zeroing/zeroing_test.cc b/frc971/zeroing/zeroing_test.cc
index 1134259..2f562aa 100644
--- a/frc971/zeroing/zeroing_test.cc
+++ b/frc971/zeroing/zeroing_test.cc
@@ -16,7 +16,7 @@
namespace zeroing {
using control_loops::PositionSensorSimulator;
-using constants::ZeroingConstants;
+using constants::PotAndIndexPulseZeroingConstants;
static const size_t kSampleSize = 30;
static const double kAcceptableUnzeroedError = 0.2;
@@ -26,7 +26,8 @@
protected:
void SetUp() override { aos::SetDieTestMode(true); }
- void MoveTo(PositionSensorSimulator* simulator, ZeroingEstimator* estimator,
+ void MoveTo(PositionSensorSimulator *simulator,
+ PotAndIndexPulseZeroingEstimator *estimator,
double new_position) {
PotAndIndexPosition sensor_values_;
simulator->MoveTo(new_position);
@@ -41,7 +42,7 @@
const double index_diff = 1.0;
PositionSensorSimulator sim(index_diff);
sim.Initialize(3.6 * index_diff, index_diff / 3.0);
- ZeroingEstimator estimator(ZeroingConstants{
+ PotAndIndexPulseZeroingEstimator estimator(PotAndIndexPulseZeroingConstants{
kSampleSize, index_diff, 0.0, kIndexErrorFraction});
// The zeroing code is supposed to perform some filtering on the difference
@@ -65,7 +66,7 @@
double position = 3.6 * index_diff;
PositionSensorSimulator sim(index_diff);
sim.Initialize(position, index_diff / 3.0);
- ZeroingEstimator estimator(ZeroingConstants{
+ PotAndIndexPulseZeroingEstimator estimator(PotAndIndexPulseZeroingConstants{
kSampleSize, index_diff, 0.0, kIndexErrorFraction});
// Make sure that the zeroing code does not consider itself zeroed until we
@@ -84,7 +85,7 @@
double index_diff = 1.0;
PositionSensorSimulator sim(index_diff);
sim.Initialize(3.6, index_diff / 3.0);
- ZeroingEstimator estimator(ZeroingConstants{
+ PotAndIndexPulseZeroingEstimator estimator(PotAndIndexPulseZeroingConstants{
kSampleSize, index_diff, 0.0, kIndexErrorFraction});
// The zeroing code is supposed to perform some filtering on the difference
@@ -117,7 +118,7 @@
double index_diff = 0.89;
PositionSensorSimulator sim(index_diff);
sim.Initialize(3.5 * index_diff, index_diff / 3.0);
- ZeroingEstimator estimator(ZeroingConstants{
+ PotAndIndexPulseZeroingEstimator estimator(PotAndIndexPulseZeroingConstants{
kSampleSize, index_diff, 0.0, kIndexErrorFraction});
// The zeroing code is supposed to perform some filtering on the difference
@@ -151,7 +152,7 @@
double index_diff = 0.89;
PositionSensorSimulator sim(index_diff);
sim.Initialize(3.5 * index_diff, index_diff / 3.0);
- ZeroingEstimator estimator(ZeroingConstants{
+ PotAndIndexPulseZeroingEstimator estimator(PotAndIndexPulseZeroingConstants{
kSampleSize, index_diff, 0.0, kIndexErrorFraction});
for (unsigned int i = 0; i < kSampleSize / 2; i++) {
@@ -171,7 +172,7 @@
double index_diff = 0.89;
PositionSensorSimulator sim(index_diff);
sim.Initialize(3.1 * index_diff, index_diff / 3.0);
- ZeroingEstimator estimator(ZeroingConstants{
+ PotAndIndexPulseZeroingEstimator estimator(PotAndIndexPulseZeroingConstants{
kSampleSize, index_diff, 0.0, kIndexErrorFraction});
MoveTo(&sim, &estimator, 3.1 * index_diff);
@@ -187,7 +188,7 @@
double index_diff = 0.6;
PositionSensorSimulator sim(index_diff);
sim.Initialize(3.1 * index_diff, index_diff / 3.0);
- ZeroingEstimator estimator(ZeroingConstants{
+ PotAndIndexPulseZeroingEstimator estimator(PotAndIndexPulseZeroingConstants{
kSampleSize, index_diff, 0.0, kIndexErrorFraction});
// Make sure to fill up the averaging filter with samples.
@@ -222,7 +223,7 @@
const double known_index_pos = 3.5 * index_diff;
PositionSensorSimulator sim(index_diff);
sim.Initialize(3.3 * index_diff, index_diff / 3.0, known_index_pos);
- ZeroingEstimator estimator(ZeroingConstants{
+ PotAndIndexPulseZeroingEstimator estimator(PotAndIndexPulseZeroingConstants{
kSampleSize, index_diff, known_index_pos, kIndexErrorFraction});
// Make sure to fill up the averaging filter with samples.
@@ -247,7 +248,7 @@
TEST_F(ZeroingTest, BasicErrorAPITest) {
const double index_diff = 1.0;
- ZeroingEstimator estimator(ZeroingConstants{
+ PotAndIndexPulseZeroingEstimator estimator(PotAndIndexPulseZeroingConstants{
kSampleSize, index_diff, 0.0, kIndexErrorFraction});
PositionSensorSimulator sim(index_diff);
sim.Initialize(1.5 * index_diff, index_diff / 3.0, 0.0);
@@ -283,7 +284,7 @@
int sample_size = 30;
PositionSensorSimulator sim(index_diff);
sim.Initialize(10 * index_diff, index_diff / 3.0, known_index_pos);
- ZeroingEstimator estimator(ZeroingConstants{
+ PotAndIndexPulseZeroingEstimator estimator(PotAndIndexPulseZeroingConstants{
sample_size, index_diff, known_index_pos, kIndexErrorFraction});
for (int i = 0; i < sample_size; i++) {