Added shot_disc_count to the indexer.
diff --git a/frc971/control_loops/index/index.cc b/frc971/control_loops/index/index.cc
index 3191729..c8f5cc8 100644
--- a/frc971/control_loops/index/index.cc
+++ b/frc971/control_loops/index/index.cc
@@ -71,6 +71,7 @@
wrist_loop_(new IndexStateFeedbackLoop(MakeIndexLoop())),
hopper_disc_count_(0),
total_disc_count_(0),
+ shot_disc_count_(0),
safe_goal_(Goal::HOLD),
loader_goal_(LoaderGoal::READY),
loader_state_(LoaderState::READY),
@@ -840,6 +841,7 @@
loader_state_ = LoaderState::LOWERING;
loader_countdown_ = kLoweringDelay;
--hopper_disc_count_;
+ ++shot_disc_count_;
case LoaderState::LOWERING:
printf("Loader LOWERING %d\n", loader_countdown_);
// Lowering the loader back down.
@@ -882,6 +884,7 @@
status->hopper_disc_count = hopper_disc_count_;
status->total_disc_count = total_disc_count_;
+ status->shot_disc_count = shot_disc_count_;
status->preloaded = (loader_state_ != LoaderState::READY);
if (output) {
diff --git a/frc971/control_loops/index/index.h b/frc971/control_loops/index/index.h
index e3a67c5..c9dc86f 100644
--- a/frc971/control_loops/index/index.h
+++ b/frc971/control_loops/index/index.h
@@ -246,6 +246,7 @@
// Count of the number of discs that we have collected.
int32_t hopper_disc_count_;
int32_t total_disc_count_;
+ int32_t shot_disc_count_;
enum class Goal {
// Hold position, in a low power state.
diff --git a/frc971/control_loops/index/index_lib_test.cc b/frc971/control_loops/index/index_lib_test.cc
index 829cdce..9b9c939 100644
--- a/frc971/control_loops/index/index_lib_test.cc
+++ b/frc971/control_loops/index/index_lib_test.cc
@@ -851,6 +851,7 @@
my_index_loop_.status.FetchLatest();
EXPECT_EQ(my_index_loop_.status->hopper_disc_count, 1);
+ EXPECT_EQ(0, my_index_loop_.status->shot_disc_count);
EXPECT_EQ(static_cast<size_t>(1), index_motor_plant_.frisbees.size());
EXPECT_NEAR(
(IndexMotor::kIndexStartPosition +
@@ -1289,6 +1290,7 @@
my_index_loop_.status.FetchLatest();
EXPECT_EQ(i, my_index_loop_.status->total_disc_count);
EXPECT_EQ(0, my_index_loop_.status->hopper_disc_count);
+ EXPECT_EQ(i, my_index_loop_.status->shot_disc_count);
}
}
diff --git a/frc971/control_loops/index/index_motor.q b/frc971/control_loops/index/index_motor.q
index e093c9a..61e7a61 100644
--- a/frc971/control_loops/index/index_motor.q
+++ b/frc971/control_loops/index/index_motor.q
@@ -57,8 +57,10 @@
message Status {
// Number of discs in the hopper
int32_t hopper_disc_count;
- // Number of shot since reboot.
+ // Number of discs seen by the hopper.
int32_t total_disc_count;
+ // Number of discs shot by the shooter.
+ int32_t shot_disc_count;
// Disc ready in the loader.
bool preloaded;
// Indexer ready to accept more discs.