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/y2017/control_loops/superstructure/column/column.cc b/y2017/control_loops/superstructure/column/column.cc
index aaca601..8a3644e 100644
--- a/y2017/control_loops/superstructure/column/column.cc
+++ b/y2017/control_loops/superstructure/column/column.cc
@@ -118,19 +118,19 @@
}
turret_last_position_ = turret_position();
- Y_ << new_position.indexer.position, new_position.turret.position;
+ Y_ << new_position.indexer.encoder, new_position.turret.encoder;
Y_ += offset_;
loop_->Correct(Y_);
- indexer_history_[indexer_history_position_] = new_position.indexer.position;
+ indexer_history_[indexer_history_position_] = new_position.indexer.encoder;
indexer_history_position_ = (indexer_history_position_ + 1) % kHistoryLength;
indexer_dt_velocity_ =
- (new_position.indexer.position - indexer_last_position_) /
+ (new_position.indexer.encoder - indexer_last_position_) /
chrono::duration_cast<chrono::duration<double>>(
::aos::controls::kLoopFrequency)
.count();
- indexer_last_position_ = new_position.indexer.position;
+ indexer_last_position_ = new_position.indexer.encoder;
stuck_indexer_detector_->Correct(Y_);
diff --git a/y2017/control_loops/superstructure/column/column_zeroing.cc b/y2017/control_loops/superstructure/column/column_zeroing.cc
index e26d33e..d5a378c 100644
--- a/y2017/control_loops/superstructure/column/column_zeroing.cc
+++ b/y2017/control_loops/superstructure/column/column_zeroing.cc
@@ -38,8 +38,8 @@
indexer_offset_ = indexer_.offset();
// Compute the current turret position.
- const double current_turret = indexer_offset_ + position.indexer.position +
- turret_.offset() + position.turret.position;
+ const double current_turret = indexer_offset_ + position.indexer.encoder +
+ turret_.offset() + position.turret.encoder;
// Now, we can compute the turret position which is closest to 0 radians
// (within +- M_PI).
@@ -47,14 +47,14 @@
::frc971::zeroing::Wrap(0.0, current_turret, M_PI * 2.0);
// Now, compute the actual turret offset.
- turret_offset_ = adjusted_turret - position.turret.position -
- (indexer_offset_ + position.indexer.position);
+ turret_offset_ = adjusted_turret - position.turret.encoder -
+ (indexer_offset_ + position.indexer.encoder);
offset_ready_ = true;
// If we are close enough to 0, we are zeroed. Otherwise, we don't know
// which revolution we are on and need more info. We will always report the
// turret position as within +- M_PI from 0 with the provided offset.
- if (::std::abs(position.indexer.position + position.turret.position +
+ if (::std::abs(position.indexer.encoder + position.turret.encoder +
indexer_offset_ + turret_offset_) <
turret_zeroed_distance_) {
zeroed_ = true;
diff --git a/y2017/control_loops/superstructure/superstructure_lib_test.cc b/y2017/control_loops/superstructure/superstructure_lib_test.cc
index d538dc8..894f99d 100644
--- a/y2017/control_loops/superstructure/superstructure_lib_test.cc
+++ b/y2017/control_loops/superstructure/superstructure_lib_test.cc
@@ -1066,7 +1066,7 @@
superstructure_queue_.position.FetchLatest();
ASSERT_TRUE(superstructure_queue_.position.get() != nullptr);
const double indexer_position =
- superstructure_queue_.position->column.indexer.position;
+ superstructure_queue_.position->column.indexer.encoder;
// Now, unstick it.
superstructure_plant_.set_freeze_indexer(false);
@@ -1094,7 +1094,7 @@
superstructure_queue_.position.FetchLatest();
ASSERT_TRUE(superstructure_queue_.position.get() != nullptr);
const double unstuck_indexer_position =
- superstructure_queue_.position->column.indexer.position;
+ superstructure_queue_.position->column.indexer.encoder;
EXPECT_LT(unstuck_indexer_position, indexer_position - 0.1);
// Now, verify that everything works as expected.