fix control loop tests running at 50Hz
diff --git a/aos/common/controls/control_loop_test.cc b/aos/common/controls/control_loop_test.cc
index 6f4e784..ab47477 100644
--- a/aos/common/controls/control_loop_test.cc
+++ b/aos/common/controls/control_loop_test.cc
@@ -3,7 +3,6 @@
#include "aos/common/messages/robot_state.q.h"
#include "aos/common/controls/sensor_generation.q.h"
#include "aos/common/controls/output_check.q.h"
-#include "aos/common/time.h"
namespace aos {
namespace testing {
@@ -17,7 +16,7 @@
.reader_pid(254)
.cape_resets(5)
.Send();
- ::aos::time::Time::EnableMockTime(::aos::time::Time::InSeconds(0.0));
+ ::aos::time::Time::EnableMockTime(current_time_);
SimulateTimestep(false);
}
@@ -50,7 +49,8 @@
.pulse_length(0)
.Send();
}
- ::aos::time::Time::IncrementMockTime(::aos::time::Time::InMS(10.0));
+ ::aos::time::Time::SetMockTime(current_time_ +=
+ ::aos::time::Time::InMS(10.0));
}
} // namespace testing
diff --git a/aos/common/controls/control_loop_test.h b/aos/common/controls/control_loop_test.h
index 14be01c..de048ba 100644
--- a/aos/common/controls/control_loop_test.h
+++ b/aos/common/controls/control_loop_test.h
@@ -4,6 +4,7 @@
#include "gtest/gtest.h"
#include "aos/common/queue_testutils.h"
+#include "aos/common/time.h"
namespace aos {
namespace testing {
@@ -24,6 +25,7 @@
private:
bool sent_robot_state_last_time_ = false;
+ ::aos::time::Time current_time_ = ::aos::time::Time::InSeconds(0);
::aos::common::testing::GlobalCoreInstance my_core;
};
diff --git a/aos/common/controls/controls.gyp b/aos/common/controls/controls.gyp
index 15be23c..ad05376 100644
--- a/aos/common/controls/controls.gyp
+++ b/aos/common/controls/controls.gyp
@@ -16,6 +16,7 @@
],
'export_dependent_settings': [
'<(EXTERNALS):gtest',
+ '<(AOS)/common/common.gyp:time',
'<(AOS)/common/common.gyp:queue_testutils',
],
},