69 void AddPeriodic(std::function<
void()> callback, units::second_t period,
70 units::second_t offset = 0_s);
75 std::function<void()> func;
76 units::second_t period;
77 units::second_t expirationTime;
87 Callback(std::function<
void()> func, units::second_t startTime,
88 units::second_t period, units::second_t offset)
89 : func{
std::move(func)},
91 expirationTime{startTime + offset +
93 (
Timer::GetFPGATimestamp() - startTime) / period) *
97 bool operator>(
const Callback& rhs)
const {
98 return expirationTime > rhs.expirationTime;
103 units::second_t m_startTime;
IterativeRobotBase implements a specific type of robot program framework, extending the RobotBase cla...
Definition: IterativeRobotBase.h:57
TimedRobot implements the IterativeRobotBase robot program framework.
Definition: TimedRobot.h:30
void AddPeriodic(std::function< void()> callback, units::second_t period, units::second_t offset=0_s)
Add a callback to run at a specific period with a starting time offset.
TimedRobot(units::second_t period=kDefaultPeriod)
Constructor for TimedRobot.
TimedRobot(TimedRobot &&)=default
void EndCompetition() override
Ends the main loop in StartCompetition().
TimedRobot & operator=(TimedRobot &&)=default
static constexpr auto kDefaultPeriod
Default loop period.
Definition: TimedRobot.h:33
void StartCompetition() override
Provide an alternate "main loop" via StartCompetition().
A timer class.
Definition: Timer.h:36
This class is the same as std::priority_queue with two changes:
Definition: priority_queue.h:27
UnitType floor(const UnitType x) noexcept
Round down value.
Definition: math.h:542
Definition: AprilTagPoseEstimator.h:15
Unit Conversion Library namespace.
Definition: data.h:31
constexpr bool operator>(const UNIT_LIB_DEFAULT_TYPE lhs, const Units &rhs) noexcept
Definition: base.h:2740