Convert y2017 to use event loop time
Change-Id: I101d113542b81fc7034640693435157ed6f637a0
diff --git a/y2017/control_loops/superstructure/hood/hood.cc b/y2017/control_loops/superstructure/hood/hood.cc
index f19bbf7..862a32c 100644
--- a/y2017/control_loops/superstructure/hood/hood.cc
+++ b/y2017/control_loops/superstructure/hood/hood.cc
@@ -61,7 +61,8 @@
last_position_ = 0;
}
-void Hood::Iterate(const control_loops::HoodGoal *unsafe_goal,
+void Hood::Iterate(const ::aos::monotonic_clock::time_point monotonic_now,
+ const control_loops::HoodGoal *unsafe_goal,
const ::frc971::IndexPosition *position, double *output,
::frc971::control_loops::IndexProfiledJointStatus *status) {
bool disable = output == nullptr;
@@ -177,11 +178,11 @@
if (::std::abs(profiled_subsystem_.position() - last_position_) >
kErrorOnPositionTillNotMoving) {
// Currently moving. Update time of last move.
- last_move_time_ = ::aos::monotonic_clock::now();
+ last_move_time_ = monotonic_now;
// Save last position.
last_position_ = profiled_subsystem_.position();
}
- if (::aos::monotonic_clock::now() > kTimeTillNotMoving + last_move_time_) {
+ if (monotonic_now > kTimeTillNotMoving + last_move_time_) {
error_voltage = kNotMovingVoltage;
}
diff --git a/y2017/control_loops/superstructure/hood/hood.h b/y2017/control_loops/superstructure/hood/hood.h
index cf45850..55d5344 100644
--- a/y2017/control_loops/superstructure/hood/hood.h
+++ b/y2017/control_loops/superstructure/hood/hood.h
@@ -45,7 +45,8 @@
::std::chrono::milliseconds(15);
static constexpr double kNotMovingVoltage = 2.0;
- void Iterate(const control_loops::HoodGoal *unsafe_goal,
+ void Iterate(::aos::monotonic_clock::time_point monotonic_now,
+ const control_loops::HoodGoal *unsafe_goal,
const ::frc971::IndexPosition *position, double *output,
::frc971::control_loops::IndexProfiledJointStatus *status);