Add claw control loop.
It's based pretty heavily on the fridge loop. Currently, all the
tests pass.
Change-Id: Ieb386dfa5c3fe2d34e2d191fa39a44dc77ee6ab6
diff --git a/frc971/control_loops/fridge/fridge.cc b/frc971/control_loops/fridge/fridge.cc
index dae8374..b0ee642 100644
--- a/frc971/control_loops/fridge/fridge.cc
+++ b/frc971/control_loops/fridge/fridge.cc
@@ -15,8 +15,6 @@
namespace frc971 {
namespace control_loops {
-constexpr double Fridge::dt;
-
namespace {
constexpr double kZeroingVoltage = 4.0;
constexpr double kElevatorZeroingVelocity = 0.10;
@@ -321,7 +319,8 @@
LOG(DEBUG, "Zeroed the elevator!\n");
} else if (!disable) {
elevator_goal_velocity = elevator_zeroing_velocity();
- elevator_goal_ += elevator_goal_velocity * dt;
+ elevator_goal_ += elevator_goal_velocity *
+ ::aos::controls::kLoopFrequency.ToSeconds();
}
break;
@@ -337,7 +336,8 @@
LOG(DEBUG, "Zeroed the arm!\n");
} else if (!disable) {
arm_goal_velocity = arm_zeroing_velocity();
- arm_goal_ += arm_goal_velocity * dt;
+ arm_goal_ += arm_goal_velocity *
+ ::aos::controls::kLoopFrequency.ToSeconds();
}
break;
diff --git a/frc971/control_loops/fridge/fridge.h b/frc971/control_loops/fridge/fridge.h
index 87dbfa4..54dc032 100644
--- a/frc971/control_loops/fridge/fridge.h
+++ b/frc971/control_loops/fridge/fridge.h
@@ -45,15 +45,6 @@
explicit Fridge(
control_loops::FridgeQueue *fridge_queue = &control_loops::fridge_queue);
- // Control loop time step.
- // Please figure out how to set dt from a common location
- // Please decide the correct value
- // Please use dt in your implementation so we can change looptimnig
- // and be consistent with legacy
- // And Brian please approve my code review as people are wait on
- // these files to exist and they will be rewritten anyway
- //static constexpr double dt;
-
enum State {
// Waiting to receive data before doing anything.
UNINITIALIZED = 0,
@@ -148,7 +139,6 @@
State last_state_ = UNINITIALIZED;
control_loops::FridgeQueue::Position current_position_;
- static constexpr double dt = 0.005;
};
} // namespace control_loops