Got angle adjust working with limiting the zeroing goal.
diff --git a/frc971/control_loops/hall_effect_loop-inl.h b/frc971/control_loops/hall_effect_loop-inl.h
index f5deb67..29c4273 100644
--- a/frc971/control_loops/hall_effect_loop-inl.h
+++ b/frc971/control_loops/hall_effect_loop-inl.h
@@ -59,15 +59,17 @@
template <int kNumHallEffect>
void HallEffectLoop<kNumHallEffect>::LimitZeroingGoal() {
- if (loop_->U_uncapped(0, 0) > kMaxZeroingVoltage) {
- double excess = (loop_->U_uncapped(0, 0) - kMaxZeroingVoltage)
- / loop_->K(0, 0);
- zeroing_position_ -= excess;
- }
- if (loop_->U_uncapped(0, 0) < -kMaxZeroingVoltage) {
- double excess = (loop_->U_uncapped(0, 0) + kMaxZeroingVoltage)
- / loop_->K(0, 0);
- zeroing_position_ -= excess;
+ if (state_ == MOVING_OFF || state_ == ZEROING) {
+ if (loop_->U_uncapped(0, 0) > kMaxZeroingVoltage) {
+ double excess = (loop_->U_uncapped(0, 0) - kMaxZeroingVoltage)
+ / loop_->K(0, 0);
+ zeroing_position_ -= excess;
+ }
+ if (loop_->U_uncapped(0, 0) < -kMaxZeroingVoltage) {
+ double excess = (loop_->U_uncapped(0, 0) + kMaxZeroingVoltage)
+ / loop_->K(0, 0);
+ zeroing_position_ -= excess;
+ }
}
}
@@ -182,10 +184,6 @@
return;
}
- if (state_ == MOVING_OFF || state_ == ZEROING) {
- LimitZeroingGoal();
- }
-
if (good_position) {
LOG(DEBUG,
"calibration sensor: %d zero_offset: %f absolute_position: %f\n",