Pull state out of the zeroing estimators more nicely

I'm eventually going to remove the position() member, but for now Austin
wants this too.

Change-Id: I12b0c01eb5174751bd04fee8fdb770378a87f541
diff --git a/frc971/zeroing/zeroing.cc b/frc971/zeroing/zeroing.cc
index 6dd6f42..70fbb56 100644
--- a/frc971/zeroing/zeroing.cc
+++ b/frc971/zeroing/zeroing.cc
@@ -19,25 +19,6 @@
 
 }  // namespace
 
-void PopulateEstimatorState(
-    const zeroing::PotAndIndexPulseZeroingEstimator &estimator,
-    EstimatorState *state) {
-  state->error = estimator.error();
-  state->zeroed = estimator.zeroed();
-  state->position = estimator.position();
-  state->pot_position = estimator.filtered_position();
-}
-
-void PopulateEstimatorState(
-    const zeroing::PotAndAbsEncoderZeroingEstimator &estimator,
-    AbsoluteEstimatorState *state) {
-  state->error = estimator.error();
-  state->zeroed = estimator.zeroed();
-
-  state->position = estimator.position();
-  state->pot_position = estimator.filtered_position();
-}
-
 PotAndIndexPulseZeroingEstimator::PotAndIndexPulseZeroingEstimator(
     const constants::PotAndIndexPulseZeroingConstants &constants)
     : constants_(constants) {
@@ -152,6 +133,17 @@
   filtered_position_ = start_average + info.encoder;
 }
 
+PotAndIndexPulseZeroingEstimator::State
+PotAndIndexPulseZeroingEstimator::GetEstimatorState() const {
+  State r;
+  r.error = error_;
+  r.zeroed = zeroed_;
+  r.position = position_;
+  r.pot_position = filtered_position_;
+  return r;
+}
+
+
 PotAndAbsEncoderZeroingEstimator::PotAndAbsEncoderZeroingEstimator(
     const constants::PotAndAbsoluteEncoderZeroingConstants &constants)
     : constants_(constants) {
@@ -309,6 +301,16 @@
   position_ = offset_ + info.encoder;
 }
 
+PotAndAbsEncoderZeroingEstimator::State
+PotAndAbsEncoderZeroingEstimator::GetEstimatorState() const {
+  State r;
+  r.error = error_;
+  r.zeroed = zeroed_;
+  r.position = position_;
+  r.pot_position = filtered_position_;
+  return r;
+}
+
 void PulseIndexZeroingEstimator::Reset() {
   max_index_position_ = ::std::numeric_limits<double>::lowest();
   min_index_position_ = ::std::numeric_limits<double>::max();