Brian Silverman | 65e4970 | 2014-04-30 17:36:40 -0700 | [diff] [blame] | 1 | #ifndef AOS_COMMON_CONTROLS_CONTROL_LOOP_TEST_H_ |
| 2 | #define AOS_COMMON_CONTROLS_CONTROL_LOOP_TEST_H_ |
| 3 | |
| 4 | #include "gtest/gtest.h" |
| 5 | |
| 6 | #include "aos/common/queue_testutils.h" |
Brian Silverman | bbc8678 | 2014-08-19 12:13:05 -0400 | [diff] [blame] | 7 | #include "aos/common/time.h" |
Brian Silverman | 65e4970 | 2014-04-30 17:36:40 -0700 | [diff] [blame] | 8 | |
| 9 | namespace aos { |
| 10 | namespace testing { |
| 11 | |
| 12 | // Handles setting up the environment that all control loops need to actually |
| 13 | // run. |
| 14 | // This includes sending the queue messages and Clear()ing the queues when |
| 15 | // appropriate. |
| 16 | // It also includes dealing with ::aos::time. |
| 17 | class ControlLoopTest : public ::testing::Test { |
| 18 | public: |
| 19 | ControlLoopTest(); |
| 20 | |
| 21 | virtual ~ControlLoopTest(); |
| 22 | |
| 23 | // Simulates everything that happens during 1 time step. |
| 24 | void SimulateTimestep(bool enabled); |
| 25 | |
| 26 | private: |
| 27 | bool sent_robot_state_last_time_ = false; |
Brian Silverman | bbc8678 | 2014-08-19 12:13:05 -0400 | [diff] [blame] | 28 | ::aos::time::Time current_time_ = ::aos::time::Time::InSeconds(0); |
Brian Silverman | 65e4970 | 2014-04-30 17:36:40 -0700 | [diff] [blame] | 29 | |
| 30 | ::aos::common::testing::GlobalCoreInstance my_core; |
| 31 | }; |
| 32 | |
| 33 | } // namespace testing |
| 34 | } // namespace aos |
| 35 | |
| 36 | #endif // AOS_COMMON_CONTROLS_CONTROL_LOOP_TEST_H_ |