RaidZeroLib
Coroutine robot framework for VEX V5
Loading...
Searching...
No Matches
rz::Component Class Referenceabstract

Anything with a loop that runs for the whole program: devices, estimators, mechanisms, loggers. More...

#include <Component.hpp>

Inheritance diagram for rz::Component:
rz::Controller rz::Device rz::Odometry rz::ProsController rz::SimulationController rz::InertialSensor rz::MotorDevice rz::RotationSensor rz::ThreeEncoderOdometry rz::TwoEncoderImuOdometry rz::TwoEncoderOdometry

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.

Detailed Description

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.

Constructor & Destructor Documentation

◆ Component() [1/3]

rz::Component::Component ( const Component & )
delete

◆ Component() [2/3]

rz::Component::Component ( Component && )
delete

◆ ~Component()

virtual rz::Component::~Component ( )
virtual

◆ Component() [3/3]

rz::Component::Component ( std::string_view name)
explicitprotected

Member Function Documentation

◆ loop()

virtual Task rz::Component::loop ( )
nodiscardprotectedpure virtual

Runs for the whole program; never returns.

◆ name()

std::string_view rz::Component::name ( ) const
inlinenodiscardnoexcept

Used in log and error messages.

◆ operator=() [1/2]

Component & rz::Component::operator= ( Component && )
delete

◆ operator=() [2/2]

Component & rz::Component::operator= ( const Component & )
delete

◆ runAll()

Task rz::Component::runAll ( )
staticnodiscard

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.


The documentation for this class was generated from the following file: