Make zeroing constants structs flatbuffers
This defines all the zeroing structs as flatbuffers and then converts
everything to use the FlatbufferT types.
This is in service of moving zeroing constants into flatbuffers.
Change-Id: Ied7ac78cfcba0f66b4b684fd9e49a49276e55169
Signed-off-by: James Kuszmaul <jabukuszmaul+collab@gmail.com>
diff --git a/frc971/zeroing/pot_and_index_test.cc b/frc971/zeroing/pot_and_index_test.cc
index b2b00ce..f2e464f 100644
--- a/frc971/zeroing/pot_and_index_test.cc
+++ b/frc971/zeroing/pot_and_index_test.cc
@@ -27,7 +27,7 @@
PositionSensorSimulator sim(index_diff);
sim.Initialize(3.6 * index_diff, index_diff / 3.0);
PotAndIndexPulseZeroingEstimator estimator(PotAndIndexPulseZeroingConstants{
- kSampleSize, index_diff, 0.0, kIndexErrorFraction});
+ {}, kSampleSize, index_diff, 0.0, kIndexErrorFraction});
// The zeroing code is supposed to perform some filtering on the difference
// between the potentiometer value and the encoder value. We assume that 300
@@ -51,7 +51,7 @@
PositionSensorSimulator sim(index_diff);
sim.Initialize(position, index_diff / 3.0);
PotAndIndexPulseZeroingEstimator estimator(PotAndIndexPulseZeroingConstants{
- kSampleSize, index_diff, 0.0, kIndexErrorFraction});
+ {}, kSampleSize, index_diff, 0.0, kIndexErrorFraction});
// Make sure that the zeroing code does not consider itself zeroed until we
// collect a good amount of samples. In this case we're waiting until the
@@ -70,7 +70,7 @@
PositionSensorSimulator sim(index_diff);
sim.Initialize(3.6, index_diff / 3.0);
PotAndIndexPulseZeroingEstimator estimator(PotAndIndexPulseZeroingConstants{
- kSampleSize, index_diff, 0.0, kIndexErrorFraction});
+ {}, kSampleSize, index_diff, 0.0, kIndexErrorFraction});
// The zeroing code is supposed to perform some filtering on the difference
// between the potentiometer value and the encoder value. We assume that 300
@@ -104,7 +104,7 @@
PositionSensorSimulator sim(index_diff);
sim.Initialize(3.5 * index_diff, index_diff / 3.0);
PotAndIndexPulseZeroingEstimator estimator(PotAndIndexPulseZeroingConstants{
- kSampleSize, index_diff, 0.0, kIndexErrorFraction});
+ {}, kSampleSize, index_diff, 0.0, kIndexErrorFraction});
// The zeroing code is supposed to perform some filtering on the difference
// between the potentiometer value and the encoder value. We assume that 300
@@ -138,7 +138,7 @@
PositionSensorSimulator sim(index_diff);
sim.Initialize(3.5 * index_diff, index_diff / 3.0);
PotAndIndexPulseZeroingEstimator estimator(PotAndIndexPulseZeroingConstants{
- kSampleSize, index_diff, 0.0, kIndexErrorFraction});
+ {}, kSampleSize, index_diff, 0.0, kIndexErrorFraction});
for (unsigned int i = 0; i < kSampleSize / 2; i++) {
MoveTo(&sim, &estimator, 3.5 * index_diff);
@@ -158,7 +158,7 @@
PositionSensorSimulator sim(index_diff);
sim.Initialize(3.1 * index_diff, index_diff / 3.0);
PotAndIndexPulseZeroingEstimator estimator(PotAndIndexPulseZeroingConstants{
- kSampleSize, index_diff, 0.0, kIndexErrorFraction});
+ {}, kSampleSize, index_diff, 0.0, kIndexErrorFraction});
MoveTo(&sim, &estimator, 3.1 * index_diff);
@@ -174,7 +174,7 @@
PositionSensorSimulator sim(index_diff);
sim.Initialize(3.1 * index_diff, index_diff / 3.0);
PotAndIndexPulseZeroingEstimator estimator(PotAndIndexPulseZeroingConstants{
- kSampleSize, index_diff, 0.0, kIndexErrorFraction});
+ {}, kSampleSize, index_diff, 0.0, kIndexErrorFraction});
// Make sure to fill up the averaging filter with samples.
for (unsigned int i = 0; i < kSampleSize; i++) {
@@ -209,7 +209,7 @@
PositionSensorSimulator sim(index_diff);
sim.Initialize(3.3 * index_diff, index_diff / 3.0, known_index_pos);
PotAndIndexPulseZeroingEstimator estimator(PotAndIndexPulseZeroingConstants{
- kSampleSize, index_diff, known_index_pos, kIndexErrorFraction});
+ {}, kSampleSize, index_diff, known_index_pos, kIndexErrorFraction});
// Make sure to fill up the averaging filter with samples.
for (unsigned int i = 0; i < kSampleSize; i++) {
@@ -234,7 +234,7 @@
TEST_F(PotAndIndexZeroingTest, BasicErrorAPITest) {
const double index_diff = 1.0;
PotAndIndexPulseZeroingEstimator estimator(PotAndIndexPulseZeroingConstants{
- kSampleSize, index_diff, 0.0, kIndexErrorFraction});
+ {}, kSampleSize, index_diff, 0.0, kIndexErrorFraction});
PositionSensorSimulator sim(index_diff);
sim.Initialize(1.5 * index_diff, index_diff / 3.0, 0.0);
@@ -262,7 +262,7 @@
PositionSensorSimulator sim(index_diff);
sim.Initialize(10 * index_diff, index_diff / 3.0, known_index_pos);
PotAndIndexPulseZeroingEstimator estimator(PotAndIndexPulseZeroingConstants{
- sample_size, index_diff, known_index_pos, kIndexErrorFraction});
+ {}, sample_size, index_diff, known_index_pos, kIndexErrorFraction});
for (size_t i = 0; i < sample_size; i++) {
MoveTo(&sim, &estimator, 13 * index_diff);