Add loop timing to IterativeRobot and TimedRobot (#781)

This commit is contained in:
Tyler Veness
2018-06-24 02:29:21 -05:00
committed by Peter Johnson
parent 50b13d2f36
commit a818c7fd47
11 changed files with 409 additions and 63 deletions

View File

@@ -8,6 +8,7 @@
#pragma once
#include "RobotBase.h"
#include "Watchdog.h"
namespace frc {
@@ -134,14 +135,26 @@ class IterativeRobotBase : public RobotBase {
virtual void TestPeriodic();
protected:
/**
* Constructor for IterativeRobotBase.
*
* @param period Period in seconds.
*/
explicit IterativeRobotBase(double period);
virtual ~IterativeRobotBase() = default;
void LoopFunc();
double m_period;
private:
enum class Mode { kNone, kDisabled, kAutonomous, kTeleop, kTest };
Mode m_lastMode = Mode::kNone;
Watchdog m_watchdog;
void PrintLoopOverrunMessage();
};
} // namespace frc