Shooter now counts shots properly.
diff --git a/frc971/control_loops/shooter/shooter.cc b/frc971/control_loops/shooter/shooter.cc
index 158e3cd..ce64c53 100755
--- a/frc971/control_loops/shooter/shooter.cc
+++ b/frc971/control_loops/shooter/shooter.cc
@@ -111,7 +111,8 @@
shooter_brake_set_time_(0, 0),
unload_timeout_(0, 0),
shot_end_time_(0, 0),
- cycles_not_moved_(0) {}
+ cycles_not_moved_(0),
+ shot_count_(0) {}
double ShooterMotor::PowerToPosition(double power) {
const frc971::constants::Values &values = constants::GetValues();
@@ -460,7 +461,7 @@
cycles_not_moved_ > 3) ||
Time::Now() > shot_end_time_) {
state_ = STATE_REQUEST_LOAD;
- status->shots += 1;
+ ++shot_count_;
}
latch_piston_ = false;
brake_piston_ = true;
@@ -587,6 +588,8 @@
last_distal_posedge_count_ = position->pusher_distal.posedge_count;
last_proximal_posedge_count_ = position->pusher_proximal.posedge_count;
}
+
+ status->shots = shot_count_;
}
} // namespace control_loops
diff --git a/frc971/control_loops/shooter/shooter.h b/frc971/control_loops/shooter/shooter.h
index 2743bad..742bb0c 100755
--- a/frc971/control_loops/shooter/shooter.h
+++ b/frc971/control_loops/shooter/shooter.h
@@ -197,6 +197,7 @@
bool brake_piston_;
int32_t last_distal_posedge_count_;
int32_t last_proximal_posedge_count_;
+ uint32_t shot_count_;
DISALLOW_COPY_AND_ASSIGN(ShooterMotor);
};