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/control_loops/control_loops.q b/frc971/control_loops/control_loops.q
index 03e93fd..bebecd0 100644
--- a/frc971/control_loops/control_loops.q
+++ b/frc971/control_loops/control_loops.q
@@ -65,7 +65,7 @@
};
// The internal state of a zeroing estimator.
-struct AbsoluteEstimatorState {
+struct PotAndAbsoluteEncoderEstimatorState {
// If true, there has been a fatal error for the estimator.
bool error;
// If the joint has seen an index pulse and is zeroed.
diff --git a/frc971/control_loops/profiled_subsystem.q b/frc971/control_loops/profiled_subsystem.q
index 3bcd6c2..d1356da 100644
--- a/frc971/control_loops/profiled_subsystem.q
+++ b/frc971/control_loops/profiled_subsystem.q
@@ -113,7 +113,7 @@
float feedforwards_power;
// State of the estimator.
- .frc971.AbsoluteEstimatorState estimator_state;
+ .frc971.PotAndAbsoluteEncoderEstimatorState estimator_state;
};
struct IndexProfiledJointStatus {
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();
diff --git a/y2017/control_loops/superstructure/intake/intake.h b/y2017/control_loops/superstructure/intake/intake.h
index 941b4ce..40f49fc 100644
--- a/y2017/control_loops/superstructure/intake/intake.h
+++ b/y2017/control_loops/superstructure/intake/intake.h
@@ -56,7 +56,8 @@
int disable_count_ = 0;
::frc971::control_loops::SingleDOFProfiledSubsystem<
- ::frc971::zeroing::PotAndAbsEncoderZeroingEstimator> profiled_subsystem_;
+ ::frc971::zeroing::PotAndAbsoluteEncoderZeroingEstimator>
+ profiled_subsystem_;
};
} // namespace intake
diff --git a/y2018/control_loops/superstructure/arm/arm.h b/y2018/control_loops/superstructure/arm/arm.h
index a9b3590..0a4666a 100644
--- a/y2018/control_loops/superstructure/arm/arm.h
+++ b/y2018/control_loops/superstructure/arm/arm.h
@@ -91,8 +91,10 @@
::aos::monotonic_clock::time_point claw_close_start_time_ =
::aos::monotonic_clock::min_time;
- ::frc971::zeroing::PotAndAbsEncoderZeroingEstimator proximal_zeroing_estimator_;
- ::frc971::zeroing::PotAndAbsEncoderZeroingEstimator distal_zeroing_estimator_;
+ ::frc971::zeroing::PotAndAbsoluteEncoderZeroingEstimator
+ proximal_zeroing_estimator_;
+ ::frc971::zeroing::PotAndAbsoluteEncoderZeroingEstimator
+ distal_zeroing_estimator_;
double proximal_offset_ = 0.0;
double distal_offset_ = 0.0;
diff --git a/y2018/control_loops/superstructure/intake/intake.h b/y2018/control_loops/superstructure/intake/intake.h
index dff0adc..552086a 100644
--- a/y2018/control_loops/superstructure/intake/intake.h
+++ b/y2018/control_loops/superstructure/intake/intake.h
@@ -104,7 +104,7 @@
State state_ = State::UNINITIALIZED;
- ::frc971::zeroing::PotAndAbsEncoderZeroingEstimator zeroing_estimator_;
+ ::frc971::zeroing::PotAndAbsoluteEncoderZeroingEstimator zeroing_estimator_;
double intake_last_position_ = 0.0;
};
diff --git a/y2018/control_loops/superstructure/superstructure.q b/y2018/control_loops/superstructure/superstructure.q
index ee38539..19fbc05 100644
--- a/y2018/control_loops/superstructure/superstructure.q
+++ b/y2018/control_loops/superstructure/superstructure.q
@@ -35,7 +35,7 @@
float delayed_voltage;
// State of the estimator.
- .frc971.AbsoluteEstimatorState estimator_state;
+ .frc971.PotAndAbsoluteEncoderEstimatorState estimator_state;
};
struct IntakeGoal {
@@ -62,8 +62,8 @@
struct ArmStatus {
// State of the estimators.
- .frc971.AbsoluteEstimatorState proximal_estimator_state;
- .frc971.AbsoluteEstimatorState distal_estimator_state;
+ .frc971.PotAndAbsoluteEncoderEstimatorState proximal_estimator_state;
+ .frc971.PotAndAbsoluteEncoderEstimatorState distal_estimator_state;
// The node we are currently going to.
uint32_t current_node;