Converted trapezoid_profile over to monotonic_clock
This also involves updating all the callers, and updating
control_loop's frequency variable.
Change-Id: Ic88d2715db30efcc25721da2dd8c89910ede7788
diff --git a/y2015/control_loops/claw/claw.cc b/y2015/control_loops/claw/claw.cc
index e6ab9e7..ad8aaee 100644
--- a/y2015/control_loops/claw/claw.cc
+++ b/y2015/control_loops/claw/claw.cc
@@ -13,6 +13,7 @@
namespace control_loops {
using ::aos::time::Time;
+namespace chrono = ::std::chrono;
constexpr double kZeroingVoltage = 4.0;
@@ -169,8 +170,9 @@
SetClawOffset(claw_estimator_.offset());
} else if (!disable) {
claw_goal_velocity = claw_zeroing_velocity();
- claw_goal_ +=
- claw_goal_velocity * ::aos::controls::kLoopFrequency.ToSeconds();
+ claw_goal_ += claw_goal_velocity *
+ chrono::duration_cast<chrono::duration<double>>(
+ ::aos::controls::kLoopFrequency).count();
}
// Clear the current profile state if we are zeroing.
diff --git a/y2015/control_loops/fridge/fridge.cc b/y2015/control_loops/fridge/fridge.cc
index 083baf2..9f2241a 100644
--- a/y2015/control_loops/fridge/fridge.cc
+++ b/y2015/control_loops/fridge/fridge.cc
@@ -15,6 +15,8 @@
namespace frc971 {
namespace control_loops {
+namespace chrono = ::std::chrono;
+
namespace {
constexpr double kZeroingVoltage = 4.0;
constexpr double kElevatorZeroingVelocity = 0.10;
@@ -333,7 +335,8 @@
LOG(DEBUG, "Moving elevator to safe height.\n");
if (elevator_goal_ < values.fridge.arm_zeroing_height) {
elevator_goal_ += kElevatorSafeHeightVelocity *
- ::aos::controls::kLoopFrequency.ToSeconds();
+ chrono::duration_cast<chrono::duration<double>>(
+ ::aos::controls::kLoopFrequency).count();
elevator_goal_velocity_ = kElevatorSafeHeightVelocity;
state_ = ZEROING_ELEVATOR;
} else {
@@ -344,7 +347,8 @@
} else if (!disable) {
elevator_goal_velocity_ = elevator_zeroing_velocity();
elevator_goal_ += elevator_goal_velocity_ *
- ::aos::controls::kLoopFrequency.ToSeconds();
+ chrono::duration_cast<chrono::duration<double>>(
+ ::aos::controls::kLoopFrequency).count();
}
// Bypass motion profiles while we are zeroing.
@@ -380,8 +384,9 @@
LOG(DEBUG, "Zeroed the arm!\n");
} else if (!disable) {
arm_goal_velocity_ = arm_zeroing_velocity();
- arm_goal_ +=
- arm_goal_velocity_ * ::aos::controls::kLoopFrequency.ToSeconds();
+ arm_goal_ += arm_goal_velocity_ *
+ chrono::duration_cast<chrono::duration<double>>(
+ ::aos::controls::kLoopFrequency).count();
}
// Bypass motion profiles while we are zeroing.