Fixed fridge to actually wait until it was high enough when zeroing.
Change-Id: I7f23b504f40c1fc2ff2d7e4ebdfbb7a7b1445972
diff --git a/frc971/control_loops/fridge/fridge.cc b/frc971/control_loops/fridge/fridge.cc
index e414f93..14514a9 100644
--- a/frc971/control_loops/fridge/fridge.cc
+++ b/frc971/control_loops/fridge/fridge.cc
@@ -335,12 +335,11 @@
elevator_goal_ += kElevatorSafeHeightVelocity *
::aos::controls::kLoopFrequency.ToSeconds();
elevator_goal_velocity_ = kElevatorSafeHeightVelocity;
+ state_ = ZEROING_ELEVATOR;
} else {
// We want it stopped at whatever height it's currently set to.
elevator_goal_velocity_ = 0;
}
-
- state_ = ZEROING_ELEVATOR;
break;
}
@@ -365,7 +364,8 @@
case ZEROING_ARM:
LOG(DEBUG, "Zeroing the arm\n");
- if (elevator() < values.fridge.arm_zeroing_height) {
+ if (elevator() < values.fridge.arm_zeroing_height - 0.10 ||
+ elevator_goal_ < values.fridge.arm_zeroing_height) {
LOG(INFO,
"Going back to ZEROING_ELEVATOR until it gets high enough to "
"safely zero the arm\n");