Rename PotAndAbsEncoder to be more consistent
$ git sed 's/AbsoluteEstimatorState/PotAndAbsoluteEncoderEstimatorState/'
$ git sed 's/PotAndAbsEncoderZeroingEstimator/PotAndAbsoluteEncoderZeroingEstimator/'
It's a bit all over the place in terms of naming and doesn't leave much
space to name something which is just an absolute encoder.
Change-Id: Iecbee91191bd9cc16eb08fd24b91335ef772beec
diff --git a/frc971/zeroing/zeroing.cc b/frc971/zeroing/zeroing.cc
index 14d26c9..7005725 100644
--- a/frc971/zeroing/zeroing.cc
+++ b/frc971/zeroing/zeroing.cc
@@ -253,7 +253,7 @@
return r;
}
-PotAndAbsEncoderZeroingEstimator::PotAndAbsEncoderZeroingEstimator(
+PotAndAbsoluteEncoderZeroingEstimator::PotAndAbsoluteEncoderZeroingEstimator(
const constants::PotAndAbsoluteEncoderZeroingConstants &constants)
: constants_(constants) {
relative_to_absolute_offset_samples_.reserve(constants_.average_filter_size);
@@ -261,7 +261,7 @@
Reset();
}
-void PotAndAbsEncoderZeroingEstimator::Reset() {
+void PotAndAbsoluteEncoderZeroingEstimator::Reset() {
first_offset_ = 0.0;
pot_relative_encoder_offset_ = 0.0;
offset_ = 0.0;
@@ -293,7 +293,7 @@
// of samples and check that the buffered samples are not different than the
// zeroing threshold. At any point that the samples differ too much, do not
// update estimates based on those samples.
-void PotAndAbsEncoderZeroingEstimator::UpdateEstimate(
+void PotAndAbsoluteEncoderZeroingEstimator::UpdateEstimate(
const PotAndAbsolutePosition &info) {
// Check for Abs Encoder NaN value that would mess up the rest of the zeroing
// code below. NaN values are given when the Absolute Encoder is disconnected.
@@ -460,8 +460,8 @@
position_ = offset_ + info.encoder;
}
-PotAndAbsEncoderZeroingEstimator::State
-PotAndAbsEncoderZeroingEstimator::GetEstimatorState() const {
+PotAndAbsoluteEncoderZeroingEstimator::State
+PotAndAbsoluteEncoderZeroingEstimator::GetEstimatorState() const {
State r;
r.error = error_;
r.zeroed = zeroed_;
diff --git a/frc971/zeroing/zeroing.h b/frc971/zeroing/zeroing.h
index 07cc43a..4d4f13d 100644
--- a/frc971/zeroing/zeroing.h
+++ b/frc971/zeroing/zeroing.h
@@ -215,12 +215,12 @@
// Estimates the position with an absolute encoder which also reports
// incremental counts, and a potentiometer.
-class PotAndAbsEncoderZeroingEstimator
+class PotAndAbsoluteEncoderZeroingEstimator
: public ZeroingEstimator<PotAndAbsolutePosition,
- constants::PotAndAbsoluteEncoderZeroingConstants,
- AbsoluteEstimatorState> {
+ constants::PotAndAbsoluteEncoderZeroingConstants,
+ PotAndAbsoluteEncoderEstimatorState> {
public:
- explicit PotAndAbsEncoderZeroingEstimator(
+ explicit PotAndAbsoluteEncoderZeroingEstimator(
const constants::PotAndAbsoluteEncoderZeroingConstants &constants);
// Resets the internal logic so it needs to be re-zeroed.
diff --git a/frc971/zeroing/zeroing_test.cc b/frc971/zeroing/zeroing_test.cc
index 7948bf4..2a35764 100644
--- a/frc971/zeroing/zeroing_test.cc
+++ b/frc971/zeroing/zeroing_test.cc
@@ -39,7 +39,7 @@
}
void MoveTo(PositionSensorSimulator *simulator,
- PotAndAbsEncoderZeroingEstimator *estimator,
+ PotAndAbsoluteEncoderZeroingEstimator *estimator,
double new_position) {
PotAndAbsolutePosition sensor_values_;
simulator->MoveTo(new_position);
@@ -338,7 +338,7 @@
sim.Initialize(start_pos, index_diff / 3.0, 0.0,
constants.measured_absolute_position);
- PotAndAbsEncoderZeroingEstimator estimator(constants);
+ PotAndAbsoluteEncoderZeroingEstimator estimator(constants);
for (size_t i = 0; i < kSampleSize + kMovingBufferSize - 1; ++i) {
MoveTo(&sim, &estimator, start_pos);
@@ -366,7 +366,7 @@
sim.Initialize(start_pos, index_diff / 3.0, 0.0,
constants.measured_absolute_position);
- PotAndAbsEncoderZeroingEstimator estimator(constants);
+ PotAndAbsoluteEncoderZeroingEstimator estimator(constants);
// We tolerate a couple NANs before we start.
PotAndAbsolutePosition sensor_values;
@@ -402,7 +402,7 @@
sim.Initialize(start_pos, index_diff / 3.0, 0.0,
constants.measured_absolute_position);
- PotAndAbsEncoderZeroingEstimator estimator(constants);
+ PotAndAbsoluteEncoderZeroingEstimator estimator(constants);
for (size_t i = 0; i < kSampleSize + kMovingBufferSize - 1; ++i) {
MoveTo(&sim, &estimator, start_pos + i * index_diff);
@@ -419,7 +419,7 @@
PotAndAbsoluteEncoderZeroingConstants constants{
kSampleSize, 1, 0.3, 0.1, kMovingBufferSize, kIndexErrorFraction};
- PotAndAbsEncoderZeroingEstimator estimator(constants);
+ PotAndAbsoluteEncoderZeroingEstimator estimator(constants);
PotAndAbsolutePosition sensor_values;
sensor_values.absolute_encoder = ::std::numeric_limits<double>::quiet_NaN();