Added average edge value that tracks the average range of values covered while on a hall effect edge. This allows us to know which edge we have hit.
diff --git a/frc971/control_loops/claw/claw.h b/frc971/control_loops/claw/claw.h
index 2d13d37..949b0f5 100755
--- a/frc971/control_loops/claw/claw.h
+++ b/frc971/control_loops/claw/claw.h
@@ -83,6 +83,15 @@
calibration_.Update(claw.calibration);
back_.Update(claw.back);
+ if (any_hall_effect_changed()) {
+ min_current_hall_edge_ = claw.position;
+ max_current_hall_edge_ = claw.position;
+ } else if (claw.position > max_current_hall_effect_edge_) {
+ max_current_hall_effect_edge_ = claw.position;
+ } else if (claw.position < min_current_hall_effect_edge_) {
+ min_current_hall_effect_edge_ = claw.position;
+ }
+
posedge_value_ = claw.posedge_value;
negedge_value_ = claw.negedge_value;
last_encoder_ = encoder_;