Change HallEffectAndPosition to proper naming
All of the templates assume the position variable is called encoder,
not position. I spent a while trying to figure out if the naming
should be the other way around, but I think 'encoder' is correct.
Change-Id: Icb0fa9a94bdea4ae3a43b947a073cc1f83ba5f4a
diff --git a/frc971/zeroing/zeroing.cc b/frc971/zeroing/zeroing.cc
index c2de2cb..14d26c9 100644
--- a/frc971/zeroing/zeroing.cc
+++ b/frc971/zeroing/zeroing.cc
@@ -173,10 +173,10 @@
// If we have a new posedge.
if (!info.current) {
if (last_hall_) {
- min_low_position_ = max_low_position_ = info.position;
+ min_low_position_ = max_low_position_ = info.encoder;
} else {
- min_low_position_ = ::std::min(min_low_position_, info.position);
- max_low_position_ = ::std::max(max_low_position_, info.position);
+ min_low_position_ = ::std::min(min_low_position_, info.encoder);
+ max_low_position_ = ::std::max(max_low_position_, info.encoder);
}
}
last_hall_ = info.current;
@@ -207,9 +207,9 @@
bool moving_backward = false;
if (constants_.zeroing_move_direction) {
- moving_backward = info.position > min_low_position_;
+ moving_backward = info.encoder > min_low_position_;
} else {
- moving_backward = info.position < max_low_position_;
+ moving_backward = info.encoder < max_low_position_;
}
// If there are no posedges to use or we don't have enough samples yet to
@@ -239,7 +239,7 @@
zeroed_ = true;
}
- position_ = info.position - offset_;
+ position_ = info.encoder - offset_;
}
HallEffectAndPositionZeroingEstimator::State