![]() |
RaidZeroLib
Coroutine robot framework for VEX V5
|
Anything with a loop that runs for the whole program: devices, estimators, mechanisms, loggers. More...
#include <Component.hpp>
Public Member Functions | |
| Component (const Component &)=delete | |
| Component & | operator= (const Component &)=delete |
| Component (Component &&)=delete | |
| Component & | operator= (Component &&)=delete |
| virtual | ~Component () |
| std::string_view | name () const noexcept |
| Used in log and error messages. | |
Static Public Member Functions | |
| static Task | runAll () |
| Runs the loop of every component constructed so far, in construction order, until cancelled. rz::robot runs it; tests without rz::robot run it alongside their script. | |
Protected Member Functions | |
| Component (std::string_view name) | |
| virtual Task | loop ()=0 |
| Runs for the whole program; never returns. | |
Anything with a loop that runs for the whole program: devices, estimators, mechanisms, loggers.
Constructing a component registers it; rz::robot runs every registered component's loop, across all competition modes, so nothing needs to be listed. The loop chooses which tick stage it waits on (tickStarted(), sensorsUpdated(), estimatorsUpdated(), componentsUpdated()), which orders it against the other kinds of component.
Components waiting on the same stage run in construction order, as long as each waits on that stage once per tick. Something a component depends on is passed to its constructor, so it is constructed, and runs, first. Globals in different files are constructed in an unspecified order, so components in the same stage that depend on each other belong in the same file, the dependency first.
|
delete |
|
delete |
|
virtual |
|
explicitprotected |
|
nodiscardprotectedpure virtual |
Runs for the whole program; never returns.
|
inlinenodiscardnoexcept |
Used in log and error messages.
|
staticnodiscard |