WPILibC++  unspecified
TimedRobot.h
1 /*----------------------------------------------------------------------------*/
2 /* Copyright (c) 2017 FIRST. All Rights Reserved. */
3 /* Open Source Software - may be modified and shared by FRC teams. The code */
4 /* must be accompanied by the FIRST BSD license file in the root directory of */
5 /* the project. */
6 /*----------------------------------------------------------------------------*/
7 
8 #pragma once
9 
10 #include <memory>
11 
12 #include "IterativeRobotBase.h"
13 #include "Notifier.h"
14 
15 namespace frc {
16 
27  public:
28  static constexpr double kDefaultPeriod = 0.02;
29 
30  void StartCompetition() override;
31 
32  void SetPeriod(double seconds);
33 
34  protected:
35  TimedRobot();
36  virtual ~TimedRobot();
37 
38  private:
39  double m_period = kDefaultPeriod;
40 
41  // Prevents loop from starting if user calls SetPeriod() in RobotInit()
42  bool m_startLoop = false;
43 
44  std::unique_ptr<Notifier> m_loop;
45 };
46 
47 } // namespace frc
Definition: Timer.cpp:18
void StartCompetition() override
Provide an alternate "main loop" via StartCompetition().
Definition: TimedRobot.cpp:19
TimedRobot implements the IterativeRobotBase robot program framework.
Definition: TimedRobot.h:26
void SetPeriod(double seconds)
Set time period between calls to Periodic() functions.
Definition: TimedRobot.cpp:42
IterativeRobotBase implements a specific type of robot program framework, extending the RobotBase cla...
Definition: IterativeRobotBase.h:43