Remove position() member from zeroing estimators
It didn't return anything particularly useful, so it should not have
been used anywhere. Turns out it was only used in the test, so it was
pretty easy.
Change-Id: I3f81bd16a1a8e429c9748abd4e9dc9c7e0259dc5
diff --git a/frc971/zeroing/zeroing.h b/frc971/zeroing/zeroing.h
index 53b8e31..4b00c23 100644
--- a/frc971/zeroing/zeroing.h
+++ b/frc971/zeroing/zeroing.h
@@ -30,9 +30,6 @@
// Returns the estimated position of the corresponding mechanism.
virtual double offset() const = 0;
- // Returns the estimated starting position of the corresponding mechansim.
- virtual double position() const = 0;
-
// Returns true if there has been an error.
virtual bool error() const = 0;
};
@@ -62,8 +59,6 @@
bool zeroed() const override { return zeroed_; }
- double position() const override { return position_; }
-
double offset() const override { return offset_; }
// Returns a number between 0 and 1 that represents the percentage of the
@@ -145,8 +140,6 @@
bool zeroed() const override { return zeroed_; }
- double position() const override { return position_; }
-
double offset() const override { return offset_; }
bool error() const override { return error_; }
@@ -198,7 +191,7 @@
public:
using Position = IndexPosition;
using ZeroingConstants = constants::PotAndIndexPulseZeroingConstants;
- using State = EstimatorState;
+ using State = IndexEstimatorState;
PulseIndexZeroingEstimator(
const constants::EncoderPlusIndexZeroingConstants &constants)
@@ -211,11 +204,6 @@
bool zeroed() const override { return zeroed_; }
- double position() const override {
- CHECK(zeroed_);
- return position_;
- }
-
double offset() const override { return offset_; }
bool error() const override { return error_; }
@@ -223,6 +211,9 @@
// Updates the internal logic with the next sensor values.
void UpdateEstimate(const IndexPosition &info);
+ // Returns information about our current state.
+ State GetEstimatorState() const;
+
private:
// Returns the current real position using the relative encoder offset.
double CalculateCurrentPosition(const IndexPosition &info);
@@ -231,7 +222,7 @@
void StoreIndexPulseMaxAndMin(const IndexPosition &info);
// Returns the number of index pulses we should have seen so far.
- int IndexPulseCount();
+ int IndexPulseCount() const;
// Contains the physical constants describing the system.
const constants::EncoderPlusIndexZeroingConstants constants_;