68 void AddPeriodic(std::function<
void()> callback, units::second_t period,
69 units::second_t offset = 0_s);
74 std::function<void()> func;
75 units::second_t period;
76 units::second_t expirationTime;
86 Callback(std::function<
void()> func, units::second_t startTime,
87 units::second_t period, units::second_t offset)
88 : func{
std::move(func)},
90 expirationTime{startTime + offset +
92 (
Timer::GetFPGATimestamp() - startTime) / period) *
96 bool operator>(
const Callback& rhs)
const {
97 return expirationTime > rhs.expirationTime;
102 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
Definition: TimedRobot.h:32
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
Definition: BFloat16.h:88
Unit Conversion Library namespace.
Definition: magnetic_flux.h:31
constexpr bool operator>(const UNIT_LIB_DEFAULT_TYPE lhs, const Units &rhs) noexcept
Definition: base.h:2751